Search in sources :

Example 1 with BidiFormatter

use of androidx.core.text.BidiFormatter in project android_packages_apps_Settings by DirtyUnicorns.

the class VirtualKeyboardPreferenceControllerTest method updateState_multiImeWithMixedLocale_setImeLabelToSummary.

@Test
public void updateState_multiImeWithMixedLocale_setImeLabelToSummary() {
    final BidiFormatter formatter = BidiFormatter.getInstance();
    final ComponentName componentName = new ComponentName("pkg", "cls");
    final List<InputMethodInfo> imis = new ArrayList<>();
    final String label1 = "label";
    final String label2 = "Keyboard מִקְלֶדֶת";
    imis.add(mock(InputMethodInfo.class));
    imis.add(mock(InputMethodInfo.class));
    when(mDpm.getPermittedInputMethodsForCurrentUser()).thenReturn(null);
    when(mImm.getEnabledInputMethodList()).thenReturn(imis);
    when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
    when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
    mController.updateState(mPreference);
    verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
}
Also used : BidiFormatter(androidx.core.text.BidiFormatter) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Example 2 with BidiFormatter

use of androidx.core.text.BidiFormatter in project android_packages_apps_Settings by SudaMod.

the class VirtualKeyboardPreferenceControllerTest method updateState_multiImeWithMixedLocale_setImeLabelToSummary.

@Test
public void updateState_multiImeWithMixedLocale_setImeLabelToSummary() {
    final BidiFormatter formatter = BidiFormatter.getInstance();
    final ComponentName componentName = new ComponentName("pkg", "cls");
    final List<InputMethodInfo> imis = new ArrayList<>();
    final String label1 = "label";
    final String label2 = "Keyboard מִקְלֶדֶת";
    imis.add(mock(InputMethodInfo.class));
    imis.add(mock(InputMethodInfo.class));
    when(mDpm.getPermittedInputMethodsForCurrentUser()).thenReturn(null);
    when(mImm.getEnabledInputMethodList()).thenReturn(imis);
    when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
    when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
    mController.updateState(mPreference);
    verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
}
Also used : BidiFormatter(androidx.core.text.BidiFormatter) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Example 3 with BidiFormatter

use of androidx.core.text.BidiFormatter in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class VirtualKeyboardPreferenceControllerTest method updateState_multiImeWithMixedLocale_setImeLabelToSummary.

@Test
public void updateState_multiImeWithMixedLocale_setImeLabelToSummary() {
    final BidiFormatter formatter = BidiFormatter.getInstance();
    final ComponentName componentName = new ComponentName("pkg", "cls");
    final List<InputMethodInfo> imis = new ArrayList<>();
    final String label1 = "label";
    final String label2 = "Keyboard מִקְלֶדֶת";
    imis.add(mock(InputMethodInfo.class));
    imis.add(mock(InputMethodInfo.class));
    when(mDpm.getPermittedInputMethodsForCurrentUser()).thenReturn(null);
    when(mImm.getEnabledInputMethodList()).thenReturn(imis);
    when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
    when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
    mController.updateState(mPreference);
    verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
}
Also used : BidiFormatter(androidx.core.text.BidiFormatter) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Example 4 with BidiFormatter

use of androidx.core.text.BidiFormatter in project android_packages_apps_Settings by omnirom.

the class VirtualKeyboardPreferenceControllerTest method updateState_multiImeWithMixedLocale_setImeLabelToSummary.

@Test
public void updateState_multiImeWithMixedLocale_setImeLabelToSummary() {
    final BidiFormatter formatter = BidiFormatter.getInstance();
    final ComponentName componentName = new ComponentName("pkg", "cls");
    final List<InputMethodInfo> imis = new ArrayList<>();
    final String label1 = "label";
    final String label2 = "Keyboard מִקְלֶדֶת";
    imis.add(mock(InputMethodInfo.class));
    imis.add(mock(InputMethodInfo.class));
    when(mDpm.getPermittedInputMethodsForCurrentUser()).thenReturn(null);
    when(mImm.getEnabledInputMethodList()).thenReturn(imis);
    when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
    when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
    mController.updateState(mPreference);
    verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
}
Also used : BidiFormatter(androidx.core.text.BidiFormatter) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Example 5 with BidiFormatter

use of androidx.core.text.BidiFormatter in project android_packages_apps_Settings by crdroidandroid.

the class VirtualKeyboardPreferenceControllerTest method updateState_multiImeWithMixedLocale_setImeLabelToSummary.

@Test
public void updateState_multiImeWithMixedLocale_setImeLabelToSummary() {
    final BidiFormatter formatter = BidiFormatter.getInstance();
    final ComponentName componentName = new ComponentName("pkg", "cls");
    final List<InputMethodInfo> imis = new ArrayList<>();
    final String label1 = "label";
    final String label2 = "Keyboard מִקְלֶדֶת";
    imis.add(mock(InputMethodInfo.class));
    imis.add(mock(InputMethodInfo.class));
    when(mDpm.getPermittedInputMethodsForCurrentUser()).thenReturn(null);
    when(mImm.getEnabledInputMethodList()).thenReturn(imis);
    when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
    when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
    when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
    mController.updateState(mPreference);
    verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
}
Also used : BidiFormatter(androidx.core.text.BidiFormatter) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) InputMethodInfo(android.view.inputmethod.InputMethodInfo) Test(org.junit.Test)

Aggregations

ComponentName (android.content.ComponentName)5 InputMethodInfo (android.view.inputmethod.InputMethodInfo)5 BidiFormatter (androidx.core.text.BidiFormatter)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5