summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2011-11-17 05:06:17 (GMT)
committerSarah Smith <sarah.j.smith@nokia.com>2011-11-17 05:10:31 (GMT)
commit665bc3951709f0d726cb82501a5bca684f3347a5 (patch)
treeb0fe4bb3cb14676b7663e66fcd1b864ab12f82bd /tests/auto/qimagereader
parentd8aad8299125da82d95406577b281dfab5c12853 (diff)
downloadQt-665bc3951709f0d726cb82501a5bca684f3347a5.zip
Qt-665bc3951709f0d726cb82501a5bca684f3347a5.tar.gz
Qt-665bc3951709f0d726cb82501a5bca684f3347a5.tar.bz2
Fix failing unit tests.
The test that was failing was the readFromDevice one - where the extension is not known. Looks as though image detection is required in a positive way, that is it is not enough to say I think I can read this file, and then fail if the format is "corrupt", you must be certain that the file was intended to be that format. In the case of TGA the original format has no magic byte header, and no consistent way to check if it really is a TGA file. With 2.0 the footer was added at the end, so that can be checked for confirming the file is TGA. However rejecting files which do not have this means that old TGA files will not be read. On a quick survey TGA files that have been used in applications so far all seem to be 2.0 TrueVision, so for now, lets just reject earlier files and see how it goes. Also add reading the tga test file to the readFromDevice test.
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 2b867c3..54e8714 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1107,6 +1107,9 @@ void tst_QImageReader::readFromDevice_data()
QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg");
QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz");
#endif
+#if defined QTEST_HAVE_TGA
+ QTest::newRow("tga") << QString("test-flag.tga") << QByteArray("tga");
+#endif
}
void tst_QImageReader::readFromDevice()