Datasets:
Download android/dozingcat-vector-pinball/tests/test_android_structure.py from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 26.9 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/dozingcat-vector-pinball/tests/test_android_structure.py
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/android/dozingcat-vector-pinball/tests/test_android_structure.py
-
curl -L -o test_android_structure.py https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/android/dozingcat-vector-pinball/tests/test_android_structure.py
26.9 kB
| #!/usr/bin/env python3 | |
| """STRUCTURE lane — Vector Pinball (com.dozingcatsoftware.bouncy). | |
| Owns (a) the launch GATE and (b) tree-SHAPE deltas: a panel/subtree/dialog that | |
| appears or disappears, and child-count shape consequences. SHAPE only — content | |
| strings are text's, checked/selected are states', reachability proofs are | |
| navigation's. Gameplay content (score, ball, field layout) is CANVAS-rendered and | |
| never reaches the view tree, so those facts are the VLM budget for this lane. | |
| All resource-ids matched by LAST segment (node_by_id) so the package prefix, which | |
| differs between original and recreation, is never compared. | |
| """ | |
| import os, sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from android_testgen_kit import * # noqa: F403,F401 | |
| # ── Depth helpers (naming is the requirement that backs a depth>=1 claim) ──────── | |
| def and_enter_gameplay(nodes): | |
| """From the fresh main menu, tap START GAME and confirm gameplay was entered: | |
| buttonPanel gone + pauseIcon present. Returns (ok, before_keys, after_keys).""" | |
| btn = node_by_id(nodes, "startGameButton") | |
| before = and_showing(nodes) | |
| if not btn or not tap_node(btn): | |
| return False, before, before | |
| after_nodes = ui() | |
| after = and_showing(after_nodes) | |
| ok = (node_by_id(after_nodes, "buttonPanel") is None | |
| and node_by_id(after_nodes, "pauseIcon") is not None) | |
| if ok: | |
| and_enter("gameplay") | |
| return ok, before, after | |
| def and_enter_paused_menu(nodes): | |
| """From gameplay, tap pauseIcon and confirm the paused menu appeared: | |
| buttonPanel back + resumeGameButton present. Returns (ok, before, after).""" | |
| icon = node_by_id(nodes, "pauseIcon") | |
| before = and_showing(nodes) | |
| if not icon or not tap_node(icon): | |
| return False, before, before | |
| after_nodes = ui() | |
| after = and_showing(after_nodes) | |
| ok = (node_by_id(after_nodes, "buttonPanel") is not None | |
| and node_by_id(after_nodes, "resumeGameButton") is not None) | |
| if ok: | |
| and_enter("paused_menu") | |
| return ok, before, after | |
| def and_reach_highscores(nodes): | |
| """From the main menu, tap HIGH SCORES; PROVE the jump (highScorePanel | |
| appeared, buttonPanel vanished). Returns (ok, before, after).""" | |
| btn = node_by_id(nodes, "highScoreButton") | |
| before = and_showing(nodes) | |
| if not btn or not tap_node(btn): | |
| return False, before, before | |
| after_nodes = ui() | |
| after = and_showing(after_nodes) | |
| ok = (node_by_id(after_nodes, "highScorePanel") is not None | |
| and node_by_id(after_nodes, "buttonPanel") is None) | |
| if ok: | |
| and_enter("highscores") | |
| return ok, before, after | |
| def and_reach_preferences(nodes): | |
| """From the main menu, tap PREFERENCES; confirm the Preferences activity's | |
| ListView appeared and the menu buttonPanel is gone. Returns (ok, nodes_after).""" | |
| btn = node_by_id(nodes, "preferencesButton") | |
| if not btn or not tap_node(btn): | |
| return False, nodes | |
| after_nodes = ui() | |
| ok = (find_by_class(after_nodes, "ListView") | |
| and node_by_id(after_nodes, "buttonPanel") is None | |
| and find_node(after_nodes, text="Sound") is not None) | |
| if ok: | |
| and_enter("preferences") | |
| return ok, after_nodes | |
| def and_reach_about(nodes): | |
| """From the main menu, tap HELP; confirm the About activity's aboutTextView | |
| is present and the menu buttonPanel is gone. Returns (ok, nodes_after).""" | |
| btn = node_by_id(nodes, "aboutButton") | |
| if not btn or not tap_node(btn): | |
| return False, nodes | |
| after_nodes = ui() | |
| ok = (node_by_id(after_nodes, "aboutTextView") is not None | |
| and node_by_id(after_nodes, "buttonPanel") is None) | |
| if ok: | |
| and_enter("about") | |
| return ok, after_nodes | |
| def and_enter_pref_dialog(nodes, row_title): | |
| """Inside Preferences, tap a row title and confirm a dialog subtree opened | |
| (an alertTitle appeared). Returns (ok, nodes_after).""" | |
| row = find_node(nodes, text=row_title) | |
| if not row or not tap_node(row): | |
| return False, nodes | |
| after_nodes = ui() | |
| ok = node_by_id(after_nodes, "alertTitle") is not None | |
| if ok: | |
| and_enter(f"dialog:{row_title}") | |
| return ok, after_nodes | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # GATE | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_launch_gate(): | |
| restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| ok = (node_by_id(nodes, "buttonPanel") is not None | |
| and node_by_id(nodes, "startGameButton") is not None) | |
| record("struct_launch_gate", bool(ok), | |
| "" if ok else "setup_failed: main menu buttonPanel/startGameButton " | |
| "missing at launch", | |
| depth=0, jump_kind="none") | |
| def test_menu_subtree_shape(): | |
| """The main-menu buttonPanel subtree: a selectTableRow, an unlimitedBalls | |
| CheckBox, and a TableLayout holding >=5 Button children. SHAPE, not content.""" | |
| restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| panel = node_by_id(nodes, "buttonPanel") | |
| row = node_by_id(nodes, "selectTableRow") | |
| toggle = node_by_id(nodes, "unlimitedBallsToggle") | |
| n_buttons = len(find_by_class(nodes, "Button")) # observed: 5 (START..QUIT) | |
| ok = (panel is not None and row is not None and toggle is not None | |
| and n_buttons >= 5) | |
| record("struct_menu_subtree_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: menu subtree shape wrong " | |
| f"(panel={panel is not None}, row={row is not None}, " | |
| f"toggle={toggle is not None}, buttons={n_buttons})", | |
| depth=0, jump_kind="none") | |
| def test_selector_row_shape(): | |
| """selectTableRow holds exactly two ImageButton children (prev/next arrows) | |
| flanking the 'Select Table' label — the picker's shape. SHAPE, not content.""" | |
| restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| prev = node_by_id(nodes, "previousTableButton") | |
| nxt = node_by_id(nodes, "nextTableButton") | |
| n_imgbtn = len(find_by_class(nodes, "ImageButton")) # observed: 2 | |
| ok = prev is not None and nxt is not None and n_imgbtn >= 2 | |
| record("struct_selector_row_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: table-picker arrows missing " | |
| f"(prev={prev is not None}, next={nxt is not None}, " | |
| f"imgbtn={n_imgbtn})", | |
| depth=0, jump_kind="none") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # SHAPE DELTAS (state-machine panel swaps within BouncyActivity) | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_start_game_shape(): | |
| """START GAME shape delta: buttonPanel DISAPPEARS + pauseIcon APPEARS. | |
| Reverse it (pause) and assert the buttonPanel subtree restores.""" | |
| restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| ok_enter, before, after = and_enter_gameplay(nodes) | |
| changed = surface_changed(before, after) | |
| # reverse: pause -> buttonPanel must come back | |
| restored = False | |
| if ok_enter: | |
| g_nodes = ui() | |
| ok_pause, _b, _a = and_enter_paused_menu(g_nodes) | |
| restored = ok_pause and node_by_id(ui(), "buttonPanel") is not None | |
| ok = ok_enter and changed and restored | |
| record("struct_start_game_shape", bool(ok), | |
| "" if ok else "behavior_wrong: START GAME did not remove buttonPanel / " | |
| "add pauseIcon, or the panel did not restore on pause", | |
| depth=1, jump_kind="transition", | |
| expect="buttonPanel->gone & pauseIcon->present on Start; " | |
| "buttonPanel restored on pause") | |
| def test_pause_shape(): | |
| """Pause shape delta (depth 2): from gameplay, tap pauseIcon -> pauseIcon | |
| DISAPPEARS + buttonPanel REAPPEARS.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| ok_p, before, after = (False, set(), set()) | |
| if ok_g: | |
| ok_p, before, after = and_enter_paused_menu(ui()) | |
| p_nodes = ui() | |
| pause_gone = node_by_id(p_nodes, "pauseIcon") is None | |
| panel_back = node_by_id(p_nodes, "buttonPanel") is not None | |
| ok = ok_g and ok_p and pause_gone and panel_back and surface_changed(before, after) | |
| record("struct_pause_shape", bool(ok), | |
| "" if ok else "behavior_wrong: pause did not remove pauseIcon / restore " | |
| "buttonPanel", | |
| depth=2, jump_kind="transition", | |
| expect="pauseIcon->gone & buttonPanel->present after pause") | |
| def test_paused_menu_shape(): | |
| """Paused-menu SHAPE contrast (depth 2): the reappeared buttonPanel now holds | |
| resumeGameButton + endGameButton, while selectTableRow + unlimitedBallsToggle | |
| + startGameButton are ABSENT — a different subtree from the fresh menu.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| ok_p = False | |
| if ok_g: | |
| ok_p, _b2, _a2 = and_enter_paused_menu(ui()) | |
| p = ui() | |
| has_resume = node_by_id(p, "resumeGameButton") is not None | |
| has_end = node_by_id(p, "endGameButton") is not None | |
| no_picker = node_by_id(p, "selectTableRow") is None | |
| no_toggle = node_by_id(p, "unlimitedBallsToggle") is None | |
| no_start = node_by_id(p, "startGameButton") is None | |
| ok = ok_g and ok_p and has_resume and has_end and no_picker and no_toggle and no_start | |
| record("struct_paused_menu_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: paused-menu shape wrong " | |
| f"(resume={has_resume}, end={has_end}, no_picker={no_picker}, " | |
| f"no_toggle={no_toggle}, no_start={no_start})", | |
| depth=2, jump_kind="transition", | |
| expect="paused panel: +resume/+end, -selectTableRow/-toggle/-startGame") | |
| def test_fresh_menu_shape(): | |
| """Fresh (not-in-progress) menu SHAPE: startGameButton + selectTableRow | |
| present, resumeGameButton + endGameButton + pauseIcon ABSENT. The exact | |
| inverse of the paused-menu shape.""" | |
| restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| has_start = node_by_id(nodes, "startGameButton") is not None | |
| has_picker = node_by_id(nodes, "selectTableRow") is not None | |
| no_resume = node_by_id(nodes, "resumeGameButton") is None | |
| no_end = node_by_id(nodes, "endGameButton") is None | |
| no_pause = node_by_id(nodes, "pauseIcon") is None | |
| ok = has_start and has_picker and no_resume and no_end and no_pause | |
| record("struct_fresh_menu_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: fresh-menu shape wrong " | |
| f"(start={has_start}, picker={has_picker}, " | |
| f"no_resume={no_resume}, no_end={no_end}, no_pause={no_pause})", | |
| depth=0, jump_kind="none") | |
| def test_end_game_restores_fresh_menu(): | |
| """END GAME shape delta (depth 2): from the paused menu, tap endGameButton -> | |
| the fresh-menu subtree returns (selectTableRow + startGameButton present, | |
| resume/end gone). End Game is non-destructive (returns to menu).""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| ok_p = False | |
| if ok_g: | |
| ok_p, _b2, _a2 = and_enter_paused_menu(ui()) | |
| end_btn = node_by_id(ui(), "endGameButton") if ok_p else None | |
| tapped = tap_node(end_btn) if end_btn else False | |
| m = ui() | |
| back_fresh = (node_by_id(m, "selectTableRow") is not None | |
| and node_by_id(m, "startGameButton") is not None | |
| and node_by_id(m, "resumeGameButton") is None | |
| and node_by_id(m, "endGameButton") is None) | |
| ok = ok_g and ok_p and tapped and back_fresh | |
| record("struct_end_game_restores_fresh_menu", bool(ok), | |
| "" if ok else "behavior_wrong: End Game did not restore the fresh menu " | |
| "subtree (selectTableRow+startGame back, resume/end gone)", | |
| depth=2, jump_kind="transition", | |
| expect="paused -> End Game -> fresh menu subtree (+picker/+start, -resume/-end)") | |
| def test_highscore_panel_shape(): | |
| """HIGH SCORES shape delta (depth 1): highScorePanel APPEARS, buttonPanel | |
| DISAPPEARS. Reverse via OK and assert the buttonPanel subtree restores.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_reach, before, after = and_reach_highscores(ui()) | |
| changed = surface_changed(before, after) | |
| # panel must hold its title TextView + OK button — SHAPE of the dialog subtree | |
| h = ui() | |
| has_ok = node_by_id(h, "hideHighScoreButton") is not None | |
| # reverse: OK -> buttonPanel back | |
| restored = False | |
| if ok_reach and has_ok: | |
| tap_node(node_by_id(h, "hideHighScoreButton")) | |
| restored = node_by_id(ui(), "buttonPanel") is not None | |
| ok = ok_reach and changed and has_ok and restored | |
| record("struct_highscore_panel_shape", bool(ok), | |
| "" if ok else "behavior_wrong: HIGH SCORES did not swap buttonPanel for " | |
| "highScorePanel(+OK), or OK did not restore the menu", | |
| depth=1, jump_kind="transition", | |
| expect="buttonPanel->highScorePanel(+OK) on HIGH SCORES; restored on OK") | |
| def test_back_closes_highscore(): | |
| """BACK on the high-scores panel is a shape RESTORE, not an app exit: | |
| highScorePanel disappears, buttonPanel returns, app still foreground.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_reach, _b, _a = and_reach_highscores(ui()) | |
| press_key(4) # KEYCODE_BACK | |
| m = ui() | |
| panel_gone = node_by_id(m, "highScorePanel") is None | |
| menu_back = node_by_id(m, "buttonPanel") is not None | |
| still_fg = is_app_foreground() | |
| ok = ok_reach and panel_gone and menu_back and still_fg | |
| record("struct_back_closes_highscore", bool(ok), | |
| "" if ok else "behavior_wrong: BACK did not restore buttonPanel from the " | |
| "high-scores panel (or app left foreground)", | |
| depth=1, jump_kind="transition", | |
| expect="BACK: highScorePanel->gone, buttonPanel->present, still foreground") | |
| def test_preferences_shape(): | |
| """PREFERENCES shape delta (depth 1, new activity): a ListView with >=8 | |
| preference rows appears; the menu buttonPanel is gone. SHAPE = row count.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_reach, prefs = and_reach_preferences(ui()) | |
| # observed 11 rows (title TextViews with android:id/title) + 8 checkboxes | |
| titles = [n for n in prefs if n.get("resource-id", "").endswith("/title") | |
| and n.get("class", "").endswith("TextView") and n.get("text")] | |
| n_rows = len(titles) | |
| n_checks = len(find_by_class(prefs, "CheckBox")) | |
| panel_gone = node_by_id(prefs, "buttonPanel") is None | |
| ok = ok_reach and n_rows >= 8 and n_checks >= 6 and panel_gone | |
| record("struct_preferences_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: Preferences shape wrong " | |
| f"(rows={n_rows} need>=8, checks={n_checks} need>=6, " | |
| f"panel_gone={panel_gone})", | |
| depth=1, jump_kind="transition", | |
| expect="Preferences ListView: >=8 rows, >=6 checkboxes, no buttonPanel") | |
| def test_about_shape(): | |
| """HELP shape delta (depth 1, new activity): the aboutTextView subtree | |
| dominates and the menu buttonPanel is gone. SHAPE: one large TextView is the | |
| dominant node (its bounds cover most of the content area).""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_reach, about = and_reach_about(ui()) | |
| tv = node_by_id(about, "aboutTextView") | |
| panel_gone = node_by_id(about, "buttonPanel") is None | |
| dominant = False | |
| if tv and "_bounds" in tv: | |
| x1, y1, x2, y2 = tv["_bounds"] | |
| s = get_screen_info() | |
| # the about text is a tall block covering a large share of the height | |
| dominant = (y2 - y1) >= 0.30 * s["height"] and (x2 - x1) >= 0.6 * s["width"] | |
| ok = ok_reach and tv is not None and panel_gone and dominant | |
| record("struct_about_shape", bool(ok), | |
| "" if ok else "behavior_wrong: About did not show a dominant aboutTextView " | |
| "with the menu buttonPanel gone", | |
| depth=1, jump_kind="transition", | |
| expect="About: aboutTextView dominant subtree, no buttonPanel") | |
| def test_gamespeed_dialog_shape(): | |
| """Game speed dialog shape delta (depth 2): inside Preferences, tap 'Game | |
| speed' -> a dialog subtree with exactly 3 CheckedTextView options appears.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_pref, prefs = and_reach_preferences(ui()) | |
| ok_dialog, dlg = (False, prefs) | |
| if ok_pref: | |
| ok_dialog, dlg = and_enter_pref_dialog(prefs, "Game speed") | |
| n_options = len(find_by_class(dlg, "CheckedTextView")) # observed: 3 | |
| has_title = node_by_id(dlg, "alertTitle") is not None | |
| ok = ok_pref and ok_dialog and n_options == 3 and has_title | |
| record("struct_gamespeed_dialog_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: Game speed dialog shape wrong " | |
| f"(options={n_options} need 3, title={has_title})", | |
| depth=2, jump_kind="transition", | |
| expect="Game speed dialog: alertTitle + exactly 3 CheckedTextView") | |
| def test_linewidth_dialog_shape(): | |
| """Line width dialog shape delta (depth 2): inside Preferences, tap 'Line | |
| width' -> a dialog subtree that adds an EditText (plus a message TextView).""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_pref, prefs = and_reach_preferences(ui()) | |
| n_edit_before = len(find_by_class(prefs, "EditText")) # observed: 0 | |
| ok_dialog, dlg = (False, prefs) | |
| if ok_pref: | |
| ok_dialog, dlg = and_enter_pref_dialog(prefs, "Line width") | |
| n_edit_after = len(find_by_class(dlg, "EditText")) # observed: 1 | |
| has_title = node_by_id(dlg, "alertTitle") is not None | |
| ok = (ok_pref and ok_dialog and has_title | |
| and n_edit_after == n_edit_before + 1) | |
| record("struct_linewidth_dialog_shape", bool(ok), | |
| "" if ok else f"behavior_wrong: Line width dialog shape wrong " | |
| f"(EditText {n_edit_before}->{n_edit_after}, title={has_title})", | |
| depth=2, jump_kind="transition", | |
| expect="Line width dialog: alertTitle + EditText count 0->1") | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| # VLM (8) — canvas/GL/layout facts that never reach the view tree | |
| # ══════════════════════════════════════════════════════════════════════════════ | |
| def test_menu_field_rendered_vlm(): | |
| """The pinball FIELD is drawn behind/around the menu panel on launch — a | |
| complex line-drawing playfield the tree cannot describe.""" | |
| restart_app(); wait_for_foreground(10) | |
| ui() | |
| vlm_assert("struct_menu_field_rendered", | |
| "Behind and around the centered menu panel, is there a complex " | |
| "line-drawing pinball playfield (thin colored outlines, arcs, and " | |
| "small round bumpers) filling the dark background?", | |
| RESULTS_DIR, depth=0, jump_kind="none", tag="shape") | |
| def test_gameplay_field_no_panel_vlm(): | |
| """After START GAME the field fills the screen with the menu panel GONE and a | |
| circular pause icon at the top-left — a layout fact (panel removed).""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| if not ok_g: | |
| record("struct_gameplay_field_no_panel_vlm", False, | |
| "setup_failed: could not enter gameplay", depth=1, | |
| jump_kind="transition", tag="layout") | |
| else: | |
| vlm_assert("struct_gameplay_field_no_panel", | |
| "Is the pinball playfield now shown WITHOUT any centered " | |
| "gray-button menu panel over it (no START GAME / HIGH SCORES " | |
| "buttons visible)?", | |
| RESULTS_DIR, depth=1, jump_kind="transition", tag="layout") | |
| def test_gameplay_pause_icon_topleft_vlm(): | |
| """During gameplay a round pause icon sits at the TOP-LEFT of the top bar — | |
| an exact rendered position fact.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| if not ok_g: | |
| record("struct_gameplay_pause_icon_topleft_vlm", False, | |
| "setup_failed: could not enter gameplay", depth=1, | |
| jump_kind="transition", tag="position") | |
| else: | |
| vlm_assert("struct_gameplay_pause_icon_topleft", | |
| "Is there a small round pause icon (two vertical bars in a " | |
| "circle) at the TOP-LEFT corner of the top status bar?", | |
| RESULTS_DIR, depth=1, jump_kind="transition", tag="position") | |
| def test_top_score_bar_vlm(): | |
| """The top status bar spans the full width across the top of the gameplay | |
| screen and contains a centered score readout — a position/layout fact.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| if not ok_g: | |
| record("struct_top_score_bar_vlm", False, | |
| "setup_failed: could not enter gameplay", depth=1, | |
| jump_kind="transition", tag="position") | |
| else: | |
| vlm_assert("struct_top_score_bar", | |
| "Is there a horizontal status bar spanning the full width at the " | |
| "very TOP of the screen, containing a centered numeric score " | |
| "readout, separate from the playfield below it?", | |
| RESULTS_DIR, depth=1, jump_kind="transition", tag="position") | |
| def test_paused_overlay_field_vlm(): | |
| """The paused menu panel is overlaid ON TOP of the still-rendered field (the | |
| field's colored lines/bumpers remain visible around the panel) — a layering | |
| fact the tree cannot express.""" | |
| restart_app(); wait_for_foreground(10) | |
| ok_g, _b, _a = and_enter_gameplay(ui()) | |
| ok_p = False | |
| if ok_g: | |
| ok_p, _b2, _a2 = and_enter_paused_menu(ui()) | |
| if not (ok_g and ok_p): | |
| record("struct_paused_overlay_field_vlm", False, | |
| "setup_failed: could not reach the paused menu", depth=2, | |
| jump_kind="transition", tag="layout") | |
| else: | |
| vlm_assert("struct_paused_overlay_field", | |
| "Is a centered menu panel (with RESUME GAME and END GAME " | |
| "buttons) overlaid on top of the pinball playfield, with the " | |
| "field's colored lines and bumpers still visible around the " | |
| "panel edges?", | |
| RESULTS_DIR, depth=2, jump_kind="transition", tag="layout") | |
| def test_table1_layout_vlm(): | |
| """Table 1's rendered field has a distinctive white circle near the top-left | |
| and cyan/red rollover rings — an exact rendered content fact. (Fresh data = | |
| table 1 by default.)""" | |
| clear_data(); restart_app(); wait_for_foreground(10) | |
| ui() | |
| vlm_assert("struct_table1_layout", | |
| "On the pinball field behind the menu, near the TOP-LEFT, is there " | |
| "a small WHITE circle outline together with red and cyan ring " | |
| "targets on the field?", | |
| RESULTS_DIR, depth=0, jump_kind="none", tag="position") | |
| def test_table_switch_changes_field_vlm(): | |
| """Tapping the next-table arrow changes the RENDERED field layout (a canvas | |
| consequence; the view tree is unchanged). Table 2 shows a row of yellow | |
| bumpers along the top — distinct from table 1.""" | |
| clear_data(); restart_app(); wait_for_foreground(10) | |
| nodes = ui() | |
| nxt = node_by_id(nodes, "nextTableButton") | |
| tapped = tap_node(nxt) if nxt else False | |
| ui() | |
| if not tapped: | |
| record("struct_table_switch_changes_field_vlm", False, | |
| "setup_failed: next-table arrow not found/tappable", depth=0, | |
| jump_kind="none", tag="color") | |
| else: | |
| vlm_assert("struct_table_switch_changes_field", | |
| "On the pinball field behind the menu, are there two large " | |
| "YELLOW round bumpers near the TOP of the playfield?", | |
| RESULTS_DIR, depth=0, jump_kind="none", tag="color") | |
| TESTS = [ | |
| # gate + static shape (depth 0, none) — kept <=30% | |
| test_launch_gate, | |
| test_menu_subtree_shape, | |
| test_selector_row_shape, | |
| test_fresh_menu_shape, | |
| # shape deltas (transition) | |
| test_start_game_shape, | |
| test_pause_shape, | |
| test_paused_menu_shape, | |
| test_end_game_restores_fresh_menu, | |
| test_highscore_panel_shape, | |
| test_back_closes_highscore, | |
| test_preferences_shape, | |
| test_about_shape, | |
| test_gamespeed_dialog_shape, | |
| test_linewidth_dialog_shape, | |
| # VLM (8) — canvas/layout facts | |
| test_menu_field_rendered_vlm, | |
| test_gameplay_field_no_panel_vlm, | |
| test_gameplay_pause_icon_topleft_vlm, | |
| test_top_score_bar_vlm, | |
| test_paused_overlay_field_vlm, | |
| test_table1_layout_vlm, | |
| test_table_switch_changes_field_vlm, | |
| ] | |
| if __name__ == "__main__": | |
| run_suite(TESTS, "structure") | |