From 8a7451a56587675664f04ec389467a52398c81fe Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 31 Mar 2022 15:27:35 +0100 Subject: [PATCH] Allow 5 hotseat icons in tablet 3 button Fix: 223756731 Test: manual Change-Id: Iacde8b9506c09a20d6b2b917da8f6589009aadc7 --- .../launcher3/DeviceProfileBaseTest.kt | 8 +-- .../com/android/launcher3/HotseatSizeTest.kt | 52 ++++++++++++++----- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/tests/src/com/android/launcher3/DeviceProfileBaseTest.kt b/tests/src/com/android/launcher3/DeviceProfileBaseTest.kt index e598df961d8..f91f1c4288d 100644 --- a/tests/src/com/android/launcher3/DeviceProfileBaseTest.kt +++ b/tests/src/com/android/launcher3/DeviceProfileBaseTest.kt @@ -88,11 +88,11 @@ abstract class DeviceProfileBaseTest { protected fun newScalableInvariantDeviceProfile(): InvariantDeviceProfile = InvariantDeviceProfile().apply { isScalable = true - numColumns = 5 - numRows = 5 - numShownHotseatIcons = 5 + numColumns = 4 + numRows = 4 + numShownHotseatIcons = 4 numDatabaseHotseatIcons = 6 - numShrunkenHotseatIcons = 4 + numShrunkenHotseatIcons = 5 horizontalMargin = FloatArray(4) { 22f } borderSpaces = listOf( PointF(16f, 16f), diff --git a/tests/src/com/android/launcher3/HotseatSizeTest.kt b/tests/src/com/android/launcher3/HotseatSizeTest.kt index ca697d7c963..a44939f4cf4 100644 --- a/tests/src/com/android/launcher3/HotseatSizeTest.kt +++ b/tests/src/com/android/launcher3/HotseatSizeTest.kt @@ -43,11 +43,11 @@ class HotseatSizeTest : DeviceProfileBaseTest() { val dp = newDP() assertThat(dp.isQsbInline).isFalse() - assertThat(dp.numShownHotseatIcons).isEqualTo(5) + assertThat(dp.numShownHotseatIcons).isEqualTo(4) } @Test - fun hotseat_size_is_max_for_foldables() { + fun hotseat_size_is_max_when_large_screen() { initializeVarsForTablet(isLandscape = true) inv = newScalableInvariantDeviceProfile().apply { deviceType = TYPE_MULTI_DISPLAY @@ -61,7 +61,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { } @Test - fun hotseat_size_is_shrunk_if_needed() { + fun hotseat_size_is_shrunk_if_needed_when_large_screen() { initializeVarsForTablet(isLandscape = true) inv = newScalableInvariantDeviceProfile().apply { deviceType = TYPE_MULTI_DISPLAY @@ -79,7 +79,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { if (dp.hotseatQsbHeight > 0) { assertThat(dp.isQsbInline).isTrue() - assertThat(dp.numShownHotseatIcons).isEqualTo(4) + assertThat(dp.numShownHotseatIcons).isEqualTo(5) } else { // Launcher3 doesn't have QSB height assertThat(dp.isQsbInline).isFalse() assertThat(dp.numShownHotseatIcons).isEqualTo(6) @@ -91,7 +91,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { * inline qsb */ @Test - fun hotseat_size_is_shrunk_even_in_portrait() { + fun hotseat_size_is_shrunk_even_in_portrait_when_large_screen() { initializeVarsForTablet() inv = newScalableInvariantDeviceProfile().apply { deviceType = TYPE_MULTI_DISPLAY @@ -109,7 +109,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { if (dp.hotseatQsbHeight > 0) { assertThat(dp.isQsbInline).isFalse() - assertThat(dp.numShownHotseatIcons).isEqualTo(4) + assertThat(dp.numShownHotseatIcons).isEqualTo(5) } else { // Launcher3 doesn't have QSB height assertThat(dp.isQsbInline).isFalse() assertThat(dp.numShownHotseatIcons).isEqualTo(6) @@ -117,7 +117,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { } @Test - fun hotseat_size_is_default_when_folded() { + fun hotseat_size_is_default_when_small_screen() { initializeVarsForPhone() inv = newScalableInvariantDeviceProfile().apply { deviceType = TYPE_MULTI_DISPLAY @@ -126,7 +126,33 @@ class HotseatSizeTest : DeviceProfileBaseTest() { val dp = newDP() - assertThat(dp.numShownHotseatIcons).isEqualTo(5) + assertThat(dp.numShownHotseatIcons).isEqualTo(4) + } + + @Test + fun hotseat_size_is_not_shrunk_on_gesture_tablet() { + initializeVarsForTablet(isLandscape = true) + inv = newScalableInvariantDeviceProfile().apply { + deviceType = TYPE_TABLET + inlineQsb = booleanArrayOf( + false, + true, // landscape + false, + false + ) + numShownHotseatIcons = 6 + } + + isGestureMode = true + val dp = newDP() + + if (dp.hotseatQsbHeight > 0) { + assertThat(dp.isQsbInline).isTrue() + assertThat(dp.numShownHotseatIcons).isEqualTo(6) + } else { // Launcher3 doesn't have QSB height + assertThat(dp.isQsbInline).isFalse() + assertThat(dp.numShownHotseatIcons).isEqualTo(6) + } } @Test @@ -140,6 +166,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { false, false ) + numShownHotseatIcons = 6 } isGestureMode = false @@ -147,10 +174,10 @@ class HotseatSizeTest : DeviceProfileBaseTest() { if (dp.hotseatQsbHeight > 0) { assertThat(dp.isQsbInline).isTrue() - assertThat(dp.numShownHotseatIcons).isEqualTo(4) + assertThat(dp.numShownHotseatIcons).isEqualTo(5) } else { // Launcher3 doesn't have QSB height assertThat(dp.isQsbInline).isFalse() - assertThat(dp.numShownHotseatIcons).isEqualTo(5) + assertThat(dp.numShownHotseatIcons).isEqualTo(6) } } @@ -169,6 +196,7 @@ class HotseatSizeTest : DeviceProfileBaseTest() { false, false ) + numShownHotseatIcons = 6 } isGestureMode = false @@ -176,10 +204,10 @@ class HotseatSizeTest : DeviceProfileBaseTest() { if (dp.hotseatQsbHeight > 0) { assertThat(dp.isQsbInline).isFalse() - assertThat(dp.numShownHotseatIcons).isEqualTo(4) + assertThat(dp.numShownHotseatIcons).isEqualTo(5) } else { // Launcher3 doesn't have QSB height assertThat(dp.isQsbInline).isFalse() - assertThat(dp.numShownHotseatIcons).isEqualTo(5) + assertThat(dp.numShownHotseatIcons).isEqualTo(6) } } -- GitLab