Bug 591718. Fix mobile browser test to handle getBoundingClientRect including a transform. r=mfinkle

This commit is contained in:
Robert O'Callahan 2011-12-30 11:14:04 +13:00
parent 46858a7a66
commit 5b7bd01d72
2 changed files with 6 additions and 2 deletions

View File

@ -65,7 +65,9 @@ function checkScrollbarsPosition(aX) {
let verticalRect = verticalScrollbar.getBoundingClientRect(); let verticalRect = verticalScrollbar.getBoundingClientRect();
let margin = parseInt(verticalScrollbar.getAttribute("end")); let margin = parseInt(verticalScrollbar.getAttribute("end"));
let expectedPosition = window.innerWidth - aX - margin; let matches = verticalScrollbar.style.MozTransform.match(/^translate\(([-0-9]+)px/);
let translateX = matches ? parseInt(matches[1]) : 0;
let expectedPosition = window.innerWidth - aX - margin + translateX;
is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")"); is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")");
EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" }); EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" });

View File

@ -65,7 +65,9 @@ function checkScrollbarsPosition(aX) {
let verticalRect = verticalScrollbar.getBoundingClientRect(); let verticalRect = verticalScrollbar.getBoundingClientRect();
let margin = parseInt(verticalScrollbar.getAttribute("end")); let margin = parseInt(verticalScrollbar.getAttribute("end"));
let expectedPosition = window.innerWidth - aX - margin; let matches = verticalScrollbar.style.MozTransform.match(/^translate\(([-0-9]+)px/);
let translateX = matches ? parseInt(matches[1]) : 0;
let expectedPosition = window.innerWidth - aX - margin + translateX;
is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")"); is(verticalRect.right, expectedPosition, "The vertical scrollbar should be position to " + expectedPosition + " (got " + verticalRect.right + ")");
EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" }); EventUtils.synthesizeMouse(browser, width / 2, height * 3 / 4, { type: "mouseup" });