summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-14 11:33:45 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-14 15:24:43 +0200
commita61bf508e3c138c429e0a73498c745c3c0d3f0f7 (patch)
tree6e939fdb8a0aca8f8d4f717aa78b460774b9e498 /tests/auto/widgets/graphicsview
parent55dd9439961b21f9b4929a80dbccfffc647678b3 (diff)
QGraphicsProxyWidget: make tolerance for errors depend on DPI
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 <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp5
1 files changed, 3 insertions, 2 deletions
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());
}