From d884f24fe1b86bbd71d62584d5cf1381355efe0d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 17 Oct 2011 14:15:17 +1000 Subject: 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 --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 54 +++++++++---------------- 1 file 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 #include -#ifdef QT_NO_PROCESS -QTEST_NOOP_MAIN -#else - -#if defined(Q_OS_WIN) -#include -#endif - -//TESTED_CLASS= -//TESTED_FILES= +#ifndef QT_NO_PROCESS +# if defined(Q_OS_WIN) +# include +# endif Q_DECLARE_METATYPE(QList); 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" -- cgit v1.2.3