use of android.support.test.annotation.UiThreadTest in project realm-java by realm.
the class RxJavaTests method dynamicRealmResults_emittedOnSubscribe.
@Test
@UiThreadTest
public void dynamicRealmResults_emittedOnSubscribe() {
final DynamicRealm dynamicRealm = DynamicRealm.getInstance(realm.getConfiguration());
final AtomicBoolean subscribedNotified = new AtomicBoolean(false);
final RealmResults<DynamicRealmObject> results = dynamicRealm.where(AllTypes.CLASS_NAME).findAll();
subscription = results.asObservable().subscribe(new Action1<RealmResults<DynamicRealmObject>>() {
@Override
public void call(RealmResults<DynamicRealmObject> rxResults) {
assertTrue(rxResults == results);
subscribedNotified.set(true);
}
});
assertTrue(subscribedNotified.get());
dynamicRealm.close();
subscription.unsubscribe();
}
use of android.support.test.annotation.UiThreadTest in project realm-java by realm.
the class RxJavaTests method realmResults_emittedOnSubscribe.
@Test
@UiThreadTest
public void realmResults_emittedOnSubscribe() {
final AtomicBoolean subscribedNotified = new AtomicBoolean(false);
final RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
subscription = results.asObservable().subscribe(new Action1<RealmResults<AllTypes>>() {
@Override
public void call(RealmResults<AllTypes> rxResults) {
assertTrue(rxResults == results);
subscribedNotified.set(true);
}
});
assertTrue(subscribedNotified.get());
subscription.unsubscribe();
}
use of android.support.test.annotation.UiThreadTest in project realm-java by realm.
the class RxJavaTests method findFirst_emittedOnSubscribe.
@Test
@UiThreadTest
public void findFirst_emittedOnSubscribe() {
realm.beginTransaction();
realm.createObject(AllTypes.class).setColumnLong(42);
realm.commitTransaction();
final AtomicBoolean subscribedNotified = new AtomicBoolean(false);
subscription = realm.where(AllTypes.class).equalTo(AllTypes.FIELD_LONG, 42).findFirst().<AllTypes>asObservable().subscribe(new Action1<AllTypes>() {
@Override
public void call(AllTypes rxObject) {
subscribedNotified.set(true);
}
});
assertTrue(subscribedNotified.get());
subscription.unsubscribe();
}
use of android.support.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxViewTest method longClicks.
@Test
@UiThreadTest
public void longClicks() {
// We need a parent because long presses delegate to the parent.
LinearLayout parent = new LinearLayout(context) {
@Override
public boolean showContextMenuForChild(View originalView) {
return true;
}
};
parent.addView(view);
RecordingObserver<Object> o = new RecordingObserver<>();
RxView.longClicks(view).subscribe(o);
// No initial value.
o.assertNoMoreEvents();
view.performLongClick();
assertNotNull(o.takeNext());
view.performLongClick();
assertNotNull(o.takeNext());
o.dispose();
view.performLongClick();
o.assertNoMoreEvents();
}
use of android.support.test.annotation.UiThreadTest in project xDrip by NightscoutFoundation.
the class HomeEspressoTest method setUp.
@UiThreadTest
@Before
public synchronized void setUp() throws Exception {
if (!onetime) {
onetime = true;
clearAllPrefs();
}
final Activity activity = mActivityRule.getActivity();
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
}
Aggregations