mobile/android/base/tests/testOverscroll.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 package org.mozilla.gecko.tests;
     3 import org.mozilla.gecko.Actions;
     4 import org.mozilla.gecko.PaintedSurface;
     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");
    16         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
    18         blockForGeckoReady();
    20         // load page and check we're at 0,0
    21         loadAndVerifyBoxes(url);
    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         }
    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