diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-01 13:14:04 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-01 13:14:04 +0200 |
commit | 6839f03051d2950e4721cbb5ee88fa7b07109588 (patch) | |
tree | d5cdfeeb6e59953f5109ef87a1be08f69fcddf7a /tests/auto/qml/qqmlpropertymap | |
parent | cc5ead1b3c8ce79c240b70bdfcfb687fe60e50f5 (diff) | |
parent | fe92db0a0eeed502ef851930b3404b38c4a03f4f (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
tests/auto/quick/qquickitem/tst_qquickitem.cpp
Change-Id: If261f8eea84dfa5944bb55de999d1f70aba528fd
Diffstat (limited to 'tests/auto/qml/qqmlpropertymap')
-rw-r--r-- | tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index e0c2324dc6..b8ea98df2b 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -60,6 +60,7 @@ private slots: void QTBUG_35233(); void disallowExtending(); void QTBUG_35906(); + void QTBUG_48136(); }; class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus @@ -462,6 +463,40 @@ void tst_QQmlPropertyMap::QTBUG_35906() QCOMPARE(value.toInt(), 42); } +void tst_QQmlPropertyMap::QTBUG_48136() +{ + static const char key[] = "mykey"; + QQmlPropertyMap map; + + // + // Test that the notify signal is emitted correctly + // + + const int propIndex = map.metaObject()->indexOfProperty(key); + const QMetaProperty prop = map.metaObject()->property(propIndex); + QSignalSpy notifySpy(&map, QByteArray::number(QSIGNAL_CODE) + prop.notifySignal().methodSignature()); + + map.insert(key, 42); + QCOMPARE(notifySpy.count(), 1); + map.insert(key, 43); + QCOMPARE(notifySpy.count(), 2); + map.insert(key, 43); + QCOMPARE(notifySpy.count(), 2); + map.insert(key, 44); + QCOMPARE(notifySpy.count(), 3); + + // + // Test that the valueChanged signal is emitted correctly + // + QSignalSpy valueChangedSpy(&map, &QQmlPropertyMap::valueChanged); + map.setProperty(key, 44); + QCOMPARE(valueChangedSpy.count(), 0); + map.setProperty(key, 45); + QCOMPARE(valueChangedSpy.count(), 1); + map.setProperty(key, 45); + QCOMPARE(valueChangedSpy.count(), 1); +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" |