import Foundation @MainActor func checkMenuSizeCommands(_ session: RealitySession, layout: String) async throws { try session.configure(layout: layout) let owned = try await session.startingWindows([.textEdit, .textEdit]) try await session.start() try await session.tiles(owned) try await session.command("reset-sizes") try await session.tiles(owned) let baseline = try LayoutSizeOracle(ids: owned.map(\.id), initial: session.readFrames(owned), layout: layout) try encodeJSON(baseline, to: session.directory.appendingPathComponent("menu-size-baseline.json")) try await session.command("ratio-three-fifths") try await session.expect("\(layout): 60% preset enlarges the main real tile") { baseline.grew(try FrameOracle.frames($0, ids: baseline.ids), visible: session.visible) } let sixty = try session.readFrames(owned)[baseline.mainIndex] try await session.command("ratio-two-thirds") try await session.expect("\(layout): two-thirds preset enlarges the main real tile beyond 60%") { let frames = try FrameOracle.frames($0, ids: baseline.ids) return baseline.grew(frames, visible: session.visible) && frames[baseline.mainIndex].area > sixty.area + 100 } try await session.command("ratio-half") try await session.expect("\(layout): half preset restores the original real frames") { baseline.restored(try FrameOracle.frames($0, ids: baseline.ids)) } try await session.command("ratio-two-thirds") try await session.expect("\(layout): custom sizes move the real tiles before reset") { baseline.grew(try FrameOracle.frames($0, ids: baseline.ids), visible: session.visible) } try await session.command("reset-sizes") try await session.expect("\(layout): reset restores the original real tile geometry") { baseline.restored(try FrameOracle.frames($0, ids: baseline.ids)) } }