aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlpropertycache
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-04-03 17:55:45 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-04-05 20:38:07 +0200
commitb91a26ae3b7b2ab68128f41db6ed4ccf7366dfc4 (patch)
tree172c9daaef074f9a875fb9aca8cc5ff938ccf0e4 /tests/auto/qml/qqmlpropertycache
parent4b5f091c499b5aad66a8b39fcdab8f80d986a1f8 (diff)
QtQml: Resolve generalized group properties during alias resolution
This way we can know the scope in which to search for the IDs. Pick-to: 6.7 6.5 Fixes: QTBUG-123865 Change-Id: I1dff9bdc69e3edaa80d85c757e3bb2b24e174cd0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlpropertycache')
-rw-r--r--tests/auto/qml/qqmlpropertycache/data/duplicateIdsAndGeneralizedGroupProperties.qml64
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp15
2 files changed, 79 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpropertycache/data/duplicateIdsAndGeneralizedGroupProperties.qml b/tests/auto/qml/qqmlpropertycache/data/duplicateIdsAndGeneralizedGroupProperties.qml
new file mode 100644
index 0000000000..2dd2cd8e21
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/data/duplicateIdsAndGeneralizedGroupProperties.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.15
+
+Item {
+ component First : Item {
+ Item {
+ id: a
+ }
+
+ states: [
+ State {
+ name: "test1"
+
+ PropertyChanges {
+ a.enabled: false
+ }
+ }
+ ]
+ }
+
+ component Second : Item {
+ QtObject {
+ id: a
+ property bool enabled: true
+ }
+
+ states: [
+ State {
+ name: "test2"
+
+ PropertyChanges {
+ a.enabled: false
+ }
+ }
+ ]
+
+ property Component cc: Item {
+ Item { id: a }
+
+ states: [
+ State {
+ name: "test3"
+
+ PropertyChanges {
+ a.enabled: false
+ }
+ }
+ ]
+ }
+ }
+
+ First { id: first }
+ Second { id: second }
+ property Item third: second.cc.createObject();
+
+ Component.onCompleted: {
+ console.log(1, first.data[0].enabled, second.data[0].enabled, third.data[0].enabled);
+ first.state = "test1";
+ console.log(2, first.data[0].enabled, second.data[0].enabled, third.data[0].enabled);
+ second.state = "test2";
+ console.log(3, first.data[0].enabled, second.data[0].enabled, third.data[0].enabled);
+ third.state = "test3";
+ console.log(4, first.data[0].enabled, second.data[0].enabled, third.data[0].enabled);
+ }
+}
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index 2d7a7b954c..6af2a3e371 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -36,6 +36,7 @@ private slots:
void restrictRegistrationVersion();
void rejectOverriddenFinal();
void overriddenSignals();
+ void duplicateIdsAndGeneralizedGroupProperties();
private:
QQmlEngine engine;
@@ -774,4 +775,18 @@ void tst_qqmlpropertycache::overriddenSignals()
// Should be an error, but we can't enforce it yet.
}
+void tst_qqmlpropertycache::duplicateIdsAndGeneralizedGroupProperties()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("duplicateIdsAndGeneralizedGroupProperties.qml"));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+
+ QTest::ignoreMessage(QtDebugMsg, "1 true true true");
+ QTest::ignoreMessage(QtDebugMsg, "2 false true true");
+ QTest::ignoreMessage(QtDebugMsg, "3 false false true");
+ QTest::ignoreMessage(QtDebugMsg, "4 false false false");
+
+ QScopedPointer<QObject> o(c.create());
+}
+
QTEST_MAIN(tst_qqmlpropertycache)