aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-07-03 11:50:06 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-07-03 13:47:04 +0200
commit256503fadf5a925933fc03980d7c878643b1fdca (patch)
treef6db8932c95afd0dae58120667f81d28c2012ff6 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parentbc314b11b08cdc6ce035bcbe85f5b1c1acddafd7 (diff)
URL: Allow non-string parameters
Previously we only allowed string parameters as the first parameter of the URL constructor. This excluded types like url. The behavior of instead trying to convert the parameter to a string and then interpreting this as an url matches the specification more closely. Change-Id: I6ef8db9d8c0f238ba8c51b1023decdfcc1caad87 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 9b750d5399..0865628061 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -335,6 +335,9 @@ private slots:
void qualifiedScopeInCustomParser();
void checkUncreatableNoReason();
+
+ void checkURLtoURLObject();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -5929,6 +5932,16 @@ void tst_qqmllanguage::checkUncreatableNoReason()
QCOMPARE(c.errors().first().description(), QString("Type cannot be created in QML."));
}
+void tst_qqmllanguage::checkURLtoURLObject()
+{
+ QQmlEngine engine;
+ QString qml = QString("import QtQuick 2.0\nItem { property url source: 'file:///foo/bar/'; "
+ "Component.onCompleted: { new URL(parent.source); } }");
+ QQmlComponent c(&engine);
+ c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath()));
+ QCOMPARE(c.errors().count(), 0);
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"