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. Change-Id: I0a598e5e94ac82c551cbeb935e2fa08cad048f84 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit a61bf508e3c138c429e0a73498c745c3c0d3f0f7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
886c7b8700
commit
583cbd607f
@ -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…
x
Reference in New Issue
Block a user