aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp')
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 27e06c6f67..ed213cd01a 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -37,6 +37,7 @@
#include <QtCore/qdir.h>
#include <QtCore/private/qobject_p.h>
#include "../../shared/util.h"
+#include <QtQml/QQmlPropertyMap>
#include <QDebug>
class MyQmlObject : public QObject
@@ -149,6 +150,8 @@ private slots:
void floatToStringPrecision();
void copy();
+
+ void nestedQQmlPropertyMap();
private:
QQmlEngine engine;
};
@@ -2106,6 +2109,24 @@ void tst_qqmlproperty::initTestCase()
qmlRegisterType<MyContainer>("Test",1,0,"MyContainer");
}
+void tst_qqmlproperty::nestedQQmlPropertyMap()
+{
+ QQmlPropertyMap mainPropertyMap;
+ QQmlPropertyMap nestedPropertyMap;
+ QQmlPropertyMap deeplyNestedPropertyMap;
+
+ mainPropertyMap.insert("nesting1", QVariant::fromValue(&nestedPropertyMap));
+ nestedPropertyMap.insert("value", 42);
+ nestedPropertyMap.insert("nesting2", QVariant::fromValue(&deeplyNestedPropertyMap));
+ deeplyNestedPropertyMap.insert("value", "success");
+
+ QQmlProperty value{&mainPropertyMap, "nesting1.value"};
+ QCOMPARE(value.read().toInt(), 42);
+
+ QQmlProperty success{&mainPropertyMap, "nesting1.nesting2.value"};
+ QCOMPARE(success.read().toString(), QLatin1String("success"));
+}
+
QTEST_MAIN(tst_qqmlproperty)
#include "tst_qqmlproperty.moc"