mobile/android/base/tests/testPanCorrectness.java

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 package org.mozilla.gecko.tests;
     3 import org.mozilla.gecko.Actions;
     4 import org.mozilla.gecko.PaintedSurface;
     6 /**
     7  * A basic panning correctness test.
     8  * - Loads a page and verifies it draws
     9  * - drags page upwards by 100 pixels and verifies it draws
    10  * - drags page leftwards by 100 pixels and verifies it draws
    11  */
    12 public class testPanCorrectness extends PixelTest {
    13     public void testPanCorrectness() {
    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 upwards by 100 pixels
    24         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
    25         meh.dragSync(10, 150, 10, 50);
    26         PaintedSurface painted = waitForPaint(paintExpecter);
    27         paintExpecter.unregisterListener();
    28         try {
    29             checkScrollWithBoxes(painted, 0, 100);
    30         } finally {
    31             painted.close();
    32         }
    34         // drag page leftwards by 100 pixels
    35         paintExpecter = mActions.expectPaint();
    36         meh.dragSync(150, 10, 50, 10);
    37         painted = waitForPaint(paintExpecter);
    38         paintExpecter.unregisterListener();
    39         try {
    40             checkScrollWithBoxes(painted, 100, 100);
    41         } finally {
    42             painted.close();
    43         }
    44     }
    45 }

mercurial