2013-11-07 16:18:51 +00:00
|
|
|
package org.mozilla.gecko.tests;
|
2012-02-01 17:19:46 +00:00
|
|
|
|
2013-11-07 16:18:51 +00:00
|
|
|
import org.mozilla.gecko.*;
|
2012-02-01 17:19:46 +00:00
|
|
|
|
2012-02-07 19:10:58 +00:00
|
|
|
/**
|
|
|
|
* 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 {
|
2012-06-27 23:56:49 +00:00
|
|
|
@Override
|
|
|
|
protected int getTestType() {
|
|
|
|
return TEST_MOCHITEST;
|
|
|
|
}
|
|
|
|
|
2012-02-01 17:19:46 +00:00
|
|
|
public void testPanCorrectness() {
|
2012-02-02 15:09:26 +00:00
|
|
|
String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
|
2012-02-01 17:19:46 +00:00
|
|
|
|
|
|
|
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
|
|
|
|
|
2012-10-25 19:37:39 +00:00
|
|
|
blockForGeckoReady();
|
2012-02-10 14:44:06 +00:00
|
|
|
|
2012-02-07 19:10:58 +00:00
|
|
|
// load page and check we're at 0,0
|
|
|
|
loadAndVerifyBoxes(url);
|
2012-02-01 17:19:46 +00:00
|
|
|
|
|
|
|
// drag page upwards by 100 pixels
|
2012-02-07 19:10:58 +00:00
|
|
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
2012-02-01 17:19:46 +00:00
|
|
|
meh.dragSync(10, 150, 10, 50);
|
2012-03-06 20:08:45 +00:00
|
|
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
2013-04-19 03:18:09 +00:00
|
|
|
paintExpecter.unregisterListener();
|
2012-08-27 17:44:58 +00:00
|
|
|
try {
|
|
|
|
checkScrollWithBoxes(painted, 0, 100);
|
|
|
|
} finally {
|
|
|
|
painted.close();
|
|
|
|
}
|
2012-02-01 17:19:46 +00:00
|
|
|
|
|
|
|
// drag page leftwards by 100 pixels
|
2012-02-07 19:10:58 +00:00
|
|
|
paintExpecter = mActions.expectPaint();
|
2012-02-01 17:19:46 +00:00
|
|
|
meh.dragSync(150, 10, 50, 10);
|
2012-02-07 19:10:58 +00:00
|
|
|
painted = waitForPaint(paintExpecter);
|
2013-04-19 03:18:09 +00:00
|
|
|
paintExpecter.unregisterListener();
|
2012-08-27 17:44:58 +00:00
|
|
|
try {
|
|
|
|
checkScrollWithBoxes(painted, 100, 100);
|
|
|
|
} finally {
|
|
|
|
painted.close();
|
|
|
|
}
|
2012-02-01 17:19:46 +00:00
|
|
|
}
|
|
|
|
}
|