summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qimage/tst_qimage.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-04 08:59:11 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-04 08:59:18 +0200
commit216f57ef8682f74b72ae4e39cf1fd23abddf6a51 (patch)
tree9d1dc12e0944ec0252dac843fbadaf1dc4693888 /tests/auto/gui/image/qimage/tst_qimage.cpp
parent36bc2477753d19a14c587b97d4ec4f263e9e16c0 (diff)
parent8ce657d0279566ef327af1b88339534041ddc012 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'tests/auto/gui/image/qimage/tst_qimage.cpp')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index d8fb39f77f..91df1ca520 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -193,6 +193,7 @@ private slots:
void metadataPassthrough();
void pixelColor();
+ void pixel();
private:
const QString m_prefix;
@@ -3085,5 +3086,33 @@ void tst_QImage::pixelColor()
QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0));
}
+void tst_QImage::pixel()
+{
+ {
+ QImage mono(1, 1, QImage::Format_Mono);
+ QImage monolsb(1, 1, QImage::Format_MonoLSB);
+ QImage indexed(1, 1, QImage::Format_Indexed8);
+
+ mono.fill(0);
+ monolsb.fill(0);
+ indexed.fill(0);
+
+ QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black));
+ QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black));
+ indexed.pixel(0, 0); // Don't crash
+ }
+
+ {
+ uchar a = 0;
+ QImage mono(&a, 1, 1, QImage::Format_Mono);
+ QImage monolsb(&a, 1, 1, QImage::Format_MonoLSB);
+ QImage indexed(&a, 1, 1, QImage::Format_Indexed8);
+
+ QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black));
+ QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black));
+ indexed.pixel(0, 0); // Don't crash
+ }
+}
+
QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc"