From 2aba6e35dc6f1534a764690382ca56b6cf099185 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 15 Sep 2017 10:07:32 +0200 Subject: 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 --- src/qmltest/quicktest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/qmltest') 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()); -- cgit v1.2.3