diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 18:46:38 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 19:02:37 +0200 |
commit | c2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e (patch) | |
tree | c6f7e058a985d7c18b51cadc76283caf555071c9 /tests/auto/qml/qqmlpromise | |
parent | 9e633bbda7608ac0231809e2a6a97ae8f2d849d6 (diff) | |
parent | 803f18f02e5609a1ca00a5b78ea6d3613d44e1a0 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml because we don't use it yet in wip/cmake.
Fixed conflict in qmlcachegen.cpp.
Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
Diffstat (limited to 'tests/auto/qml/qqmlpromise')
-rw-r--r-- | tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml | 17 | ||||
-rw-r--r-- | tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml b/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml new file mode 100644 index 0000000000..d23ea43e74 --- /dev/null +++ b/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml @@ -0,0 +1,17 @@ +import QtQuick 2.12 + +Item { + id: root + property string errorMessage + Component.onCompleted: () => { + let prom = Promise.reject("Some error") + .then( + o => {console.log("Never reached");}, + err => { + console.log("Rethrowing err"); + throw err; + } + ) + .catch(err => root.errorMessage = err) + } +} diff --git a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp index 41850d0263..b430434526 100644 --- a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp +++ b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp @@ -83,6 +83,7 @@ private slots: void then_reject_non_callable(); void then_resolve_multiple_then(); void promiseChain(); + void promiseHandlerThrows(); private: void execute_test(QString testName); @@ -285,6 +286,17 @@ void tst_qqmlpromise::promiseChain() } +void tst_qqmlpromise::promiseHandlerThrows() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("promisehandlerthrows.qml")); + QVERIFY(component.isReady()); + QTest::ignoreMessage(QtDebugMsg, "Rethrowing err"); + QScopedPointer<QObject> root(component.create()); + QVERIFY(root); + QTRY_VERIFY(root->property("errorMessage") == QLatin1String("Some error")); +} + QTEST_MAIN(tst_qqmlpromise) |