summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-11 10:48:15 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-01-03 09:36:03 +0000
commit9f69817344eb75fbc4613892c1f54ee69cae2e66 (patch)
tree8c6edc785b80e373983c85808cb4e3ce86e58fe8 /tests
parent0f8ac893a7fad1d3cdfcc55b511b2d88e4645ba9 (diff)
downloadqtimageformats-9f69817344eb75fbc4613892c1f54ee69cae2e66.tar.gz
Add Grayscale16 support to TIFF
Change-Id: I927d9ab0af78baf90d8fd8d44088218dff0e7082 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tiff/tst_qtiff.cpp20
-rw-r--r--tests/shared/images/tiff.qrc1
-rw-r--r--tests/shared/images/tiff/gray16.tiffbin0 -> 8164 bytes
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/tiff/tst_qtiff.cpp b/tests/auto/tiff/tst_qtiff.cpp
index 9c815d5..b2c5546 100644
--- a/tests/auto/tiff/tst_qtiff.cpp
+++ b/tests/auto/tiff/tst_qtiff.cpp
@@ -85,6 +85,7 @@ private slots:
void tiled();
void readRgba64();
+ void readGray16();
private:
QString prefix;
@@ -168,6 +169,7 @@ void tst_qtiff::readImage_data()
QTest::newRow("tiled_oddsize_grayscale") << QString("tiled_oddsize_grayscale.tiff") << QSize(59, 71);
QTest::newRow("tiled_oddsize_mono") << QString("tiled_oddsize_mono.tiff") << QSize(59, 71);
QTest::newRow("16bpc") << QString("16bpc.tiff") << QSize(64, 46);
+ QTest::newRow("gray16") << QString("gray16.tiff") << QSize(64, 46);
}
void tst_qtiff::readImage()
@@ -178,9 +180,13 @@ void tst_qtiff::readImage()
QString path = prefix + fileName;
QImageReader reader(path);
QVERIFY(reader.canRead());
+ QImage::Format headerFormat = reader.imageFormat();
+ QSize headerSize = reader.size();
QImage image = reader.read();
QVERIFY(!image.isNull());
QCOMPARE(image.size(), size);
+ QCOMPARE(image.size(), headerSize);
+ QCOMPARE(image.format(), headerFormat);
}
void tst_qtiff::readCorruptImage_data()
@@ -386,7 +392,8 @@ void tst_qtiff::readWriteNonDestructive_data()
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;
+ QTest::newRow("tiff grayscale8") << QImage::Format_Grayscale8 << QImage::Format_Grayscale8 << QImageIOHandler::TransformationFlip;
+ QTest::newRow("tiff grayscale16") << QImage::Format_Grayscale16 << QImage::Format_Grayscale16 << QImageIOHandler::TransformationMirror;
QTest::newRow("tiff rgb64") << QImage::Format_RGBX64 << QImage::Format_RGBX64 << QImageIOHandler::TransformationNone;
QTest::newRow("tiff rgba64") << QImage::Format_RGBA64 << QImage::Format_RGBA64 << QImageIOHandler::TransformationRotate90;
QTest::newRow("tiff rgba64pm") << QImage::Format_RGBA64_Premultiplied << QImage::Format_RGBA64_Premultiplied << QImageIOHandler::TransformationNone;
@@ -609,5 +616,16 @@ void tst_qtiff::readRgba64()
QCOMPARE(image.format(), QImage::Format_RGBX64);
}
+void tst_qtiff::readGray16()
+{
+ QString path = prefix + QString("gray16.tiff");
+ QImageReader reader(path);
+ QVERIFY(reader.canRead());
+ QCOMPARE(reader.imageFormat(), QImage::Format_Grayscale16);
+ QImage image = reader.read();
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.format(), QImage::Format_Grayscale16);
+}
+
QTEST_MAIN(tst_qtiff)
#include "tst_qtiff.moc"
diff --git a/tests/shared/images/tiff.qrc b/tests/shared/images/tiff.qrc
index 91bbf93..e1ce9da 100644
--- a/tests/shared/images/tiff.qrc
+++ b/tests/shared/images/tiff.qrc
@@ -51,5 +51,6 @@
<file>tiff/tiled_oddsize_mono.tiff</file>
<file>tiff/oddsize_mono.tiff</file>
<file>tiff/tiled_rgb.tiff</file>
+ <file>tiff/gray16.tiff</file>
</qresource>
</RCC>
diff --git a/tests/shared/images/tiff/gray16.tiff b/tests/shared/images/tiff/gray16.tiff
new file mode 100644
index 0000000..aeeb045
--- /dev/null
+++ b/tests/shared/images/tiff/gray16.tiff
Binary files differ