summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-06-07 15:52:26 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-08 23:00:50 +0200
commitebea15cb33da8063a630867e38eacf7857b0b936 (patch)
tree16dffd956d6d690bdb72c599e7f69cc889e90381 /tests
parent9ef24ff8ed487d49cf441c65c69ea7ebfe8acfb3 (diff)
QEventLoop: Remove the test that checked throwing from an event handler
In Qt 5, we declared that throwing from event handlers is undefined behavior. So stop testing this. We will try our best to capture and pass along std::bad_alloc, but even that might not work, depending on compiler settings. In particular, after the upgrade to MinGW/GCC 4.8 with DW2, this test stopped working. Task-number: QTBUG-31615 Change-Id: Ibf5fb2ce0c48b983549096bf7aac434b6ed3ac2e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp67
1 files changed, 0 insertions, 67 deletions
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 2250d0bb5e..25e5f03566 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -159,23 +159,6 @@ public slots:
}
};
-#ifndef QT_NO_EXCEPTIONS
-class QEventLoopTestException { };
-
-class ExceptionThrower : public QObject
-{
- Q_OBJECT
-public:
- ExceptionThrower() : QObject() { }
-public slots:
- void throwException()
- {
- QEventLoopTestException e;
- throw e;
- }
-};
-#endif
-
class tst_QEventLoop : public QObject
{
Q_OBJECT
@@ -183,9 +166,6 @@ private slots:
// This test *must* run first. See the definition for why.
void processEvents();
void exec();
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
- void throwInExec();
-#endif
void reexec();
void execAfterExit();
void wakeUp();
@@ -322,53 +302,6 @@ void tst_QEventLoop::exec()
}
}
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
-// Exceptions need to be enabled for this test
-// Q_OS_WINCE_WM case: this platform doesn't support propagating exceptions through the event loop
-// Windows Mobile cannot handle cross library exceptions
-// qobject.cpp will try to rethrow the exception after handling
-// which causes gwes.exe to crash
-void tst_QEventLoop::throwInExec()
-{
-// exceptions compiled in, runtime tests follow.
-#if 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)))
- );
- }
-#endif
-
- {
- // QEventLoop::exec() is exception safe
- QEventLoop eventLoop;
- int caughtExceptions = 0;
-
- try {
- ExceptionThrower exceptionThrower;
- QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
- (void) eventLoop.exec();
- } catch (...) {
- ++caughtExceptions;
- }
- try {
- ExceptionThrower exceptionThrower;
- QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
- (void) eventLoop.exec();
- } catch (...) {
- ++caughtExceptions;
- }
- QCOMPARE(caughtExceptions, 2);
- }
-}
-#endif
-
void tst_QEventLoop::reexec()
{
QEventLoop loop;