Search in sources :

Example 66 with UiThreadTest

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));
}
Also used : Resources(android.content.res.Resources) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 67 with UiThreadTest

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);
}
Also used : Resources(android.content.res.Resources) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 68 with UiThreadTest

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));
}
Also used : Resources(android.content.res.Resources) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 69 with UiThreadTest

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);
}
Also used : Intent(android.content.Intent) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 70 with UiThreadTest

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();
}
Also used : Activity(android.app.Activity) UiThreadTest(androidx.test.annotation.UiThreadTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Aggregations

UiThreadTest (androidx.test.annotation.UiThreadTest)136 Test (org.junit.Test)129 View (android.view.View)41 Unbinder (butterknife.Unbinder)31 Context (android.content.Context)23 AdapterView (android.widget.AdapterView)18 TextView (android.widget.TextView)15 RecordingObserver (com.jakewharton.rxbinding4.RecordingObserver)15 MediumTest (androidx.test.filters.MediumTest)14 Intent (android.content.Intent)10 SubscriptionInfo (android.telephony.SubscriptionInfo)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 LocalPSMP (de.danoeh.antennapod.core.service.playback.LocalPSMP)9 PlaybackServiceMediaPlayer (de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer)9 Slice (androidx.slice.Slice)8 Playable (de.danoeh.antennapod.model.playback.Playable)8 AssertionFailedError (junit.framework.AssertionFailedError)8 Before (org.junit.Before)7 ViewGroup (android.view.ViewGroup)6 FrameLayout (android.widget.FrameLayout)6