use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class ColorModePreferenceFragmentTest method getCandidates_withAutomatic.
@Test
@UiThreadTest
public void getCandidates_withAutomatic() {
final Resources res = spy(mContext.getResources());
when(res.getIntArray(com.android.internal.R.array.config_availableColorModes)).thenReturn(new int[] { ColorDisplayManager.COLOR_MODE_NATURAL, ColorDisplayManager.COLOR_MODE_AUTOMATIC });
doReturn(res).when(mContext).getResources();
mFragment.onAttach(mContext);
List<? extends CandidateInfo> candidates = mFragment.getCandidates();
assertThat(candidates.size()).isEqualTo(2);
assertThat(candidates.get(0).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_NATURAL));
assertThat(candidates.get(1).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC));
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class ColorModePreferenceFragmentTest method getCandidates_none.
@Test
@UiThreadTest
public void getCandidates_none() {
final Resources res = spy(mContext.getResources());
when(res.getIntArray(com.android.internal.R.array.config_availableColorModes)).thenReturn(new int[] {});
doReturn(res).when(mContext).getResources();
mFragment.onAttach(mContext);
List<? extends CandidateInfo> candidates = mFragment.getCandidates();
assertThat(candidates.size()).isEqualTo(0);
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class ColorModePreferenceFragmentTest method getCandidates_all.
@Test
@UiThreadTest
public void getCandidates_all() {
final Resources res = spy(mContext.getResources());
when(res.getIntArray(com.android.internal.R.array.config_availableColorModes)).thenReturn(new int[] { ColorDisplayManager.COLOR_MODE_NATURAL, ColorDisplayManager.COLOR_MODE_BOOSTED, ColorDisplayManager.COLOR_MODE_SATURATED, ColorDisplayManager.COLOR_MODE_AUTOMATIC });
doReturn(res).when(mContext).getResources();
mFragment.onAttach(mContext);
final List<? extends CandidateInfo> candidates = mFragment.getCandidates();
assertThat(candidates.size()).isEqualTo(4);
assertThat(candidates.get(0).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_NATURAL));
assertThat(candidates.get(1).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_BOOSTED));
assertThat(candidates.get(2).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_SATURATED));
assertThat(candidates.get(3).getKey()).isEqualTo(mFragment.getKeyForColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC));
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class DataUsageSummaryPreferenceTest method testSetUsageInfo_withLaunchIntent_launchButtonShown.
@UiThreadTest
@Test
public void testSetUsageInfo_withLaunchIntent_launchButtonShown() {
mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, FAKE_CARRIER, 0, /* numPlans */
new Intent());
mSummaryPreference.onBindViewHolder(mHolder);
assertThat(mSummaryPreference.getLaunchButton(mHolder).getVisibility()).isEqualTo(View.VISIBLE);
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class ProfileSelectStorageFragmentTest method test_initializeOptionsMenuInvalidatesExistingMenu.
@Test
@UiThreadTest
public void test_initializeOptionsMenuInvalidatesExistingMenu() {
final Activity activity = mock(Activity.class);
mFragment.initializeOptionsMenu(activity);
verify(activity).invalidateOptionsMenu();
}
Aggregations