diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-04-21 13:07:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-05-29 13:24:02 +0000 |
commit | 454fb13c465e29f0d0f9a295bdb822b4a09c7e48 (patch) | |
tree | 33504ec71e798e0e5b6613ce23298e3df57e99ec /tests | |
parent | 40e9ba00a05d3a0ef0aa401565d7129eaa476ee6 (diff) |
Handle Grayscale8 TIFFs
Correctly read and write Grayscale8 image format.
Change-Id: I537c68f94077458c69ee1de08b5b37986b54aa26
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tiff/tst_qtiff.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/auto/tiff/tst_qtiff.cpp b/tests/auto/tiff/tst_qtiff.cpp index a073025..70837a5 100644 --- a/tests/auto/tiff/tst_qtiff.cpp +++ b/tests/auto/tiff/tst_qtiff.cpp @@ -364,31 +364,23 @@ void tst_qtiff::readWriteNonDestructive_data() { QTest::addColumn<QImage::Format>("format"); QTest::addColumn<QImage::Format>("expectedFormat"); - QTest::addColumn<bool>("grayscale"); QTest::addColumn<QImageIOHandler::Transformation>("transformation"); - QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono << false << QImageIOHandler::TransformationNone; - QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << false << QImageIOHandler::TransformationMirror; - QTest::newRow("tiff argb32pm") << QImage::Format_ARGB32_Premultiplied << QImage::Format_ARGB32_Premultiplied << false << QImageIOHandler::TransformationRotate90; - QTest::newRow("tiff rgb32") << QImage::Format_RGB32 << QImage::Format_RGB32 << false << QImageIOHandler::TransformationRotate270; - QTest::newRow("tiff grayscale") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << true << QImageIOHandler::TransformationFlip; + QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono << QImageIOHandler::TransformationNone; + QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << QImageIOHandler::TransformationMirror; + QTest::newRow("tiff argb32pm") << QImage::Format_ARGB32_Premultiplied << QImage::Format_ARGB32_Premultiplied << QImageIOHandler::TransformationRotate90; + QTest::newRow("tiff rgb32") << QImage::Format_RGB32 << QImage::Format_RGB32 << QImageIOHandler::TransformationRotate270; + QTest::newRow("tiff grayscale") << QImage::Format_Grayscale8 << QImage::Format_Grayscale8 << QImageIOHandler::TransformationFlip; } void tst_qtiff::readWriteNonDestructive() { QFETCH(QImage::Format, format); QFETCH(QImage::Format, expectedFormat); - QFETCH(bool, grayscale); QFETCH(QImageIOHandler::Transformation, transformation); + QImage image = QImage(prefix + "colorful.bmp").convertToFormat(format); QVERIFY(!image.isNull()); - if (grayscale) { - QVector<QRgb> colors; - for (int i = 0; i < 256; ++i) - colors << qRgb(i, i, i); - image.setColorTable(colors); - } - QByteArray output; QBuffer buf(&output); QVERIFY(buf.open(QIODevice::WriteOnly)); |