Fix qimagereader, qmovie and qmake unittest to work in shadow build.

Changed to use QFINDTESTDATA and TESTDATA.

Change-Id: I8684bc191cf8ffb8b531456e32047d582ebc018c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Kurt Korbatits 2011-12-15 09:34:50 +10:00 committed by Qt by Nokia
parent 2163f05942
commit d936fe0858
6 changed files with 18 additions and 32 deletions

View File

@ -4,20 +4,10 @@ SOURCES += tst_qimagereader.cpp
MOC_DIR=tmp MOC_DIR=tmp
QT += widgets widgets-private core-private gui-private network testlib QT += widgets widgets-private core-private gui-private network testlib
RESOURCES += qimagereader.qrc RESOURCES += qimagereader.qrc
DEFINES += SRCDIR=\\\"$$PWD\\\"
win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800 win32-msvc:QMAKE_CXXFLAGS += -Zm800
win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300 win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300
win32-msvc.net:QMAKE_CXXFLAGS += -Zm1100 win32-msvc.net:QMAKE_CXXFLAGS += -Zm1100
wince*: { TESTDATA += images/* baseline/*
images.files = images
images.path = .
imagePlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*.dll
imagePlugins.path = imageformats
DEPLOYMENT += images imagePlugins
DEFINES += SRCDIR=\\\".\\\"
}

View File

@ -179,11 +179,10 @@ private slots:
void preserveTexts(); void preserveTexts();
private: private:
QString prefix;
QTemporaryDir m_temporaryDir; QTemporaryDir m_temporaryDir;
}; };
static const QLatin1String prefix(SRCDIR "/images/");
// helper to skip an autotest when the given image format is not supported // helper to skip an autotest when the given image format is not supported
#define SKIP_IF_UNSUPPORTED(format) do { \ #define SKIP_IF_UNSUPPORTED(format) do { \
if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \
@ -220,6 +219,7 @@ tst_QImageReader::~tst_QImageReader()
void tst_QImageReader::init() void tst_QImageReader::init()
{ {
prefix = QFINDTESTDATA("images/");
QVERIFY(m_temporaryDir.isValid()); QVERIFY(m_temporaryDir.isValid());
} }

View File

@ -8,11 +8,5 @@ MOC_DIR=tmp
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG !contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
wince*: {
addFiles.files = animations\\*
addFiles.path = animations
DEPLOYMENT += addFiles
}
RESOURCES += resources.qrc RESOURCES += resources.qrc
TESTDATA += animations/*

View File

@ -152,7 +152,7 @@ void tst_QMovie::playMovie()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, frameCount); QFETCH(int, frameCount);
QMovie movie(fileName); QMovie movie(QFINDTESTDATA(fileName));
QCOMPARE(movie.state(), QMovie::NotRunning); QCOMPARE(movie.state(), QMovie::NotRunning);
movie.setSpeed(1000); movie.setSpeed(1000);

View File

@ -5,3 +5,5 @@ SOURCES += tst_qmake.cpp testcompiler.cpp
QT = core testlib QT = core testlib
cross_compile: DEFINES += QMAKE_CROSS_COMPILED cross_compile: DEFINES += QMAKE_CROSS_COMPILED
TESTDATA += testdata/*

View File

@ -97,6 +97,15 @@ private:
}; };
tst_qmake::tst_qmake() tst_qmake::tst_qmake()
{
}
tst_qmake::~tst_qmake()
{
}
void tst_qmake::initTestCase()
{ {
QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath); QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
QString cmd = QString("%2/qmake \"QT_VERSION=%1\"").arg(QT_VERSION).arg(binpath); QString cmd = QString("%2/qmake \"QT_VERSION=%1\"").arg(QT_VERSION).arg(binpath);
@ -109,17 +118,8 @@ tst_qmake::tst_qmake()
#else #else
test_compiler.setBaseCommands( "make", cmd ); test_compiler.setBaseCommands( "make", cmd );
#endif #endif
QDir dir; QString tmpFile = QFINDTESTDATA("testdata");
base_path = dir.currentPath(); base_path = tmpFile.left(tmpFile.lastIndexOf('/'));
}
tst_qmake::~tst_qmake()
{
}
void tst_qmake::initTestCase()
{
} }
void tst_qmake::cleanupTestCase() void tst_qmake::cleanupTestCase()