aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2021-02-09 16:49:05 +0100
committerMitch Curtis <mitch.curtis@qt.io>2021-04-22 15:56:48 +0200
commit77803fce273e0c87cf826ce122f06994ef4658e8 (patch)
treeba51f1a5e112f26b27279dcaefb945a5f17afd99 /tests
parenta0c95852fed72fb8b315b7cdea6f7b858d9099ea (diff)
Add initialProperties argument to QQuickApplicationHelper
This allows setting required properties on loaded QML components. Change-Id: I9737cf85fac027077df234a02f81f5499e0cb6b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/shared/visualtestutil.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index 1e530c70..122dd415 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -131,7 +131,8 @@ namespace QQuickVisualTestUtil
{
public:
QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath,
- const QStringList &qmlImportPaths = QStringList())
+ const QStringList &qmlImportPaths = {},
+ const QVariantMap &initialProperties = {})
{
for (const auto &path : qmlImportPaths)
engine.addImportPath(path);
@@ -139,7 +140,7 @@ namespace QQuickVisualTestUtil
QQmlComponent component(&engine);
component.loadUrl(testCase->testFileUrl(testFilePath));
- QObject *rootObject = component.create();
+ QObject *rootObject = component.createWithInitialProperties(initialProperties);
cleanup.reset(rootObject);
if (!rootObject) {
errorMessage = QString::fromUtf8("Failed to create window: %1").arg(component.errorString()).toUtf8();