From 0786716ce57a06b7984b3a6934c64e35115c507e Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Thu, 17 Nov 2011 15:06:17 +1000 Subject: [PATCH] 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. (cherry picked from commit 665bc3951709f0d726cb82501a5bca684f3347a5) Change-Id: I665bc3951709f0d726cb82501a5bca684f3347a5 Reviewed-by: Sarah Jane Smith --- tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index d0bbc57..4fa1bed 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1041,6 +1041,9 @@ void tst_QImageReader::readFromDevice_data() QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg"); QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz"); +#if defined QTEST_HAVE_TGA + QTest::newRow("tga") << QString("test-flag.tga") << QByteArray("tga"); +#endif } void tst_QImageReader::readFromDevice() -- 2.7.4