summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-27 12:10:12 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-30 10:00:21 +0000
commit52ddfb36c80f1f0cba4e90d40b43c426687fac41 (patch)
tree1671e5c4cc5a0217dd5d5377a63a1d1b182fd6a5 /tests
parentfe086ddb9e4640489595a4c12aef6a27b989ed70 (diff)
Fix two errors in RGB30 conversions
The one converters from RGB30 was misplaced in the method table, and the unpremultiplication from A2RGB30 to RGB30 had an underflow mistake when alpha was 2. Change-Id: I92c11ede28611a3dbdce72aca1898845c120c209 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 51e4c6233e..266230de38 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -183,6 +183,7 @@ private slots:
void cleanupFunctions();
void devicePixelRatio();
+ void rgb30Unpremul();
void metadataPassthrough();
@@ -2829,6 +2830,20 @@ void tst_QImage::devicePixelRatio()
QCOMPARE(b.devicePixelRatio(), qreal(1.0));
}
+void tst_QImage::rgb30Unpremul()
+{
+ QImage a(3, 1, QImage::Format_A2RGB30_Premultiplied);
+ ((uint*)a.bits())[0] = (3U << 30) | (128 << 20) | (256 << 10) | 512;
+ ((uint*)a.bits())[1] = (2U << 30) | (131 << 20) | (259 << 10) | 515;
+ ((uint*)a.bits())[2] = (1U << 30) | ( 67 << 20) | (131 << 10) | 259;
+
+ QImage b = a.convertToFormat(QImage::Format_RGB30);
+ const uint* bbits = (const uint*)b.bits();
+ QCOMPARE(bbits[0], (3U << 30) | (128 << 20) | (256 << 10) | 512);
+ QCOMPARE(bbits[1], (3U << 30) | (196 << 20) | (388 << 10) | 772);
+ QCOMPARE(bbits[2], (3U << 30) | (201 << 20) | (393 << 10) | 777);
+}
+
void tst_QImage::metadataPassthrough()
{
QImage a(64, 64, QImage::Format_ARGB32);