summaryrefslogtreecommitdiffstats
path: root/tests/auto/tiff/tst_qtiff.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tiff/tst_qtiff.cpp')
-rw-r--r--tests/auto/tiff/tst_qtiff.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/tiff/tst_qtiff.cpp b/tests/auto/tiff/tst_qtiff.cpp
index 29d85df..87fdfa8 100644
--- a/tests/auto/tiff/tst_qtiff.cpp
+++ b/tests/auto/tiff/tst_qtiff.cpp
@@ -87,6 +87,9 @@ private slots:
void readRgba64();
void readGray16();
+ void colorSpace_data();
+ void colorSpace();
+
private:
QString prefix;
};
@@ -624,5 +627,40 @@ void tst_qtiff::readGray16()
QCOMPARE(image.format(), QImage::Format_Grayscale16);
}
+void tst_qtiff::colorSpace_data()
+{
+ QTest::addColumn<decltype(QColorSpace::SRgb)>("namedColorSpace");
+
+ QTest::newRow("sRGB") << QColorSpace::SRgb;
+ QTest::newRow("sRGB(linear)") << QColorSpace::SRgbLinear;
+ QTest::newRow("AdobeRGB") << QColorSpace::AdobeRgb;
+ QTest::newRow("DisplayP3") << QColorSpace::DisplayP3;
+ QTest::newRow("ProPhotoRgb") << QColorSpace::ProPhotoRgb;
+}
+
+void tst_qtiff::colorSpace()
+{
+ QFETCH(decltype(QColorSpace::SRgb), namedColorSpace);
+
+ QImage image(prefix + "colorful.bmp");
+ QVERIFY(!image.isNull());
+
+ image.setColorSpace(namedColorSpace);
+
+ QByteArray output;
+ QBuffer buf(&output);
+ QVERIFY(buf.open(QIODevice::WriteOnly));
+ QImageWriter writer(&buf, "tiff");
+ writer.write(image);
+ buf.close();
+
+ QVERIFY(buf.open(QIODevice::ReadOnly));
+ QImageReader reader(&buf);
+ QImage image2 = reader.read();
+
+ QCOMPARE(image2.colorSpace(), namedColorSpace);
+ QCOMPARE(image2, image);
+}
+
QTEST_MAIN(tst_qtiff)
#include "tst_qtiff.moc"