on xenial help sign in
Lockscreen test: Clean up test_resize, tryVerify
commit7ff365e62bf320b038d45e61f49735e7e1a39089 authorDalton Durst <dalton@ubports.com> dateMon 27 May 2019, 17:40 (7 years ago) parent89b02bc
1 file changed+5−3
tests/qmltests/Components/tst_Lockscreen.qml+5−3
tests/qmltests/Components/tst_Lockscreen.qml+5−3
@@ -459,9 +459,11 @@ Rectangle {
459459
460460 var numbersGrid = findChild(lockscreen, "numbersGrid");
461461 // Make sure the numbers pad keeps a 4gu margin on left/right but doesn't grow larger than 50 gu's width.
462− // For rounding reasons it might be off 1 pixel. Let's make sure it's within +/- 1 pixel of what we expect
463− verify(numbersGrid.width >= Math.min(units.gu(50), data.width - units.gu(8)) - 1);
464− verify(numbersGrid.width <= Math.min(units.gu(50), data.width - units.gu(8)) + 1);
462+ // For rounding reasons it might be off 2 pixels. Let's make sure it's within +/- 2 pixels of what we expect
463+ var idealWidth = Math.min(units.gu(50), data.width - units.gu(8));
464+ tryVerify(function() {
465+ return (idealWidth - 2) <= numbersGrid.width <= (idealWidth + 2);
466+ }, 5000, "numbersGrid's width of " + numbersGrid.width + " is within 2 pixels of " + idealWidth);
465467 }
466468 }
467469