diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 581c060d36..2c11d63167 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -155,6 +156,7 @@ private slots: void createInsideJSModule(); void qmlErrorIsReported(); void initJSValueProp(); + void qmlPropertySignalExists(); private: QQmlEngine engine; @@ -1101,6 +1103,22 @@ void tst_qqmlcomponent::initJSValueProp() QCOMPARE(jsValue.toInt(), 5); } +void tst_qqmlcomponent::qmlPropertySignalExists() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQml; QtObject { property int p: 41; function doStuff() { p++; } }", + QUrl()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer o(component.create()); + QVERIFY(!o.isNull()); + + QSignalSpy changeSignalSpy(o.get(), SIGNAL(pChanged())); + QVERIFY(QMetaObject::invokeMethod(o.get(), "doStuff")); + QCOMPARE(changeSignalSpy.count(), 1); + QCOMPARE(o->property("p").toInt(), 42); +} + QTEST_MAIN(tst_qqmlcomponent) #include "tst_qqmlcomponent.moc"