From 06657ea84bdee3293fa9110653100121fedf7e5f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 2 Aug 2011 12:05:21 +1000 Subject: test: fixed tst_qeventloop and removed CONFIG+=insignificant_test Throwing C++ exceptions through the event loop doesn't work if the Glib event loop is used, so conditionally skip that part of the test. Change-Id: Ic27ebf4eb75bd1cf7c7e35f371f29bcfc0e1844a Reviewed-on: http://codereview.qt.nokia.com/2471 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen Reviewed-by: Sergio Ahumada --- tests/auto/qeventloop/qeventloop.pro | 2 -- tests/auto/qeventloop/tst_qeventloop.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/qeventloop/qeventloop.pro b/tests/auto/qeventloop/qeventloop.pro index 153cdbafe7..e3c170a33b 100644 --- a/tests/auto/qeventloop/qeventloop.pro +++ b/tests/auto/qeventloop/qeventloop.pro @@ -6,5 +6,3 @@ QT += network win32:!wince*:LIBS += -luser32 symbian:TARGET.CAPABILITY += NetworkServices - -CONFIG+=insignificant_test diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index 828366ba49..a702908549 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -203,6 +203,7 @@ private slots: void symbianNestedActiveSchedulerLoop(); void processEvents(); void exec(); + void throwInExec(); void reexec(); void exit(); void execAfterExit(); @@ -445,14 +446,35 @@ void tst_QEventLoop::exec() QCOMPARE(returnCode, 0); QCOMPARE(executor.returnCode, -1); } +} -#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN) && !defined(NO_EVENTLOOP_EXCEPTIONS) +void tst_QEventLoop::throwInExec() +{ +#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS) + QSKIP("Exceptions are disabled", SkipAll); +#elif defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) // Windows Mobile cannot handle cross library exceptions // qobject.cpp will try to rethrow the exception after handling // which causes gwes.exe to crash // Symbian doesn't propagate exceptions from eventloop, but converts them to // CActiveScheduler errors instead -> this test will hang. + QSKIP("This platform doesn't support propagating exceptions through the event loop", SkipAll); +#elif defined(Q_OS_LINUX) + // C++ exceptions can't be passed through glib callbacks. Skip the test if + // we're using the glib event loop. + QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className(); + if (dispatcher.contains("Glib")) { + QSKIP( + qPrintable(QString( + "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n" + "Try running with QT_NO_GLIB=1 in environment." + ).arg(QString::fromLatin1(dispatcher))), + SkipAll + ); + } +#endif + { // QEventLoop::exec() is exception safe QEventLoop eventLoop; @@ -474,7 +496,6 @@ void tst_QEventLoop::exec() } QCOMPARE(caughtExceptions, 2); } -#endif } void tst_QEventLoop::reexec() -- cgit v1.2.3