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 <qt_sanity_bot@ovi.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
This commit is contained in:
Rohan McGovern 2011-08-02 12:05:21 +10:00 committed by Qt by Nokia
parent 66fbd24849
commit 06657ea84b
2 changed files with 23 additions and 4 deletions

View File

@ -6,5 +6,3 @@ QT += network
win32:!wince*:LIBS += -luser32 win32:!wince*:LIBS += -luser32
symbian:TARGET.CAPABILITY += NetworkServices symbian:TARGET.CAPABILITY += NetworkServices
CONFIG+=insignificant_test

View File

@ -203,6 +203,7 @@ private slots:
void symbianNestedActiveSchedulerLoop(); void symbianNestedActiveSchedulerLoop();
void processEvents(); void processEvents();
void exec(); void exec();
void throwInExec();
void reexec(); void reexec();
void exit(); void exit();
void execAfterExit(); void execAfterExit();
@ -445,14 +446,35 @@ void tst_QEventLoop::exec()
QCOMPARE(returnCode, 0); QCOMPARE(returnCode, 0);
QCOMPARE(executor.returnCode, -1); 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 // Windows Mobile cannot handle cross library exceptions
// qobject.cpp will try to rethrow the exception after handling // qobject.cpp will try to rethrow the exception after handling
// which causes gwes.exe to crash // which causes gwes.exe to crash
// Symbian doesn't propagate exceptions from eventloop, but converts them to // Symbian doesn't propagate exceptions from eventloop, but converts them to
// CActiveScheduler errors instead -> this test will hang. // 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::exec() is exception safe
QEventLoop eventLoop; QEventLoop eventLoop;
@ -474,7 +496,6 @@ void tst_QEventLoop::exec()
} }
QCOMPARE(caughtExceptions, 2); QCOMPARE(caughtExceptions, 2);
} }
#endif
} }
void tst_QEventLoop::reexec() void tst_QEventLoop::reexec()