diff options
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, |