diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-13 11:07:58 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-14 08:13:46 +0000 |
commit | 590e71a69cc74b4e7da1ccb19a1304047dbaecb8 (patch) | |
tree | 126f11c43cc86ea01bbca345ebf43f70e08cf489 /tests/auto/gui/image/qimage/tst_qimage.cpp | |
parent | b6e99ec056387e8720ef5acff824089fe585e00a (diff) |
Fix convertToFormat with color-tables
The function was only well defined from RGB32 and ARGB32PM formats,
this patch fixes it so it behaves well from all formats.
Task-number: QTBUG-63163
Change-Id: Id892531d9aaf997b707b430196c1166493792a2a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/gui/image/qimage/tst_qimage.cpp')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index fac785ac86..73e11e7cc7 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -69,6 +69,7 @@ private slots: void convertToFormat_data(); void convertToFormat(); + void convertToFormatWithColorTable(); void convertToFormatRgb888ToRGB32(); @@ -958,6 +959,18 @@ void tst_QImage::convertToFormat() QFile::remove(QLatin1String("expected2.xpm")); } +void tst_QImage::convertToFormatWithColorTable() +{ + QVector<QRgb> colors(2); + colors[0] = 0xFF000000; + colors[1] = 0xFFFFFFFF; + for (int format = QImage::Format_RGB32; format < QImage::Format_Alpha8; ++format) { + QImage fromImage(10, 10, (QImage::Format)format); + QImage bitmap = fromImage.convertToFormat(QImage::Format_Mono, colors); + QVERIFY(!bitmap.isNull()); + } +} + void tst_QImage::convertToFormatRgb888ToRGB32() { // 545 so width % 4 != 0. This ensure there is padding at the end of the scanlines |