diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-11 09:35:39 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-11 09:35:39 (GMT) |
commit | 69917d7b4dafa2b5bdd526d2d21b959a31b13438 (patch) | |
tree | 75605437441102ca180cfc2771d682b2ab6cab9f /tests | |
parent | e8ddca677db9b0d3ac8ff1b2079c3b000d59d6ec (diff) | |
parent | 98d51e42c81c0674bc724eccbdf8521d9317998a (diff) | |
download | Qt-69917d7b4dafa2b5bdd526d2d21b959a31b13438.zip Qt-69917d7b4dafa2b5bdd526d2d21b959a31b13438.tar.gz Qt-69917d7b4dafa2b5bdd526d2d21b959a31b13438.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Support exception handling in QtConcurrent::run()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp | 38 |
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() { |