gecko/mobile/android/base/tests/testOverscroll.java.in

45 lines
1.7 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.app.Instrumentation;
/**
* Basic test to check bounce-back from overscroll.
* - Load the page and verify it draws
* - Drag page downwards by 100 pixels into overscroll, verify it snaps back.
* - Drag page rightwards by 100 pixels into overscroll, verify it snaps back.
*/
public class testOverscroll extends PixelTest {
@Override
protected int getTestType() {
return TEST_MOCHITEST;
}
public void testOverscroll() {
String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
// load page and check we're at 0,0
loadAndVerifyBoxes(url);
// drag page downwards by 100 pixels so that it goes into overscroll.
// wait for it to bounce back and check we're at the right spot.
// the screen size is small). Note that since we only go into overscroll
// and back this should NOT trigger a gecko-paint
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
meh.dragSync(10, 50, 10, 150);
PaintedSurface painted = waitWithNoPaint(paintExpecter);
checkScrollWithBoxes(painted, 0, 0);
// drag page rightwards to go into overscroll on the left. let it bounce and verify.
paintExpecter = mActions.expectPaint();
meh.dragSync(50, 10, 150, 10);
painted = waitWithNoPaint(paintExpecter);
checkScrollWithBoxes(painted, 0, 0);
}
}