| | |
| | | PY |
| | | } |
| | | |
| | | assert_space_click_report() { |
| | | assert_space_click_filter_report() { |
| | | /usr/bin/python3 - "$1" <<'PY' |
| | | import json |
| | | import sys |
| | |
| | | root = report.get("rootView", {}) |
| | | columns = sorted(root.get("waterfallColumns", []), key=lambda column: column.get("appGroupIndex", 0)) |
| | | target_space_id = 1 |
| | | first_space_card = None |
| | | for column in columns: |
| | | cards = sorted(column.get("cards", []), key=lambda card: card.get("windowIndex", 0)) |
| | | first_space_card = next((card for card in cards if card.get("primarySpaceID") == target_space_id), None) |
| | | if first_space_card is not None: |
| | | break |
| | | |
| | | require(first_space_card is not None, "fixture must include at least one window in Space A1") |
| | | expected_window_id = first_space_card.get("windowID") |
| | | cards = [card for column in columns for card in column.get("cards", [])] |
| | | segments = root.get("spaceLaneSegments", []) |
| | | locked_segments = [segment for segment in segments if "locked" in segment.get("visualStates", [])] |
| | | |
| | | require(report.get("snapshotLoaded") is True, "snapshotLoaded must be true") |
| | | require(report.get("quickSwitchVisible") is False, "click-space must close Quick Switch after committing a window in that Space") |
| | | require(report.get("quickSwitchVisible") is True, "click-space must keep Quick Switch visible after locking Space filter") |
| | | require(report.get("spaceFilterActive") is True, "click-space must enable session Space filter") |
| | | require(report.get("spaceFilterLockedSpaceID") == target_space_id, "click-space must lock the clicked Space") |
| | | require(report.get("lastSpaceFilterAction") == "lock", "click-space must record a lock action") |
| | | require(root.get("spaceFilterActive") is True, "root report must expose active Space filter") |
| | | require(root.get("spaceFilterLockedSpaceID") == target_space_id, "root report must expose the locked Space") |
| | | require(root.get("lastSpaceLaneClickSpaceID") == target_space_id, "click-space must record the clicked Space") |
| | | require(root.get("spaceLaneFocusedSpaceID") is None, "click-space must not reuse persistent focus as its behavior") |
| | | require(root.get("lastCommittedWindowID") == expected_window_id, "click-space must commit the first window in the clicked Space") |
| | | require(report.get("lastCommittedWindowID") == expected_window_id, "session must surface the Space click commit") |
| | | require(report.get("lastActivationWindowID") == expected_window_id, "activation window must match the first window in clicked Space") |
| | | require(report.get("lastActivationResult") == "activated", "debug activation must activate the clicked Space window") |
| | | require(report.get("lastCommitSource") == "mouse", "click-space commit source must be mouse") |
| | | require(root.get("spaceLaneFocusedSpaceID") is None, "click-space must not reuse persistent hover focus as its behavior") |
| | | require(report.get("lastCommittedWindowID") is None, "ordinary click-space must not commit a window") |
| | | require(report.get("lastActivationWindowID") is None, "ordinary click-space must not activate a window") |
| | | require(report.get("lastActivationResult") is None, "ordinary click-space must not report activation") |
| | | require(report.get("lastCommitSource") is None, "ordinary click-space must not report a commit source") |
| | | require(cards, "fixture must include filtered cards for Space A1") |
| | | require(all(card.get("primarySpaceID") == target_space_id for card in cards), "click-space filter must only keep windows in clicked Space") |
| | | require(len(locked_segments) == 1, "exactly one Space Lane segment must expose locked") |
| | | require(locked_segments[0].get("spaceID") == target_space_id, "locked segment must be the clicked Space") |
| | | |
| | | print(json.dumps({ |
| | | "clickedSpaceID": root.get("lastSpaceLaneClickSpaceID"), |
| | | "lastCommittedWindowID": root.get("lastCommittedWindowID"), |
| | | "lastActivationResult": report.get("lastActivationResult") |
| | | "lockedSpaceID": root.get("spaceFilterLockedSpaceID"), |
| | | "visibleCardSpaceIDs": sorted({card.get("primarySpaceID") for card in cards}), |
| | | "quickSwitchVisible": report.get("quickSwitchVisible") |
| | | }, indent=2, ensure_ascii=False)) |
| | | PY |
| | | } |
| | |
| | | run_report "$CLEAR_REPORT" "hover-space:1,hover-card:0:0" "hover-card:0:0" |
| | | assert_space_focus_clear_report "$CLEAR_REPORT" |
| | | |
| | | run_report "$SPACE_CLICK_REPORT" "click-space:1" "click-space:1" "$FIXTURE_APP_COUNT" "$FIXTURE_WINDOWS_PER_APP" hidden |
| | | assert_space_click_report "$SPACE_CLICK_REPORT" |
| | | run_report "$SPACE_CLICK_REPORT" "click-space:1" "click-space:1" "$FIXTURE_APP_COUNT" "$FIXTURE_WINDOWS_PER_APP" visible |
| | | assert_space_click_filter_report "$SPACE_CLICK_REPORT" |
| | | |
| | | run_report "$REMOTE_REPORT" "hover-space:1,click-app:$REMOTE_APP_INDEX" "click-app:$REMOTE_APP_INDEX" "$FIXTURE_APP_COUNT" "$FIXTURE_WINDOWS_PER_APP" hidden |
| | | assert_remote_click_report "$REMOTE_REPORT" |