summaryrefslogtreecommitdiffstats
path: root/tests/auto/exceptionsafety
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2009-06-18 09:37:59 +0100
committermread <qt-info@nokia.com>2009-06-18 09:37:59 +0100
commit715db7c01d29d316700089f1abc5eea2f7c98975 (patch)
tree98d36d28e9c42c155d04d757c71808047393f4c9 /tests/auto/exceptionsafety
parent53c3e52cbd7194ef2e2e4b4648f5fac9cd780930 (diff)
report and continue policy for exceptions in all Qt threads
Diffstat (limited to 'tests/auto/exceptionsafety')
-rw-r--r--tests/auto/exceptionsafety/tst_exceptionsafety.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
index 8ed29136db..4dce86da77 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();