|
1 package org.mozilla.gecko.tests; |
|
2 |
|
3 import org.mozilla.gecko.Actions; |
|
4 import org.mozilla.gecko.PaintedSurface; |
|
5 |
|
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"); |
|
15 |
|
16 MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); |
|
17 |
|
18 blockForGeckoReady(); |
|
19 |
|
20 // load page and check we're at 0,0 |
|
21 loadAndVerifyBoxes(url); |
|
22 |
|
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 } |
|
33 |
|
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 } |