diff options
Diffstat (limited to 'tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp')
-rw-r--r-- | tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index a9c28a0911..0f5eea8b95 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -52,6 +52,7 @@ private slots: void removeObjectsWhenDestroyed(); void loadTranslation_data(); void loadTranslation(); + void setInitialProperties(); private: QString buildDir; @@ -96,6 +97,9 @@ void tst_qqmlapplicationengine::basicLoading() // will break. void tst_qqmlapplicationengine::testNonResolvedPath() { +#ifdef Q_OS_ANDROID + QSKIP("Android stores QML files in resources, and the path to a resource cannot be relative in this case"); +#endif { // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a // non-resolved URL. @@ -117,6 +121,9 @@ void tst_qqmlapplicationengine::testNonResolvedPath() void tst_qqmlapplicationengine::application_data() { +#ifdef Q_OS_ANDROID + QSKIP("Cannot launch external process on Android"); +#endif QTest::addColumn<QByteArray>("qmlFile"); QTest::addColumn<QByteArray>("expectedStdErr"); @@ -269,6 +276,23 @@ void tst_qqmlapplicationengine::loadTranslation() QCOMPARE(rootObject->property("translation").toString(), translation); } +void tst_qqmlapplicationengine::setInitialProperties() +{ + QQmlApplicationEngine test {}; + { + test.setInitialProperties(QVariantMap{{"success", false}}); + test.load(testFileUrl("basicTest.qml")); + QVERIFY(!test.rootObjects().empty()); + QCOMPARE(test.rootObjects().first()->property("success").toBool(), false); + } + { + test.setInitialProperties({{"success", true}}); + test.load(testFileUrl("basicTest.qml")); + QCOMPARE(test.rootObjects().size(), 2); + QCOMPARE(test.rootObjects().at(1)->property("success").toBool(), true); + } +} + QTEST_MAIN(tst_qqmlapplicationengine) #include "tst_qqmlapplicationengine.moc" |