diff options
author | mread <qt-info@nokia.com> | 2009-06-18 08:37:59 (GMT) |
---|---|---|
committer | mread <qt-info@nokia.com> | 2009-06-18 08:37:59 (GMT) |
commit | 715db7c01d29d316700089f1abc5eea2f7c98975 (patch) | |
tree | 98d36d28e9c42c155d04d757c71808047393f4c9 /tests | |
parent | 53c3e52cbd7194ef2e2e4b4648f5fac9cd780930 (diff) | |
download | Qt-715db7c01d29d316700089f1abc5eea2f7c98975.zip Qt-715db7c01d29d316700089f1abc5eea2f7c98975.tar.gz Qt-715db7c01d29d316700089f1abc5eea2f7c98975.tar.bz2 |
report and continue policy for exceptions in all Qt threads
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/exceptionsafety/tst_exceptionsafety.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp index 8ed2913..4dce86d 100644 --- a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp +++ b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp @@ -617,6 +617,12 @@ public: {} }; +struct IntEx : public std::exception +{ + IntEx(int aEx) : ex(aEx) {} + int ex; +}; + class TestObject : public QObject { public: @@ -630,7 +636,7 @@ protected: bool event(QEvent *event) { if (int(event->type()) == ThrowEventId) { - throw ++throwEventCount; + throw IntEx(++throwEventCount); } else if (int(event->type()) == NoThrowEventId) { ++noThrowEventCount; } @@ -645,8 +651,8 @@ void tst_ExceptionSafety::exceptionEventLoop() ThrowEvent throwEvent; try { qApp->sendEvent(&obj, &throwEvent); - } catch (int code) { - QCOMPARE(code, 1); + } catch (IntEx code) { + QCOMPARE(code.ex, 1); } QCOMPARE(obj.throwEventCount, 1); @@ -655,8 +661,8 @@ void tst_ExceptionSafety::exceptionEventLoop() try { qApp->processEvents(); - } catch (int code) { - QCOMPARE(code, 2); + } catch (IntEx code) { + QCOMPARE(code.ex, 2); } QCOMPARE(obj.throwEventCount, 2); @@ -669,12 +675,15 @@ void tst_ExceptionSafety::exceptionEventLoop() try { qApp->processEvents(); - } catch (int code) { - QCOMPARE(code, 3); + } catch (IntEx code) { + QCOMPARE(code.ex, 3); } // here, we should have received on non-throwing event and one throwing one QCOMPARE(obj.throwEventCount, 3); +#ifndef __SYMBIAN32__ + // symbian event loops will have absorbed the exceptions QCOMPARE(obj.noThrowEventCount, 1); +#endif // spin the event loop again qApp->processEvents(); |