From a089de0d992072bb06aa35323a53ca6cb5d76557 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 26 May 2017 13:28:55 +0200 Subject: [PATCH] Fix tst_QWidget::translucentWidget() on high DPI displays It was grabbing a QLabel without accounting for the size of the window in the case where the DPI is larger than 1: FAIL! : tst_QWidget::translucentWidget() Compared values are not the same Actual (actual.size()) : QSize(32x32) Expected (expected.size()): QSize(16x16) Change-Id: I4873f3c6364ee2696f5612d91e6c97c60b2cd915 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index e68f0f57ef..0933dc991d 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8526,8 +8526,8 @@ void tst_QWidget::translucentWidget() else #endif widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size())); - QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); - QImage expected = pm.toImage().convertToFormat(QImage::Format_RGB32); + const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); + const QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size()); QCOMPARE(actual.size(),expected.size()); QCOMPARE(actual,expected); }