| | |
| | | print(json.dumps(report, indent=2, ensure_ascii=False), file=sys.stderr) |
| | | sys.exit(1) |
| | | |
| | | def expected_index_text(index): |
| | | symbols = list("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
| | | if index < len(symbols): |
| | | return symbols[index] |
| | | overflow = index - len(symbols) |
| | | return symbols[10 + (overflow // 26) % 26] + symbols[10 + overflow % 26] |
| | | |
| | | root = report.get("rootView", {}) |
| | | items = root.get("appShelfItems", []) |
| | | columns = root.get("waterfallColumns", []) |
| | | segments = root.get("spaceLaneSegments", []) |
| | | |
| | | require(report.get("snapshotLoaded") is True, "snapshotLoaded must be true") |
| | | require(report.get("appCount") == fixture_app_count, "fixture appCount must match requested count") |
| | |
| | | require(root.get("appShelfContentWidth", 0) <= root.get("appShelfVisibleWidth", 0), "non-scrollable fixture App Shelf content must fit visible width") |
| | | require(root.get("appShelfMaxScrollOffset", 0) == 0, "non-scrollable fixture App Shelf must expose zero max scroll offset") |
| | | require(root.get("appShelfHoveredIndex") == hover_index, "fixture App Shelf must expose requested hovered index") |
| | | require(len(columns) == fixture_app_count, "Waterfall column reports must match fixture count") |
| | | require(sum(1 for item in items if item.get("isSelected") is True) == 1, "App Shelf must expose one selected app") |
| | | require(sum(1 for item in items if item.get("isHovered") is True) == 1, "App Shelf must expose one hovered app") |
| | | require(sum(1 for column in columns if column.get("isHovered") is True) == 1, "Waterfall must expose one hovered column") |
| | | require(items[0].get("isSelected") is True, "fixture first app should be selected") |
| | | require(items[hover_index].get("isHovered") is True, "fixture requested app should be hovered") |
| | | require("selected" in items[0].get("visualStates", []), "selected app must expose selected visual state") |
| | | require(columns[hover_index].get("isHovered") is True, "fixture requested app column should be hovered") |
| | | require("selectedVisualSuppressed" in items[0].get("visualStates", []), "non-hovered selected app must suppress selected visual state") |
| | | require("hover" in items[hover_index].get("visualStates", []), "hovered app must expose hover visual state") |
| | | require(items[0].get("iconFrame", {}).get("width") == 68, "selected app icon must be 68pt") |
| | | require("hover" in columns[hover_index].get("visualStates", []), "hovered column must expose hover visual state") |
| | | require(items[0].get("iconFrame", {}).get("width") == expected_icon_size, "non-hovered selected app icon must match normal fixture icon size") |
| | | require(items[hover_index].get("iconFrame", {}).get("width") == 68, "hovered app icon must be 68pt") |
| | | |
| | | legacy_blue_reference = {"red": 135 / 255, "green": 200 / 255, "blue": 1.0, "alpha": 1.0} |
| | | hovered_title_color = columns[hover_index].get("appNameColor", {}) |
| | | hovered_header_color = columns[hover_index].get("headerBackgroundColor", {}) |
| | | hovered_count_color = columns[hover_index].get("countColor", {}) |
| | | |
| | | def is_legacy_blue(color): |
| | | return all(abs(color.get(channel, -1) - legacy_blue_reference[channel]) <= 0.01 for channel in ("red", "green", "blue")) |
| | | |
| | | hovered_header_channels = [hovered_header_color.get(channel, -1) for channel in ("red", "green", "blue")] |
| | | require(not is_legacy_blue(hovered_header_color), "hovered column header must no longer use the previous blue fill") |
| | | require(max(hovered_header_channels) - min(hovered_header_channels) <= 0.035, "hovered column header must use a neutral gray fill") |
| | | require(0.16 <= hovered_header_color.get("alpha", 0) <= 0.30, "hovered column header gray fill must stay lightweight") |
| | | require(hovered_title_color.get("alpha", 0) >= 0.8, "hovered column title must remain readable") |
| | | require(hovered_count_color.get("alpha", 0) >= 0.45, "hovered column count must remain readable") |
| | | hovered_cards = columns[hover_index].get("cards", []) |
| | | require(hovered_cards, "hovered column must include at least one card") |
| | | require("appLinked" in hovered_cards[0].get("visualStates", []), "hovered App column first card must expose appLinked visual state") |
| | | require(hovered_cards[0].get("closeButtonVisible") is False, "App-linked first card must not show close button unless directly hovered") |
| | | require(hovered_cards[0].get("shadowOpacity", 0) > 0, "App-linked first card must lift with a shadow") |
| | | require(hovered_cards[0].get("titleBarBackgroundColor", {}).get("alpha", 0) > 0.10, "App-linked first card title bar must expose a visible highlight") |
| | | require(all("appLinked" not in card.get("visualStates", []) for card in hovered_cards[1:]), "only the first vertical card in the hovered App column should expose appLinked") |
| | | for index, column in enumerate(columns): |
| | | if index == hover_index: |
| | | continue |
| | | require(column.get("isHovered") is False, "non-hovered columns must not be marked hovered") |
| | | require("hover" not in column.get("visualStates", []), "non-hovered columns must not expose hover visual state") |
| | | normal_header = column.get("headerBackgroundColor", {}) |
| | | require(not is_legacy_blue(normal_header), "non-hovered column headers must not use the previous blue fill") |
| | | require(all("appLinked" not in card.get("visualStates", []) for card in column.get("cards", [])), "non-hovered columns must not expose appLinked cards") |
| | | |
| | | normal_items = [ |
| | | item for item in items |
| | |
| | | require(normal_items, "fixture must include normal app items") |
| | | require(all(item.get("iconFrame", {}).get("width") == expected_icon_size for item in normal_items), "normal app icons must match expected fixture icon size") |
| | | require(all(item.get("labelTruncationMode") == "middle" for item in items), "all App Shelf labels must use middle truncation") |
| | | require(all(item.get("indexVisible") is True for item in items), "all App Shelf items must expose a visible hand-written index marker") |
| | | require(all(item.get("indexText") == expected_index_text(index) for index, item in enumerate(items)), "App Shelf index markers must follow 1234567890ABCDEFG order") |
| | | require(all(item.get("indexFontSize", 0) >= 14 for item in items), "App Shelf index markers must keep readable font size") |
| | | require(all(0.38 <= item.get("indexColor", {}).get("alpha", 0) <= 0.62 for item in items), "App Shelf index markers must stay low-noise but fully readable") |
| | | require(all(item.get("indexOpacity", 0) == 1 for item in items), "App Shelf index markers must avoid double alpha fading") |
| | | require(all(item.get("indexFrame", {}).get("width", 0) >= 16 for item in items), "App Shelf index markers must reserve enough width") |
| | | require(all(item.get("indexFrame", {}).get("height", 0) >= 22 for item in items), "App Shelf index markers must reserve enough height to avoid bottom clipping") |
| | | require(all(item.get("indexFrame", {}).get("x", 99) < item.get("iconFrame", {}).get("x", -99) for item in items), "App Shelf index markers must sit beside the icon, not over the icon center") |
| | | |
| | | row_y_values = {round(item.get("frame", {}).get("y", 0), 2) for item in items} |
| | | require(len(row_y_values) == expected_rows, "fixture App Shelf visible rows must match expected rows") |
| | |
| | | selected_z = items[0].get("zPosition", 0) |
| | | hover_z = items[hover_index].get("zPosition", 0) |
| | | normal_z = normal_items[0].get("zPosition", 0) |
| | | require(selected_z > hover_z, "selected App Shelf item must stay above non-selected hover item") |
| | | require(selected_z == normal_z, "non-hovered selected App Shelf item must not float above normal items") |
| | | require(hover_z > normal_z, "hover App Shelf item must stay above normal items") |
| | | |
| | | print(json.dumps({ |
| | |
| | | "selectedIcon": items[0].get("iconFrame"), |
| | | "hoveredIndex": root.get("appShelfHoveredIndex"), |
| | | "hoveredIcon": items[hover_index].get("iconFrame"), |
| | | "hoveredColumnHeaderColor": hovered_header_color, |
| | | "hoveredColumnTitleColor": hovered_title_color, |
| | | "hoveredColumnCountColor": hovered_count_color, |
| | | "legacyBlueReference": legacy_blue_reference, |
| | | "hoveredFirstCardStates": hovered_cards[0].get("visualStates"), |
| | | "hoveredFirstCardTitleBarColor": hovered_cards[0].get("titleBarBackgroundColor"), |
| | | "firstIndexes": [item.get("indexText") for item in items[:min(12, len(items))]], |
| | | "selectedZ": selected_z, |
| | | "hoverZ": hover_z, |
| | | "scrollable": root.get("appShelfScrollable"), |
| | |
| | | --round01-open-quick-switch |
| | | --round01-fixture-app-count="$app_count" |
| | | --round01-disable-screenshot-refresh |
| | | --round01-waterfall-view-mode=vertical |
| | | --round01-debug-hover-app-index="$hover_index" |
| | | --round01-quick-switch-report="$report" |
| | | ) |