summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qimage/tst_qimage.cpp
diff options
context:
space:
mode:
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 dd10ba2e82..cc75846fdd 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;
@@ -3077,5 +3078,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"