summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp')
-rw-r--r--tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index e4b728f9509..ae1edb54a5f 100644
--- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -48,6 +48,7 @@ private slots:
void recursive();
#ifndef QT_NO_EXCEPTIONS
void exceptions();
+ void unhandledException();
#endif
void functor();
void lambda();
@@ -890,6 +891,25 @@ void tst_QtConcurrentRun::exceptions()
QVERIFY2(caught, "did not get exception");
}
+
+void tst_QtConcurrentRun::unhandledException()
+{
+ struct Exception {};
+ bool caught = false;
+ try {
+ auto f = QtConcurrent::run([] { throw Exception {}; });
+ f.waitForFinished();
+ } catch (const QUnhandledException &e) {
+ try {
+ if (e.exception())
+ std::rethrow_exception(e.exception());
+ } catch (const Exception &) {
+ caught = true;
+ }
+ }
+
+ QVERIFY(caught);
+}
#endif
// Compiler supports decltype