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