test: fixed crash of tst_qdialog and removed CONFIG+=insignificant_test
authorRohan McGovern <rohan.mcgovern@nokia.com>
Mon, 1 Aug 2011 23:13:38 +0000 (09:13 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 2 Aug 2011 05:37:16 +0000 (07:37 +0200)
This test assumed that C++ exceptions could always be caught by the
event loop.  This is not the case when the Glib event loop is used.
Skip the relevant portion of the test in that case.

Change-Id: I6a6325c3590c810a5aba28ec98279581dcfaf55c
Reviewed-on: http://codereview.qt.nokia.com/2455
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
tests/auto/qdialog/qdialog.pro
tests/auto/qdialog/tst_qdialog.cpp

index ab7bfd9..161a6b4 100644 (file)
@@ -1,5 +1,2 @@
 load(qttest_p4)
 SOURCES += tst_qdialog.cpp
-
-
-CONFIG+=insignificant_test
index 6d9f798..86dde21 100644 (file)
@@ -467,6 +467,22 @@ void tst_QDialog::throwInExec()
 #if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_))
     QSKIP("Throwing exceptions in exec() is not supported on this platform.", SkipAll);
 #endif
+
+#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))),
+            SkipAll
+        );
+    }
+#endif
+
     int caughtExceptions = 0;
     try {
         ExceptionDialog dialog;