1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tests/testPanCorrectness.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +package org.mozilla.gecko.tests; 1.5 + 1.6 +import org.mozilla.gecko.Actions; 1.7 +import org.mozilla.gecko.PaintedSurface; 1.8 + 1.9 +/** 1.10 + * A basic panning correctness test. 1.11 + * - Loads a page and verifies it draws 1.12 + * - drags page upwards by 100 pixels and verifies it draws 1.13 + * - drags page leftwards by 100 pixels and verifies it draws 1.14 + */ 1.15 +public class testPanCorrectness extends PixelTest { 1.16 + public void testPanCorrectness() { 1.17 + String url = getAbsoluteUrl("/robocop/robocop_boxes.html"); 1.18 + 1.19 + MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); 1.20 + 1.21 + blockForGeckoReady(); 1.22 + 1.23 + // load page and check we're at 0,0 1.24 + loadAndVerifyBoxes(url); 1.25 + 1.26 + // drag page upwards by 100 pixels 1.27 + Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint(); 1.28 + meh.dragSync(10, 150, 10, 50); 1.29 + PaintedSurface painted = waitForPaint(paintExpecter); 1.30 + paintExpecter.unregisterListener(); 1.31 + try { 1.32 + checkScrollWithBoxes(painted, 0, 100); 1.33 + } finally { 1.34 + painted.close(); 1.35 + } 1.36 + 1.37 + // drag page leftwards by 100 pixels 1.38 + paintExpecter = mActions.expectPaint(); 1.39 + meh.dragSync(150, 10, 50, 10); 1.40 + painted = waitForPaint(paintExpecter); 1.41 + paintExpecter.unregisterListener(); 1.42 + try { 1.43 + checkScrollWithBoxes(painted, 100, 100); 1.44 + } finally { 1.45 + painted.close(); 1.46 + } 1.47 + } 1.48 +}