diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-10-17 14:15:17 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-19 01:38:36 +0200 |
commit | d884f24fe1b86bbd71d62584d5cf1381355efe0d (patch) | |
tree | 919e253c80dc42e7a3d224b8334981a02b5a2671 /tests/auto/corelib/io/qprocess/tst_qprocess.cpp | |
parent | b419e567c028a6cbc2e0c30906426d12f4abc99c (diff) |
Prefer QSKIP to QTEST_NOOP_MAIN.
There is no way for a .pro file to know if QProcess is in the Qt build,
so the QProcess autotest cannot be omitted from the build if QProcess is
not available. Because of this limitation, the test was using
QTEST_NOOP_MAIN when QProcess was not available, making the test 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
QProcess is not available.
Change-Id: I79f667b17ff98dfc47eb61fb977365abef8883fb
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp')
-rw-r--r-- | tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index d28efd8934..cb0d0149b6 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -52,20 +52,15 @@ #include <QtNetwork/QHostInfo> #include <stdlib.h> -#ifdef QT_NO_PROCESS -QTEST_NOOP_MAIN -#else - -#if defined(Q_OS_WIN) -#include <windows.h> -#endif - -//TESTED_CLASS= -//TESTED_FILES= +#ifndef QT_NO_PROCESS +# if defined(Q_OS_WIN) +# include <windows.h> +# endif Q_DECLARE_METATYPE(QList<QProcess::ExitStatus>); Q_DECLARE_METATYPE(QProcess::ExitStatus); Q_DECLARE_METATYPE(QProcess::ProcessState); +#endif #define QPROCESS_VERIFY(Process, Fn) \ { \ @@ -79,14 +74,10 @@ class tst_QProcess : public QObject { Q_OBJECT -public: - tst_QProcess(); - virtual ~tst_QProcess(); - +#ifdef QT_NO_PROCESS public slots: - void init(); - void cleanup(); - + void initTestCase(); +#else private slots: void getSetCheck(); void constructing(); @@ -197,8 +188,17 @@ protected slots: private: QProcess *process; qint64 bytesAvailable; +#endif }; +#ifdef QT_NO_PROCESS +void tst_QProcess::initTestCase() +{ + QSKIP("This test requires QProcess support", SkipAll); +} + +#else + // Testing get/set functions void tst_QProcess::getSetCheck() { @@ -220,22 +220,6 @@ void tst_QProcess::getSetCheck() QCOMPARE(QProcess::ProcessChannel(QProcess::StandardError), obj1.readChannel()); } -tst_QProcess::tst_QProcess() -{ -} - -tst_QProcess::~tst_QProcess() -{ -} - -void tst_QProcess::init() -{ -} - -void tst_QProcess::cleanup() -{ -} - //----------------------------------------------------------------------------- void tst_QProcess::constructing() { @@ -2282,7 +2266,7 @@ void tst_QProcess::onlyOneStartedSignal() QCOMPARE(spyFinished.count(), 1); } -QTEST_MAIN(tst_QProcess) -#include "tst_qprocess.moc" #endif +QTEST_MAIN(tst_QProcess) +#include "tst_qprocess.moc" |