asserting-bounds-and-dimensions

Verify Jetpack Compose layout measurements and positioning with dp-typed assertions.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/trancee/MeshLink-template --skill asserting-bounds-and-dimensions-trancee
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: asserting-bounds-and-dimensions
Source: https://github.com/trancee/MeshLink-template/tree/main/.agents/skills/android-testing-skills/compose/assertions/asserting-bounds-and-dimensions
Command: npx skills add https://github.com/trancee/MeshLink-template --skill asserting-bounds-and-dimensions-trancee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves the difficulty of writing reliable UI tests for Jetpack Compose by providing a standardized, dp-based approach to verifying layout measurements, padding, and alignment, avoiding the pitfalls of pixel-based comparisons.

Core Features & Use Cases

  • Layout Verification: Assert exact widths, heights, and positions in dp with built-in tolerance for sub-dp drift.
  • Padding and Alignment Math: Calculate spacing between components by subtracting unclipped bounds of two nodes.
  • Accessibility Testing: Verify minimum touch target sizes to ensure compliance with accessibility standards.
  • Use Case: Use this skill when you need to ensure a button is exactly 48dp tall or that the padding between a text element and its container is exactly 24dp, regardless of screen density.

Quick Start

Use the asserting-bounds-and-dimensions skill to verify that the submit button has a height of at least 48dp and is positioned correctly in the root layout.

Frequently Asked Questions about asserting-bounds-and-dimensions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify Jetpack Compose layout dimensions in dp during UI testing?▼

Verifying Jetpack Compose layout dimensions in dp during UI testing involves using dp-typed assertions to check exact widths and heights, avoiding pixel-based comparisons. This skill performs deterministic layout checks with built-in tolerance for sub-dp rounding.

What is the best way to test minimum touch target sizes for Compose components?▼

Testing minimum touch target sizes for Compose components requires asserting exact dimensions in dp to ensure compliance with accessibility standards. This skill verifies component dimensions like a 48dp button height regardless of screen density.

How do I calculate padding and spacing between Jetpack Compose UI elements?▼

Calculating padding and spacing between Jetpack Compose UI elements involves subtracting the unclipped bounds of two nodes. This skill provides standardized dp-based assertions to validate exact spacing like 24dp padding between a text element and its container.

Does this Compose layout assertion approach handle sub-dp rounding differences?▼

Yes, this Compose layout assertion approach handles sub-dp rounding differences through built-in tolerance. It applies dp-typed assertions to perform deterministic layout checks, ensuring reliable verification across varying screen densities.

Can I use this skill for pixel-based layout comparisons in Android?▼

No, this skill resolves the difficulty of writing reliable Android UI tests by avoiding pixel-based comparisons entirely. It uses a standardized dp-based approach to verify layout measurements, padding, and alignment in Jetpack Compose.

Why do my Compose UI layout tests fail across different screen densities?▼

Compose UI layout tests often fail across different screen densities due to pixel-based comparisons and sub-dp drift. This skill fixes the issue by applying dp-typed assertions with built-in tolerance for deterministic layout checks.