WidgetAppearanceUtils { public static boolean isFrontCameraAppearance(FormEntryPrompt prompt) { String appearance = getSanitizedAppearanceHint(prompt); return appearance.contains(FRONT) || appearance.contains(NEW_FRONT) || appearance.contains(SELFIE); } private  WidgetAppearanceUtils(); static @NonNull String getSanitizedAppearanceHint(FormEntryPrompt fep); static boolean hasAppearance(FormEntryPrompt fep, String appearance); static int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context); static boolean isNoButtonsAppearance(FormEntryPrompt prompt); static boolean isCompactAppearance(FormEntryPrompt prompt); static boolean useThousandSeparator(FormEntryPrompt prompt); static boolean isFrontCameraAppearance(FormEntryPrompt prompt); static boolean isFlexAppearance(FormEntryPrompt prompt); static boolean isAutocomplete(FormEntryPrompt prompt); static final String ETHIOPIAN; static final String COPTIC; static final String ISLAMIC; static final String BIKRAM_SAMBAT; static final String MYANMAR; static final String PERSIAN; static final String NO_CALENDAR; static final String MONTH_YEAR; static final String YEAR; @Deprecated static final String COMPACT; @Deprecated static final String COMPACT_N; static final String MINIMAL; static final String COLUMNS; static final String COLUMNS_N; static final String COLUMNS_PACK; @Deprecated static final String QUICKCOMPACT; @Deprecated static final String SEARCH; static final String AUTOCOMPLETE; static final String LIST_NO_LABEL; static final String LIST; static final String LIKERT; static final String LABEL; static final String IMAGE_MAP; static final String NO_BUTTONS; static final String QUICK; static final String SIGNATURE; static final String ANNOTATE; static final String DRAW; @Deprecated static final String SELFIE; static final String NEW_FRONT; static final String NEW; static final String FRONT; static final String PLACEMENT_MAP; static final String MAPS; static final String NO_APPEARANCE; static final String BEARING; static final String EX; static final String THOUSANDS_SEP; static final String PRINTER; static final String NUMBERS; static final String URL; static final String RATING; }
@Test public void isFrontCameraAppearance_returnsFalse_whenFrontCameraAppearanceIsNotFound() { assertFalse(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); }
@Test public void isFrontCameraAppearance_returnsTrue_whenFrontAppearanceIsFound() { when(formEntryPrompt.getAppearanceHint()).thenReturn("FRONT"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("front"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("FrontCompact"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); }
@Test public void isFrontCameraAppearance_returnsTrue_whenNewFrontAppearanceIsFound() { when(formEntryPrompt.getAppearanceHint()).thenReturn("NEW-FRONT"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("new-front"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("New-frontCompact"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); }
@Test public void isFrontCameraAppearance_returnsTrue_whenSelfieAppearanceIsFound() { when(formEntryPrompt.getAppearanceHint()).thenReturn("SELFIE"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("selfie"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); when(formEntryPrompt.getAppearanceHint()).thenReturn("SelfieCompact"); assertTrue(WidgetAppearanceUtils.isFrontCameraAppearance(formEntryPrompt)); }