summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-10-28 18:37:58 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-10-28 18:37:58 +0000
commita545efde33f8860433a138c6738bb9c1cbd711ad (patch)
tree61540db232ec33701f93b9ce2120201ea6b0bb34
parentc6a025ef68646b9ed937719754fa634279242879 (diff)
parentb4cb61b96c165d59f4d39b28b28df5efa1dceae7 (diff)
Merge "Updating default size info if widget is not able to resize" into main
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt18
2 files changed, 19 insertions, 1 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
index e329aaee9a06..5e1ac1f30354 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
@@ -715,7 +715,7 @@ fun calculateWidgetSize(item: CommunalContentModel, isResizable: Boolean): Widge
WidgetSizeInfo(minHeightPx, maxHeightPx)
}
} else {
- WidgetSizeInfo(0, Int.MAX_VALUE)
+ WidgetSizeInfo(0, 0)
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
index 0269577af789..7816d3b131cb 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
@@ -480,6 +480,24 @@ class ResizeableItemFrameViewModelTest : SysuiTestCase() {
fun testIllegalState_resizeMultipleZeroOrNegative() =
testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) }
+ @Test
+ fun testZeroHeights_cannotResize() = runTestWithSnapshots {
+ val zeroHeightGrid =
+ singleSpanGrid.copy(
+ totalSpans = 2,
+ currentSpan = 1,
+ currentRow = 0,
+ minHeightPx = 0,
+ maxHeightPx = 0,
+ )
+ updateGridLayout(zeroHeightGrid)
+
+ val topState = underTest.topDragState
+ val bottomState = underTest.bottomDragState
+ assertThat(topState.anchors.toList()).containsExactly(0 to 0f)
+ assertThat(bottomState.anchors.toList()).containsExactly(0 to 0f)
+ }
+
private fun TestScope.updateGridLayout(gridLayout: GridLayout) {
underTest.setGridLayoutInfo(
verticalItemSpacingPx = gridLayout.verticalItemSpacingPx,