aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp')
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index f2b0b9973e..3c78f6601e 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -117,6 +117,8 @@ private slots:
void recursion();
void recursionContinuation();
void callingContextForInitialProperties();
+ void relativeUrl_data();
+ void relativeUrl();
private:
QQmlEngine engine;
@@ -581,6 +583,28 @@ void tst_qqmlcomponent::callingContextForInitialProperties()
QVERIFY(checker->scopeObject->metaObject()->indexOfProperty("incubatedObject") != -1);
}
+void tst_qqmlcomponent::relativeUrl_data()
+{
+ QTest::addColumn<QUrl>("url");
+
+ QTest::addRow("fromLocalFile") << QUrl::fromLocalFile("data/QtObjectComponent.qml");
+ QTest::addRow("fromLocalFileHash") << QUrl::fromLocalFile("data/QtObjectComponent#2.qml");
+ QTest::addRow("constructor") << QUrl("data/QtObjectComponent.qml");
+ QTest::addRow("absolute") << QUrl::fromLocalFile(QFINDTESTDATA("data/QtObjectComponent.qml"));
+ QTest::addRow("qrc") << QUrl("qrc:/data/QtObjectComponent.qml");
+}
+
+void tst_qqmlcomponent::relativeUrl()
+{
+ QFETCH(QUrl, url);
+
+ QQmlComponent component(&engine);
+ // Shouldn't assert in QQmlTypeLoader; we want QQmlComponent to assume that
+ // data/QtObjectComponent.qml refers to the data/QtObjectComponent.qml in the current working directory.
+ component.loadUrl(url);
+ QVERIFY2(!component.isError(), qPrintable(component.errorString()));
+}
+
QTEST_MAIN(tst_qqmlcomponent)
#include "tst_qqmlcomponent.moc"