From efa0dac9c4c456793f9e0e706a3b026ed0941801 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 5 Mar 2018 10:19:33 +0100 Subject: Fix regression involving aliases on case-insensitive file systems When initializing a QQmlProperty with the following syntax: QQmlProperty property(root, "testType.objectName", QQmlEngine::contextForObject(root)); only try to look up types (for each token after splitting on the '.') if the token starts with an uppercase letter, as 1e350a8c now enforces that type names begin with an uppercase letter. Task-number: QTBUG-66715 Change-Id: Iab64be1deb971dca256fc65d358c773837222a57 Reviewed-by: Simon Hausmann --- .../qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml | 9 +++++++++ tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml b/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml new file mode 100644 index 0000000000..8cbd928f36 --- /dev/null +++ b/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +Item { + property alias testType: testType + + Rectangle { + id: testType + } +} diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 128dc21b9a..1e9ba80264 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -143,6 +143,7 @@ private slots: void registeredCompositeTypeProperty(); void deeplyNestedObject(); void readOnlyDynamicProperties(); + void aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSystem(); void floatToStringPrecision_data(); void floatToStringPrecision(); @@ -2047,6 +2048,17 @@ void tst_qqmlproperty::readOnlyDynamicProperties() delete obj; } +void tst_qqmlproperty::aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSystem() +{ + const QUrl url = testFileUrl("aliasToIdWithMatchingQmlFileName.qml"); + QQmlEngine engine; + QQmlComponent component(&engine, url); + QScopedPointer root(component.create()); + + QQmlProperty property(root.data(), "testType.objectName", QQmlEngine::contextForObject(root.data())); + QVERIFY(property.isValid()); +} + void tst_qqmlproperty::floatToStringPrecision_data() { QTest::addColumn("propertyName"); -- cgit v1.2.3