diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-12-14 09:27:33 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-15 03:56:16 +0100 |
commit | 2163f05942a9e13264fcfc52666c451e9c77f5f0 (patch) | |
tree | 3bd16a3e002d94bb8b888c615c697cd7ec61bd4c /tests/auto/widgets/kernel | |
parent | dc98d585624d5f1de529dab86bbc061f6b64f89d (diff) |
Application-test: Fix location of sub-executables.
Use QFINDTESTDATA to set the working directory
and change the profiles accordingly (as in
the qprocess-test).
Change-Id: I332038728c64214f73ced448e1466ad96c11b3b3
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/widgets/kernel')
4 files changed, 53 insertions, 28 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 216a9710c7..3aa363d796 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -5,10 +5,14 @@ TEMPLATE = app DEPENDPATH += . INCLUDEPATH += . -wince*:TARGET = ../desktopsettingsaware +DESTDIR = ./ # Input QT += widgets SOURCES += main.cpp CONFIG += qt warn_on create_prl link_prl CONFIG -= app_bundle + +# This app is testdata for tst_qapplication +target.path = $$[QT_INSTALL_TESTS]/tst_qapplication/$$TARGET +INSTALLS += target diff --git a/tests/auto/widgets/kernel/qapplication/modal/modal.pro b/tests/auto/widgets/kernel/qapplication/modal/modal.pro index 9ed69769bb..b13165bcda 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/modal.pro +++ b/tests/auto/widgets/kernel/qapplication/modal/modal.pro @@ -1,9 +1,13 @@ TEMPLATE = app QT += widgets -TARGET = DEPENDPATH += . INCLUDEPATH += . SOURCES += main.cpp \ base.cpp DESTDIR = ./ +CONFIG -= app_bundle HEADERS += base.h + +# This app is testdata for tst_qapplication +target.path = $$[QT_INSTALL_TESTS]/tst_qapplication/$$TARGET +INSTALLS += target diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 4de05e1b98..23536ec6db 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -45,12 +45,26 @@ #include <QtTest/QtTest> -#include "qabstracteventdispatcher.h" -#include <QtGui> -#include <QtWidgets> +#include <QtCore/QAbstractEventDispatcher> +#include <QtCore/QFileInfo> +#include <QtCore/QDir> +#include <QtCore/QProcess> + +#include <QtGui/QFontDatabase> +#include <QtGui/QClipboard> + +#include <QtWidgets/QApplication> +#include <QtWidgets/QMessageBox> +#include <QtWidgets/QInputContext> +#include <QtWidgets/QStyleFactory> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QLabel> +#include <QtWidgets/QMainWindow> +#include <QtWidgets/private/qapplication_p.h> +#include <QtWidgets/private/qstylesheetstyle_p.h> -#include "private/qapplication_p.h" -#include "private/qstylesheetstyle_p.h" #ifdef Q_OS_WINCE #include <windows.h> #endif @@ -64,6 +78,7 @@ public: virtual ~tst_QApplication(); public slots: + void initTestCase(); void init(); void cleanup(); private slots: @@ -140,6 +155,13 @@ public: } }; +void tst_QApplication::initTestCase() +{ + // chdir to our testdata path and execute helper apps relative to that. + const QString testdataDir = QFileInfo(QFINDTESTDATA("desktopsettingsaware")).absolutePath(); + QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir)); +} + void tst_QApplication::sendEventsOnProcessEvents() { int argc = 0; @@ -1463,19 +1485,14 @@ void tst_QApplication::desktopSettingsAware() { #ifndef QT_NO_PROCESS QProcess testProcess; + const QString path = QStringLiteral("desktopsettingsaware/desktopsettingsaware"); #ifdef Q_OS_WINCE int argc = 0; QApplication tmpApp(argc, 0, QApplication::GuiServer); - testProcess.start("desktopsettingsaware/desktopsettingsaware"); -#else -#if defined(Q_OS_WIN) && defined(QT_DEBUG) - testProcess.start("desktopsettingsaware/debug/desktopsettingsaware"); -#elif defined(Q_OS_WIN) - testProcess.start("desktopsettingsaware/release/desktopsettingsaware"); -#else - testProcess.start("desktopsettingsaware/desktopsettingsaware"); -#endif #endif + testProcess.start(path); + QVERIFY2(testProcess.waitForStarted(), + qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(10000)); QCOMPARE(int(testProcess.state()), int(QProcess::NotRunning)); QVERIFY(int(testProcess.error()) != int(QProcess::Crashed)); @@ -1866,11 +1883,10 @@ void tst_QApplication::windowsCommandLine() QFETCH(QString, expected); QProcess testProcess; -#if defined(QT_DEBUG) - testProcess.start("wincmdline/debug/wincmdline", QStringList(args)); -#else - testProcess.start("wincmdline/release/wincmdline", QStringList(args)); -#endif + const QString path = QStringLiteral("wincmdline/wincmdline"); + testProcess.start(path, QStringList(args)); + QVERIFY2(testProcess.waitForStarted(), + qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(10000)); QByteArray error = testProcess.readAllStandardError(); QString procError(error); @@ -2126,11 +2142,10 @@ void tst_QApplication::qtbug_12673() { QProcess testProcess; QStringList arguments; -#ifdef Q_OS_MAC - testProcess.start("modal/modal.app", arguments); -#else - testProcess.start("modal/modal", arguments); -#endif + const QString path = QStringLiteral("modal/modal"); + testProcess.start(path, arguments); + QVERIFY2(testProcess.waitForStarted(), + qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(20000)); QCOMPARE(testProcess.exitStatus(), QProcess::NormalExit); } diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro index 3ba8f48167..9abeb1cc83 100644 --- a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro +++ b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro @@ -1,8 +1,10 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . QT += widgets SOURCES += main.cpp +DESTDIR = ./ - +# This app is testdata for tst_qapplication +target.path = $$[QT_INSTALL_TESTS]/tst_qapplication/$$TARGET +INSTALLS += target |