aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-09-11 16:18:50 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-09-24 13:48:58 +0200
commita0f0b4f65e96aecc9949d3089a283cdfaeefbb3b (patch)
tree175f986e31860164c000b9a66c09a549b4f5da55 /tests/auto/shared
parent526729cb8a53972b6925cbfd7a5f5cbf124be71c (diff)
Support compile-time style selection
By allowing importing styles without first importing QtQuick.Controls, which does runtime style selection. [ChangeLog][Styles] It's now possible to select a style at compile-time by importing that style explicitly instead of QtQuick.Controls. This avoids the need to do run-time style selection and hence deploy the QtQuick.Controls plugin with the application. Change-Id: I666d6dc7727fffd2c7b05743855f2086f076465a Fixes: QTBUG-86284 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/shared')
-rw-r--r--tests/auto/shared/visualtestutil.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index cbc0bade..78c625ea 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -118,9 +118,14 @@ namespace QQuickVisualTestUtil
class QQuickApplicationHelper
{
public:
- QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath) :
- component(&engine)
+ QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath,
+ const QStringList &qmlImportPaths = QStringList())
{
+ for (const auto &path : qmlImportPaths)
+ engine.addImportPath(path);
+
+ QQmlComponent component(&engine);
+
component.loadUrl(testCase->testFileUrl(testFilePath));
QObject *rootObject = component.create();
cleanup.reset(rootObject);
@@ -152,7 +157,6 @@ namespace QQuickVisualTestUtil
}
QQmlEngine engine;
- QQmlComponent component;
QScopedPointer<QObject> cleanup;
QQuickApplicationWindow *appWindow = nullptr;
QQuickWindow *window = nullptr;