aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-09-15 10:07:32 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-09-15 09:11:29 +0000
commit2aba6e35dc6f1534a764690382ca56b6cf099185 (patch)
tree831979a05fd8ec30ed62118dfc6da387be660c80
parenta361e62a9fedabc7bd4c57d933bf78468fdc6795 (diff)
QuickTest: initialize import and plugin paths before TestCaseCollector
215c0145 broke QQC1 auto tests. The problem seems to be that TestCaseCollector created a QQmlComponent instance before the import and plugin paths were set. Later on, when running the actual tests, a cached component was used and the paths were missing. Task-number: QTBUG-63220 Change-Id: Ifec163899db9ea088fdabc179181cc150534fc4d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qmltest/quicktest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 56f76aa880..a9bf02aeca 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -469,6 +469,10 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
continue;
QQmlEngine engine;
+ for (const QString &path : qAsConst(imports))
+ engine.addImportPath(path);
+ for (const QString &path : qAsConst(pluginPaths))
+ engine.addPluginPath(path);
TestCaseCollector testCaseCollector(fi, &engine);
if (!testCaseCollector.errors().isEmpty()) {
@@ -500,10 +504,6 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
&eventLoop, SLOT(quit()));
view.rootContext()->setContextProperty
(QLatin1String("qtest"), QTestRootObject::instance()); // Deprecated. Use QTestRootObject from Qt.test.qtestroot instead
- for (const QString &path : qAsConst(imports))
- view.engine()->addImportPath(path);
- for (const QString &path : qAsConst(pluginPaths))
- view.engine()->addPluginPath(path);
view.setObjectName(fi.baseName());
view.setTitle(view.objectName());