summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagewriter
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-06-09 16:48:16 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-06-09 16:48:16 (GMT)
commit2dc47ad36f235ba053a329179be4ed87d0b4d484 (patch)
tree0568eeacf8134c9b7b43cb0dbdc83ab131ce9529 /tests/auto/qimagewriter
parent2312b121131774a84d01854b3e47d3d2a035a6a1 (diff)
downloadQt-2dc47ad36f235ba053a329179be4ed87d0b4d484.zip
Qt-2dc47ad36f235ba053a329179be4ed87d0b4d484.tar.gz
Qt-2dc47ad36f235ba053a329179be4ed87d0b4d484.tar.bz2
Add support for TIFF formats (Mono and indexed)
Add support for reading and writing for Mono, MonoLSB and Indexed images in the tiff format. Previously, the images were always written in RGB32, dismissing the input format. Task-number: 254317 Reviewed-by: Samuel
Diffstat (limited to 'tests/auto/qimagewriter')
-rw-r--r--tests/auto/qimagewriter/tst_qimagewriter.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp
index 349afa5..3ceb2c2 100644
--- a/tests/auto/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp
@@ -59,6 +59,7 @@ Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList)
Q_DECLARE_METATYPE(QImageWriter::ImageWriterError)
Q_DECLARE_METATYPE(QIODevice *)
+Q_DECLARE_METATYPE(QImage::Format)
//TESTED_FILES=
@@ -82,6 +83,9 @@ private slots:
void writeImage2();
void supportedFormats();
+ void readWriteNonDestructive_data();
+ void readWriteNonDestructive();
+
#if defined QTEST_HAVE_TIFF
void largeTiff();
#endif
@@ -376,6 +380,28 @@ void tst_QImageWriter::supportedFormats()
QCOMPARE(formatSet.size(), formats.size());
}
+void tst_QImageWriter::readWriteNonDestructive_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<QImage::Format>("expectedFormat");
+ QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono;
+ QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8;
+ QTest::newRow("tiff rgb32") << QImage::Format_ARGB32 << QImage::Format_ARGB32;
+}
+
+void tst_QImageWriter::readWriteNonDestructive()
+{
+ QFETCH(QImage::Format, format);
+ QFETCH(QImage::Format, expectedFormat);
+ QImage image = QImage(prefix + "colorful.bmp").convertToFormat(format);
+ QVERIFY(image.save(prefix + "gen-readWriteNonDestructive.tiff"));
+
+ QImage image2 = QImage(prefix + "gen-readWriteNonDestructive.tiff");
+ QImage::Format readFormat = image2.format();
+ QCOMPARE(readFormat, expectedFormat);
+ QCOMPARE(image, image2);
+}
+
void tst_QImageWriter::setDescription_data()
{
QTest::addColumn<QString>("fileName");