mobile/android/base/tests/testOverscroll.java

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

mercurial