summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
index 8fdc50c..8b10ea4 100644
--- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -61,6 +61,9 @@ private slots:
void implicitConvertibleTypes();
void runWaitLoop();
void recursive();
+#ifndef QT_NO_EXCEPTIONS
+ void exceptions();
+#endif
#if 0
void createFunctor();
#endif
@@ -374,6 +377,41 @@ int fn2(double, int *)
return 1;
}
+
+#ifndef QT_NO_EXCEPTIONS
+void throwFunction()
+{
+ throw QtConcurrent::Exception();
+}
+
+int throwFunctionReturn()
+{
+ throw QtConcurrent::Exception();
+ return 0;
+}
+
+void tst_QtConcurrentRun::exceptions()
+{
+ bool caught = false;
+ try {
+ QtConcurrent::run(throwFunction).waitForFinished();
+ } catch (Exception &e) {
+ caught = true;
+ }
+ if (!caught)
+ QFAIL("did not get exception");
+
+ caught = false;
+ try {
+ QtConcurrent::run(throwFunctionReturn).waitForFinished();
+ } catch (Exception &e) {
+ caught = true;
+ }
+ if (!caught)
+ QFAIL("did not get exception");
+}
+#endif
+
#if 0
void tst_QtConcurrentRun::createFunctor()
{