diff options
Diffstat (limited to 'tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp')
-rw-r--r-- | tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 4e39ad3a41..3fd9dbec8f 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -64,6 +64,7 @@ private slots: void crashBug(); void QTBUG_17868(); + void metaObjectAccessibility(); }; void tst_QQmlPropertyMap::insert() @@ -280,6 +281,48 @@ void tst_QQmlPropertyMap::QTBUG_17868() } +class MyEnhancedPropertyMap : public QQmlPropertyMap +{ + Q_OBJECT +public: + MyEnhancedPropertyMap() : QQmlPropertyMap(this) {} + +signals: + void testSignal(); + +public slots: + void testSlot() {} +}; + +namespace +{ + QStringList messages; + void msgHandler(QtMsgType, const char *msg) + { + messages << QLatin1String(msg); + } +} + +void tst_QQmlPropertyMap::metaObjectAccessibility() +{ + messages.clear(); + QtMsgHandler old = qInstallMsgHandler(msgHandler); + + QQmlEngine engine; + + MyEnhancedPropertyMap map; + + // Verify that signals and slots of QQmlPropertyMap-derived classes are accessible + QObject::connect(&map, SIGNAL(testSignal()), &engine, SIGNAL(quit())); + QObject::connect(&engine, SIGNAL(quit()), &map, SLOT(testSlot())); + + QCOMPARE(map.metaObject()->className(), "MyEnhancedPropertyMap"); + + qInstallMsgHandler(old); + + QCOMPARE(messages.count(), 0); +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" |