michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: import org.mozilla.gecko.Actions; michael@0: import org.mozilla.gecko.PaintedSurface; michael@0: michael@0: /** michael@0: * Basic test to check bounce-back from overscroll. michael@0: * - Load the page and verify it draws michael@0: * - Drag page downwards by 100 pixels into overscroll, verify it snaps back. michael@0: * - Drag page rightwards by 100 pixels into overscroll, verify it snaps back. michael@0: */ michael@0: public class testOverscroll extends PixelTest { michael@0: public void testOverscroll() { michael@0: String url = getAbsoluteUrl("/robocop/robocop_boxes.html"); michael@0: michael@0: MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); michael@0: michael@0: blockForGeckoReady(); michael@0: michael@0: // load page and check we're at 0,0 michael@0: loadAndVerifyBoxes(url); michael@0: michael@0: // drag page downwards by 100 pixels so that it goes into overscroll. michael@0: // wait for it to bounce back and check we're at the right spot. michael@0: // the screen size is small). Note that since we only go into overscroll michael@0: // and back this should NOT trigger a gecko-paint michael@0: Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint(); michael@0: meh.dragSync(10, 50, 10, 150); michael@0: PaintedSurface painted = waitWithNoPaint(paintExpecter); michael@0: paintExpecter.unregisterListener(); michael@0: try { michael@0: checkScrollWithBoxes(painted, 0, 0); michael@0: } finally { michael@0: painted.close(); michael@0: } michael@0: michael@0: // drag page rightwards to go into overscroll on the left. let it bounce and verify. michael@0: paintExpecter = mActions.expectPaint(); michael@0: meh.dragSync(50, 10, 150, 10); michael@0: painted = waitWithNoPaint(paintExpecter); michael@0: paintExpecter.unregisterListener(); michael@0: try { michael@0: checkScrollWithBoxes(painted, 0, 0); michael@0: } finally { michael@0: painted.close(); michael@0: } michael@0: } michael@0: }