diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-08 07:09:26 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-08 07:09:47 +0100 |
commit | 3ec31ef9c5acd57a4a59c0d5f5e20b8d9a19bfa1 (patch) | |
tree | 8b55dd13dbc2a33fe7c857f622e10b817386bdb3 /tests/auto/gui/image/qimage/tst_qimage.cpp | |
parent | 6f87f2d23fb50d8183ea173fe423b7e1a24c0e2e (diff) | |
parent | 4ad8798de428b44fe4c56e1ca111940068056c57 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
Diffstat (limited to 'tests/auto/gui/image/qimage/tst_qimage.cpp')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 1935e86fc7..26b812715d 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -196,6 +196,8 @@ private slots: void metadataPassthrough(); + void pixelColor(); + private: const QString m_prefix; }; @@ -3027,5 +3029,21 @@ void tst_QImage::metadataPassthrough() QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio()); } +void tst_QImage::pixelColor() +{ + QImage argb32(1, 1, QImage::Format_ARGB32); + QImage argb32pm(1, 1, QImage::Format_ARGB32_Premultiplied); + + QColor c(Qt::red); + c.setAlpha(128); + argb32.setPixelColor(QPoint(0, 0), c); + argb32pm.setPixelColor(QPoint(0, 0), c); + QCOMPARE(argb32.pixelColor(QPoint(0, 0)), c); + QCOMPARE(argb32pm.pixelColor(QPoint(0, 0)), c); + + QImage t = argb32.convertToFormat(QImage::Format_ARGB32_Premultiplied); + QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0)); +} + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" |