summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-17 14:32:54 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-17 10:30:04 +0200
commit19168ca21ffda95de6c1e3ef07b4b57a58559e41 (patch)
tree33a20d00b12d0efe1fed0d5b32e1e3fdea708d48 /tests
parent5d8d7b1dbc703c381033681c2cd4f7a912f60850 (diff)
Prefer QSKIP to QTEST_NOOP_MAIN.
There is no way for a .pro file to know if exceptions are supported in the Qt build, so these tests cannot be omitted from the build if exceptions are not supported. Because of this limitation, these tests were using QTEST_NOOP_MAIN when exceptions were not available, making the tests appear to pass. This commit changes QTEST_NOOP_MAIN to QSKIP, so that the user receives a clear indication that the test isn't testing anything when exceptions are not available. Change-Id: I2facf08ba69e6f985e2da50dd36ad2658246b22e Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/exceptionsafety/tst_exceptionsafety.cpp18
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp16
2 files changed, 25 insertions, 9 deletions
diff --git a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
index ef6e96f00b..27db9ea7f7 100644
--- a/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
+++ b/tests/auto/exceptionsafety/tst_exceptionsafety.cpp
@@ -44,13 +44,13 @@
QT_USE_NAMESPACE
-#if defined(QT_NO_EXCEPTIONS)
- QTEST_NOOP_MAIN
-#else
class tst_ExceptionSafety: public QObject
{
Q_OBJECT
private slots:
+#ifdef QT_NO_EXCEPTIONS
+ void initTestCase();
+#else
void exceptionInSlot();
void exceptionVector();
void exceptionHash();
@@ -59,8 +59,17 @@ private slots:
void exceptionLinkedList();
// void exceptionEventLoop();
// void exceptionSignalSlot();
+#endif
};
+#ifdef QT_NO_EXCEPTIONS
+void tst_ExceptionSafety::initTestCase()
+{
+ QSKIP("This test requires exception support", SkipAll);
+}
+
+#else
+
class Emitter : public QObject
{
Q_OBJECT
@@ -719,6 +728,7 @@ void tst_ExceptionSafety::exceptionSignalSlot()
}
#endif
+#endif
+
QTEST_MAIN(tst_ExceptionSafety)
#include "tst_exceptionsafety.moc"
-#endif // QT_NO_EXCEPTIONS
diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
index 82289d9efd..0d410a79a2 100644
--- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
+++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
@@ -50,10 +50,6 @@ QT_USE_NAMESPACE
// this test only works with GLIBC
-#if defined(QT_NO_EXCEPTIONS)
- QTEST_NOOP_MAIN
-#else
-
#include "oomsimulator.h"
#include "3rdparty/memcheck.h"
@@ -63,6 +59,7 @@ class tst_ExceptionSafety_Objects: public QObject
public slots:
void initTestCase();
+#ifndef QT_NO_EXCEPTIONS
void cleanupTestCase();
private slots:
@@ -84,8 +81,16 @@ private slots:
private:
static QtMsgHandler testMessageHandler;
static void safeMessageHandler(QtMsgType, const char *);
+#endif
};
+#ifdef QT_NO_EXCEPTIONS
+void tst_ExceptionSafety_Objects::initTestCase()
+{
+ QSKIP("This test requires exception support", SkipAll);
+}
+
+#else
// helper structs to create an arbitrary widget
struct AbstractTester
{
@@ -790,6 +795,7 @@ void tst_ExceptionSafety_Objects::linkedList()
doOOMTest(testFunction, 0);
}
+#endif
+
QTEST_MAIN(tst_ExceptionSafety_Objects)
#include "tst_exceptionsafety_objects.moc"
-#endif // QT_NO_EXCEPTIONS