Modern Apps git

← Modern-Apps.git

library: run the overlay TalkBack test on native graphics (#ux-audit)

Commit
5076f1f77eaabe11fc697f5b04f7cfb8e74fddd7
Author
Vayun Mathur <[email protected]>
When
2026-11-13 07:52 UTC (23 days ago)
Parents
369a98a
Follow-up to the result-overlay modality commits. The TalkBack test
kept failing even though the overlay's pane node is important for
accessibility and covers the board. A scratch experiment (not
committed) showed why: under Robolectric's default legacy graphics,
even a full-size node with a content description drawn over a
clickable left that clickable in the accessibility tree. Compose
computes what a cover hides with android.graphics.Region arithmetic,
which the legacy graphics shadows do not implement, so in that mode
nothing is ever covered.

Fix: annotate just that test @GraphicsMode(NATIVE) (already used by
pipes' and arrows' rendering tests in this toolchain), so the real
Region code runs, as on a device. Test-only; no production change.

Verification: :library:ui:testDebugUnitTest - the board node is
reachable before the overlay, absent while it shows, and the card is
reachable.

Diff

library/ui/src/test/java/com/vayunmathur/library/ui/game/GameResultOverlayTest.kt
diff --git a/library/ui/src/test/java/com/vayunmathur/library/ui/game/GameResultOverlayTest.kt b/library/ui/src/test/java/com/vayunmathur/library/ui/game/GameResultOverlayTest.ktindex 48d2a2184c..5e539df137 100644--- a/library/ui/src/test/java/com/vayunmathur/library/ui/game/GameResultOverlayTest.kt+++ b/library/ui/src/test/java/com/vayunmathur/library/ui/game/GameResultOverlayTest.kt@@ -37,6 +37,7 @@ import org.junit.Rule import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.Shadows.shadowOf+import org.robolectric.annotation.GraphicsMode import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse@@ -91,6 +92,10 @@ class GameResultOverlayTest {         assertEquals(0, behindTaps)     } +    // Compose decides what a cover hides with android.graphics.Region arithmetic, which Robolectric's+    // legacy graphics shadows do not implement: under them nothing is ever covered, even by a full-size+    // node with a content description. Native graphics runs the real Region code, as a device does.+    @GraphicsMode(GraphicsMode.Mode.NATIVE)     @Test     fun `TalkBack cannot reach the board while the overlay shows`() {         val am = appContext.getSystemService(AccessibilityManager::class.java)