summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-02-25 09:59:03 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-02 14:06:24 +0000
commit38c67a9aadb19e4e15128167d66172b06cae7287 (patch)
tree3c96eb29c46beab4f83fdab39da9429cd7f26ad4 /tests
parentbead6b445ba04560370166f2e61f5fcf53a0a961 (diff)
Android: fix tst_QFrame::testPainting
When we create a QPixmap using QWidget::grab(), a default system image format is used for that. On Android this format is ARGB32_Premultiplied, while on the desktop systems it is RGB32. The images that are saved in the resources and used as references, also have the RGB32 format. As a result, on Android we need to convert the pixmap to a proper format before comparing it to the reference. Fixes: QTBUG-69064 Change-Id: I2d881e508d34e0b1a2a1a7bffcbc71ae2907d31d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit e37919b758799e71a8481ae9edf690bc7b01c70a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qframe/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qframe/tst_qframe.cpp11
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/widgets/widgets/qframe/BLACKLIST b/tests/auto/widgets/widgets/qframe/BLACKLIST
deleted file mode 100644
index 3a28dd1239..0000000000
--- a/tests/auto/widgets/widgets/qframe/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-# QTBUG-69064
-[testPainting]
-android
diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
index b5272f6b1a..65585123a9 100644
--- a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
+++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
@@ -173,7 +173,16 @@ void tst_QFrame::testPainting()
frame.setMidLineWidth(midLineWidth);
frame.resize(16, 16);
- const QPixmap pixmap = frame.grab();
+ QPixmap pixmap = frame.grab();
+#ifdef Q_OS_ANDROID
+ // QPixmap is created with system's default format, which is
+ // ARGB32_Premultiplied for Android. For desktop systems the format is
+ // RGB32, so that's also the format of the images in resources. So on
+ // Android we need to explicitly convert the pixmap to a proper format.
+ QImage img = pixmap.toImage();
+ QVERIFY(img.reinterpretAsFormat(QImage::Format_RGB32));
+ pixmap = QPixmap::fromImage(img);
+#endif
const QString fileName = QLatin1String("images/") + basename + QLatin1Char('_')
+ QString::number(lineWidth) + QLatin1Char('_') + QString::number(midLineWidth)