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>
This commit is contained in:
parent
55dd943996
commit
a61bf508e3
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user