use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AvailableMediaDeviceGroupControllerTest method onDeviceRemoved_notLastRemove_stillVisible.
@Test
public void onDeviceRemoved_notLastRemove_stillVisible() {
mPreferenceGroup.setVisible(true);
mPreferenceGroup.addPreference(mPreference);
mPreferenceGroup.addPreference(new Preference(mContext));
mAvailableMediaDeviceGroupController.onDeviceRemoved(mPreference);
assertThat(mPreferenceGroup.isVisible()).isTrue();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BasePreferenceControllerTest method disabledDependentSetting_disabledOnDisplayPreference_preferenceDisabled.
@Test
public void disabledDependentSetting_disabledOnDisplayPreference_preferenceDisabled() {
final PreferenceScreen screen = mock(PreferenceScreen.class);
final Preference preference = new Preference(mContext);
preference.setEnabled(true);
when(screen.findPreference(anyString())).thenReturn(preference);
mPreferenceController.setAvailability(DISABLED_DEPENDENT_SETTING);
mPreferenceController.displayPreference(screen);
assertThat(preference.isEnabled()).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BasePreferenceControllerTest method settingAvailable_disabledOnDisplayPreference_preferenceEnabled.
@Test
public void settingAvailable_disabledOnDisplayPreference_preferenceEnabled() {
final PreferenceScreen screen = mock(PreferenceScreen.class);
final Preference preference = new Preference(mContext);
preference.setEnabled(true);
when(screen.findPreference(anyString())).thenReturn(preference);
mPreferenceController.displayPreference(screen);
assertThat(preference.isEnabled()).isTrue();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppDataUsageTest method bindData_hasAppUsageData_shouldShowCycleSpinnerAndUpdateUsageSummary.
@Test
public void bindData_hasAppUsageData_shouldShowCycleSpinnerAndUpdateUsageSummary() {
mFragment = spy(new AppDataUsage());
final Context context = RuntimeEnvironment.application;
ReflectionHelpers.setField(mFragment, "mContext", context);
final long backgroundBytes = 1234L;
final long foregroundBytes = 5678L;
final List<NetworkCycleDataForUid> appUsage = new ArrayList<>();
appUsage.add(new NetworkCycleDataForUid.Builder().setBackgroundUsage(backgroundBytes).setForegroundUsage(foregroundBytes).build());
ReflectionHelpers.setField(mFragment, "mUsageData", appUsage);
final Preference backgroundPref = mock(Preference.class);
ReflectionHelpers.setField(mFragment, "mBackgroundUsage", backgroundPref);
final Preference foregroundPref = mock(Preference.class);
ReflectionHelpers.setField(mFragment, "mForegroundUsage", foregroundPref);
final Preference totalPref = mock(Preference.class);
ReflectionHelpers.setField(mFragment, "mTotalUsage", totalPref);
final SpinnerPreference cycle = mock(SpinnerPreference.class);
ReflectionHelpers.setField(mFragment, "mCycle", cycle);
mFragment.bindData(0);
verify(cycle).setVisible(true);
verify(totalPref).setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes + foregroundBytes));
verify(backgroundPref).setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes));
verify(foregroundPref).setSummary(DataUsageUtils.formatDataUsage(context, foregroundBytes));
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConnectedDeviceGroupControllerTest method onDeviceRemoved_notLastRemove_stillVisible.
@Test
public void onDeviceRemoved_notLastRemove_stillVisible() {
mPreferenceGroup.setVisible(true);
mPreferenceGroup.addPreference(mPreference);
mPreferenceGroup.addPreference(new Preference(mContext));
mConnectedDeviceGroupController.onDeviceRemoved(mPreference);
assertThat(mPreferenceGroup.isVisible()).isTrue();
}
Aggregations