summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qimage
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-12 16:38:40 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-19 10:08:41 +0000
commitee3ac3a3bfb4c4a0802f6530f61995297c573646 (patch)
treee581e20e1c2949a1b7fb1b6d46db2b824152208d /tests/auto/gui/image/qimage
parent288bfb0bbd778fdfa6ac9fdcdc1afc19ec13aeaf (diff)
Fix PNGs saved from QImage transform of 8-bit images
Fixes two separate errors. QImage::transform was incorrectly adding colors to the color-table of the returned image when the converted image would not be indexed, and qpnghandler was looking at non-empty color- table instead of color format. Task-number: QTBUG-43708 Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/gui/image/qimage')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 21481e374d..fac785ac86 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -211,6 +211,8 @@ private slots:
void reinterpretAsFormat2();
+ void complexTransform8bit();
+
#ifdef Q_OS_DARWIN
void toCGImage_data();
void toCGImage();
@@ -3366,6 +3368,18 @@ void tst_QImage::reinterpretAsFormat2()
}
}
+void tst_QImage::complexTransform8bit()
+{
+ QImage img1(100, 100, QImage::Format_RGB32);
+ img1.fill(Qt::green);
+ img1 = img1.convertToFormat(QImage::Format_Indexed8);
+ QImage img2 = img1.transformed(QTransform().rotate(45), Qt::SmoothTransformation);
+ // Currently the format is always QImage::Format_ARGB32_Premultiplied, but it
+ // doesn't have to be, and if it becomes indexed this test is no longer be valid.
+ QVERIFY(img2.format() > QImage::Format_Indexed8);
+ QCOMPARE(img2.colorCount(), 0);
+}
+
#ifdef Q_OS_DARWIN
void tst_QImage::toCGImage_data()