use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FirmwareVersionPreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final Context context = RuntimeEnvironment.application;
final PreferenceManager preferenceManager = new PreferenceManager(context);
mController = new FirmwareVersionPreferenceController(context, KEY);
mPreference = new Preference(context);
mPreference.setKey(KEY);
mScreen = preferenceManager.createPreferenceScreen(context);
mScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HardwareInfoPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mController = new HardwareInfoPreferenceController(mContext, KEY);
mPreference = new Preference(mContext);
mPreference.setKey(KEY);
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = preferenceManager.createPreferenceScreen(mContext);
mPreferenceScreen.addPreference(mPreference);
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndSubtypePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPreferenceManager = new PreferenceManager(mContext);
when(mFragment.getContext()).thenReturn(mContext);
when(mFragment.getResources()).thenReturn(mContext.getResources());
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
mController = new InputMethodAndSubtypePreferenceController(mContext, "pref_key");
mController.initialize(mFragment, "");
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndSubtypePreferenceControllerTest method displayPreference_hasInputMethodSubType_shouldAddPreference.
@Test
public void displayPreference_hasInputMethodSubType_shouldAddPreference() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mController.displayPreference(screen);
assertThat(screen.getPreferenceCount()).isEqualTo(0);
final List<InputMethodInfo> imis = new ArrayList<>();
imis.add(createInputMethodInfo("test", mContext));
ShadowInputMethodManagerWithMethodList.getShadow().setInputMethodList(imis);
mController.initialize(mFragment, "");
mController.displayPreference(screen);
assertThat(screen.getPreferenceCount()).isEqualTo(2);
}
use of androidx.preference.PreferenceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class KeyboardLayoutPickerControllerTest method test_createPreferenceHierarchy_shouldAddTwoPreference.
@Test
public void test_createPreferenceHierarchy_shouldAddTwoPreference() {
initializeTwoLayouts();
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mController.displayPreference(screen);
// We create two keyboard layouts in initializeOneLayout()
assertThat(screen.getPreferenceCount()).isEqualTo(2);
}
Aggregations