5#import <XCTest/XCTest.h>
16 self.continueAfterFailure = NO;
25 XCUIApplication*
app = [[XCUIApplication alloc] init];
26 app.launchArguments = @[ @"--platform-view-no-overlay-intersection" ];
30 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
36 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
37 XCTAssertFalse(overlay.exists);
47 XCUIApplication*
app = [[XCUIApplication alloc] init];
48 app.launchArguments = @[ @"--platform-view" ];
52 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
58 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
59 XCTAssertTrue(overlay.exists);
60 XCTAssertEqual(overlay.frame.origin.x, 150);
61 XCTAssertEqual(overlay.frame.origin.y, 150);
62 XCTAssertEqual(overlay.frame.size.width, 50);
63 XCTAssertEqual(overlay.frame.size.height, 50);
65 XCUIElement* overlayView =
app.otherElements[@"platform_view[0].overlay_view[0]"];
66 XCTAssertTrue(overlayView.exists);
68 XCTAssertEqualWithAccuracy(overlayView.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
69 XCTAssertEqualWithAccuracy(overlayView.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
70 XCTAssertEqualWithAccuracy(overlayView.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
71 XCTAssertEqualWithAccuracy(overlayView.frame.size.height,
app.frame.size.height,
81 XCUIApplication*
app = [[XCUIApplication alloc] init];
82 app.launchArguments = @[ @"--platform-view-partial-intersection" ];
86 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
92 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
93 XCTAssertTrue(overlay.exists);
94 XCTAssertEqual(overlay.frame.origin.x, 200);
95 XCTAssertEqual(overlay.frame.origin.y, 245);
96 XCTAssertEqual(overlay.frame.size.width, 50);
98 XCTAssertEqual(overlay.frame.size.height, 5);
100 XCUIElement* overlayView =
app.otherElements[@"platform_view[0].overlay_view[0]"];
101 XCTAssertTrue(overlayView.exists);
103 XCTAssertEqualWithAccuracy(overlayView.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
104 XCTAssertEqualWithAccuracy(overlayView.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
105 XCTAssertEqualWithAccuracy(overlayView.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
106 XCTAssertEqualWithAccuracy(overlayView.frame.size.height,
app.frame.size.height,
118 XCUIApplication*
app = [[XCUIApplication alloc] init];
119 app.launchArguments = @[ @"--platform-view-two-intersecting-overlays" ];
123 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
129 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
130 XCTAssertTrue(overlay.exists);
131 XCTAssertEqual(overlay.frame.origin.x, 150);
132 XCTAssertEqual(overlay.frame.origin.y, 150);
133 XCTAssertEqual(overlay.frame.size.width, 75);
134 XCTAssertEqual(overlay.frame.size.height, 75);
136 XCTAssertFalse(
app.otherElements[
@"platform_view[0].overlay[1]"].exists);
147 XCUIApplication*
app = [[XCUIApplication alloc] init];
148 app.launchArguments = @[ @"--platform-view-one-overlay-two-intersecting-overlays" ];
152 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
158 XCUIElement* overlay1 =
app.otherElements[@"platform_view[0].overlay[0]"];
159 XCTAssertTrue(overlay1.exists);
160 XCTAssertEqual(overlay1.frame.origin.x, 75);
161 XCTAssertEqual(overlay1.frame.origin.y, 150);
162 XCTAssertEqual(overlay1.frame.size.width, 150);
163 XCTAssertEqual(overlay1.frame.size.height, 100);
167 XCTAssertFalse(
app.otherElements[
@"platform_view[0].overlay[1]"].exists);
169 XCUIElement* overlayView0 =
app.otherElements[@"platform_view[0].overlay_view[0]"];
170 XCTAssertTrue(overlayView0.exists);
172 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
173 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
174 XCTAssertEqualWithAccuracy(overlayView0.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
175 XCTAssertEqualWithAccuracy(overlayView0.frame.size.height,
app.frame.size.height,
187 XCUIApplication*
app = [[XCUIApplication alloc] init];
188 app.launchArguments = @[ @"--platform-view-multiple-without-overlays" ];
191 XCUIElement* platform_view1 =
app.otherElements[@"platform_view[0]"];
192 XCTAssertTrue([platform_view1 waitForExistenceWithTimeout:1.0]);
193 XCTAssertEqual(platform_view1.frame.origin.x, 0);
194 XCTAssertEqual(platform_view1.frame.origin.y, 300);
195 XCTAssertEqual(platform_view1.frame.size.width, 250);
196 XCTAssertEqual(platform_view1.frame.size.height, 250);
198 XCUIElement* platform_view2 =
app.otherElements[@"platform_view[1]"];
199 XCTAssertTrue(platform_view2.exists);
200 XCTAssertEqual(platform_view2.frame.origin.x, 0);
201 XCTAssertEqual(platform_view2.frame.origin.y, 0);
202 XCTAssertEqual(platform_view2.frame.size.width, 250);
203 XCTAssertEqual(platform_view2.frame.size.height, 250);
205 XCTAssertFalse(
app.otherElements[
@"platform_view[0].overlay[0]"].exists);
206 XCTAssertFalse(
app.otherElements[
@"platform_view[1].overlay[0]"].exists);
207 XCTAssertFalse(
app.otherElements[
@"platform_view[0].overlay_view[0]"].exists);
208 XCTAssertFalse(
app.otherElements[
@"platform_view[1].overlay_view[0]"].exists);
219 XCUIApplication*
app = [[XCUIApplication alloc] init];
220 app.launchArguments = @[ @"--platform-view-multiple-background-foreground" ];
223 XCUIElement* platform_view1 =
app.otherElements[@"platform_view[0]"];
224 XCTAssertTrue([platform_view1 waitForExistenceWithTimeout:1.0]);
225 XCTAssertEqual(platform_view1.frame.origin.x, 25);
226 XCTAssertEqual(platform_view1.frame.origin.y, 300);
227 XCTAssertEqual(platform_view1.frame.size.width, 250);
228 XCTAssertEqual(platform_view1.frame.size.height, 250);
230 XCUIElement* platform_view2 =
app.otherElements[@"platform_view[1]"];
231 XCTAssertTrue(platform_view2.exists);
232 XCTAssertEqual(platform_view2.frame.origin.x, 25);
233 XCTAssertEqual(platform_view2.frame.origin.y, 0);
234 XCTAssertEqual(platform_view2.frame.size.width, 250);
235 XCTAssertEqual(platform_view2.frame.size.height, 250);
237 XCUIElement* overlay1 =
app.otherElements[@"platform_view[0].overlay[0]"];
238 XCTAssertTrue(overlay1.exists);
239 XCTAssertEqual(overlay1.frame.origin.x, 25);
240 XCTAssertEqual(overlay1.frame.origin.y, 300);
241 XCTAssertEqual(overlay1.frame.size.width, 225);
242 XCTAssertEqual(overlay1.frame.size.height, 200);
244 XCUIElement* overlay2 =
app.otherElements[@"platform_view[1].overlay[0]"];
245 XCTAssertTrue(overlay2.exists);
246 XCTAssertEqual(overlay2.frame.origin.x, 25);
247 XCTAssertEqual(overlay2.frame.origin.y, 0);
248 XCTAssertEqual(overlay2.frame.size.width, 225);
249 XCTAssertEqual(overlay2.frame.size.height, 250);
251 XCUIElement* overlayView0 =
app.otherElements[@"platform_view[0].overlay_view[0]"];
252 XCTAssertTrue(overlayView0.exists);
254 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
255 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
256 XCTAssertEqualWithAccuracy(overlayView0.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
257 XCTAssertEqualWithAccuracy(overlayView0.frame.size.height,
app.frame.size.height,
260 XCUIElement* overlayView1 =
app.otherElements[@"platform_view[1].overlay_view[0]"];
261 XCTAssertTrue(overlayView1.exists);
263 XCTAssertEqualWithAccuracy(overlayView1.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
264 XCTAssertEqualWithAccuracy(overlayView1.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
265 XCTAssertEqualWithAccuracy(overlayView1.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
266 XCTAssertEqualWithAccuracy(overlayView1.frame.size.height,
app.frame.size.height,
279 XCUIApplication*
app = [[XCUIApplication alloc] init];
280 app.launchArguments = @[ @"--platform-view-max-overlays" ];
284 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
290 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
291 XCTAssertTrue(overlay.exists);
292 XCTAssertFalse(
app.otherElements[
@"platform_view[0].overlay[1]"].exists);
293 XCTAssertTrue(CGRectContainsRect(
platform_view.frame, overlay.frame));
295 XCUIElement* overlayView0 =
app.otherElements[@"platform_view[0].overlay_view[0]"];
296 XCTAssertTrue(overlayView0.exists);
298 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.x,
app.frame.origin.x,
kCompareAccuracy);
299 XCTAssertEqualWithAccuracy(overlayView0.frame.origin.y,
app.frame.origin.x,
kCompareAccuracy);
300 XCTAssertEqualWithAccuracy(overlayView0.frame.size.width,
app.frame.size.width,
kCompareAccuracy);
301 XCTAssertEqualWithAccuracy(overlayView0.frame.size.height,
app.frame.size.height,
304 XCUIElement* overlayView1 =
app.otherElements[@"platform_view[0].overlay_view[1]"];
305 XCTAssertFalse(overlayView1.exists);
317 XCUIApplication*
app = [[XCUIApplication alloc] init];
318 app.launchArguments = @[ @"--platform-view-surrounding-layers-fractional-coordinate" ];
322 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
324 CGFloat
scale = [UIScreen mainScreen].scale;
330 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
331 XCTAssertFalse(overlay.exists);
343 XCUIApplication*
app = [[XCUIApplication alloc] init];
344 app.launchArguments = @[ @"--platform-view-partial-intersection-fractional-coordinate" ];
348 XCTAssertTrue([
platform_view waitForExistenceWithTimeout:1.0]);
350 CGFloat
scale = [UIScreen mainScreen].scale;
356 XCUIElement* overlay =
app.otherElements[@"platform_view[0].overlay[0]"];
357 XCTAssert(overlay.exists);
360 XCTAssertEqual(CGRectGetMaxX(overlay.frame) *
scale, 101);
361 XCTAssertEqual(CGRectGetMaxY(overlay.frame) *
scale, 101);