From a61bf508e3c138c429e0a73498c745c3c0d3f0f7 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 14 Jul 2022 11:33:45 +0200 Subject: QGraphicsProxyWidget: make tolerance for errors depend on DPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test already accepts an error margin for coordinate mapping. It is still flaky, so make that margin larger if the DPI of the widget >1. Pick-to: 6.4 6.3 6.2 Change-Id: I0a598e5e94ac82c551cbeb935e2fa08cad048f84 Reviewed-by: Axel Spoerl Reviewed-by: Tor Arne Vestbø --- .../graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/auto/widgets/graphicsview') diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 43522e325a..69ecee59e1 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -3531,8 +3531,9 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135 QCOMPARE(embeddedWidget->mapFromGlobal(embeddedCenterGlobal), embeddedCenter); // This should be equivalent to the view center give or take rounding // errors due to odd window margins + const int Tolerance = qCeil(3 * view.devicePixelRatio()); const QPoint viewCenter = view.geometry().center(); - QVERIFY2((viewCenter - embeddedCenterGlobal).manhattanLength() <= 3, + QVERIFY2((viewCenter - embeddedCenterGlobal).manhattanLength() <= Tolerance, msgPointMismatch(embeddedCenterGlobal, viewCenter).constData()); // Same test with child centered on embeddedWidget. Also make sure @@ -3542,7 +3543,7 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135 const QPoint childCenter = childWidget->rect().center(); const QPoint childCenterGlobal = childWidget->mapToGlobal(childCenter); QCOMPARE(childWidget->mapFromGlobal(childCenterGlobal), childCenter); - QVERIFY2((viewCenter - childCenterGlobal).manhattanLength() <= 4, + QVERIFY2((viewCenter - childCenterGlobal).manhattanLength() <= Tolerance, msgPointMismatch(childCenterGlobal, viewCenter).constData()); } -- cgit v1.2.3