From d936fe085894f58451a6f36c46377ac507f09170 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 15 Dec 2011 09:34:50 +1000 Subject: [PATCH] Fix qimagereader, qmovie and qmake unittest to work in shadow build. Changed to use QFINDTESTDATA and TESTDATA. Change-Id: I8684bc191cf8ffb8b531456e32047d582ebc018c Reviewed-by: Rohan McGovern --- .../gui/image/qimagereader/qimagereader.pro | 12 +--------- .../image/qimagereader/tst_qimagereader.cpp | 4 ++-- tests/auto/gui/image/qmovie/qmovie.pro | 8 +------ tests/auto/gui/image/qmovie/tst_qmovie.cpp | 2 +- tests/auto/tools/qmake/qmake.pro | 2 ++ tests/auto/tools/qmake/tst_qmake.cpp | 22 +++++++++---------- 6 files changed, 18 insertions(+), 32 deletions(-) diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index fc2b97267c..14d23f05ba 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -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/* diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 2ce4d01e8e..d0be14c65d 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -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()); } diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index d565418d6d..5da0b80670 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -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/* diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp index b2d0360e33..a94e39a10c 100644 --- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp +++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp @@ -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); diff --git a/tests/auto/tools/qmake/qmake.pro b/tests/auto/tools/qmake/qmake.pro index d535c9c0b8..1d9c5bec6e 100644 --- a/tests/auto/tools/qmake/qmake.pro +++ b/tests/auto/tools/qmake/qmake.pro @@ -5,3 +5,5 @@ SOURCES += tst_qmake.cpp testcompiler.cpp QT = core testlib cross_compile: DEFINES += QMAKE_CROSS_COMPILED + +TESTDATA += testdata/* diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 8de822b47a..dbb845ba81 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -97,6 +97,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); @@ -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()