@@ -89,6 +89,23 @@ void AccessibilityObjectDidLoseFocus(int32_t id) override {}
89
89
} // namespace
90
90
} // namespace flutter
91
91
92
+ @interface FakePlatformView : UIView
93
+
94
+ @property (nonatomic , strong , readonly ) UIView* subview;
95
+
96
+ @end
97
+
98
+ @implementation FakePlatformView
99
+
100
+ - (id )_accessibilityHitTest : (CGPoint)point withEvent : (UIEvent*)event {
101
+ if (_subview) {
102
+ _subview = [[UIView alloc ] init ];
103
+ }
104
+ return _subview;
105
+ }
106
+
107
+ @end
108
+
92
109
@interface SemanticsObjectTest : XCTestCase
93
110
@end
94
111
@@ -210,8 +227,8 @@ - (void)testAccessibilityHitTestSearchPlatformViewSubtree {
210
227
SemanticsObject* object0 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 0 ];
211
228
SemanticsObject* object1 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 1 ];
212
229
SemanticsObject* object3 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 3 ];
213
- UIView * platformView = [[UIView alloc ] initWithFrame: CGRectMake ( 0 , 0 , 100 , 100 )];
214
- UIView* subView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , 50 , 50 )];
230
+ FakePlatformView * platformView =
231
+ [[FakePlatformView alloc ] initWithFrame: CGRectMake (0 , 0 , 100 , 100 )];
215
232
FlutterPlatformViewSemanticsContainer* platformViewSemanticsContainer =
216
233
[[FlutterPlatformViewSemanticsContainer alloc ] initWithBridge: bridge
217
234
uid: 1
@@ -247,12 +264,13 @@ - (void)testAccessibilityHitTestSearchPlatformViewSubtree {
247
264
[object3 setSemanticsNode: &node3];
248
265
249
266
CGPoint point = CGPointMake (10 , 10 );
250
- id partialMockPlatformView = OCMPartialMock (platformView);
251
- OCMStub ([partialMockPlatformView _accessibilityHitTest: point withEvent: nil ]).andReturn (subView);
267
+ // id partialMockPlatformView = OCMPartialMock(platformView);
268
+ // OCMStub([partialMockPlatformView _accessibilityHitTest:point
269
+ // withEvent:nil]).andReturn(subView);
252
270
id hitTestResult = [object0 _accessibilityHitTest: point withEvent: nil ];
253
271
254
272
// Focus to object2 because it's the first object in hit test order
255
- XCTAssertEqual (hitTestResult, subView );
273
+ XCTAssertEqual (hitTestResult, platformView. subview );
256
274
}
257
275
258
276
- (void )testAccessibilityScrollToVisible {
0 commit comments