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>
bb10
Jason McDonald 2011-10-17 14:15:17 +10:00 committed by Qt by Nokia
parent b419e567c0
commit d884f24fe1
1 changed files with 19 additions and 35 deletions

View File

@ -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"