use of android.support.test.annotation.UiThreadTest in project xDrip-plus by jamorham.
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);
}
use of android.support.test.annotation.UiThreadTest in project teamward-client by Neamar.
the class FlowTest method setUp.
@UiThreadTest
@Before
public void setUp() throws Throwable {
// Clean up all accounts
InstrumentationRegistry.getTargetContext().getSharedPreferences("accounts", Context.MODE_PRIVATE).edit().clear().commit();
mActivityTestRule.launchActivity(null);
final Activity activity = mActivityTestRule.getActivity();
mActivityTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
KeyguardManager mKG = (KeyguardManager) activity.getSystemService(KEYGUARD_SERVICE);
KeyguardManager.KeyguardLock mLock = mKG.newKeyguardLock(KEYGUARD_SERVICE);
mLock.disableKeyguard();
// turn the screen on
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);
}
});
}
use of android.support.test.annotation.UiThreadTest in project BottomBar by roughike.
the class BottomBarTest method afterConfigurationChanged_SavedStateRestored_AndSelectedTabPersists.
@Test
@UiThreadTest
public void afterConfigurationChanged_SavedStateRestored_AndSelectedTabPersists() {
bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_favorites);
Bundle savedState = bottomBar.saveState();
bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_nearby);
bottomBar.restoreState(savedState);
assertEquals(com.roughike.bottombar.test.R.id.tab_favorites, bottomBar.getCurrentTabId());
}
use of android.support.test.annotation.UiThreadTest in project BottomBar by roughike.
the class BottomBarTest method whenTabIsSelected_SelectionListenerIsFired.
@Test
@UiThreadTest
public void whenTabIsSelected_SelectionListenerIsFired() {
bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_friends);
bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_nearby);
bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_favorites);
InOrder inOrder = inOrder(selectListener);
inOrder.verify(selectListener, times(1)).onTabSelected(com.roughike.bottombar.test.R.id.tab_friends);
inOrder.verify(selectListener, times(1)).onTabSelected(com.roughike.bottombar.test.R.id.tab_nearby);
inOrder.verify(selectListener, times(1)).onTabSelected(com.roughike.bottombar.test.R.id.tab_favorites);
inOrder.verifyNoMoreInteractions();
}
use of android.support.test.annotation.UiThreadTest in project BottomBar by roughike.
the class BottomBarTest method setTitleTypeface_UpdatesTypeface.
@Test
@UiThreadTest
public void setTitleTypeface_UpdatesTypeface() {
BottomBarTab tab = bottomBar.getCurrentTab();
Typeface testTypeface = Typeface.createFromAsset(bottomBar.getContext().getAssets(), "fonts/GreatVibes-Regular.otf");
assertNotEquals(testTypeface, tab.getTitleTypeFace());
assertNotEquals(testTypeface, tab.getTitleView().getTypeface());
bottomBar.setTabTitleTypeface(testTypeface);
assertEquals(testTypeface, tab.getTitleTypeFace());
assertEquals(testTypeface, tab.getTitleView().getTypeface());
}
Aggregations