Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ extension RunnerTests {
/// `liveContentTranslation` and never defaulted: a vector nobody read must not pass for full screen.
enum TextEntryContentTranslation {
case known(CGSize)
/// The app fills the screen, so a snapshot frame is already a screen frame.
/// The window's box sits at the screen origin, so a snapshot frame is already a screen frame.
case none
/// The window read could not answer, so no snapshot frame names a screen box.
case unknown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,41 +216,6 @@ extension RunnerTests {
)
}

func testSynthesizedDispatchInvertsCaptureOnEveryInterfaceOrientation() {
let frames = [
CGRect(x: 0, y: 0, width: 430, height: 932),
CGRect(x: 0, y: 0, width: 951, height: 669),
]
for frame in frames {
for orientation in [
RunnerInterfaceOrientation.portrait,
RunnerInterfaceOrientation.portraitUpsideDown,
RunnerInterfaceOrientation.landscapeLeft,
RunnerInterfaceOrientation.landscapeRight,
] {
let corners = [
CGPoint(x: frame.minX + 1, y: frame.minY + 1),
CGPoint(x: frame.midX, y: frame.midY),
CGPoint(x: frame.maxX - 2, y: frame.maxY - 3),
]
for displayed in corners {
let captured = CoordinateSpaceRotation.oriented(
point: displayed,
in: frame,
interfaceOrientation: orientation
)
let dispatched = CoordinateSpaceRotation.native(
point: captured,
in: frame,
interfaceOrientation: orientation
)
XCTAssertEqual(dispatched.x, displayed.x, accuracy: 0.001, "orientation \(orientation)")
XCTAssertEqual(dispatched.y, displayed.y, accuracy: 0.001, "orientation \(orientation)")
}
}
}
}

func testPlannedMultiTouchGestureAcceptsMatchingInBoundsTrajectories() throws {
let plan = try JSONDecoder().decode(
RunnerGesturePlan.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ public enum CoordinateSpaceRotation {
}
}

public static func native(vector: CGVector, interfaceOrientation: Int) -> CGVector {
switch interfaceOrientation {
case RunnerInterfaceOrientation.landscapeRight:
return CGVector(dx: -vector.dy, dy: vector.dx)
case RunnerInterfaceOrientation.landscapeLeft:
return CGVector(dx: vector.dy, dy: -vector.dx)
case RunnerInterfaceOrientation.portraitUpsideDown:
return CGVector(dx: -vector.dx, dy: -vector.dy)
default:
return vector
}
}

public static func oriented(
point: CGPoint,
in frame: CGRect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,6 @@ final class CoordinateSpaceTests: XCTestCase {
)
}

func testNativeSynthesizedVectorRotatesByInterfaceOrientation() {
let cases: [(Int, CGVector)] = [
(RunnerInterfaceOrientation.portrait, CGVector(dx: 40, dy: -20)),
(RunnerInterfaceOrientation.landscapeRight, CGVector(dx: 20, dy: 40)),
(RunnerInterfaceOrientation.landscapeLeft, CGVector(dx: -20, dy: -40)),
(RunnerInterfaceOrientation.portraitUpsideDown, CGVector(dx: -40, dy: 20)),
(RunnerInterfaceOrientation.unknown, CGVector(dx: 40, dy: -20)),
]
for (orientation, expected) in cases {
let vector = CoordinateSpaceRotation.native(
vector: CGVector(dx: 40, dy: -20),
interfaceOrientation: orientation
)
XCTAssertEqual(vector.dx, expected.dx, "dx interfaceOrientation \(orientation)")
XCTAssertEqual(vector.dy, expected.dy, "dy interfaceOrientation \(orientation)")
}
}

/// Capture rotates back with the exact inverse of what dispatch rotates forward. A landscape
/// rotation that drifts on one side only fails here; the two paths cannot disagree silently.
func testOrientationRotationRoundTripsBetweenInterfaceAndNativeSpace() {
Expand Down
Loading