| | |
| | | import CoreGraphics |
| | | import Foundation |
| | | import AlignerCore |
| | | |
| | |
| | | case candidateFiltering |
| | | case activation |
| | | case spaceFilter |
| | | case splitView |
| | | } |
| | | |
| | | final class LiveQuickSwitchSnapshotLoader: QuickSwitchSnapshotLoading { |
| | |
| | | } |
| | | if mode == .spaceFilter { |
| | | return spaceFilterSnapshot() |
| | | } |
| | | if mode == .splitView { |
| | | return splitViewSnapshot() |
| | | } |
| | | |
| | | return layoutSnapshot() |
| | |
| | | currentSpaceIDs: [1, 4] |
| | | ) |
| | | } |
| | | |
| | | private func splitViewSnapshot() -> QuickSwitchSnapshotLoad { |
| | | let displayUUID = "fixture-display-a" |
| | | let displays = [ |
| | | AlignerDisplay( |
| | | uuid: displayUUID, |
| | | physical: true, |
| | | spaces: [ |
| | | AlignerSpace(id: 1, type: .user, displayUUID: displayUUID, index: 1), |
| | | AlignerSpace(id: 2, type: .fullscreen, displayUUID: displayUUID, index: 2), |
| | | AlignerSpace(id: 3, type: .fullscreen, displayUUID: displayUUID, index: 3) |
| | | ] |
| | | ) |
| | | ] |
| | | |
| | | let normalApp = AlignerApp( |
| | | bundleIdentifier: "com.example.split.normal", |
| | | name: "普通窗口", |
| | | category: .generic, |
| | | processIdentifier: 60_001 |
| | | ) |
| | | let leftApp = AlignerApp( |
| | | bundleIdentifier: "com.example.split.left", |
| | | name: "左侧应用", |
| | | category: .finder, |
| | | processIdentifier: 60_002 |
| | | ) |
| | | let rightApp = AlignerApp( |
| | | bundleIdentifier: "com.example.split.right", |
| | | name: "右侧应用", |
| | | category: .documentNotes, |
| | | processIdentifier: 60_003 |
| | | ) |
| | | let singleFullscreenApp = AlignerApp( |
| | | bundleIdentifier: "com.example.split.single", |
| | | name: "单全屏", |
| | | category: .generic, |
| | | processIdentifier: 60_004 |
| | | ) |
| | | |
| | | let windows = [ |
| | | AlignerWindow( |
| | | id: 60_101, |
| | | app: normalApp, |
| | | title: "普通窗口", |
| | | frame: CGRect(x: 80, y: 120, width: 900, height: 620), |
| | | spaceIDs: [1] |
| | | ), |
| | | AlignerWindow( |
| | | id: 60_202, |
| | | app: rightApp, |
| | | title: "右侧 Split View", |
| | | isFullscreen: true, |
| | | frame: CGRect(x: 960, y: 0, width: 960, height: 1080), |
| | | spaceIDs: [2] |
| | | ), |
| | | AlignerWindow( |
| | | id: 60_201, |
| | | app: leftApp, |
| | | title: "左侧 Split View", |
| | | isFullscreen: true, |
| | | frame: CGRect(x: 0, y: 0, width: 960, height: 1080), |
| | | spaceIDs: [2] |
| | | ), |
| | | AlignerWindow( |
| | | id: 60_301, |
| | | app: singleFullscreenApp, |
| | | title: "单全屏", |
| | | isFullscreen: true, |
| | | frame: CGRect(x: 0, y: 0, width: 1920, height: 1080), |
| | | spaceIDs: [3] |
| | | ) |
| | | ] |
| | | |
| | | return QuickSwitchSnapshotLoad( |
| | | snapshot: QuickSwitchSnapshotBuilder.snapshot(displays: displays, windows: windows), |
| | | currentSpaceIDs: [1] |
| | | ) |
| | | } |
| | | } |