asserting-bounds-and-dimensions
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAsserting Bounds and Dimensions — Layout Math in Dp, Not Pixels
断言边界与尺寸——使用 Dp 而非像素进行布局计算
Layout assertions belong in dp, run with a half-dp tolerance, and most of the interesting checks (padding, gap, alignment) are subtractions between two rectangles. This skill picks the right size/position assertion, explains clipped vs unclipped, and shows the canonical "compute padding from two rects" pattern lifted directly from .
getUnclippedBoundsInRoot()material3/ButtonTest.kt布局断言应以 dp 为单位,使用半个 dp 的容差执行,大多数有意义的检查(padding、间距、对齐)都是对两个 矩形进行差值计算。此 skill 用于选择合适的尺寸或位置断言,解释已裁剪与未裁剪边界的区别,并展示直接取自 的“根据两个未裁剪矩形计算 padding”标准模式。
getUnclippedBoundsInRoot()material3/ButtonTest.ktWhen to use this skill
何时使用此 skill
- The developer wants to verify a Button is 48 dp tall, a Spacer is 16 dp wide, an Icon is at position .
(24.dp, 12.dp) - The developer asks how to assert the padding between two composables.
- The developer asks about minimum touch target sizes ().
ChipDefaults.MinHeight + 1.dp - The developer is comparing layout values in pixels and wants the dp-typed equivalent.
- The developer mentions ,
assertWidthIsEqualTo,getUnclippedBoundsInRoot,DpRect,getAlignmentLinePosition.getFirstLinkBounds
- 开发者希望验证 Button 的高度为 48 dp、Spacer 的宽度为 16 dp,或 Icon 的位置为 。
(24.dp, 12.dp) - 开发者询问如何断言两个 composable 之间的 padding。
- 开发者询问最小触摸目标尺寸()。
ChipDefaults.MinHeight + 1.dp - 开发者正在比较以 pixels 表示的布局值,并希望获得等效的 dp 类型断言。
- 开发者提到 、
assertWidthIsEqualTo、getUnclippedBoundsInRoot、DpRect或getAlignmentLinePosition。getFirstLinkBounds
When NOT to use this skill
何时不应使用此 skill
- The check is about state (enabled, on, selected) — see .
./asserting-node-state-and-text/SKILL.md - The check is "is the node on screen at all" — is enough; bounds math adds friction without value.
assertIsDisplayed() - The composable's bounds depend on an animation in flight — pause the clock first; see .
../../synchronization/testing-animations-deterministically/SKILL.md - The bounds are relative to a screenshot — use a screenshot test instead.
- 检查内容涉及状态(enabled、on、selected)——参见 。
./asserting-node-state-and-text/SKILL.md - 检查内容是“节点是否完全位于屏幕上”——使用 即可;边界计算只会徒增复杂度。
assertIsDisplayed() - composable 的边界取决于正在执行的动画——请先暂停测试时钟;参见 。
../../synchronization/testing-animations-deterministically/SKILL.md - 边界是相对于截图而言的——请改用截图测试。
Prerequisites
前置条件
- A working /
ComposeTestRule. SeeComposeUiTest.../../setup/configuring-test-dependencies/SKILL.md - The target composable has finished measuring and placing. If it animates in, advance the test clock first — see .
../../synchronization/controlling-the-test-clock/SKILL.md - For touch-target assertions, the target node has a click action so is meaningful.
touchBoundsInRoot
- 可正常工作的 /
ComposeTestRule。参见ComposeUiTest。../../setup/configuring-test-dependencies/SKILL.md - 目标 composable 已完成测量和放置。如果它通过动画进入,请先推进测试时钟——参见 。
../../synchronization/controlling-the-test-clock/SKILL.md - 对于触摸目标断言,目标节点包含 click action,这样 才有意义。
touchBoundsInRoot
Workflow
工作流
-
1. Pick the assertion by question type. All APIs live in.
commonMain/.../BoundsAssertions.ktQuestion API File:line Is the layout exactly W dp wide? assertWidthIsEqualTo(expectedWidth: Dp)BoundsAssertions.kt:44-46Is the layout exactly H dp tall? assertHeightIsEqualTo(expectedHeight: Dp)BoundsAssertions.kt:53-55At least W wide? assertWidthIsAtLeast(expectedMinWidth: Dp)BoundsAssertions.kt:85-87At least H tall? assertHeightIsAtLeast(expectedMinHeight: Dp)BoundsAssertions.kt:95-99Touch-target width? assertTouchWidthIsEqualTo(expectedWidth: Dp)BoundsAssertions.kt:62-66Touch-target height? assertTouchHeightIsEqualTo(expectedHeight: Dp)BoundsAssertions.kt:73-77Exact position in root? assertPositionInRootIsEqualTo(left: Dp, top: Dp)BoundsAssertions.kt:109-117Top position only? assertTopPositionInRootIsEqualTo(top: Dp)BoundsAssertions.kt:126-130Left position only? assertLeftPositionInRootIsEqualTo(left: Dp)BoundsAssertions.kt:139-143Read full unclipped bounds getUnclippedBoundsInRoot(): DpRectBoundsAssertions.kt:148-152Read clipped bounds getBoundsInRoot(): DpRectBoundsAssertions.kt:158-165Alignment line in dp getAlignmentLinePosition(line: AlignmentLine): DpBoundsAssertions.kt:171-180Bounds of a in a TextLinkAnnotationgetFirstLinkBounds(predicate)BoundsAssertions.kt:196-248Compare any two valuesDpDp.assertIsEqualTo(expected, subject, tolerance = Dp(.5f))BoundsAssertions.kt:319-324 -
2. Use unclipped bounds for layout math; clipped bounds for "what the user sees".returns the laid-out rectangle ignoring viewport clipping (
getUnclippedBoundsInRoot()→BoundsAssertions.kt:148-152private,unclippedBoundsInRoot).BoundsAssertions.kt:284-291clips to the viewport (getBoundsInRoot()). Padding/spacing math uses unclipped; partial-visibility checks use clipped.BoundsAssertions.kt:158-165 -
3. Tolerance is half a dp by default.(
Dp.assertIsEqualTo(expected, subject, tolerance = Dp(.5f))) accepts deviations up to 0.5 dp because layout rounding introduces sub-dp drift. Override only when stricter precision is justified by an explicit measurement contract.BoundsAssertions.kt:319 -
4. Compute padding by subtracting two unclipped rects, then call. This is the canonical material3 pattern (
Dp.assertIsEqualTo):material3/.../ButtonTest.kt:213-225kotlinval buttonBounds = rule.onNodeWithTag(ButtonTestTag).getUnclippedBoundsInRoot() val textBounds = rule.onNodeWithTag(TextTestTag).getUnclippedBoundsInRoot() (textBounds.left - buttonBounds.left).assertIsEqualTo( 24.dp, "padding between the start of the button and the start of the text.", ) (buttonBounds.right - textBounds.right).assertIsEqualTo( 24.dp, "padding between the end of the text and the end of the button.", ) buttonBounds.height.assertIsEqualTo(ButtonDefaults.MinHeight, "height of button.")Thestring lands in the failure message:subject."Actual padding between the start of the button and the start of the text. is 22.dp, expected 24.dp (tolerance: .5.dp)" -
5. For minimum-size contracts, use/
assertHeightIsAtLeast. Useful when a composable should never be smaller than a constant, even at large font scale. Example fromassertWidthIsAtLeast:material/ChipTest.kt:226-233kotlinrule.setMaterialContent { Chip(onClick = {}) { Text(text = "Test chip", fontSize = 50.sp) } } rule.onNode(hasClickAction()).assertHeightIsAtLeast(ChipDefaults.MinHeight + 1.dp) -
6. Use touch bounds when verifying tap-target accessibility./
assertTouchWidthIsEqualToreadsassertTouchHeightIsEqualTo(node.touchBoundsInRoot), which can extend past the visual bounds when the composable appliesBoundsAssertions.kt:270-282or similar. Visual bounds useModifier.minimumInteractiveComponentSize(); touch bounds answer "where will a click land".getUnclippedBoundsInRoot
-
1. 根据问题类型选择断言。 所有 API 均位于。
commonMain/.../BoundsAssertions.kt问题 API 文件:行号 布局宽度是否恰好为 W dp? assertWidthIsEqualTo(expectedWidth: Dp)BoundsAssertions.kt:44-46布局高度是否恰好为 H dp? assertHeightIsEqualTo(expectedHeight: Dp)BoundsAssertions.kt:53-55宽度是否至少为 W? assertWidthIsAtLeast(expectedMinWidth: Dp)BoundsAssertions.kt:85-87高度是否至少为 H? assertHeightIsAtLeast(expectedMinHeight: Dp)BoundsAssertions.kt:95-99触摸目标宽度是多少? assertTouchWidthIsEqualTo(expectedWidth: Dp)BoundsAssertions.kt:62-66触摸目标高度是多少? assertTouchHeightIsEqualTo(expectedHeight: Dp)BoundsAssertions.kt:73-77根坐标中的精确位置是多少? assertPositionInRootIsEqualTo(left: Dp, top: Dp)BoundsAssertions.kt:109-117仅顶部位置是多少? assertTopPositionInRootIsEqualTo(top: Dp)BoundsAssertions.kt:126-130仅左侧位置是多少? assertLeftPositionInRootIsEqualTo(left: Dp)BoundsAssertions.kt:139-143读取完整的未裁剪边界 getUnclippedBoundsInRoot(): DpRectBoundsAssertions.kt:148-152读取已裁剪边界 getBoundsInRoot(): DpRectBoundsAssertions.kt:158-165以 dp 表示的对齐线位置 getAlignmentLinePosition(line: AlignmentLine): DpBoundsAssertions.kt:171-180Text 中 的边界LinkAnnotationgetFirstLinkBounds(predicate)BoundsAssertions.kt:196-248比较任意两个 值DpDp.assertIsEqualTo(expected, subject, tolerance = Dp(.5f))BoundsAssertions.kt:319-324 -
2. 布局计算使用未裁剪边界;“用户看到的内容”使用已裁剪边界。返回忽略视口裁剪的已布局矩形(
getUnclippedBoundsInRoot()→ 私有BoundsAssertions.kt:148-152,unclippedBoundsInRoot)。BoundsAssertions.kt:284-291会裁剪到视口范围内(getBoundsInRoot())。padding 和间距计算使用未裁剪边界;部分可见性检查使用已裁剪边界。BoundsAssertions.kt:158-165 -
3. 默认容差为半个 dp。(
Dp.assertIsEqualTo(expected, subject, tolerance = Dp(.5f)))允许最多 0.5 dp 的偏差,因为布局舍入可能产生小于 dp 的偏移。只有在明确的测量契约证明需要更高精度时,才应覆盖默认容差。BoundsAssertions.kt:319 -
4. 通过减去两个未裁剪矩形来计算 padding,然后调用。 这是标准的 material3 模式(
Dp.assertIsEqualTo):material3/.../ButtonTest.kt:213-225kotlinval buttonBounds = rule.onNodeWithTag(ButtonTestTag).getUnclippedBoundsInRoot() val textBounds = rule.onNodeWithTag(TextTestTag).getUnclippedBoundsInRoot() (textBounds.left - buttonBounds.left).assertIsEqualTo( 24.dp, "padding between the start of the button and the start of the text.", ) (buttonBounds.right - textBounds.right).assertIsEqualTo( 24.dp, "padding between the end of the text and the end of the button.", ) buttonBounds.height.assertIsEqualTo(ButtonDefaults.MinHeight, "height of button.")字符串会出现在失败消息中:subject。"Actual padding between the start of the button and the start of the text. is 22.dp, expected 24.dp (tolerance: .5.dp)" -
5. 对于最小尺寸契约,使用/
assertHeightIsAtLeast。 当 composable 在字体缩放较大时也不得小于某个常量时,此方式非常有用。示例来自assertWidthIsAtLeast:material/ChipTest.kt:226-233kotlinrule.setMaterialContent { Chip(onClick = {}) { Text(text = "Test chip", fontSize = 50.sp) } } rule.onNode(hasClickAction()).assertHeightIsAtLeast(ChipDefaults.MinHeight + 1.dp) -
6. 验证点击目标无障碍时,使用触控边界。/
assertTouchWidthIsEqualTo读取assertTouchHeightIsEqualTo(node.touchBoundsInRoot)。当 composable 应用BoundsAssertions.kt:270-282或类似修饰器时,触控边界可能超出视觉边界。视觉边界使用Modifier.minimumInteractiveComponentSize();触控边界用于回答“点击实际会落在哪里”。getUnclippedBoundsInRoot
Patterns
模式
Pattern: dp typed assertions over pixel reads
模式:优先使用 dp 类型断言,而非读取像素
kotlin
// WRONG
@Test
fun submit_isMin48dpTall() {
rule.setContent { CheckoutScreen() }
val node = rule.onNodeWithTag(SubmitTag).fetchSemanticsNode()
val heightPx = node.size.height
assert(heightPx >= 48 * Resources.getSystem().displayMetrics.density)
}
// WRONG because: pixel-typed and density-dependent. Reads outside the framework's tolerance
// model. Failure prints raw integers, no node dump, no subject label.kotlin
// RIGHT
@Test
fun submit_isMin48dpTall() {
rule.setContent { CheckoutScreen() }
rule.onNodeWithTag(SubmitTag).assertHeightIsAtLeast(48.dp)
}kotlin
// WRONG
@Test
fun submit_isMin48dpTall() {
rule.setContent { CheckoutScreen() }
val node = rule.onNodeWithTag(SubmitTag).fetchSemanticsNode()
val heightPx = node.size.height
assert(heightPx >= 48 * Resources.getSystem().displayMetrics.density)
}
// WRONG because: pixel-typed and density-dependent. Reads outside the framework's tolerance
// model. Failure prints raw integers, no node dump, no subject label.kotlin
// RIGHT
@Test
fun submit_isMin48dpTall() {
rule.setContent { CheckoutScreen() }
rule.onNodeWithTag(SubmitTag).assertHeightIsAtLeast(48.dp)
}Pattern: padding by subtracting two unclipped rects
模式:通过减去两个未裁剪矩形计算 padding
kotlin
@Test
fun button_text_has24dpPadding() {
rule.setContent {
Button(onClick = {}, modifier = Modifier.testTag(ButtonTestTag)) {
Text("Submit", modifier = Modifier.testTag(TextTestTag).semantics(mergeDescendants = true) {})
}
}
val buttonBounds = rule.onNodeWithTag(ButtonTestTag).getUnclippedBoundsInRoot()
val textBounds = rule.onNodeWithTag(TextTestTag).getUnclippedBoundsInRoot()
(textBounds.left - buttonBounds.left).assertIsEqualTo(24.dp, "start padding")
(buttonBounds.right - textBounds.right).assertIsEqualTo(24.dp, "end padding")
}The merge bypass on the inner is the same trick used by to keep the inner Text addressable from the merged tree.
Textmaterial3/ButtonTest.kt:202-226kotlin
@Test
fun button_text_has24dpPadding() {
rule.setContent {
Button(onClick = {}, modifier = Modifier.testTag(ButtonTestTag)) {
Text("Submit", modifier = Modifier.testTag(TextTestTag).semantics(mergeDescendants = true) {})
}
}
val buttonBounds = rule.onNodeWithTag(ButtonTestTag).getUnclippedBoundsInRoot()
val textBounds = rule.onNodeWithTag(TextTestTag).getUnclippedBoundsInRoot()
(textBounds.left - buttonBounds.left).assertIsEqualTo(24.dp, "start padding")
(buttonBounds.right - textBounds.right).assertIsEqualTo(24.dp, "end padding")
}对内部 使用 merge bypass,与 中采用的技巧相同,可确保内部 Text 在合并后的树中仍可被寻址。
Textmaterial3/ButtonTest.kt:202-226Pattern: assertPositionInRootIsEqualTo
for absolute placement
assertPositionInRootIsEqualTo模式:使用 assertPositionInRootIsEqualTo
进行绝对定位
assertPositionInRootIsEqualTokotlin
// "the close button sits at (320.dp, 0.dp) in the root"
rule.onNodeWithTag(CloseButtonTag)
.assertPositionInRootIsEqualTo(expectedLeft = 320.dp, expectedTop = 0.dp)If only one axis matters, use / to avoid coupling the test to layout decisions on the other axis.
assertLeftPositionInRootIsEqualToassertTopPositionInRootIsEqualTokotlin
// "the close button sits at (320.dp, 0.dp) in the root"
rule.onNodeWithTag(CloseButtonTag)
.assertPositionInRootIsEqualTo(expectedLeft = 320.dp, expectedTop = 0.dp)如果只关心一个轴,应使用 / ,避免测试与另一个轴上的布局决策耦合。
assertLeftPositionInRootIsEqualToassertTopPositionInRootIsEqualToPattern: alignment line for baseline math
模式:使用 alignment line 进行基线计算
kotlin
val baselineDp = rule.onNodeWithTag(LabelTag)
.getAlignmentLinePosition(FirstBaseline)
require(!baselineDp.isUnspecified) { "Label has no first baseline" }
baselineDp.assertIsEqualTo(20.dp, "first baseline of label")getAlignmentLinePositionDp.UnspecifiedBoundsAssertions.kt:172-179isUnspecifiedkotlin
val baselineDp = rule.onNodeWithTag(LabelTag)
.getAlignmentLinePosition(FirstBaseline)
require(!baselineDp.isUnspecified) { "Label has no first baseline" }
baselineDp.assertIsEqualTo(20.dp, "first baseline of label")未提供 alignment line 时, 会返回 ()。比较之前务必检查 。
getAlignmentLinePositionDp.UnspecifiedBoundsAssertions.kt:172-179isUnspecifiedPattern: tolerance override for sub-dp precision
模式:为亚 dp 精度覆盖容差
kotlin
// Most tests want the default ½ dp tolerance:
rule.onNodeWithTag(IconTag).getUnclippedBoundsInRoot().width.assertIsEqualTo(24.dp, "icon width")
// Stricter tolerance when measuring a hand-aligned constant:
val width = rule.onNodeWithTag(IconTag).getUnclippedBoundsInRoot().width
width.assertIsEqualTo(expected = 24.dp, subject = "icon width", tolerance = 0.1.dp)kotlin
// Most tests want the default ½ dp tolerance:
rule.onNodeWithTag(IconTag).getUnclippedBoundsInRoot().width.assertIsEqualTo(24.dp, "icon width")
// Stricter tolerance when measuring a hand-aligned constant:
val width = rule.onNodeWithTag(IconTag).getUnclippedBoundsInRoot().width
width.assertIsEqualTo(expected = 24.dp, subject = "icon width", tolerance = 0.1.dp)Pattern: clipped vs unclipped — partial visibility
模式:已裁剪与未裁剪——部分可见性
kotlin
val unclipped = rule.onNodeWithTag(BannerTag).getUnclippedBoundsInRoot()
val clipped = rule.onNodeWithTag(BannerTag).getBoundsInRoot()
// Banner laid out 200 dp tall but only 80 dp visible (rest clipped by parent):
unclipped.height.assertIsEqualTo(200.dp, "banner intrinsic height")
clipped.height.assertIsEqualTo(80.dp, "banner visible height")For "is any of it visible", prefer — see .
assertIsDisplayed()./asserting-node-state-and-text/SKILL.mdkotlin
val unclipped = rule.onNodeWithTag(BannerTag).getUnclippedBoundsInRoot()
val clipped = rule.onNodeWithTag(BannerTag).getBoundsInRoot()
// Banner laid out 200 dp tall but only 80 dp visible (rest clipped by parent):
unclipped.height.assertIsEqualTo(200.dp, "banner intrinsic height")
clipped.height.assertIsEqualTo(80.dp, "banner visible height")如果只需判断“是否有任何部分可见”,优先使用 ——参见 。
assertIsDisplayed()./asserting-node-state-and-text/SKILL.mdMandatory rules
强制规则
- MUST assert in dp using the typed /
assertWidthIsEqualTo/assertHeightIsEqualTo. MUST NOT readassertPositionInRootIsEqualToand compare pixels.fetchSemanticsNode().size.width - MUST use for padding / gap / alignment math; MUST use
getUnclippedBoundsInRoot()only when the contract is "what the user sees after clipping".getBoundsInRoot() - MUST pass a meaningful string to
subjectso the failure message identifies which measurement failed.Dp.assertIsEqualTo - MUST prefer over
assertHeightIsAtLeast(MinHeight + 1.dp)when the goal is "the layout grows past the minimum at large font scales".assertHeightIsEqualTo(MinHeight + N.dp) - MUST NOT assume zero tolerance. Layout rounding produces sub-dp drift; rely on the half-dp default and override only when justified.
- PREFERRED: when an animation is in flight, pause and step deterministically before reading bounds. Skydoves hot take #3.
mainClock.autoAdvance = false
- 必须使用类型化的 /
assertWidthIsEqualTo/assertHeightIsEqualTo以 dp 进行断言。不得读取assertPositionInRootIsEqualTo后比较像素值。fetchSemanticsNode().size.width - 必须使用 进行 padding、间距或对齐计算;只有在契约要求表示“用户裁剪后看到的内容”时,才使用
getUnclippedBoundsInRoot()。getBoundsInRoot() - 必须向 传入有意义的
Dp.assertIsEqualTo字符串,使失败消息能够指出具体失败的测量项。subject - 当目标是“在大字体缩放下,布局会增长到最小尺寸之上”时,必须优先使用 ,而不是
assertHeightIsAtLeast(MinHeight + 1.dp)。assertHeightIsEqualTo(MinHeight + N.dp) - 不得假定容差为零。布局舍入会产生小于 dp 的偏移;应依赖默认的半个 dp 容差,仅在有充分依据时覆盖。
- 优先做法: 动画正在执行时,将 并以确定性方式逐步推进,然后再读取边界。Skydoves 的尖锐观点 #3。
mainClock.autoAdvance = false
Verification
验证
- No /
node.size.widthreads remain. All dimension checks use the typednode.size.height/assert*IsEqualTo.Dp.assertIsEqualTo - Padding / gap math uses ; clipped reads only appear with a comment explaining why.
getUnclippedBoundsInRoot - Every passes a non-empty
Dp.assertIsEqualTo(...)string.subject - Touch-target assertions use /
assertTouchWidthIsEqualTorather than visual bounds when verifying accessibility constraints.assertTouchHeightIsEqualTo - passes; failure messages identify the specific failed measurement by
./gradlew :app:connectedDebugAndroidTest.subject
- 不再存在 /
node.size.width读取。所有尺寸检查均使用类型化的node.size.height/assert*IsEqualTo。Dp.assertIsEqualTo - Padding 和间距计算使用 ;只有在注释说明原因时,才会出现已裁剪边界读取。
getUnclippedBoundsInRoot - 每个 都传入非空的
Dp.assertIsEqualTo(...)字符串。subject - 验证无障碍约束时,触摸目标断言使用 /
assertTouchWidthIsEqualTo,而不是视觉边界。assertTouchHeightIsEqualTo - 通过;失败消息通过
./gradlew :app:connectedDebugAndroidTest标识具体失败的测量项。subject
References
参考资料
- Compose testing overview: https://developer.android.com/develop/ui/compose/testing
- Compose testing cheat sheet: https://developer.android.com/develop/ui/compose/testing-cheatsheet
- Layout in Compose: https://developer.android.com/develop/ui/compose/layouts
- —
compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/BoundsAssertions.kt,assertWidthIsEqualTo,assertHeightIsAtLeast,assertPositionInRootIsEqualTo,getUnclippedBoundsInRoot,getBoundsInRoot,getAlignmentLinePosition,getFirstLinkBounds(default tolerance ½ dp).Dp.assertIsEqualTo - — canonical "subtract two unclipped rects" padding test.
compose/material3/material3/src/androidDeviceTest/kotlin/androidx/compose/material3/ButtonTest.kt:202-226 - —
compose/material/material/src/androidDeviceTest/kotlin/androidx/compose/material/ChipTest.kt:226-233for minimum-touch contracts.assertHeightIsAtLeast(MinHeight + 1.dp)
- Compose 测试概览:https://developer.android.com/develop/ui/compose/testing
- Compose 测试速查表:https://developer.android.com/develop/ui/compose/testing-cheatsheet
- Compose 中的布局:https://developer.android.com/develop/ui/compose/layouts
- ——
compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/BoundsAssertions.kt、assertWidthIsEqualTo、assertHeightIsAtLeast、assertPositionInRootIsEqualTo、getUnclippedBoundsInRoot、getBoundsInRoot、getAlignmentLinePosition、getFirstLinkBounds(默认容差为 ½ dp)。Dp.assertIsEqualTo - ——标准的“减去两个未裁剪矩形”padding 测试。
compose/material3/material3/src/androidDeviceTest/kotlin/androidx/compose/material3/ButtonTest.kt:202-226 - ——用于最小触摸目标契约的
compose/material/material/src/androidDeviceTest/kotlin/androidx/compose/material/ChipTest.kt:226-233。assertHeightIsAtLeast(MinHeight + 1.dp)