Bug 489506. Fix test so it can pass when the screen height is an odd number. r=enndeakin

--HG--
extra : rebase_source : 50f3fd53ab54185ed6f05525dcae070ca6bf9d6e
This commit is contained in:
Robert O'Callahan 2009-04-25 20:39:32 +12:00
parent 0cc4169245
commit 0e278f42c6

View File

@ -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");