summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-15 14:26:06 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-15 14:26:06 +0200
commita56d52b553b16b8f944c62368cdc38db6784b7c3 (patch)
treecc4e76d1f0c493b53480f14617284037b01bf784 /tests
parent36c362412b8829c61a1292c654a7d9e2a8c290e9 (diff)
parent89caeeb5bd5e34242afc76e71868deb1b2874af0 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'tests')
-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"