diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-04 08:59:11 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-04 08:59:18 +0200 |
commit | 216f57ef8682f74b72ae4e39cf1fd23abddf6a51 (patch) | |
tree | 9d1dc12e0944ec0252dac843fbadaf1dc4693888 /tests/auto/gui/image/qimage/tst_qimage.cpp | |
parent | 36bc2477753d19a14c587b97d4ec4f263e9e16c0 (diff) | |
parent | 8ce657d0279566ef327af1b88339534041ddc012 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
Diffstat (limited to 'tests/auto/gui/image/qimage/tst_qimage.cpp')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 29 |
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" |