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 <Friedemann.Kleint@qt.io>
This commit is contained in:
Mitch Curtis 2017-05-26 13:28:55 +02:00
parent 8b1377fde1
commit a089de0d99

View File

@ -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);
}