tst_qapplication: Fix execution for WinRT

Not putting executables into debug/release subdirectories leads to the
WinRT AppxManifest being overwritten by the wrong configuration. When Qt
is configured with -release for example, it was possible that the debug
manifest (Manifest files are always created next to the target) is
written last and thus contains debug VCLibs as a dependency.

Additionally the test was changed in that way, that the resulting file
system structure (having helper and test application in a "top level"
debug and release folder) is the same structure as in tst_qobject.

Change-Id: I017b501506c54c4b89773d2b949c097598bc7049
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Oliver Wolff 2018-06-28 08:43:42 +02:00
parent 63f78e41dc
commit 030eddd173
4 changed files with 39 additions and 43 deletions

View File

@ -1,6 +1,14 @@
QT += widgets
CONFIG -= app_bundle debug_and_release_target
CONFIG -= app_bundle
DESTDIR = ./
debug_and_release {
CONFIG(debug, debug|release) {
TARGET = ../../debug/desktopsettingsaware_helper
} else {
TARGET = ../../release/desktopsettingsaware_helper
}
} else {
TARGET = ../desktopsettingsaware_helper
}
SOURCES += main.cpp

View File

@ -1,7 +1,15 @@
QT += widgets
SOURCES += main.cpp \
base.cpp
DESTDIR = ./
CONFIG -= app_bundle debug_and_release_target
debug_and_release {
CONFIG(debug, debug|release) {
TARGET = ../../debug/modal_helper
} else {
TARGET = ../../release/modal_helper
}
} else {
TARGET = ../modal_helper
}
CONFIG -= app_bundle
HEADERS += base.h

View File

@ -1,11 +1,9 @@
CONFIG += testcase
CONFIG -= debug_and_release_target
QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += ../tst_qapplication.cpp
TARGET = ../tst_qapplication
builtin_testdata: DEFINES += BUILTIN_TESTDATA
@ -14,7 +12,20 @@ TESTDATA = ../test/test.pro ../tmp/README ../modal
!winrt {
SUBPROGRAMS = desktopsettingsaware modal
win32:SUBPROGRAMS += wincmdline
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
}
debug_and_release {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qapplication
!winrt: TEST_HELPER_INSTALLS = ../debug/helper
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../debug/$${file}"
} else {
TARGET = ../../release/tst_qapplication
!winrt: TEST_HELPER_INSTALLS = ../release/helper
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../release/$${file}"
}
} else {
TARGET = ../tst_qapplication
!winrt: TEST_HELPER_INSTALLS = ../helper
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}"
}

View File

@ -96,7 +96,6 @@ public:
tst_QApplication();
private slots:
void initTestCase();
void cleanup();
void sendEventsOnProcessEvents(); // this must be the first test
void staticSetup();
@ -187,15 +186,6 @@ public:
}
};
void tst_QApplication::initTestCase()
{
#if QT_CONFIG(process)
// 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));
#endif
}
void tst_QApplication::sendEventsOnProcessEvents()
{
int argc = 0;
@ -1452,20 +1442,10 @@ void tst_QApplication::testDeleteLaterProcessEvents()
void tst_QApplication::desktopSettingsAware()
{
#if QT_CONFIG(process)
QString path;
{
// We need an application object for QFINDTESTDATA to work
// properly in all cases.
int argc = 0;
QCoreApplication app(argc, 0);
path = QFINDTESTDATA("desktopsettingsaware/");
}
QVERIFY2(!path.isEmpty(), "Cannot locate desktopsettingsaware helper application");
path += "desktopsettingsaware";
QProcess testProcess;
testProcess.start(path);
testProcess.start("desktopsettingsaware_helper");
QVERIFY2(testProcess.waitForStarted(),
qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString())));
qPrintable(QString::fromLatin1("Cannot start 'desktopsettingsaware_helper': %1").arg(testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(10000));
QCOMPARE(int(testProcess.state()), int(QProcess::NotRunning));
QVERIFY(int(testProcess.error()) != int(QProcess::Crashed));
@ -2133,23 +2113,12 @@ void tst_QApplication::touchEventPropagation()
void tst_QApplication::qtbug_12673()
{
QString path;
{
// We need an application object for QFINDTESTDATA to work
// properly in all cases.
int argc = 0;
QCoreApplication app(argc, 0);
path = QFINDTESTDATA("modal/");
}
QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application");
path += "modal";
#if QT_CONFIG(process)
QProcess testProcess;
QStringList arguments;
testProcess.start(path, arguments);
testProcess.start("modal_helper", arguments);
QVERIFY2(testProcess.waitForStarted(),
qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString())));
qPrintable(QString::fromLatin1("Cannot start 'modal_helper': %1").arg(testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(20000));
QCOMPARE(testProcess.exitStatus(), QProcess::NormalExit);
#else