summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-11-06 15:09:16 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-11-09 09:41:06 (GMT)
commit845c69b2e780e1646f68ee99beda10768a1971e2 (patch)
treebdc68d5f18d3c3cba755722d55fb8c1851775273 /tests/auto/qimagereader
parent3143014a80d1dfdfe3bb0f6175a3f7f7f41b2aaf (diff)
downloadQt-845c69b2e780e1646f68ee99beda10768a1971e2.zip
Qt-845c69b2e780e1646f68ee99beda10768a1971e2.tar.gz
Qt-845c69b2e780e1646f68ee99beda10768a1971e2.tar.bz2
Fixed loading of 8-bit grayscale TIFF files.
The PHOTOMETRIC_MINISBLACK and PHOTOMETRIC_MINISWHITE settings also apply to 8-bit grayscale, so we need to check the bit depth of the image as well. For convenience we also try to write the images using PHOTOMETRIC_MINISBLACK and PHOTOMETRIC_MINISWHITE as opposed to PHOTOMETRIC_PALETTE when we detect that the color table is grayscale. Task-number: QTBUG-5459 Reviewed-by: Benjamin Poulain
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/images/grayscale-ref.tifbin0 -> 256182 bytes
-rw-r--r--tests/auto/qimagereader/images/grayscale.tifbin0 -> 64162 bytes
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp9
3 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/images/grayscale-ref.tif b/tests/auto/qimagereader/images/grayscale-ref.tif
new file mode 100644
index 0000000..960531e
--- /dev/null
+++ b/tests/auto/qimagereader/images/grayscale-ref.tif
Binary files differ
diff --git a/tests/auto/qimagereader/images/grayscale.tif b/tests/auto/qimagereader/images/grayscale.tif
new file mode 100644
index 0000000..5f4e114
--- /dev/null
+++ b/tests/auto/qimagereader/images/grayscale.tif
Binary files differ
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 05b506c..15b1c1c 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -157,6 +157,8 @@ private slots:
void tiffOrientation_data();
void tiffOrientation();
+
+ void tiffGrayscale();
#endif
void autoDetectImageFormat();
@@ -1376,6 +1378,13 @@ void tst_QImageReader::tiffOrientation()
QCOMPARE(expectedImage, orientedImage);
}
+void tst_QImageReader::tiffGrayscale()
+{
+ QImage actualImage(prefix + "grayscale.tif");
+ QImage expectedImage(prefix + "grayscale-ref.tif");
+
+ QCOMPARE(expectedImage, actualImage.convertToFormat(expectedImage.format()));
+}
#endif
void tst_QImageReader::dotsPerMeter_data()