aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-02-18 09:20:13 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-02-19 20:55:47 +0100
commitadd46fd9055088e6aa458f21558234e267eb60ca (patch)
tree39e8c3909c6fcaf407f370ebb873fa0a16114e5d /tests/auto
parentd4f3445bb050bbc34f0e86832fca9b7047041c1e (diff)
ResolvedList: attempt read from correct meta object
Fixes: QTBUG-82171 Change-Id: If14b10d703aa1b69cd697024ada2fae0453103d7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmllanguage/data/Action.qml21
-rw-r--r--tests/auto/qml/qqmllanguage/data/listPropertiesChild.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp11
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/Action.qml b/tests/auto/qml/qqmllanguage/data/Action.qml
new file mode 100644
index 0000000000..4db2bacf6e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/Action.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.12
+
+QtObject {
+ id:root
+ property Item parent
+ property Item displayComponent: null
+
+ property list<QtObject> children
+
+ readonly property var visibleChildren: {
+ var visible = [];
+ var child;
+ for (var i in children) {
+ child = children[i];
+ if (!child.hasOwnProperty("visible") || child.visible) {
+ visible.push(child)
+ }
+ }
+ return visible;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/listPropertiesChild.qml b/tests/auto/qml/qqmllanguage/data/listPropertiesChild.qml
new file mode 100644
index 0000000000..b1635a9409
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listPropertiesChild.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.12
+
+Action
+{
+ id: action
+ property color color
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 2112e0cffb..bd23806e3a 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -123,6 +123,7 @@ private slots:
void dynamicProperties();
void dynamicPropertiesNested();
void listProperties();
+ void listPropertiesInheritanceNoCrash();
void badListItemType();
void dynamicObjectProperties();
void dynamicSignalsAndSlots();
@@ -1491,6 +1492,16 @@ void tst_qqmllanguage::listProperties()
QCOMPARE(object->property("test").toInt(), 2);
}
+// Tests that initializing list properties of a base class does not crash
+// (QTBUG-82171)
+void tst_qqmllanguage::listPropertiesInheritanceNoCrash()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("listPropertiesChild.qml"));
+ QScopedPointer<QObject> object(component.create()); // should not crash
+ QVERIFY(object != nullptr);
+}
+
void tst_qqmllanguage::badListItemType()
{
QQmlComponent component(&engine, testFileUrl("badListItemType.qml"));