From c8f88e6292c155c431cf8eb8657e46717c862eb0 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 25 Jan 2012 11:29:16 +1000 Subject: [PATCH] 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 Reviewed-by: Jason McDonald Reviewed-by: Rohan McGovern --- .../desktopsettingsaware/desktopsettingsaware.pro | 3 --- tests/auto/widgets/kernel/qapplication/modal/modal.pro | 3 --- .../auto/widgets/kernel/qapplication/qapplication.pro | 8 ++++---- tests/auto/widgets/kernel/qapplication/test/test.pro | 18 ++++++++++-------- .../widgets/kernel/qapplication/tst_qapplication.cpp | 8 ++++---- .../kernel/qapplication/wincmdline/wincmdline.pro | 3 --- 6 files changed, 18 insertions(+), 25 deletions(-) diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 3aa363d..3b229e3 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -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 diff --git a/tests/auto/widgets/kernel/qapplication/modal/modal.pro b/tests/auto/widgets/kernel/qapplication/modal/modal.pro index b13165b..d948992 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/modal.pro +++ b/tests/auto/widgets/kernel/qapplication/modal/modal.pro @@ -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 diff --git a/tests/auto/widgets/kernel/qapplication/qapplication.pro b/tests/auto/widgets/kernel/qapplication/qapplication.pro index becc6c6..5f369bf 100644 --- a/tests/auto/widgets/kernel/qapplication/qapplication.pro +++ b/tests/auto/widgets/kernel/qapplication/qapplication.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs -SUBDIRS = test \ - desktopsettingsaware \ - modal \ - wincmdline +SUBDIRS = desktopsettingsaware modal +win32:!wince*:SUBDIRS += wincmdline +test.depends += $$SUBDIRS +SUBDIRS += test diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro index db9d59b..9f6db3c 100644 --- a/tests/auto/widgets/kernel/qapplication/test/test.pro +++ b/tests/auto/widgets/kernel/qapplication/test/test.pro @@ -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}) + + diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 7431ff2..ac8f2a3 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -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 diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro index 9abeb1c..8498d8b 100644 --- a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro +++ b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro @@ -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 -- 2.7.4