Changed qapplication unittest to work from installation directory
authorKurt Korbatits <kurt.korbatits@nokia.com>
Wed, 25 Jan 2012 01:29:16 +0000 (11:29 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 31 Jan 2012 03:55:38 +0000 (04:55 +0100)
- 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>
tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
tests/auto/widgets/kernel/qapplication/modal/modal.pro
tests/auto/widgets/kernel/qapplication/qapplication.pro
tests/auto/widgets/kernel/qapplication/test/test.pro
tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro

index 3aa363d..3b229e3 100644 (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
index b13165b..d948992 100644 (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
index becc6c6..5f369bf 100644 (file)
@@ -1,7 +1,7 @@
 TEMPLATE = subdirs
-SUBDIRS = test \
-         desktopsettingsaware \
-          modal \
-      wincmdline
 
+SUBDIRS = desktopsettingsaware modal
 
+win32:!wince*:SUBDIRS += wincmdline
+test.depends += $$SUBDIRS
+SUBDIRS += test
index db9d59b..9f6db3c 100644 (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})
+
+
index 7431ff2..ac8f2a3 100644 (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
index 9abeb1c..8498d8b 100644 (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