summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp13
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml (renamed from tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml)0
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir (renamed from tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir)0
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp7
5 files changed, 15 insertions, 7 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 0bedbeb..c49c464 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1418,6 +1418,11 @@ struct QDeclarativeEnginePrivate::ImportedNamespace {
}
};
+static bool greaterThan(const QString &s1, const QString &s2)
+{
+ return s1 > s2;
+}
+
class QDeclarativeImportsPrivate {
public:
QDeclarativeImportsPrivate() : ref(1)
@@ -1495,6 +1500,8 @@ public:
// add fileImportPath last, this is *not* search order.
paths += QDeclarativeEnginePrivate::get(engine)->fileImportPath;
+ qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
+
QString stableRelativePath = dir;
foreach( QString path, paths) {
if (dir.startsWith(path)) {
@@ -1545,11 +1552,11 @@ public:
paths += applicationDirPath;
paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath;
- #if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
+#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
- #else
+#else
QString builtinPath;
- #endif
+#endif
if (!builtinPath.isEmpty())
paths += builtinPath;
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml
index f29ae24..f29ae24 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir
index 0a8b5d4..0a8b5d4 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro
index 035cb7d..fc77225 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro
@@ -2,5 +2,5 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES = plugin.cpp
QT = core declarative
-DESTDIR = ../com/nokia/AutoTestQmlPluginType
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index 1335c7c..26199d3 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -48,8 +48,8 @@ class tst_qdeclarativemoduleplugin : public QObject
{
Q_OBJECT
public:
- tst_qdeclarativemoduleplugin() {
- QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"));
+ tst_qdeclarativemoduleplugin()
+ {
}
private slots:
@@ -103,9 +103,10 @@ void tst_qdeclarativemoduleplugin::importsPlugin()
{
QSKIP("Fix me", SkipAll);
QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
QTest::ignoreMessage(QtWarningMsg, "plugin created");
QTest::ignoreMessage(QtWarningMsg, "import worked");
- QDeclarativeComponent component(&engine, TEST_FILE("plugin.qml"));
+ QDeclarativeComponent component(&engine, TEST_FILE("data/works.qml"));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
VERIFY_ERRORS(0);