michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: import org.mozilla.gecko.Actions; michael@0: import org.mozilla.gecko.PaintedSurface; michael@0: michael@0: /** michael@0: * A basic panning correctness test. michael@0: * - Loads a page and verifies it draws michael@0: * - drags page upwards by 100 pixels and verifies it draws michael@0: * - drags page leftwards by 100 pixels and verifies it draws michael@0: */ michael@0: public class testPanCorrectness extends PixelTest { michael@0: public void testPanCorrectness() { michael@0: String url = getAbsoluteUrl("/robocop/robocop_boxes.html"); michael@0: michael@0: MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); michael@0: michael@0: blockForGeckoReady(); michael@0: michael@0: // load page and check we're at 0,0 michael@0: loadAndVerifyBoxes(url); michael@0: michael@0: // drag page upwards by 100 pixels michael@0: Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint(); michael@0: meh.dragSync(10, 150, 10, 50); michael@0: PaintedSurface painted = waitForPaint(paintExpecter); michael@0: paintExpecter.unregisterListener(); michael@0: try { michael@0: checkScrollWithBoxes(painted, 0, 100); michael@0: } finally { michael@0: painted.close(); michael@0: } michael@0: michael@0: // drag page leftwards by 100 pixels michael@0: paintExpecter = mActions.expectPaint(); michael@0: meh.dragSync(150, 10, 50, 10); michael@0: painted = waitForPaint(paintExpecter); michael@0: paintExpecter.unregisterListener(); michael@0: try { michael@0: checkScrollWithBoxes(painted, 100, 100); michael@0: } finally { michael@0: painted.close(); michael@0: } michael@0: } michael@0: }