diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-12 09:12:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-16 10:48:52 +0200 |
commit | d20bacbb4cedf012566ce0020f9e53a7c1ecbe5f (patch) | |
tree | 42cf9386b4eba75e0af0f9659a27c23134722981 /tests | |
parent | 9c76b82885253bbec9d9019b9113be16b15385f2 (diff) |
tst_QWidget::translucentWidget(): Pass with High DPI scaling enabled
Since 9c8d1ca18b48dbcc89dda1b9bacdf7d49c7fc754, the test would fail
when High DPI scaling is enabled:
FAIL! : tst_QWidget::translucentWidget() Compared QImages differ in device pixel ratio.
Actual (actual): 2
Expected (expected): 1
.\tst_qwidget.cpp(8913) : failure location
Set the device pixel ratio on the expected pixmap to fix this.
Change-Id: I517495931c2c6b1f49125bb4b5836e304bdbf545
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 1724d3ce8c..3e372b76f5 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8906,7 +8906,8 @@ void tst_QWidget::translucentWidget() widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size())); #endif const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); - const QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size()); + QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size()); + expected.setDevicePixelRatio(label.devicePixelRatioF()); if (m_platform == QStringLiteral("winrt")) QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QCOMPARE(actual.size(),expected.size()); |