16 self.continueAfterFailure = NO;
20 XCUIApplication* app = [[XCUIApplication alloc] init];
21 app.launchArguments = @[ @"--gesture-reject-after-touches-ended" ];
24 NSPredicate* predicateToFindPlatformView =
25 [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject,
26 NSDictionary<NSString*, id>* _Nullable bindings) {
27 XCUIElement* element = evaluatedObject;
28 return [element.identifier hasPrefix:@"platform_view"];
30 XCUIElement* textView =
31 [app.otherElements elementMatchingPredicate:predicateToFindPlatformView].textViews.firstMatch;
33 NSLog(
@"%@", app.debugDescription);
34 XCTFail(
@"Failed due to not able to find any textView with %@ seconds",
38 XCTAssertNotNil(textView);
39 XCTAssertEqualObjects(textView.label,
@"");
41 NSPredicate* predicate =
42 [NSPredicate predicateWithFormat:@"label == %@", @"-gestureTouchesBegan-gestureTouchesEnded"];
43 XCTNSPredicateExpectation* exception =
44 [[XCTNSPredicateExpectation alloc] initWithPredicate:predicate object:textView];
47 [
self waitForExpectations:@[ exception ] timeout:kSecondsToWaitForPlatformView];
48 XCTAssertEqualObjects(textView.label,
@"-gestureTouchesBegan-gestureTouchesEnded");
52 XCUIApplication* app = [[XCUIApplication alloc] init];
53 app.launchArguments = @[ @"--gesture-reject-eager" ];
56 NSPredicate* predicateToFindPlatformView =
57 [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject,
58 NSDictionary<NSString*, id>* _Nullable bindings) {
59 XCUIElement* element = evaluatedObject;
60 return [element.identifier hasPrefix:@"platform_view"];
62 XCUIElement* textView =
63 [app.otherElements elementMatchingPredicate:predicateToFindPlatformView].textViews.firstMatch;
65 NSLog(
@"%@", app.debugDescription);
66 XCTFail(
@"Failed due to not able to find any textView with %@ seconds",
70 XCTAssertNotNil(textView);
71 XCTAssertEqualObjects(textView.label,
@"");
73 NSPredicate* predicate =
74 [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject,
75 NSDictionary<NSString*, id>* _Nullable bindings) {
76 XCUIElement* view = (XCUIElement*)evaluatedObject;
77 return [view.label containsString:@"-gestureTouchesBegan"];
79 XCTNSPredicateExpectation* exception =
80 [[XCTNSPredicateExpectation alloc] initWithPredicate:predicate object:textView];
83 [
self waitForExpectations:@[ exception ] timeout:kSecondsToWaitForPlatformView];
84 XCTAssertTrue([textView.label containsString:
@"-gestureTouchesBegan"]);
88 XCUIApplication* app = [[XCUIApplication alloc] init];
89 app.launchArguments = @[ @"--gesture-accept" ];
92 NSPredicate* predicateToFindPlatformView =
93 [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject,
94 NSDictionary<NSString*, id>* _Nullable bindings) {
95 XCUIElement* element = evaluatedObject;
96 return [element.identifier hasPrefix:@"platform_view"];
98 XCUIElement* textView =
99 [app.otherElements elementMatchingPredicate:predicateToFindPlatformView].textViews.firstMatch;
101 NSLog(
@"%@", app.debugDescription);
102 XCTFail(
@"Failed due to not able to find any textView with %@ seconds",
106 XCTAssertNotNil(textView);
107 XCTAssertEqualObjects(textView.label,
@"");
109 NSPredicate* predicate = [NSPredicate
110 predicateWithFormat:@"label == %@",
111 @"-gestureTouchesBegan-gestureTouchesEnded-platformViewTapped"];
112 XCTNSPredicateExpectation* exception =
113 [[XCTNSPredicateExpectation alloc] initWithPredicate:predicate object:textView];
117 [
self waitForExpectations:@[ exception ] timeout:kSecondsToWaitForPlatformView];
118 XCTAssertEqualObjects(textView.label,
119 @"-gestureTouchesBegan-gestureTouchesEnded-platformViewTapped");
123 XCUIApplication* app = [[XCUIApplication alloc] init];
124 app.launchArguments = @[ @"--gesture-accept", @"--maskview-blocking" ];
127 NSPredicate* predicateToFindPlatformView =
128 [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject,
129 NSDictionary<NSString*, id>* _Nullable bindings) {
130 XCUIElement* element = evaluatedObject;
131 return [element.identifier hasPrefix:@"platform_view"];
133 XCUIElement* textView =
134 [app.otherElements elementMatchingPredicate:predicateToFindPlatformView].textViews.firstMatch;
136 NSLog(
@"%@", app.debugDescription);
137 XCTFail(
@"Failed due to not able to find any platformView with %@ seconds",
141 XCTAssertNotNil(textView);
142 XCTAssertEqualObjects(textView.label,
@"");
144 NSPredicate* predicate = [NSPredicate
145 predicateWithFormat:@"label == %@",
146 @"-gestureTouchesBegan-gestureTouchesEnded-platformViewTapped"];
147 XCTNSPredicateExpectation* exception =
148 [[XCTNSPredicateExpectation alloc] initWithPredicate:predicate object:textView];
150 XCUICoordinate* coordinate =
152 point:CGVectorMake(textView.frame.origin.x + 10,
153 textView.frame.origin.y + 10)];
156 [
self waitForExpectations:@[ exception ] timeout:kSecondsToWaitForPlatformView];
157 XCTAssertEqualObjects(textView.label,
158 @"-gestureTouchesBegan-gestureTouchesEnded-platformViewTapped");
161- (XCUICoordinate*)getNormalizedCoordinate:(XCUIApplication*)app point:(CGVector)vector {
162 XCUICoordinate* appZero = [app coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
163 XCUICoordinate* coordinate = [appZero coordinateWithOffset:vector];