summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/styles
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/widgets/styles
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/widgets/styles')
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp24
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp10
2 files changed, 18 insertions, 16 deletions
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index e0a9570ee2..77c1d71129 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -133,7 +133,7 @@ private slots:
#ifndef QT_NO_STYLE_CDE
void testCDEStyle();
#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
+#ifndef QT_NO_STYLE_WINDOWSXP
void testWindowsXPStyle();
#endif
void testWindowsVistaStyle();
@@ -141,12 +141,8 @@ private slots:
void testCleanlooksStyle();
#endif
void testMacStyle();
-#ifdef Q_OS_WINCE
void testWindowsCEStyle();
-#endif
-#ifdef Q_OS_WINCE_WM
void testWindowsMobileStyle();
-#endif
void testStyleFactory();
void testProxyStyle();
void pixelMetric();
@@ -420,12 +416,16 @@ void tst_QStyle::testWindowsStyle()
wstyle.drawControl(QStyle::CE_ProgressBar, &pb, &painter, 0);
}
-#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
+#ifndef QT_NO_STYLE_WINDOWSXP
void tst_QStyle::testWindowsXPStyle()
{
+#ifdef Q_WS_WIN
QWindowsXPStyle xpstyle;
QVERIFY(testAllFunctions(&xpstyle));
lineUpLayoutTest(&xpstyle);
+#else
+ QSKIP("No WindowsXP style");
+#endif
}
#endif
@@ -586,21 +586,25 @@ void tst_QStyle::testCDEStyle()
}
#endif
-#ifdef Q_OS_WINCE
void tst_QStyle::testWindowsCEStyle()
{
+#if defined(Q_OS_WINCE)
QWindowsCEStyle cstyle;
QVERIFY(testAllFunctions(&cstyle));
-}
+#else
+ QSKIP("No WindowsCEStyle style");
#endif
+}
-#ifdef Q_OS_WINCE_WM
void tst_QStyle::testWindowsMobileStyle()
{
+#if defined(Q_OS_WINCE_WM)
QWindowsMobileStyle cstyle;
QVERIFY(testAllFunctions(&cstyle));
-}
+#else
+ QSKIP("No WindowsMobileStyle style");
#endif
+}
// Helper class...
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 2e5ddb4695..9ecf4d8676 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -79,9 +79,7 @@ private slots:
void fontPropagation();
void onWidgetDestroyed();
void fontPrecedence();
-#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
void focusColors();
-#endif
void hoverColors();
void background();
void tabAlignement();
@@ -726,9 +724,6 @@ static bool testForColors(const QImage& image, const QColor& color, bool ensureP
return false;
}
-// This is a fragile test which fails on many esoteric platforms
-// because of focus problems. Test only on Windows, Mac, and Linux/gcc.
-#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
void tst_QStyleSheetStyle::focusColors()
{
// Tests if colors can be changed by altering the focus of the widget.
@@ -736,6 +731,10 @@ void tst_QStyleSheetStyle::focusColors()
// is reached if at least ten pixels of the right color can be found in
// the image.
// For this reason, we use unusual and extremely ugly colors! :-)
+#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
+ QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems. "
+ "That doesn't mean that the feature doesn't work in practice.");
+#endif
QList<QWidget *> widgets;
widgets << new QPushButton("TESTING");
widgets << new QLineEdit("TESTING");
@@ -792,7 +791,6 @@ void tst_QStyleSheetStyle::focusColors()
.toLocal8Bit().constData());
}
}
-#endif
void tst_QStyleSheetStyle::hoverColors()
{