diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2014-08-29 13:09:53 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2014-08-29 13:15:49 +0200 |
commit | 576914516aaa2df3342caf6d68b90c15ef2781ac (patch) | |
tree | df5107c45e4c27103bda3b22c8b07c570b916998 /tests/auto/qml/qqmlimport | |
parent | 461e3ddfe673ffbc6f9e4dcc0e0f851a3dc000e3 (diff) |
introduce *.ui.qml file types as new forms file type
Change-Id: I1f07b6c1ab8afac7ee7ad05e988fe313ba904705
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlimport')
7 files changed, 65 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlimport/FormFromQmlDir/TestForm.ui.qml b/tests/auto/qml/qqmlimport/FormFromQmlDir/TestForm.ui.qml new file mode 100644 index 0000000000..837835f6df --- /dev/null +++ b/tests/auto/qml/qqmlimport/FormFromQmlDir/TestForm.ui.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property bool success: true +} diff --git a/tests/auto/qml/qqmlimport/FormFromQmlDir/qmldir b/tests/auto/qml/qqmlimport/FormFromQmlDir/qmldir new file mode 100644 index 0000000000..95dfedc634 --- /dev/null +++ b/tests/auto/qml/qqmlimport/FormFromQmlDir/qmldir @@ -0,0 +1,2 @@ +module FormFromQmlDir +TestForm 1.0 TestForm.ui.qml diff --git a/tests/auto/qml/qqmlimport/data/FormFromDir/TestForm.ui.qml b/tests/auto/qml/qqmlimport/data/FormFromDir/TestForm.ui.qml new file mode 100644 index 0000000000..837835f6df --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/FormFromDir/TestForm.ui.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property bool success: true +} diff --git a/tests/auto/qml/qqmlimport/data/TestForm.ui.qml b/tests/auto/qml/qqmlimport/data/TestForm.ui.qml new file mode 100644 index 0000000000..837835f6df --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/TestForm.ui.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property bool success: true +} diff --git a/tests/auto/qml/qqmlimport/data/openTestFormFromDir.qml b/tests/auto/qml/qqmlimport/data/openTestFormFromDir.qml new file mode 100644 index 0000000000..a1d7396396 --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/openTestFormFromDir.qml @@ -0,0 +1,4 @@ +import "FormFromDir" + +TestForm { +} diff --git a/tests/auto/qml/qqmlimport/data/openTestFormFromQmlDir.qml b/tests/auto/qml/qqmlimport/data/openTestFormFromQmlDir.qml new file mode 100644 index 0000000000..aea8d0fb65 --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/openTestFormFromQmlDir.qml @@ -0,0 +1,4 @@ +import FormFromQmlDir 1.0 + +TestForm { +} diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index bd29b8f18b..33a6c6f9cb 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -52,6 +52,7 @@ class tst_QQmlImport : public QQmlDataTest private slots: void testDesignerSupported(); + void uiFormatLoading(); void cleanup(); }; @@ -95,6 +96,45 @@ void tst_QQmlImport::testDesignerSupported() delete window; } +void tst_QQmlImport::uiFormatLoading() +{ + int size = 0; + + QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("TestForm.ui.qml")); + test->addImportPath(QT_TESTCASE_BUILDDIR); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,QUrl))); + test->load(testFileUrl("TestForm.ui.qml")); + QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestForm t: TestForm{}}"); + test->loadData(testQml, testFileUrl("dynamicTestForm.ui.qml")); + QCOMPARE(objectCreated.count(), size); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + test->load(testFileUrl("openTestFormFromDir.qml")); + QCOMPARE(objectCreated.count(), size); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + test->load(testFileUrl("openTestFormFromQmlDir.qml")); + QCOMPARE(objectCreated.count(), size); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + delete test; +} + QTEST_MAIN(tst_QQmlImport) #include "tst_qqmlimport.moc" |