mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 20:17:37 +00:00
55 lines
2.2 KiB
Java
55 lines
2.2 KiB
Java
|
#filter substitution
|
||
|
package @ANDROID_PACKAGE_NAME@.tests;
|
||
|
|
||
|
import @ANDROID_PACKAGE_NAME@.*;
|
||
|
import android.app.Instrumentation;
|
||
|
|
||
|
public class testPanCorrectness extends BaseTest {
|
||
|
private static final String URL = "http://mochi.test:8888/tests/robocop/robocop_boxes.html";
|
||
|
|
||
|
private void checkPixels(int[][] colors) {
|
||
|
mActions.expectPaint().blockForEvent();
|
||
|
getInstrumentation().waitForIdleSync();
|
||
|
|
||
|
int[][] painted = mDriver.getPaintedSurface();
|
||
|
mAsserter.ispixel(painted[0][0], colors[0][0], colors[0][1], colors[0][2], "Pixel at 0, 0");
|
||
|
mAsserter.ispixel(painted[0][100], colors[1][0], colors[1][1], colors[1][2], "Pixel at 100, 0");
|
||
|
mAsserter.ispixel(painted[100][0], colors[2][0], colors[2][1], colors[2][2], "Pixel at 0, 100");
|
||
|
mAsserter.ispixel(painted[100][100], colors[3][0], colors[3][1], colors[3][2], "Pixel at 100, 100");
|
||
|
}
|
||
|
|
||
|
public void testPanCorrectness() {
|
||
|
loadUrl(URL);
|
||
|
|
||
|
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
|
||
|
|
||
|
checkPixels(new int[][] {
|
||
|
/* at 0, 0 */ /* at 100, 0 */
|
||
|
{ 0, 255, 255 }, { 100, 255, 245 },
|
||
|
|
||
|
/* at 0, 100 */ /* at 100, 100 */
|
||
|
{ 100, 245, 255 }, { 200, 245, 245 },
|
||
|
});
|
||
|
|
||
|
// drag page upwards by 100 pixels
|
||
|
meh.dragSync(10, 150, 10, 50);
|
||
|
checkPixels(new int[][] {
|
||
|
/* 0, 100 now at 0, 0 */ /* 100, 100 now at 100, 0 */
|
||
|
{ 100, 245, 255 }, { 200, 245, 245 },
|
||
|
|
||
|
/* 0, 200 now at 0, 100 */ /* 100, 200 now at 100, 100 */
|
||
|
{ 200, 235, 255 }, { 45, 235, 245 },
|
||
|
});
|
||
|
|
||
|
// drag page leftwards by 100 pixels
|
||
|
meh.dragSync(150, 10, 50, 10);
|
||
|
checkPixels(new int[][] {
|
||
|
/* 100, 100 now at 0, 0 */ /* 200, 100 now at 100, 0 */
|
||
|
{ 200, 245, 245 }, { 45, 245, 235 },
|
||
|
|
||
|
/* 100, 200 now at 0, 100 */ /* 200, 200 now at 100, 100 */
|
||
|
{ 45, 235, 245 }, { 145, 235, 235 },
|
||
|
});
|
||
|
}
|
||
|
}
|