use of android.accessibilityservice.AccessibilityService.GestureResultCallback in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method getGesturesDispatched_returnsFirstGestureResultCallback.
@Test
@Config(minSdk = N)
public void getGesturesDispatched_returnsFirstGestureResultCallback() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null);
assertThat(shadow.getGesturesDispatched().get(0).callback()).isSameInstanceAs(gestureResultCallback);
}
use of android.accessibilityservice.AccessibilityService.GestureResultCallback in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method setCanDispatchGestures_true_causesDispatchGestureToReturnTrue.
@Test
@Config(minSdk = N)
public void setCanDispatchGestures_true_causesDispatchGestureToReturnTrue() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
shadow.setCanDispatchGestures(false);
shadow.setCanDispatchGestures(true);
assertThat(service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null)).isTrue();
}
use of android.accessibilityservice.AccessibilityService.GestureResultCallback in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method getGesturesDispatched_returnsFirstGestureDescription.
@Test
@Config(minSdk = N)
public void getGesturesDispatched_returnsFirstGestureDescription() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null);
assertThat(shadow.getGesturesDispatched().get(0).description()).isSameInstanceAs(gestureDescription);
}
use of android.accessibilityservice.AccessibilityService.GestureResultCallback in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method setCanDispatchGestures_false_stopsRecordingDispatchedGestures.
@Test
@Config(minSdk = N)
public void setCanDispatchGestures_false_stopsRecordingDispatchedGestures() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
shadow.setCanDispatchGestures(false);
service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null);
assertThat(shadow.getGesturesDispatched()).isEmpty();
}
use of android.accessibilityservice.AccessibilityService.GestureResultCallback in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method setCanDispatchGestures_false_causesDispatchGestureToReturnFalse.
@Test
@Config(minSdk = N)
public void setCanDispatchGestures_false_causesDispatchGestureToReturnFalse() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
shadow.setCanDispatchGestures(false);
assertThat(service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null)).isFalse();
}
Aggregations