diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-01-06 16:12:40 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-01-06 16:12:41 +0100 |
commit | 24e2b39e7a06687322a18a158a083eb51a7c0dca (patch) | |
tree | 1a32caf6dd6db74fbac9553a094bb00b216fa678 /tests/auto/qml/qqmlpropertymap | |
parent | 39540124dd0900e0c99dcda8c0ebdf4f3cea8d5e (diff) | |
parent | daff5f2988cef31442629a48c3b3088abf01837a (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: If9a205bea219b9aca95d78b1e556ca9bbff58dd0
Diffstat (limited to 'tests/auto/qml/qqmlpropertymap')
-rw-r--r-- | tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 28a9bce98d..669ae7d5ea 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -72,6 +72,7 @@ private slots: void QTBUG_29836(); void QTBUG_35233(); void disallowExtending(); + void QTBUG_35906(); }; class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus @@ -79,7 +80,7 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus Q_OBJECT Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty) + Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty NOTIFY someFixedPropertyChanged) public: LazyPropertyMap() : QQmlPropertyMap(this, /*parent*/0) @@ -92,7 +93,10 @@ public: } int someFixedProperty() const { return value; } - void setSomeFixedProperty(int v) { value = v; } + void setSomeFixedProperty(int v) { value = v; emit someFixedPropertyChanged(); } + +signals: + void someFixedPropertyChanged(); private: int value; @@ -450,6 +454,27 @@ void tst_QQmlPropertyMap::disallowExtending() QCOMPARE(component.errors().at(0).toString(), QStringLiteral("<Unknown File>: Fully dynamic types cannot declare new properties.")); } +void tst_QQmlPropertyMap::QTBUG_35906() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQml 2.0\n" + "import QTBUG_35233 1.0\n" + "QtObject {\n" + " property int testValue: mapById.someFixedProperty\n" + "\n" + " property QtObject maProperty: LazyPropertyMap {\n" + " id: mapById\n" + " someFixedProperty: 42\n" + " }\n" + "}\n", QUrl()); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QVariant value = obj->property("testValue"); + QVERIFY(value.type() == QVariant::Int); + QCOMPARE(value.toInt(), 42); +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" |