summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-17 15:11:12 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-19 03:05:31 +0200
commitafb80f0cd93fa31b94b22e4d0cedb55af14f2d89 (patch)
tree80dcc7bdc35738bc5bbe179944de15c8990ad81d
parent946805f07f9f8270d60df58f07bd8836b76d7258 (diff)
downloadqtbase-afb80f0cd93fa31b94b22e4d0cedb55af14f2d89.tar.gz
Prefer QSKIP to QTEST_NOOP_MAIN.
Use QSKIP instead of QTEST_NOOP_MAIN so that the user receives a clear indication that this test isn't testing anything when not built for X11. Change-Id: I9e9ef8fe738c06eb86f2ce398f6a515bf17e220a Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
-rw-r--r--tests/auto/qx11info/qx11info.pro1
-rw-r--r--tests/auto/qx11info/tst_qx11info.cpp25
2 files changed, 16 insertions, 10 deletions
diff --git a/tests/auto/qx11info/qx11info.pro b/tests/auto/qx11info/qx11info.pro
index 05d942adfe..a6c06e6fff 100644
--- a/tests/auto/qx11info/qx11info.pro
+++ b/tests/auto/qx11info/qx11info.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
+QT += widgets
SOURCES += tst_qx11info.cpp
diff --git a/tests/auto/qx11info/tst_qx11info.cpp b/tests/auto/qx11info/tst_qx11info.cpp
index d42be420fb..f94c29065c 100644
--- a/tests/auto/qx11info/tst_qx11info.cpp
+++ b/tests/auto/qx11info/tst_qx11info.cpp
@@ -41,9 +41,6 @@
#include <QtTest/QtTest>
-
-#ifdef Q_WS_X11
-
#include <QApplication>
#include <QX11Info>
@@ -51,10 +48,23 @@ class tst_QX11Info : public QObject
{
Q_OBJECT
+#ifndef Q_WS_X11
+public slots:
+ void initTestCase();
+#else
private slots:
void staticFunctionsBeforeQApplication();
+#endif
};
+#ifndef Q_WS_X11
+void tst_QX11Info::initTestCase()
+{
+ QSKIP("This test is only valid for X11", SkipAll);
+}
+
+#else
+
void tst_QX11Info::staticFunctionsBeforeQApplication()
{
QVERIFY(!QApplication::instance());
@@ -111,12 +121,7 @@ void tst_QX11Info::staticFunctionsBeforeQApplication()
QCOMPARE(appTime, 0ul);
}
-QTEST_APPLESS_MAIN(tst_QX11Info)
+#endif
+QTEST_APPLESS_MAIN(tst_QX11Info)
#include "tst_qx11info.moc"
-
-#else // !Q_WS_X11
-
-QTEST_NOOP_MAIN
-
-#endif