mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
f03c0309a1
* fix: project iOS transition semantics * fix: derive iOS transition semantics from visible state * fix: preserve iOS presentation context for scoped snapshots * fix: confirm broad iOS transition settlement * ci: run coordinate input regression on pull requests * test: mock migrated snapshot capture seam * fix: confirm transitions across snapshot backends * fix: arm transition confirmation after first capture * fix: settle against immutable action baseline
48 lines
1.0 KiB
Swift
48 lines
1.0 KiB
Swift
import CoreGraphics
|
|
import XCTest
|
|
|
|
func isCoordinateTextInputCandidate(
|
|
enabled: Bool,
|
|
frame: CGRect,
|
|
point: CGPoint,
|
|
tolerance: CGFloat = 2
|
|
) -> Bool {
|
|
enabled
|
|
&& !frame.isEmpty
|
|
&& point.x >= frame.minX - tolerance
|
|
&& point.x <= frame.maxX + tolerance
|
|
&& point.y >= frame.minY - tolerance
|
|
&& point.y <= frame.maxY + tolerance
|
|
}
|
|
|
|
extension RunnerTests {
|
|
#if AGENT_DEVICE_RUNNER_UNIT_TESTS
|
|
func testCoordinateTextInputCandidateMustBeEnabledAndContainTheTouchPoint() {
|
|
let frame = CGRect(x: 10, y: 20, width: 100, height: 40)
|
|
let point = CGPoint(x: 50, y: 40)
|
|
|
|
XCTAssertTrue(
|
|
isCoordinateTextInputCandidate(
|
|
enabled: true,
|
|
frame: frame,
|
|
point: point
|
|
)
|
|
)
|
|
XCTAssertFalse(
|
|
isCoordinateTextInputCandidate(
|
|
enabled: false,
|
|
frame: frame,
|
|
point: point
|
|
)
|
|
)
|
|
XCTAssertFalse(
|
|
isCoordinateTextInputCandidate(
|
|
enabled: true,
|
|
frame: frame,
|
|
point: CGPoint(x: 200, y: 200)
|
|
)
|
|
)
|
|
}
|
|
#endif
|
|
}
|