summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@qt.io>2023-10-16 12:44:03 +0300
committerJoni Poikelin <joni.poikelin@qt.io>2023-10-26 07:48:02 +0300
commit799bfe94e8c17c0ff890c45b22d670d3bc8778c9 (patch)
tree169ae73933557cb8da7c25acc393961170a5ed37 /tests/auto/gui
parentc5d9e4a7a78b82ed31e5225c169de4718dfe4f05 (diff)
Fix smooth scaling of Format_Mono and Format_MonoLSB
Fixes: QTBUG-117713 Pick-to: 6.6 6.5 6.2 Change-Id: I2fb071a4d2229da50dfacb0a92c51c3e4ea57a74 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 2d1137bd09..fd155fbf1c 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -108,6 +108,8 @@ private slots:
void smoothScaleAlpha();
void smoothScaleFormats_data();
void smoothScaleFormats();
+ void smoothScaleNoConversion_data();
+ void smoothScaleNoConversion();
void transformed_data();
void transformed();
@@ -2058,6 +2060,24 @@ void tst_QImage::smoothScaleFormats()
QVERIFY(rotated.hasAlphaChannel());
}
+void tst_QImage::smoothScaleNoConversion_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addRow("Mono") << QImage::Format_Mono;
+ QTest::addRow("MonoLSB") << QImage::Format_MonoLSB;
+ QTest::addRow("Indexed8") << QImage::Format_Indexed8;
+}
+
+void tst_QImage::smoothScaleNoConversion()
+{
+ QFETCH(QImage::Format, format);
+ QImage img(128, 128, format);
+ img.fill(1);
+ img.setColorTable(QList<QRgb>() << qRgba(255,0,0,255) << qRgba(0,0,0,0));
+ img = img.scaled(QSize(48, 48), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ QVERIFY(img.hasAlphaChannel());
+}
+
static int count(const QImage &img, int x, int y, int dx, int dy, QRgb pixel)
{
int i = 0;