diff -r 000000000000 -r 6474c204b198 mobile/android/base/tests/testPanCorrectness.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mobile/android/base/tests/testPanCorrectness.java Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,45 @@ +package org.mozilla.gecko.tests; + +import org.mozilla.gecko.Actions; +import org.mozilla.gecko.PaintedSurface; + +/** + * A basic panning correctness test. + * - Loads a page and verifies it draws + * - drags page upwards by 100 pixels and verifies it draws + * - drags page leftwards by 100 pixels and verifies it draws + */ +public class testPanCorrectness extends PixelTest { + public void testPanCorrectness() { + String url = getAbsoluteUrl("/robocop/robocop_boxes.html"); + + MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); + + blockForGeckoReady(); + + // load page and check we're at 0,0 + loadAndVerifyBoxes(url); + + // drag page upwards by 100 pixels + Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint(); + meh.dragSync(10, 150, 10, 50); + PaintedSurface painted = waitForPaint(paintExpecter); + paintExpecter.unregisterListener(); + try { + checkScrollWithBoxes(painted, 0, 100); + } finally { + painted.close(); + } + + // drag page leftwards by 100 pixels + paintExpecter = mActions.expectPaint(); + meh.dragSync(150, 10, 50, 10); + painted = waitForPaint(paintExpecter); + paintExpecter.unregisterListener(); + try { + checkScrollWithBoxes(painted, 100, 100); + } finally { + painted.close(); + } + } +}