Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f476c8a

Browse files
committed
Bug 1944989 - Use fuzzy comparisons in PanZoomControllerTest#compositorScrollDelegate. r=hiro,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D236503
1 parent 8c4a6bc commit f476c8a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/PanZoomControllerTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,11 @@ class PanZoomControllerTest : BaseSessionTest() {
742742
}
743743
})
744744

745+
val fuzzyEqual = { a: Float, b: Float -> Math.abs(a - b) <= 1.0 }
746+
745747
// Scroll down to the bottom using touch gestures, and check
746748
// that the expected scroll updates are reported
747-
while (updates.size == 0 || updates[updates.size - 1].scrollY < scrollMaxY) {
749+
while (updates.size == 0 || !fuzzyEqual(updates[updates.size - 1].scrollY, scrollMaxY)) {
748750
pan(25f, 15f)
749751
mainSession.flushApzRepaints()
750752
}
@@ -765,7 +767,7 @@ class PanZoomControllerTest : BaseSessionTest() {
765767

766768
// Scroll back up to the top using script, and check that
767769
// the expected scroll updates are reported
768-
while (updates.size == 0 || updates[updates.size - 1].scrollY > 0) {
770+
while (updates.size == 0 || !fuzzyEqual(updates[updates.size - 1].scrollY, 0)) {
769771
mainSession.evaluateJS("window.scrollBy(0, -10)")
770772
mainSession.flushApzRepaints()
771773
}

0 commit comments

Comments
 (0)