diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/scriptConnect.7.qml | 11 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 14 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 8 |
4 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.7.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.7.qml new file mode 100644 index 0000000000..9dab8d7815 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.7.qml @@ -0,0 +1,11 @@ +import Qt.test +import QtQml + +QtObject { + readonly property Sender s: Sender {id: sender} + readonly property Receiver r: Receiver {id: receiver} + Component.onCompleted: () => { + sender.sig1.connect(receiver.slot1) + sender.sig1() + } +} diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 688ed2c946..9b699f485b 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -556,6 +556,9 @@ void registerTypes() qmlRegisterType<ClassWithQProperty>("Qt.test", 1, 0, "ClassWithQProperty"); qmlRegisterType<ClassWithQProperty2>("Qt.test", 1, 0, "ClassWithQProperty2"); + + qmlRegisterType<Receiver>("Qt.test", 1,0, "Receiver"); + qmlRegisterType<Sender>("Qt.test", 1,0, "Sender"); } #include "testtypes.moc" diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 7074ffaa10..09c3fcaf40 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1781,6 +1781,20 @@ public: // QNotifiedProperty<float, &ClassWithQProperty2::callback> value; }; +struct Sender : QObject +{ + Q_OBJECT +signals: + void sig1(); +}; + +struct Receiver : QObject +{ + Q_OBJECT +public slots: + int slot1(int i, int j, int k) {return i+j+k;} +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 1ac1c04fd4..59f2b1ab88 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -3617,6 +3617,14 @@ void tst_qqmlecmascript::scriptConnect() delete object; } + + { + QRegularExpression msg {".*scriptConnect.7.qml:9: Error: Insufficient arguments"}; + QTest::ignoreMessage(QtMsgType::QtWarningMsg, msg); + QQmlComponent component(&engine, testFileUrl("scriptConnect.7.qml")); + QScopedPointer<QObject> root { component.create() }; + QVERIFY2(root, qPrintable(component.errorString())); + } } void tst_qqmlecmascript::scriptDisconnect() |