Datasets:
Download android/dijia1124-plusplusbattery/tests/test_android_structure.py from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 29.2 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/dijia1124-plusplusbattery/tests/test_android_structure.py
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/android/dijia1124-plusplusbattery/tests/test_android_structure.py
-
curl -L -o test_android_structure.py https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/dijia1124-plusplusbattery/tests/test_android_structure.py
29.2 kB
| #!/usr/bin/env python3 | |
| """STRUCTURE lane — PlusPlusBattery (Jetpack Compose, single Activity). | |
| Owns exactly two things: | |
| (1) the GATE: the app launches to the Dashboard with its top-level surfaces | |
| present (main container, title, 4-item bottom-nav host). jump_kind="none". | |
| (2) tree-SHAPE deltas: an interaction that changes the view tree's SHAPE — a | |
| dialog adds a modal window layer (node count / a widget CLASS appears), | |
| the FAB expand/collapse re-shapes the overlay, a tab renders a distinct | |
| subtree (a class of checkable View that the Dashboard card list lacks), | |
| a deep surface exposes a column of CheckBox / a row of SeekBar widgets. | |
| Each is recorded as jump_kind="transition" and REVERSED to prove it restores. | |
| CEDES to other lanes: content strings (text), checked/enabled/selected (states), | |
| reachability of a named screen (navigation), computed values (computation), | |
| CRUD on records (interaction). This file asserts SHAPE only. | |
| All observed values below were read off the running original with uiautomator. | |
| """ | |
| import os, sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from android_testgen_kit import * # noqa: F403,F401 | |
| RESULTS_DIR = sys.argv[2] if len(sys.argv) > 2 else os.path.dirname(os.path.abspath(__file__)) | |
| # Bottom-nav sibling tabs (content-desc on every surface except the selected one, | |
| # which renders as a plain text label instead). | |
| NAV_SIBLINGS = ("Monitor", "History", "Settings") | |
| # ── depth-family helpers (named and_enter_* so the depth auditor accepts the | |
| # declared depth>=1 as BACKED navigation, per the kit's DEPTH_FWD_RE). Each taps a | |
| # real user-path trigger, confirms the surface actually changed, then increments | |
| # the kit depth counter via the kit's and_enter(). ───────────────────────────── | |
| def and_enter_dialog(nodes, *, text="", content_desc="", info_near="") -> tuple[bool, set]: | |
| """Open a dialog from a trigger and confirm the surface re-shaped. Returns | |
| (opened, before_showing). Counts one surface. `info_near` disambiguates a | |
| duplicate 'Show Info' button by the y-row of the given label.""" | |
| trig = None | |
| if info_near: | |
| trig = _info_near(nodes, info_near) | |
| elif text: | |
| trig = find_node(nodes, text=text) or find_node_ci(nodes, text) | |
| elif content_desc: | |
| trig = find_node(nodes, content_desc=content_desc) | |
| if trig is None: | |
| return False, set() | |
| before = and_showing(nodes) | |
| if not tap_node(trig): | |
| return False, before | |
| after = and_showing() | |
| if not surface_changed(before, after): | |
| return False, before | |
| and_enter("dialog") | |
| return True, before | |
| def and_enter_tab(nodes, content_desc: str) -> tuple[bool, set]: | |
| """Tap a bottom-nav tab and confirm its subtree replaced the current one. | |
| Counts one surface. Returns (ok, before_showing).""" | |
| trig = find_node(nodes, content_desc=content_desc) | |
| if trig is None: | |
| return False, set() | |
| before = and_showing(nodes) | |
| if not tap_node(trig): | |
| return False, before | |
| after = and_showing() | |
| if not surface_changed(before, after): | |
| return False, before | |
| and_enter(content_desc) | |
| return True, before | |
| def and_enter_deep(nodes, *, text: str) -> tuple[bool, set]: | |
| """From a tab, open a nested settings surface (Monitor entry settings / | |
| Floating window settings / About). Counts one MORE surface (depth 2).""" | |
| trig = find_node(nodes, text=text) or find_node_ci(nodes, text) | |
| if trig is None: | |
| return False, set() | |
| before = and_showing(nodes) | |
| if not tap_node(trig): | |
| return False, before | |
| after = and_showing() | |
| if not surface_changed(before, after): | |
| return False, before | |
| and_enter(text) | |
| return True, before | |
| def _info_near(nodes, label: str) -> dict | None: | |
| """The 'Show Info' button closest in y to `label` (the content-desc repeats | |
| across cards, so proximity is the only honest disambiguator).""" | |
| ln = find_node(nodes, text=label) or find_node_ci(nodes, label) | |
| if not ln or "_center" not in ln: | |
| return None | |
| infos = find_nodes(nodes, content_desc="Show Info") | |
| infos = [n for n in infos if "_center" in n] | |
| if not infos: | |
| return None | |
| return min(infos, key=lambda n: abs(n["_center"][1] - ln["_center"][1])) | |
| def _count_checkable(nodes) -> int: | |
| return len([n for n in nodes if n.get("checkable") == "true"]) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # (1) THE GATE — top-level surfaces exist. jump_kind="none", depth=0. | |
| # Kept to 3 of 18 tests (17%), under the 30% existence ceiling. | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_gate_launch(): | |
| restart_app() | |
| fg = wait_for_foreground() | |
| nodes = ui() | |
| # Main container present: a Compose host FrameLayout/View tree with the | |
| # dashboard's card TextViews rendered inside it. | |
| container = bool(find_by_class(nodes, "FrameLayout")) and bool(find_by_class(nodes, "View")) | |
| cards = len(find_by_class(nodes, "TextView")) | |
| ok = bool(fg) and container and cards >= 15 | |
| record("structure_gate_launch", ok, | |
| "" if ok else f"setup_failed: app did not reach a populated foreground " | |
| f"(fg={fg}, container={container}, textviews={cards})", | |
| depth=0, jump_kind="none") | |
| vlm_assert("structure_gate_launch", | |
| "Does this screen show a vertical list of battery-info cards with a " | |
| "bottom navigation bar containing exactly 4 icons evenly spaced across " | |
| "the bottom edge?", | |
| RESULTS_DIR, tag="shape") | |
| def test_gate_navhost(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| # 4-item nav host: 3 sibling tabs by content-desc + the selected "Dashboard" | |
| # label as text (the selected item renders its label instead of a desc). | |
| siblings = [cd for cd in NAV_SIBLINGS if find_node(nodes, content_desc=cd)] | |
| selected = bool(find_node(nodes, text="Dashboard")) | |
| ok = len(siblings) == 3 and selected | |
| record("structure_gate_navhost", ok, | |
| "" if ok else f"feature_missing: bottom-nav host incomplete " | |
| f"(siblings={siblings}, dashboard_label={selected})", | |
| depth=0, jump_kind="none") | |
| def test_gate_title_and_cards(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| # App title present as the top TextView, and the dashboard exposes a stack of | |
| # value Buttons (info/swap/calibrate/expand affordances) — its shape signature. | |
| title = bool(find_node(nodes, text="Plus Plus Battery")) | |
| buttons = len(find_by_class(nodes, "Button")) | |
| ok = title and buttons == 8 | |
| record("structure_gate_title_and_cards", ok, | |
| "" if ok else f"feature_missing: dashboard shape wrong " | |
| f"(title={title}, buttons={buttons}, expected 8)", | |
| depth=0, jump_kind="none") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # (2) DIALOG SHAPE DELTAS — a dialog adds a modal window layer. depth=1. | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_calibrate_dialog_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| before_rb = len(find_by_class(nodes, "RadioButton")) # 0 on dashboard | |
| opened, before = and_enter_dialog(nodes, content_desc="Calibrate") | |
| dlg = ui() | |
| after_rb = len(find_by_class(dlg, "RadioButton")) # 2 in the dialog | |
| grew = opened and after_rb == before_rb + 2 and surface_changed(before, and_showing(dlg)) | |
| # Ask the VLM WHILE the dialog is still on screen — a rendered modal-overlay | |
| # property the tree cannot express. (Fired here, not after Close, so the | |
| # screenshot actually contains the dialog.) | |
| settle("tap") | |
| vlm_assert("structure_calibrate_dialog_shape", | |
| "Is there a rounded dialog box floating on top of the screen, with the " | |
| "app content behind it faded or greyed out?", | |
| RESULTS_DIR, tag="position") | |
| # reverse: Close removes the RadioButton subtree | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): # DANGEROUS word -> tap_node, not safe_tap | |
| restored = len(find_by_class(ui(), "RadioButton")) == before_rb | |
| ok = grew and restored | |
| record("structure_calibrate_dialog_shape", ok, | |
| "" if ok else f"behavior_wrong: calibrate dialog RadioButton delta wrong " | |
| f"(before={before_rb}, after={after_rb}, restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="RadioButton class 0->2 when Calibrate opens, back to 0 on Close") | |
| def test_cyclecount_info_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| before_n = len(nodes) | |
| opened, before = and_enter_dialog(nodes, info_near="Charge Cycle Count") | |
| dlg = ui() | |
| # The modal replaces the dashboard window: node count collapses sharply and a | |
| # single "Close" Button appears in place of the card stack. | |
| shrank = opened and len(dlg) < before_n - 30 | |
| has_close = bool(find_node(dlg, text="Close")) | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = shrank and has_close and changed and restored | |
| record("structure_cyclecount_info_shape", ok, | |
| "" if ok else f"behavior_wrong: cycle-count info dialog shape delta wrong " | |
| f"(before_n={before_n}, dlg_n={len(dlg)}, close={has_close}, " | |
| f"restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="dashboard subtree (~88 nodes) replaced by a small modal (~13) with a Close button, restored on Close") | |
| def test_voltage_info_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| before_n = len(nodes) | |
| opened, before = and_enter_dialog(nodes, info_near="Battery Voltage") | |
| dlg = ui() | |
| shrank = opened and len(dlg) < before_n - 30 | |
| has_close = bool(find_node(dlg, text="Close")) | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = shrank and has_close and changed and restored | |
| record("structure_voltage_info_shape", ok, | |
| "" if ok else f"behavior_wrong: voltage info dialog shape delta wrong " | |
| f"(before_n={before_n}, dlg_n={len(dlg)}, close={has_close}, " | |
| f"restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="dashboard subtree replaced by a small modal with a Close button, restored on Close") | |
| def test_estfcc_info_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| before_n = len(nodes) | |
| opened, before = and_enter_dialog(nodes, info_near="Full Charge Capacity") | |
| dlg = ui() | |
| shrank = opened and len(dlg) < before_n - 30 | |
| has_close = bool(find_node(dlg, text="Close")) | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = shrank and has_close and changed and restored | |
| record("structure_estfcc_info_shape", ok, | |
| "" if ok else f"behavior_wrong: FCC info dialog shape delta wrong " | |
| f"(before_n={before_n}, dlg_n={len(dlg)}, close={has_close}, " | |
| f"restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="dashboard subtree replaced by a small modal with a Close button, restored on Close") | |
| def test_history_help_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "History") | |
| h = ui() | |
| before_n = len(h) | |
| before = and_showing(h) | |
| help_btn = find_node(h, content_desc="Help") | |
| opened = bool(help_btn) and tap_node(help_btn) | |
| dlg = ui() | |
| shrank = opened and len(dlg) < before_n - 15 | |
| has_close = bool(find_node(dlg, text="Close")) | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = ok_tab and shrank and has_close and changed and restored | |
| record("structure_history_help_shape", ok, | |
| "" if ok else f"behavior_wrong: history Help dialog shape delta wrong " | |
| f"(tab={ok_tab}, before_n={before_n}, dlg_n={len(dlg)}, " | |
| f"close={has_close}, restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="History list subtree (~43) replaced by a Help modal (~13) with Close, restored on Close") | |
| def test_history_export_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "History") | |
| h = ui() | |
| before_n = len(h) | |
| before = and_showing(h) | |
| exp = find_node(h, content_desc="Export") | |
| opened = bool(exp) and tap_node(exp) | |
| dlg = ui() | |
| # Confirm modal adds an Export/Cancel action pair as a new layer. | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| has_actions = bool(find_node(dlg, text="Cancel")) and bool(find_node(dlg, text="Export")) | |
| restored = False | |
| if opened: | |
| cancel = find_node(dlg, text="Cancel") # safe dismissal, no write | |
| if cancel and tap_node(cancel): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = ok_tab and changed and has_actions and restored | |
| record("structure_history_export_shape", ok, | |
| "" if ok else f"behavior_wrong: history Export dialog shape delta wrong " | |
| f"(tab={ok_tab}, changed={changed}, actions={has_actions}, " | |
| f"restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="Export confirm modal (Export/Cancel buttons) layered over the History list, restored on Cancel") | |
| def test_refresh_dialog_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "Settings") | |
| # The refresh row is below the fold — scroll it into view first. | |
| ri = scroll_into_view("Set refresh interval (ms)") | |
| s = ui() | |
| before_n = len(s) | |
| before = and_showing(s) | |
| opened = False | |
| if ri: | |
| ri = find_node(s, text="Set refresh interval (ms)") or find_node_ci(s, "Set refresh interval (ms)") | |
| opened = bool(ri) and tap_node(ri) | |
| if opened: | |
| and_enter("refresh_dialog") | |
| dlg = ui() | |
| shrank = opened and len(dlg) < before_n - 30 | |
| has_close = bool(find_node(dlg, text="Close")) | |
| changed = opened and surface_changed(before, and_showing(dlg)) | |
| restored = False | |
| if opened: | |
| close = find_node(dlg, text="Close") | |
| if close and tap_node(close): | |
| restored = len(ui()) >= before_n - 2 | |
| ok = ok_tab and shrank and has_close and changed and restored | |
| record("structure_refresh_dialog_shape", ok, | |
| "" if ok else f"behavior_wrong: refresh dialog shape delta wrong " | |
| f"(tab={ok_tab}, before_n={before_n}, dlg_n={len(dlg)}, " | |
| f"close={has_close}, restored={restored})", | |
| depth=1, jump_kind="transition", | |
| expect="Settings subtree (~83) replaced by the refresh modal (~20) with a Close button, restored on Close") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # (3) FAB EXPAND SHAPE DELTA — in-place overlay re-shapes the tree. depth=0. | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_fab_expand_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| nodes = ui() | |
| fab = find_node(nodes, content_desc="Open menu") | |
| before = and_showing(nodes) | |
| opened = bool(fab) and tap_node(fab) | |
| exp = ui() | |
| # The speed-dial overlays the dashboard: the collapsed "Open menu" affordance | |
| # is gone and a "Close menu" affordance plus menu-item subtree appear. | |
| flipped = opened and (not find_node(exp, content_desc="Open menu")) and \ | |
| bool(find_node(exp, content_desc="Close menu")) | |
| reshaped = opened and surface_changed(before, and_showing(exp)) | |
| # Ask the VLM WHILE the speed-dial is expanded (screenshot must contain the stack). | |
| settle("tap") | |
| vlm_assert("structure_fab_expand_shape", | |
| "Above the bottom-right circular button, is there a vertical stack of " | |
| "labeled action buttons that expanded upward from that button?", | |
| RESULTS_DIR, tag="shape") | |
| # reverse | |
| restored = False | |
| if opened: | |
| cm = find_node(exp, content_desc="Close menu") | |
| if cm and tap_node(cm): | |
| back = ui() | |
| restored = bool(find_node(back, content_desc="Open menu")) and \ | |
| not find_node(back, content_desc="Close menu") | |
| ok = flipped and reshaped and restored | |
| record("structure_fab_expand_shape", ok, | |
| "" if ok else f"behavior_wrong: FAB expand shape delta wrong " | |
| f"(flipped={flipped}, reshaped={reshaped}, restored={restored})", | |
| depth=0, jump_kind="transition", | |
| expect="FAB affordance 'Open menu'->'Close menu' with a menu-item subtree overlay, restored on collapse") | |
| def test_fab_position(): | |
| # A pure rendered-position claim the tree cannot express: the collapsed FAB | |
| # sits at the bottom-right, above the nav bar. VLM-only record. | |
| restart_app() | |
| wait_for_foreground() | |
| ui() # settle a fresh dashboard before the screenshot | |
| vlm_assert("structure_fab_position", | |
| "Is there a single round floating action button positioned in the " | |
| "bottom-right corner of the screen, just above the bottom navigation bar?", | |
| RESULTS_DIR, tag="position") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # (4) TAB CONTENT SHAPE — each tab renders a DISTINCT top-level subtree. depth=1. | |
| # Signature = a widget CLASS present here and absent on the Dashboard card list. | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_monitor_tab_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| dash = ui() | |
| dash_chk = _count_checkable(dash) # 0 on dashboard | |
| ok_tab, before = and_enter_tab(dash, "Monitor") | |
| mon = ui() | |
| mon_chk = _count_checkable(mon) # 2 toggle Views on Monitor | |
| # Distinct subtree: Monitor adds a class of checkable View the dashboard lacks, | |
| # and the surface materially changed. | |
| ok = ok_tab and dash_chk == 0 and mon_chk == 2 and surface_changed(before, and_showing(mon)) | |
| record("structure_monitor_tab_shape", ok, | |
| "" if ok else f"behavior_wrong: Monitor subtree shape wrong " | |
| f"(tab={ok_tab}, dash_checkable={dash_chk}, monitor_checkable={mon_chk})", | |
| depth=1, jump_kind="transition", | |
| expect="checkable-View count 0 (Dashboard) -> 2 (Monitor); distinct subtree") | |
| def test_settings_tab_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| dash = ui() | |
| dash_chk = _count_checkable(dash) # 0 | |
| ok_tab, before = and_enter_tab(dash, "Settings") | |
| st = ui() | |
| set_chk = _count_checkable(st) # 6 toggle Views on Settings | |
| ok = ok_tab and dash_chk == 0 and set_chk == 6 and surface_changed(before, and_showing(st)) | |
| record("structure_settings_tab_shape", ok, | |
| "" if ok else f"behavior_wrong: Settings subtree shape wrong " | |
| f"(tab={ok_tab}, dash_checkable={dash_chk}, settings_checkable={set_chk})", | |
| depth=1, jump_kind="transition", | |
| expect="checkable-View count 0 (Dashboard) -> 6 (Settings); distinct subtree") | |
| vlm_assert("structure_settings_tab_shape", | |
| "Is the settings content organized into multiple grouped section cards, " | |
| "each containing rows with a toggle switch on the right side?", | |
| RESULTS_DIR, tag="layout") | |
| def test_history_tab_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| dash = ui() | |
| ok_tab, before = and_enter_tab(dash, "History") | |
| h = ui() | |
| # History's signature: a top toolbar exposing Export + Help icon Buttons that | |
| # the Dashboard does not have, plus its own list subtree (no checkable Views). | |
| toolbar = bool(find_node(h, content_desc="Export")) and bool(find_node(h, content_desc="Help")) | |
| no_toggles = _count_checkable(h) == 0 | |
| dash_toolbar = bool(find_node(dash, content_desc="Export")) # absent on dashboard | |
| ok = ok_tab and toolbar and no_toggles and not dash_toolbar and \ | |
| surface_changed(before, and_showing(h)) | |
| record("structure_history_tab_shape", ok, | |
| "" if ok else f"behavior_wrong: History subtree shape wrong " | |
| f"(tab={ok_tab}, toolbar={toolbar}, no_toggles={no_toggles}, " | |
| f"dash_had_toolbar={dash_toolbar})", | |
| depth=1, jump_kind="transition", | |
| expect="History adds an Export+Help toolbar subtree absent on the Dashboard") | |
| vlm_assert("structure_history_tab_shape", | |
| "Are there two circular icon buttons in the top-right corner, with a " | |
| "list of history record entries below them?", | |
| RESULTS_DIR, tag="position") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # (5) DEEP SURFACE SHAPE — depth=2 (Dashboard -> tab -> nested settings). | |
| # Backed by TWO and_enter_* calls so the depth auditor accepts depth=2. | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_monitor_entry_checkboxes(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "Monitor") | |
| mon = ui() | |
| ok_deep, before = and_enter_deep(mon, text="Monitor entry settings") | |
| mes = ui() | |
| # Deep surface signature: a column of CheckBox widgets (none exist anywhere on | |
| # the Dashboard/Monitor card surfaces). | |
| cbs = len(find_by_class(mes, "CheckBox")) | |
| ok = ok_tab and ok_deep and cbs == 9 and surface_changed(before, and_showing(mes)) | |
| record("structure_monitor_entry_checkboxes", ok, | |
| "" if ok else f"behavior_wrong: Monitor Entry Settings CheckBox count wrong " | |
| f"(tab={ok_tab}, deep={ok_deep}, checkboxes={cbs}, expected 9)", | |
| depth=2, jump_kind="transition", | |
| expect="CheckBox class count = 9 on Monitor Entry Settings (0 on the tabs above it)") | |
| vlm_assert("structure_monitor_entry_checkboxes", | |
| "Is this a vertical list of rows where each row has a filled checkbox " | |
| "at its far left followed by a text label?", | |
| RESULTS_DIR, tag="position") | |
| def test_floating_window_seekbars(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "Monitor") | |
| mon = ui() | |
| ok_deep, before = and_enter_deep(mon, text="Floating window settings") | |
| fws = ui() | |
| # Deep surface signature: a set of SeekBar (Compose Slider) widgets that no | |
| # other surface in this app renders. | |
| sbs = len(find_by_class(fws, "SeekBar")) | |
| ok = ok_tab and ok_deep and sbs == 3 and surface_changed(before, and_showing(fws)) | |
| record("structure_floating_window_seekbars", ok, | |
| "" if ok else f"behavior_wrong: Floating Window Settings SeekBar count wrong " | |
| f"(tab={ok_tab}, deep={ok_deep}, seekbars={sbs}, expected 3)", | |
| depth=2, jump_kind="transition", | |
| expect="SeekBar class count = 3 on Floating Window Settings") | |
| vlm_assert("structure_floating_window_seekbars", | |
| "Does this screen show horizontal slider controls and a horizontal row " | |
| "of rounded color-option chips grouped inside cards?", | |
| RESULTS_DIR, tag="shape") | |
| def test_about_shape(): | |
| restart_app() | |
| wait_for_foreground() | |
| ok_tab, _ = and_enter_tab(ui(), "Settings") | |
| # About is below the fold on Settings; scroll then open it. | |
| ab = scroll_into_view("About") | |
| st = ui() | |
| ok_deep = False | |
| before = set() | |
| if ab: | |
| ok_deep, before = and_enter_deep(st, text="About") | |
| ab_nodes = ui() | |
| # About's signature: a Back affordance + a scrollable long text block, and it | |
| # carries NONE of Settings' toggle Views. | |
| back = bool(find_node(ab_nodes, content_desc="Back")) | |
| has_scroll = bool(find_by_class(ab_nodes, "ScrollView")) | |
| no_toggles = _count_checkable(ab_nodes) == 0 | |
| ok = ok_tab and ok_deep and back and has_scroll and no_toggles and \ | |
| surface_changed(before, and_showing(ab_nodes)) | |
| record("structure_about_shape", ok, | |
| "" if ok else f"behavior_wrong: About subtree shape wrong " | |
| f"(tab={ok_tab}, deep={ok_deep}, back={back}, " | |
| f"scroll={has_scroll}, toggles0={no_toggles})", | |
| depth=2, jump_kind="transition", | |
| expect="About = Back + a scrollable text block, none of Settings' toggle Views") | |
| vlm_assert("structure_about_shape", | |
| "Is this screen dominated by a single large block of paragraph text " | |
| "(version, repo, author and battery-field descriptions) rather than " | |
| "rows of controls?", | |
| RESULTS_DIR, tag="layout") | |
| TESTS = [ | |
| test_gate_launch, | |
| test_gate_navhost, | |
| test_gate_title_and_cards, | |
| test_calibrate_dialog_shape, | |
| test_cyclecount_info_shape, | |
| test_voltage_info_shape, | |
| test_estfcc_info_shape, | |
| test_history_help_shape, | |
| test_history_export_shape, | |
| test_refresh_dialog_shape, | |
| test_fab_expand_shape, | |
| test_fab_position, | |
| test_monitor_tab_shape, | |
| test_settings_tab_shape, | |
| test_history_tab_shape, | |
| test_monitor_entry_checkboxes, | |
| test_floating_window_seekbars, | |
| test_about_shape, | |
| ] | |
| if __name__ == "__main__": | |
| run_suite(TESTS, "structure") | |