From 0a1e4cc7ec7548f6273befff9cdddb0bc7a58961 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 15 Jun 2020 17:53:16 +0200 Subject: Do not resolve URLs when assigning them to a property We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale --- tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp') diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 411ff7df56..177f7554f7 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -814,7 +814,7 @@ void tst_qqmllanguage::assignBasicTypes() QCOMPARE(object->vector2Property(), QVector2D(2, 3)); QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f)); const QUrl encoded = QUrl::fromEncoded("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); - QCOMPARE(object->urlProperty(), component.url().resolved(encoded)); + QCOMPARE(object->urlProperty(), encoded); QVERIFY(object->objectProperty() != nullptr); MyTypeObject *child = qobject_cast(object->objectProperty()); QVERIFY(child != nullptr); @@ -1293,7 +1293,7 @@ void tst_qqmllanguage::bindTypeToJSValue() MyQmlObject *object = root->findChild("urlProperty"); QJSValue value = object->qjsvalue(); const QUrl encoded = QUrl::fromEncoded("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); - QCOMPARE(value.toString(), component.url().resolved(encoded).toString()); + QCOMPARE(value.toString(), encoded.toString()); } { MyQmlObject *object = root->findChild("objectProperty"); QJSValue value = object->qjsvalue(); @@ -1468,7 +1468,7 @@ void tst_qqmllanguage::dynamicProperties() QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); QCOMPARE(object->property("realProperty"), QVariant((qreal)-19.9)); QCOMPARE(object->property("stringProperty"), QVariant("Hello World!")); - QCOMPARE(object->property("urlProperty"), QVariant(testFileUrl("main.qml"))); + QCOMPARE(object->property("urlProperty"), QVariant(QUrl("main.qml"))); QCOMPARE(object->property("colorProperty"), QVariant(QColor("red"))); QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2))); QCOMPARE(object->property("varProperty"), QVariant("Hello World!")); -- cgit v1.2.3