Skip to content

Commit 6a49be9

Browse files
committed
fix(ios): keep the shared measurability block at its prior size
Trim the predicate's comment and keep it as one guard clause, and name the CoreGraphics constant correctly (CGRectInfinite, not CGRectInfinity) in the unit test (#3918 review thread r4371193252). The pinned block and the two callers now net fewer lines than before the predicate moved in.
1 parent 1b36cb9 commit 6a49be9

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ static BOOL AgentDeviceForegroundOwnershipMatches(pid_t primaryProcessID, pid_t
3434
// of the screen (Windowed Apps or Stage Manager).
3535
static const CGFloat AgentDeviceFullScreenFrameTolerance = 0.5;
3636

37-
// A frame that is null, empty, the infinite sentinel, or carries a non-finite component is not a
38-
// measurement at all. It proves neither the fill nor the window, so it must reach each caller's
39-
// unknown policy, never a comparison that reads as a difference (the bridge would refuse
40-
// `app-window-not-full-screen` on a runtime that said nothing). This is the whole usability test;
41-
// callers make one call, not two.
37+
// A null, empty, infinite-sentinel, or non-finite-component frame is not a measurement at all: it
38+
// proves neither the fill nor the window, so it must reach each caller's unknown policy, never a
39+
// comparison that reads as a difference. This is the whole usability test; callers make one call.
4240
static BOOL AgentDeviceForegroundFrameIsMeasurable(CGRect frame) {
43-
if (CGRectIsNull(frame) || CGRectIsEmpty(frame) || CGRectIsInfinite(frame)) {
44-
return NO;
45-
}
41+
if (CGRectIsNull(frame) || CGRectIsEmpty(frame) || CGRectIsInfinite(frame)) return NO;
4642
return isfinite(frame.origin.x) && isfinite(frame.origin.y) &&
4743
isfinite(frame.size.width) && isfinite(frame.size.height);
4844
}

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+XCTestEventBridgeTests.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ extension RunnerTests {
254254
RunnerFullScreenEvidenceFromForeground(100, 100, screen, .zero),
255255
.unknown
256256
)
257-
// The infinite sentinel is the framework's own "no measurement" marker (CGRectInfinity's
257+
// The infinite sentinel is the framework's own "no measurement" marker (CGRectInfinite's
258258
// components are finite extremes), so the predicate refuses it and the answer is Unknown.
259259
XCTAssertEqual(
260260
RunnerFullScreenEvidenceFromForeground(100, 100, .infinite, screen),

‎apple/snapshot-bridge/SnapshotBridgeRuntime.m‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,11 @@ static BOOL AgentDeviceForegroundOwnershipMatches(pid_t primaryProcessID, pid_t
9191
// of the screen (Windowed Apps or Stage Manager).
9292
static const CGFloat AgentDeviceFullScreenFrameTolerance = 0.5;
9393

94-
// A frame that is null, empty, the infinite sentinel, or carries a non-finite component is not a
95-
// measurement at all. It proves neither the fill nor the window, so it must reach each caller's
96-
// unknown policy, never a comparison that reads as a difference (the bridge would refuse
97-
// `app-window-not-full-screen` on a runtime that said nothing). This is the whole usability test;
98-
// callers make one call, not two.
94+
// A null, empty, infinite-sentinel, or non-finite-component frame is not a measurement at all: it
95+
// proves neither the fill nor the window, so it must reach each caller's unknown policy, never a
96+
// comparison that reads as a difference. This is the whole usability test; callers make one call.
9997
static BOOL AgentDeviceForegroundFrameIsMeasurable(CGRect frame) {
100-
if (CGRectIsNull(frame) || CGRectIsEmpty(frame) || CGRectIsInfinite(frame)) {
101-
return NO;
102-
}
98+
if (CGRectIsNull(frame) || CGRectIsEmpty(frame) || CGRectIsInfinite(frame)) return NO;
10399
return isfinite(frame.origin.x) && isfinite(frame.origin.y) &&
104100
isfinite(frame.size.width) && isfinite(frame.size.height);
105101
}

0 commit comments

Comments
 (0)