Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | package org.mozilla.gecko.tests; |
michael@0 | 2 | |
michael@0 | 3 | import org.mozilla.gecko.Actions; |
michael@0 | 4 | import org.mozilla.gecko.PaintedSurface; |
michael@0 | 5 | |
michael@0 | 6 | /** |
michael@0 | 7 | * Basic test to check bounce-back from overscroll. |
michael@0 | 8 | * - Load the page and verify it draws |
michael@0 | 9 | * - Drag page downwards by 100 pixels into overscroll, verify it snaps back. |
michael@0 | 10 | * - Drag page rightwards by 100 pixels into overscroll, verify it snaps back. |
michael@0 | 11 | */ |
michael@0 | 12 | public class testOverscroll extends PixelTest { |
michael@0 | 13 | public void testOverscroll() { |
michael@0 | 14 | String url = getAbsoluteUrl("/robocop/robocop_boxes.html"); |
michael@0 | 15 | |
michael@0 | 16 | MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); |
michael@0 | 17 | |
michael@0 | 18 | blockForGeckoReady(); |
michael@0 | 19 | |
michael@0 | 20 | // load page and check we're at 0,0 |
michael@0 | 21 | loadAndVerifyBoxes(url); |
michael@0 | 22 | |
michael@0 | 23 | // drag page downwards by 100 pixels so that it goes into overscroll. |
michael@0 | 24 | // wait for it to bounce back and check we're at the right spot. |
michael@0 | 25 | // the screen size is small). Note that since we only go into overscroll |
michael@0 | 26 | // and back this should NOT trigger a gecko-paint |
michael@0 | 27 | Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint(); |
michael@0 | 28 | meh.dragSync(10, 50, 10, 150); |
michael@0 | 29 | PaintedSurface painted = waitWithNoPaint(paintExpecter); |
michael@0 | 30 | paintExpecter.unregisterListener(); |
michael@0 | 31 | try { |
michael@0 | 32 | checkScrollWithBoxes(painted, 0, 0); |
michael@0 | 33 | } finally { |
michael@0 | 34 | painted.close(); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | // drag page rightwards to go into overscroll on the left. let it bounce and verify. |
michael@0 | 38 | paintExpecter = mActions.expectPaint(); |
michael@0 | 39 | meh.dragSync(50, 10, 150, 10); |
michael@0 | 40 | painted = waitWithNoPaint(paintExpecter); |
michael@0 | 41 | paintExpecter.unregisterListener(); |
michael@0 | 42 | try { |
michael@0 | 43 | checkScrollWithBoxes(painted, 0, 0); |
michael@0 | 44 | } finally { |
michael@0 | 45 | painted.close(); |
michael@0 | 46 | } |
michael@0 | 47 | } |
michael@0 | 48 | } |