diff options
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 11 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e8b6913..f5fe140 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1620,6 +1620,18 @@ public: url.chop(1); } + if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { + QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin(); + for (; it != qmldircomponents.end(); ++it) { + if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin)) + break; + } + if (it == qmldircomponents.end()) { + *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); + return false; + } + } + s->uris.prepend(uri); s->urls.prepend(url); s->majversions.prepend(vmaj); diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 8990fb4..dcd72d2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1347,11 +1347,16 @@ void tst_qdeclarativelanguage::importsInstalled_data() "InstalledTest {}" << "QDeclarativeText" << ""; - QTest::newRow("installed import 4") + QTest::newRow("installed import minor version not available") // QTBUG-9627 << "import com.nokia.installedtest 1.10\n" "InstalledTest {}" - << "QDeclarativeText" - << ""; + << "" + << "module \"com.nokia.installedtest\" version 1.10 is not installed"; + QTest::newRow("installed import major version not available") // QTBUG-9627 + << "import com.nokia.installedtest 9.0\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 9.0 is not installed"; QTest::newRow("installed import visibility") // QT-614 << "import com.nokia.installedtest 1.4\n" "PrivateType {}" |