Search in sources :

Example 1 with GestureResultCallback

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);
}
Also used : GestureDescription(android.accessibilityservice.GestureDescription) GestureResultCallback(android.accessibilityservice.AccessibilityService.GestureResultCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 2 with 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();
}
Also used : GestureDescription(android.accessibilityservice.GestureDescription) GestureResultCallback(android.accessibilityservice.AccessibilityService.GestureResultCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 3 with GestureResultCallback

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);
}
Also used : GestureDescription(android.accessibilityservice.GestureDescription) GestureResultCallback(android.accessibilityservice.AccessibilityService.GestureResultCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 4 with GestureResultCallback

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();
}
Also used : GestureDescription(android.accessibilityservice.GestureDescription) GestureResultCallback(android.accessibilityservice.AccessibilityService.GestureResultCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 5 with GestureResultCallback

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();
}
Also used : GestureDescription(android.accessibilityservice.GestureDescription) GestureResultCallback(android.accessibilityservice.AccessibilityService.GestureResultCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

GestureResultCallback (android.accessibilityservice.AccessibilityService.GestureResultCallback)5 GestureDescription (android.accessibilityservice.GestureDescription)5 Test (org.junit.Test)5 Config (org.robolectric.annotation.Config)5