diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 18:40:58 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 18:44:54 +0200 |
commit | 2be575b4b1e6f6e11a8dbd0b1c05c003828d2598 (patch) | |
tree | 55d2bfaff9583b3e1e9f3291f4b91f34adae1d92 /tests/auto/qml/qqmlpromise | |
parent | 4a5939d26d1e36efdb2b30cdee1f3672587c3fa5 (diff) | |
parent | 9e32b23a1514f367921b4a9ee25bc864a008463c (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I6f2152aeecaeb8e63fdbc1cdf1444132a054b6f5
Diffstat (limited to 'tests/auto/qml/qqmlpromise')
-rw-r--r-- | tests/auto/qml/qqmlpromise/data/promisechain.qml | 24 | ||||
-rw-r--r-- | tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp | 15 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpromise/data/promisechain.qml b/tests/auto/qml/qqmlpromise/data/promisechain.qml new file mode 100644 index 0000000000..fa1809aef0 --- /dev/null +++ b/tests/auto/qml/qqmlpromise/data/promisechain.qml @@ -0,0 +1,24 @@ +import QtQml 2.0 + +QtObject { + property int x: 0 + id: root; + Component.onCompleted: { + new Promise((res) => { + res(1) + }) + .then((data) => { + console.debug(data) + return new Promise((res) => {res(2)}); + }) + .then((data) => { + console.debug(data) + return new Promise((res) => {res(3)}); + }) + .then((data) => { + console.debug(data); + root.x = 42; + }); + } + +} diff --git a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp index 0f4bb5cdcc..41850d0263 100644 --- a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp +++ b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp @@ -82,6 +82,7 @@ private slots: void then_fulfilled_non_callable(); void then_reject_non_callable(); void then_resolve_multiple_then(); + void promiseChain(); private: void execute_test(QString testName); @@ -270,6 +271,20 @@ void tst_qqmlpromise::execute_test(QString testName) QTRY_COMPARE(object->property("wasTestSuccessful").toBool(), true); } +void tst_qqmlpromise::promiseChain() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("promisechain.qml")); + QVERIFY(component.isReady()); + QTest::ignoreMessage(QtDebugMsg, "1"); + QTest::ignoreMessage(QtDebugMsg, "2"); + QTest::ignoreMessage(QtDebugMsg, "3"); + QScopedPointer<QObject> root(component.create()); + QVERIFY(root); + QTRY_VERIFY(root->property("x") == 42); + +} + QTEST_MAIN(tst_qqmlpromise) |