diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-06-19 18:28:36 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-19 17:23:10 +0000 |
commit | ba64b7d013fb95fb7b3afe9f1724edae7fcca2ed (patch) | |
tree | 9aaddf6c214b41999a584129e63282b443734ca9 /tests/auto/qml/qqmlengine | |
parent | 9333ea8649838d7e0400b0e94c8cbd4fa5d216b0 (diff) | |
parent | 5100d558742c682d83e0d4033d78ed4c9f521f56 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
.qmake.conf
src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp
src/qml/compiler/qv4codegen.cpp
tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
Diffstat (limited to 'tests/auto/qml/qqmlengine')
-rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 09480a8e1a..f179093a3d 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -78,6 +78,7 @@ private slots: void testGroupedPropertyRevisions(); void componentFromEval(); void qrcUrls(); + void cppSignalAndEval(); public slots: QObject *createAQObjectForOwnershipTest () @@ -920,6 +921,37 @@ void tst_qqmlengine::qrcUrls() } } +class ObjectCaller : public QObject +{ + Q_OBJECT +signals: + void doubleReply(const double a); +}; + +void tst_qqmlengine::cppSignalAndEval() +{ + ObjectCaller objectCaller; + QQmlEngine engine; + engine.rootContext()->setContextProperty(QLatin1Literal("CallerCpp"), &objectCaller); + QQmlComponent c(&engine); + c.setData("import QtQuick 2.9\n" + "Item {\n" + " property var r: 0\n" + " Connections {\n" + " target: CallerCpp;\n" + " onDoubleReply: {\n" + " eval('var z = 1');\n" + " r = a;\n" + " }\n" + " }\n" + "}", + QUrl(QStringLiteral("qrc:/main.qml"))); + QScopedPointer<QObject> object(c.create()); + QVERIFY(!object.isNull()); + emit objectCaller.doubleReply(1.1234); + QCOMPARE(object->property("r"), 1.1234); +} + QTEST_MAIN(tst_qqmlengine) #include "tst_qqmlengine.moc" |