Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/source/TestShortcuts.kt +31 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,27 @@ object TestShortcuts { /* modifiers = */ KeyEvent.META_SHIFT_ON, ) private val ShortcutsWithDiffSizeOfKeys = KeyboardShortcutInfo( /* label = */ "Shortcuts with diff size of keys", /* keycode = */ KeyEvent.KEYCODE_HOME, /* modifiers = */ 0, ) private val ShortcutsWithDiffSizeOfKeys2 = KeyboardShortcutInfo( /* label = */ ShortcutsWithDiffSizeOfKeys.label, /* keycode = */ KeyEvent.KEYCODE_1, /* modifiers = */ META_META_ON, ) private val ShortcutsWithDiffSizeOfKeys3 = KeyboardShortcutInfo( /* label = */ ShortcutsWithDiffSizeOfKeys.label, /* keycode = */ KeyEvent.KEYCODE_2, /* modifiers = */ META_META_ON or META_FUNCTION_ON, ) private val shortcutWithGroupedRepeatedLabel = shortcut(shortcutInfoWithRepeatedLabel.label!!.toString()) { command { Loading Loading @@ -381,6 +402,16 @@ object TestShortcuts { groupWithSupportedAndUnsupportedModifierShortcut, ) val groupWithDifferentSizeOfShortcutKeys = KeyboardShortcutGroup( "Group with different size of shortcut keys", listOf( ShortcutsWithDiffSizeOfKeys3, ShortcutsWithDiffSizeOfKeys, ShortcutsWithDiffSizeOfKeys2, ), ) val subCategoriesWithUnsupportedModifiersRemoved = listOf(subCategoryWithStandardShortcut, subCategoryWithUnsupportedShortcutsRemoved) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,20 @@ class ShortcutHelperCategoriesInteractorTest : SysuiTestCase() { } } @Test fun categories_showShortcutsInAscendingOrderOfKeySize() = testScope.runTest { systemShortcutsSource.setGroups(TestShortcuts.groupWithDifferentSizeOfShortcutKeys) val categories by collectLastValue(interactor.shortcutCategories) helper.showFromActivity() val systemCategoryShortcuts = categories?.get(0)?.subCategories?.get(0)?.shortcuts val shortcutKeyCount = systemCategoryShortcuts?.flatMap { it.commands }?.map { it.keys.size } assertThat(shortcutKeyCount).containsExactly(1, 2, 3).inOrder() } private fun setCustomInputGestures(customInputGestures: List<InputGestureData>) { whenever(fakeInputManager.inputManager.getCustomInputGestures(/* filter= */ anyOrNull())) .thenReturn(customInputGestures) Loading packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/source/SystemShortcutsSource.kt +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ constructor(@Main private val resources: Resources, private val inputManager: In listOf( KeyboardShortcutGroup( resources.getString(R.string.shortcut_helper_category_system_controls), hardwareShortcuts(deviceId) + systemControlsShortcuts(), systemControlsShortcuts() + hardwareShortcuts(deviceId), ), KeyboardShortcutGroup( resources.getString(R.string.shortcut_helper_category_system_apps), Loading packages/SystemUI/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ constructor( Shortcut( label = commonLabel, icon = groupedShortcuts.firstOrNull()?.icon, commands = groupedShortcuts.flatMap { it.commands }, commands = groupedShortcuts.flatMap { it.commands }.sortedBy { it.keys.size }, contentDescription = toContentDescription(commonLabel, groupedShortcuts.flatMap { it.commands }), ) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/source/TestShortcuts.kt +31 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,27 @@ object TestShortcuts { /* modifiers = */ KeyEvent.META_SHIFT_ON, ) private val ShortcutsWithDiffSizeOfKeys = KeyboardShortcutInfo( /* label = */ "Shortcuts with diff size of keys", /* keycode = */ KeyEvent.KEYCODE_HOME, /* modifiers = */ 0, ) private val ShortcutsWithDiffSizeOfKeys2 = KeyboardShortcutInfo( /* label = */ ShortcutsWithDiffSizeOfKeys.label, /* keycode = */ KeyEvent.KEYCODE_1, /* modifiers = */ META_META_ON, ) private val ShortcutsWithDiffSizeOfKeys3 = KeyboardShortcutInfo( /* label = */ ShortcutsWithDiffSizeOfKeys.label, /* keycode = */ KeyEvent.KEYCODE_2, /* modifiers = */ META_META_ON or META_FUNCTION_ON, ) private val shortcutWithGroupedRepeatedLabel = shortcut(shortcutInfoWithRepeatedLabel.label!!.toString()) { command { Loading Loading @@ -381,6 +402,16 @@ object TestShortcuts { groupWithSupportedAndUnsupportedModifierShortcut, ) val groupWithDifferentSizeOfShortcutKeys = KeyboardShortcutGroup( "Group with different size of shortcut keys", listOf( ShortcutsWithDiffSizeOfKeys3, ShortcutsWithDiffSizeOfKeys, ShortcutsWithDiffSizeOfKeys2, ), ) val subCategoriesWithUnsupportedModifiersRemoved = listOf(subCategoryWithStandardShortcut, subCategoryWithUnsupportedShortcutsRemoved) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,20 @@ class ShortcutHelperCategoriesInteractorTest : SysuiTestCase() { } } @Test fun categories_showShortcutsInAscendingOrderOfKeySize() = testScope.runTest { systemShortcutsSource.setGroups(TestShortcuts.groupWithDifferentSizeOfShortcutKeys) val categories by collectLastValue(interactor.shortcutCategories) helper.showFromActivity() val systemCategoryShortcuts = categories?.get(0)?.subCategories?.get(0)?.shortcuts val shortcutKeyCount = systemCategoryShortcuts?.flatMap { it.commands }?.map { it.keys.size } assertThat(shortcutKeyCount).containsExactly(1, 2, 3).inOrder() } private fun setCustomInputGestures(customInputGestures: List<InputGestureData>) { whenever(fakeInputManager.inputManager.getCustomInputGestures(/* filter= */ anyOrNull())) .thenReturn(customInputGestures) Loading
packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/source/SystemShortcutsSource.kt +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ constructor(@Main private val resources: Resources, private val inputManager: In listOf( KeyboardShortcutGroup( resources.getString(R.string.shortcut_helper_category_system_controls), hardwareShortcuts(deviceId) + systemControlsShortcuts(), systemControlsShortcuts() + hardwareShortcuts(deviceId), ), KeyboardShortcutGroup( resources.getString(R.string.shortcut_helper_category_system_apps), Loading
packages/SystemUI/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ constructor( Shortcut( label = commonLabel, icon = groupedShortcuts.firstOrNull()?.icon, commands = groupedShortcuts.flatMap { it.commands }, commands = groupedShortcuts.flatMap { it.commands }.sortedBy { it.keys.size }, contentDescription = toContentDescription(commonLabel, groupedShortcuts.flatMap { it.commands }), ) Loading