From 63d738d44f484ac4bfa66a8c3468f2121901b31d Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 25 Apr 2009 20:39:32 +1200 Subject: [PATCH] Bug 489506. Fix test so it can pass when the screen height is an odd number. r=enndeakin --HG-- extra : rebase_source : 50f3fd53ab54185ed6f05525dcae070ca6bf9d6e --- toolkit/content/tests/chrome/window_largemenu.xul | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/toolkit/content/tests/chrome/window_largemenu.xul b/toolkit/content/tests/chrome/window_largemenu.xul index 755e0d2d1604..a95e99eaa9d1 100644 --- a/toolkit/content/tests/chrome/window_largemenu.xul +++ b/toolkit/content/tests/chrome/window_largemenu.xul @@ -91,8 +91,10 @@ function popupShown() var expectedScrollPos = 0; if (gTestIndex == 0) { - // the popup should be in the center of the screen - is(Math.round(rect.top) + gScreenY, screen.height / 2, + // the popup should be in the center of the screen + // note that if the height is odd, the y-offset will have been rounded + // down when we pass the fractional value to openPopupAtScreen above. + is(Math.round(rect.top) + gScreenY, Math.floor(screen.height / 2), gTests[gTestIndex] + " top"); ok(Math.round(rect.bottom) + gScreenY < screen.height, gTests[gTestIndex] + " bottom"); @@ -120,7 +122,9 @@ function popupShown() expectedScrollPos = 40; } else if (gTestIndex == 4) { - is(Math.round(rect.top) + gScreenY, screen.height / 2, + // note that if the height is odd, the y-offset will have been rounded + // down when we pass the fractional value to openPopupAtScreen above. + is(Math.round(rect.top) + gScreenY, Math.floor(screen.height / 2), gTests[gTestIndex] + " top"); ok(Math.round(rect.bottom) + gScreenY < screen.height, gTests[gTestIndex] + " bottom");