SwtRx { public static Chit chit(ControlWrapper wrapper) { return chit(wrapper.getRootControl()); }  static @SwtThread Observable<Event> addListener(Widget widget, int... events); static @SwtThread Observable<Event> addListener(Widget widget, Collection<Integer> events); static @SwtThread Observable<Event> addListener(Widget widget, Stream<Integer> events); static @SwtThread Observable<Point> rightClickGlobal(Control ctl); static @SwtThread Observable<Point> rightClickLocal(Control ctl); static @SwtThread RxBox<String> textImmediate(Text text); static @SwtThread RxBox<String> textConfirmed(Text text); static RxBox<Boolean> toggle(Button btn); static RxBox<T> combo(Combo combo, ImmutableList<T> values, Function<T, String> converter); static void combo(Combo combo, ImmutableList<T> values, Function<T, String> converter, RxBox<T> box); static Chit chit(ControlWrapper wrapper); static Chit chit(Widget guard);  }
@Test public void testDisposableEar() { InteractiveTest.testCoat("Non-interactive, will pass itself", cmp -> { Shell underTest = new Shell(cmp.getShell(), SWT.NONE); Chit chit = SwtRx.chit(underTest); Assert.assertFalse(chit.isDisposed()); Box<Boolean> hasBeenDisposed = Box.of(false); chit.runWhenDisposed(() -> hasBeenDisposed.set(true)); Assert.assertFalse(hasBeenDisposed.get()); underTest.dispose(); Assert.assertTrue(hasBeenDisposed.get()); Assert.assertTrue(chit.isDisposed()); Box<Boolean> alreadyDisposed = Box.of(false); chit.runWhenDisposed(() -> alreadyDisposed.set(true)); Assert.assertTrue(alreadyDisposed.get()); InteractiveTest.closeAndPass(cmp); }); }