mobile/android/base/tests/testPanCorrectness.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.

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

mercurial