Search in sources :

Example 1 with SwipeDismissBehavior

use of com.google.android.material.behavior.SwipeDismissBehavior in project RxBinding by JakeWharton.

the class RxSwipeDismissBehaviorTest method dismisses.

@Test
public void dismisses() {
    ((CoordinatorLayout.LayoutParams) view.getLayoutParams()).setBehavior(new SwipeDismissBehavior());
    RecordingObserver<View> o = new RecordingObserver<>();
    RxSwipeDismissBehavior.dismisses(view).subscribeOn(AndroidSchedulers.mainThread()).subscribe(o);
    // No initial value.
    o.assertNoMoreEvents();
    onView(withId(1)).perform(swipeRight());
    assertEquals(view, o.takeNext());
    o.dispose();
    onView(withId(1)).perform(swipeRight());
    o.assertNoMoreEvents();
}
Also used : SwipeDismissBehavior(com.google.android.material.behavior.SwipeDismissBehavior) RecordingObserver(com.jakewharton.rxbinding4.RecordingObserver) Espresso.onView(androidx.test.espresso.Espresso.onView) View(android.view.View) Test(org.junit.Test)

Aggregations

View (android.view.View)1 Espresso.onView (androidx.test.espresso.Espresso.onView)1 SwipeDismissBehavior (com.google.android.material.behavior.SwipeDismissBehavior)1 RecordingObserver (com.jakewharton.rxbinding4.RecordingObserver)1 Test (org.junit.Test)1