Fix qimagereader, qmovie and qmake unittest to work in shadow build.
authorKurt Korbatits <kurt.korbatits@nokia.com>
Wed, 14 Dec 2011 23:34:50 +0000 (09:34 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 15 Dec 2011 04:48:27 +0000 (05:48 +0100)
Changed to use QFINDTESTDATA and TESTDATA.

Change-Id: I8684bc191cf8ffb8b531456e32047d582ebc018c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
tests/auto/gui/image/qimagereader/qimagereader.pro
tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
tests/auto/gui/image/qmovie/qmovie.pro
tests/auto/gui/image/qmovie/tst_qmovie.cpp
tests/auto/tools/qmake/qmake.pro
tests/auto/tools/qmake/tst_qmake.cpp

index fc2b972..14d23f0 100644 (file)
@@ -4,20 +4,10 @@ SOURCES += tst_qimagereader.cpp
 MOC_DIR=tmp
 QT += widgets widgets-private core-private gui-private network testlib
 RESOURCES += qimagereader.qrc
-DEFINES += SRCDIR=\\\"$$PWD\\\"
 
 win32-msvc:QMAKE_CXXFLAGS -= -Zm200
 win32-msvc:QMAKE_CXXFLAGS += -Zm800
 win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300
 win32-msvc.net:QMAKE_CXXFLAGS += -Zm1100
 
-wince*: {
-    images.files = images
-    images.path = .
-
-    imagePlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*.dll
-    imagePlugins.path = imageformats
-
-    DEPLOYMENT += images imagePlugins
-    DEFINES += SRCDIR=\\\".\\\"
-}
+TESTDATA += images/* baseline/*
index 2ce4d01..d0be14c 100644 (file)
@@ -179,11 +179,10 @@ private slots:
     void preserveTexts();
 
 private:
+    QString prefix;
     QTemporaryDir m_temporaryDir;
 };
 
-static const QLatin1String prefix(SRCDIR "/images/");
-
 // helper to skip an autotest when the given image format is not supported
 #define SKIP_IF_UNSUPPORTED(format) do {                                                          \
     if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \
@@ -220,6 +219,7 @@ tst_QImageReader::~tst_QImageReader()
 
 void tst_QImageReader::init()
 {
+    prefix = QFINDTESTDATA("images/");
    QVERIFY(m_temporaryDir.isValid());
 }
 
index d565418..5da0b80 100644 (file)
@@ -8,11 +8,5 @@ MOC_DIR=tmp
 !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
 !contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
 
-wince*: {
-   addFiles.files = animations\\*
-   addFiles.path = animations
-   DEPLOYMENT += addFiles
-}
-
 RESOURCES += resources.qrc
-
+TESTDATA += animations/*
index b2d0360..a94e39a 100644 (file)
@@ -152,7 +152,7 @@ void tst_QMovie::playMovie()
     QFETCH(QString, fileName);
     QFETCH(int, frameCount);
 
-    QMovie movie(fileName);
+    QMovie movie(QFINDTESTDATA(fileName));
 
     QCOMPARE(movie.state(), QMovie::NotRunning);
     movie.setSpeed(1000);
index d535c9c..1d9c5be 100644 (file)
@@ -5,3 +5,5 @@ SOURCES += tst_qmake.cpp testcompiler.cpp
 QT = core testlib
 
 cross_compile: DEFINES += QMAKE_CROSS_COMPILED
+
+TESTDATA += testdata/*
index 8de822b..dbb845b 100644 (file)
@@ -98,6 +98,15 @@ private:
 
 tst_qmake::tst_qmake()
 {
+}
+
+tst_qmake::~tst_qmake()
+{
+
+}
+
+void tst_qmake::initTestCase()
+{
     QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
     QString cmd = QString("%2/qmake \"QT_VERSION=%1\"").arg(QT_VERSION).arg(binpath);
 #ifdef Q_CC_MSVC
@@ -109,17 +118,8 @@ tst_qmake::tst_qmake()
 #else
     test_compiler.setBaseCommands( "make", cmd );
 #endif
-    QDir dir;
-    base_path = dir.currentPath();
-}
-
-tst_qmake::~tst_qmake()
-{
-
-}
-
-void tst_qmake::initTestCase()
-{
+    QString tmpFile = QFINDTESTDATA("testdata");
+    base_path = tmpFile.left(tmpFile.lastIndexOf('/'));
 }
 
 void tst_qmake::cleanupTestCase()