diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-09-30 13:19:21 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-03 03:34:57 +0200 |
commit | 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b (patch) | |
tree | 33c67e6b261357b5bd4a180e13bb48d26da5ca16 /tests/auto/gui/painting/qprinterinfo | |
parent | 3c54bd67dacc2a5d11246213377e804be364a387 (diff) |
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at
run-time to be inapplicable or unsafe. If a test function can be
determined to be inapplicable at compile-time, the entire test function
should be omitted instead of replacing the body of the test function
with a QSKIP, which only serves to slow down test runs and to inflate
test run-rates with empty, inapplicable tests.
Task-number: QTQAINFRA-278
Change-Id: I31e069f5476f8adf9851e94b33c6afac4394b88e
Reviewed-on: http://codereview.qt-project.org/5824
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/gui/painting/qprinterinfo')
-rw-r--r-- | tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp index 7e5da4a6f8..f4579cfd79 100644 --- a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp @@ -56,12 +56,6 @@ Q_DECLARE_METATYPE(QRect) - -#if defined(Q_OS_WIN32) -# define ACCEPTABLE_WINDOWS -#endif - - //TESTED_CLASS= //TESTED_FILES= @@ -80,8 +74,10 @@ public slots: //void init(); //void cleanup(); private slots: +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void testForDefaultPrinter(); void testForPrinters(); +#endif void testForPaperSizes(); void testConstructors(); void testAssignment(); @@ -208,13 +204,13 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command) } #else return QString(); -#endif // Q_OS_UNIX +#endif } +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void tst_QPrinterInfo::testForDefaultPrinter() { -#if defined(Q_OS_UNIX) || defined(ACCEPTABLE_WINDOWS) -# ifdef ACCEPTABLE_WINDOWS +# ifdef Q_OS_WIN32 if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") { QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail"); } else { @@ -245,15 +241,13 @@ void tst_QPrinterInfo::testForDefaultPrinter() } if (!found && defSysPrinter != "") QFAIL("No default printer reported by Qt, although there is one"); -#else - QSKIP("Test doesn't work on non-Unix", SkipAll); -#endif // defined(Q_OS_UNIX) || defined(ACCEPTABLE_WINDOWS) } +#endif +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void tst_QPrinterInfo::testForPrinters() { -#if defined(Q_OS_UNIX) || defined(ACCEPTABLE_WINDOWS) -# ifdef ACCEPTABLE_WINDOWS +# ifdef Q_OS_WIN32 if (QHostInfo::localHostName() == "fantomet" || QHostInfo::localHostName() == "bobo") { QWARN("Test is hardcoded to \"fantomet\" and \"bobo\" on Windows and may fail"); } else { @@ -296,10 +290,8 @@ void tst_QPrinterInfo::testForPrinters() QFAIL(qPrintable(QString("Printer '%1' reported by system, but not reported by Qt").arg(sysPrinters.at(i)))); } } -#else - QSKIP("Test doesn't work on non-Unix", SkipAll); -#endif // defined(Q_OS_UNIX) || defined(ACCEPTABLE_WINDOWS) } +#endif void tst_QPrinterInfo::testForPaperSizes() { |