aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-01-15 15:25:25 +0100
committerRobin Burchell <robin.burchell@crimson.no>2017-01-16 15:13:49 +0000
commit01f7a9dbe2e41434db34841f7d0c812e7a492128 (patch)
tree2a7fb0f867064482f036443368d171faedd658a5 /tests
parentd8ce18b323f0eb8850177f86065f520bb555b5a4 (diff)
QQmlApplicationEngine: Yet another fix after QUrl behavior changes in QtBase
Picture the following application: QQmlApplication qAppEngine("main.qml"); With main.qml: ... AComponentInTheSameDirectory { } ... This was failing, with the error: file:main.qml:13 AComponentInTheSameDirectory is not a type Which is wrong, but also reveals the root cause in that the original filename was not a fully resolved path. Change-Id: Ifc5557cc43f4bb92fd121ea9f7a37f09b3b38a9b Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml6
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml9
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp24
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
new file mode 100644
index 0000000000..ece4f45b4a
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+// used in nonResolvedLocal
+QtObject {
+
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
new file mode 100644
index 0000000000..45a235346d
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+
+QtObject {
+ property bool success: true
+
+ property QtObject local: LocalComponent {
+ }
+}
+
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index 98b92e5fab..74add85cb0 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -42,6 +42,7 @@ public:
private slots:
void initTestCase();
void basicLoading();
+ void testNonResolvedPath();
void application();
void applicationProperties();
private:
@@ -83,6 +84,29 @@ void tst_qqmlapplicationengine::basicLoading()
delete test;
}
+// make sure we resolve a relative URL to an absolute one, otherwise things
+// will break.
+void tst_qqmlapplicationengine::testNonResolvedPath()
+{
+ {
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ QQmlApplicationEngine test("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+ {
+ QQmlApplicationEngine test;
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ test.load("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+}
+
void tst_qqmlapplicationengine::application()
{
/* This test batches together some tests about running an external application