summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2016-12-07 13:03:44 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-01-03 14:11:09 +0000
commit0b7235d46a80644dedbc802d1f0ec971b06af698 (patch)
tree3b1e1fe62ab68a46dbb1d5c082424b2009cf5853 /tests
parente3a47a7e5f9c4a027a5a7c9fa376f17dfd9634b7 (diff)
Fix qdrawhelper function toRGB64
The function was incorrectly handling green and blue color channels causing them to be dropped. This affects drawing non 32-bit images onto 10-bit per color channels formats such as RGB30. Change-Id: I9211e253b1a9da0dada5c418d592a8f531265989 (cherry picked from commit f882d2f443a8950a2f784fa91b3ff10a645577f7) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 2c0012497d..ee8b3d1719 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -309,6 +309,8 @@ private slots:
void QTBUG56252();
+ void toRGB64();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5097,6 +5099,21 @@ void tst_QPainter::QTBUG56252()
// If no crash or illegal memory read, all is fine
}
+void tst_QPainter::toRGB64()
+{
+ QImage dst(10, 1, QImage::Format_BGR30);
+ QImage src(10, 1, QImage::Format_RGB16);
+ src.fill(Qt::white);
+
+ QPainter paint(&dst);
+ paint.drawImage(0, 0, src);
+ paint.end();
+
+ for (int i=0; i < dst.width(); ++i) {
+ QVERIFY(dst.pixelColor(i,0) == QColor(Qt::white));
+ }
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"