Changed qapplication unittest to work from installation directory

- Changed to use TESTDATA and installTestHelperApp()
- Changed to use QFINDTESTDATA instead of currentPath()

Change-Id: Ia24ebc758d5d0fdfcca951500766adefbcf9fe93
Reviewed-by: Kurt Korbatits  <kurt.korbatits@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Kurt Korbatits 2012-01-25 11:29:16 +10:00 committed by Qt by Nokia
parent 4ca298f42b
commit c8f88e6292
6 changed files with 18 additions and 25 deletions

View File

@ -13,6 +13,3 @@ 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

View File

@ -8,6 +8,3 @@ DESTDIR = ./
CONFIG -= app_bundle
HEADERS += base.h
# This app is testdata for tst_qapplication
target.path = $$[QT_INSTALL_TESTS]/tst_qapplication/$$TARGET
INSTALLS += target

View File

@ -1,7 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = test \
desktopsettingsaware \
modal \
wincmdline
SUBDIRS = desktopsettingsaware modal
win32:!wince*:SUBDIRS += wincmdline
test.depends += $$SUBDIRS
SUBDIRS += test

View File

@ -6,14 +6,6 @@ QT += core-private gui-private
SOURCES += ../tst_qapplication.cpp
TARGET = ../tst_qapplication
wince* {
additional.files = ../desktopsettingsaware/desktopsettingsaware.exe
additional.path = desktopsettingsaware
someTest.files = test.pro
someTest.path = test
DEPLOYMENT += additional deploy someTest
}
win32 {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qapplication
@ -23,3 +15,13 @@ win32 {
}
mac*:CONFIG+=insignificant_test
TESTDATA = ../test/test.pro ../tmp/README
SUBPROGRAMS = desktopsettingsaware modal
win32: !wince*: SUBPROGRAMS += wincmdline
load(testcase) # for target.path and installTestHelperApp()
for(file, SUBPROGRAMS): installTestHelperApp("../$${file}/$${file}",$${file},$${file})

View File

@ -815,7 +815,7 @@ void tst_QApplication::libraryPaths()
{
{
#ifndef Q_OS_WINCE
QString testDir = QDir::current().canonicalPath() + "/test";
QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath();
#else
// On Windows CE we need QApplication object to have valid
// current Path. Therefore we need to identify it ourselves
@ -861,7 +861,7 @@ void tst_QApplication::libraryPaths()
"\nexpected:\n - " + expected.join("\n - ")));
// setting the library paths overrides everything
QString testDir = QDir::currentPath() + "/test";
QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath();
QApplication::setLibraryPaths(QStringList() << testDir);
QVERIFY2(isPathListIncluded(QApplication::libraryPaths(), (QStringList() << testDir)),
qPrintable("actual:\n - " + QApplication::libraryPaths().join("\n - ") +
@ -884,8 +884,8 @@ void tst_QApplication::libraryPaths()
qDebug() << "After adding plugins path:" << QApplication::libraryPaths();
#endif
QCOMPARE(QApplication::libraryPaths().count(), count);
QApplication::addLibraryPath(QDir::currentPath() + "/test");
QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath();
QApplication::addLibraryPath(testDir);
QCOMPARE(QApplication::libraryPaths().count(), count + 1);
// creating QApplication adds the applicationDirPath to the libraryPath

View File

@ -5,6 +5,3 @@ QT += widgets
SOURCES += main.cpp
DESTDIR = ./
# This app is testdata for tst_qapplication
target.path = $$[QT_INSTALL_TESTS]/tst_qapplication/$$TARGET
INSTALLS += target