From b8cc85402bf0992657ed527996532d6020ac9acb Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Mon, 14 Nov 2011 13:51:50 +1000 Subject: Move tga support from Qt3d to Qt. Rev-By: Samuel Rodal Fix-for: QTBUG-21955 Part of fix for https://bugreports.qt.nokia.com/browse/QTBUG-21955 Having tga plugin inside a Qt add-on causes packaging problems. There have been many queries over the years for tga support even tho it is a niche image format. It is particularly useful for OpenGL work as a texture format since it is a blittable bitmap, but it is very innefficient compared to png or jpg. For this reason only read support is added, and this is documented. Also add some unit tests. The unit tests are in the qimagereader suite, and this is the right place for them as the other formats are tested there. Noticed that there was an annoying bug with tiff files and chased it down, in the hope of getting a clean test case PASS. Looks as tho there is a bit of work for someone to fix the other FAILs, but the ones for tga are all passing. --- tests/auto/qimagereader/tst_qimagereader.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 5bf9d19..2b867c3 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -590,17 +590,17 @@ void tst_QImageReader::imageFormat() #ifndef QTEST_HAVE_JPEG return; #endif // !QTEST_HAVE_JPEG - } + } if (QByteArray("gif") == format) { #ifndef QTEST_HAVE_GIF return; #endif // !QTEST_HAVE_GIF - } + } if (QByteArray("mng") == format) { #ifndef QTEST_HAVE_MNG return; #endif // !QTEST_HAVE_MNG - } + } if (QByteArray("svg") == format || QByteArray("svgz") == format) { #ifndef QTEST_HAVE_SVG return; @@ -1736,8 +1736,8 @@ void tst_QImageReader::tiffGrayscale() #if defined QTEST_HAVE_TGA void tst_QImageReader::tgaTestImages() { - QImage tgaTest(prefix + "test-flag.tga"); - + QImage tgaTest(prefix + "test-flag.tga"); + // Test image is 400x400 of a "flag" with a blue circle in the middle // and a green square top left, and red rectangle on the bottom so // so we test for pixels in those areas to ensure the image is not @@ -1745,8 +1745,8 @@ void tst_QImageReader::tgaTestImages() QVERIFY(!tgaTest.isNull()); QCOMPARE(tgaTest.size().width(), 400); QCOMPARE(tgaTest.size().height(), 400); - QRgb pixel = tgaTest.pixel(200,200); - QCOMPARE(qRgb(0, 0, 255), pixel); + QRgb pixel = tgaTest.pixel(200,200); + QCOMPARE(qRgb(0, 0, 255), pixel); pixel = tgaTest.pixel(0, 0); QCOMPARE(qRgb(0, 255, 0), pixel); pixel = tgaTest.pixel(0, 399); -- cgit v0.12