use of com.jakewharton.rxbinding2.UnsafeRunnable in project RxBinding by JakeWharton.
the class RxSlidingPaneLayoutTest method open.
@Test
public void open() {
final Consumer<? super Boolean> open = RxSlidingPaneLayout.open(view);
view.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelOpened(View panel) {
idler.decrement();
}
@Override
public void onPanelClosed(View panel) {
idler.decrement();
}
});
idler.increment();
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
protected void unsafeRun() throws Exception {
open.accept(true);
}
});
instrumentation.waitForIdleSync();
onView(withId(view.getId())).check(matches(isOpen()));
idler.increment();
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
protected void unsafeRun() throws Exception {
open.accept(false);
}
});
instrumentation.waitForIdleSync();
onView(withId(view.getId())).check(matches(isClosed()));
view.setPanelSlideListener(null);
}
use of com.jakewharton.rxbinding2.UnsafeRunnable in project RxBinding by JakeWharton.
the class RxDrawerLayoutTest method open.
@Test
public void open() {
final Consumer<? super Boolean> open = RxDrawerLayout.open(view, RIGHT);
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
protected void unsafeRun() throws Exception {
open.accept(true);
}
});
onView(withId(view.getId())).check(matches(isOpen(RIGHT)));
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
protected void unsafeRun() throws Exception {
open.accept(false);
}
});
onView(withId(view.getId())).check(matches(isClosed(RIGHT)));
}
use of com.jakewharton.rxbinding2.UnsafeRunnable in project RxBinding by JakeWharton.
the class RxAdapterViewTest method selection.
@Test
public void selection() {
final Consumer<? super Integer> action = RxAdapterView.selection(spinner);
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
public void unsafeRun() throws Exception {
action.accept(2);
}
});
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
assertEquals(2, spinner.getSelectedItemPosition());
}
});
instrumentation.runOnMainSync(new UnsafeRunnable() {
@Override
public void unsafeRun() throws Exception {
action.accept(1);
}
});
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
assertEquals(1, spinner.getSelectedItemPosition());
}
});
}
Aggregations