Java 类org.robolectric.shadows.ShadowGestureDetector 实例源码

项目:materialistic    文件:NavFloatingActionButtonTest.java   
@Before
public void setUp() {
    button = new NavFloatingActionButton(new ContextThemeWrapper(RuntimeEnvironment.application,
            R.style.AppTheme));
    shadowOf(button).getOnTouchListener().onTouch(button,
            MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0));
    gestureListener = (GestureDetector.SimpleOnGestureListener)
            shadowOf(ShadowGestureDetector.getLastActiveDetector()).getListener();
    navigable = mock(Navigable.class);
    button.setNavigable(navigable);
    assertTrue(gestureListener.onDown(null));
}
项目:Fabric-Example-App-Android    文件:ViewGestureDetectorTest.java   
@Test
public void constructor_shouldDisableLongPressAndSetGestureListener() throws Exception {
    subject = new ViewGestureDetector(context, view, mockAdReport);

    ShadowGestureDetector shadowGestureDetector = shadowOf(subject);

    assertThat(subject.isLongpressEnabled()).isFalse();
    assertThat(shadowGestureDetector.getListener()).isNotNull();
    assertThat(shadowGestureDetector.getListener()).isInstanceOf(AdAlertGestureListener.class);
}
项目:materialistic    文件:ItemActivityTest.java   
private ShadowGestureDetector getDetector(View view) {
    shadowOf(view).getOnTouchListener()
            .onTouch(view, MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 0, 0));
    return shadowOf(ShadowGestureDetector.getLastActiveDetector());

}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowGestureDetector shadowOf(GestureDetector instance) {
  return (ShadowGestureDetector) shadowOf_(instance);
}