| | |
| | | |
| | | 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") |
| | | |
| | | blue_reference = next( |
| | | ( |
| | | color |
| | | for segment in segments |
| | | for color in segment.get("windowBlockColors", []) |
| | | if color.get("alpha", 0) > 0 |
| | | ), |
| | | None |
| | | ) |
| | | require(blue_reference is not None, "fixture must expose a Space Lane blue reference color") |
| | | hovered_title_color = columns[hover_index].get("appNameColor", {}) |
| | | for channel in ("red", "green", "blue"): |
| | | require( |
| | | abs(hovered_title_color.get(channel, -1) - blue_reference.get(channel, -2)) <= 0.002, |
| | | f"hovered column title must use the same blue reference for {channel}" |
| | | ) |
| | | require(hovered_title_color.get("alpha", 0) >= 0.98, "hovered column title color must be opaque") |
| | | 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_items = [ |
| | | item for item in items |
| | |
| | | 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"), |
| | | "hoveredColumnTitleColor": hovered_title_color, |
| | | "blueReference": blue_reference, |
| | | "selectedZ": selected_z, |
| | | "hoverZ": hover_z, |
| | | "scrollable": root.get("appShelfScrollable"), |