QObject-test: Reorganize subprocess.

On Windows, the signalbug.exe could not be launched since it is
not next to tst_qobject.exe, which is in one of the
'release', 'debug' subfolders.

Introduce a subdirectory structure similar to that of
the QProcess test and use QFINDTESTDATA to locate it.

Change-Id: Ie8f2ede8cb76f22a908cb77517a74076be11fbb7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Friedemann Kleint 2011-12-12 16:28:30 +01:00 committed by Qt by Nokia
parent d939dd8791
commit ab272fff56
6 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,3 @@
tst_qobject
signalbug
signalbug.exe
signalbug/signalbug
signalbug/signalbug.exe

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = tst_qobject.pro signalbug.pro
SUBDIRS = signalbug tst_qobject.pro
CONFIG += parallel_test

View File

@ -1,9 +1,9 @@
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG -= app_bundle debug_and_release
DESTDIR=.
CONFIG += console
DESTDIR = ./
QT -= gui
wince*: {
LIBS += coredll.lib
@ -13,5 +13,5 @@ HEADERS += signalbug.h
SOURCES += signalbug.cpp
# This app is testdata for tst_qobject
target.path = $$[QT_INSTALL_TESTS]/tst_qobject
target.path = $$[QT_INSTALL_TESTS]/tst_qobject/$$TARGET
INSTALLS += target

View File

@ -65,6 +65,7 @@ class tst_QObject : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void disconnect();
void connectByName();
void connectSignalsToSignalsWithDefaultArguments();
@ -236,6 +237,12 @@ public slots:
int ReceiverObject::sequence = 0;
void tst_QObject::initTestCase()
{
const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath();
QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir));
}
void tst_QObject::disconnect()
{
SenderObject *s = new SenderObject;
@ -2794,7 +2801,9 @@ void tst_QObject::recursiveSignalEmission()
{
QProcess proc;
// signalbug helper app should always be next to this test binary
proc.start(QCoreApplication::applicationDirPath() + "/signalbug");
const QString path = QStringLiteral("signalbug/signalbug");
proc.start(path);
QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString())));
QVERIFY(proc.waitForFinished());
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
QCOMPARE(proc.exitCode(), 0);