@@ -203,6 +203,54 @@ - (void)testAccessibilityHitTestNoFocusableItem {
203
203
XCTAssertNil (hitTestResult);
204
204
}
205
205
206
+ - (void )testAccessibilityHitTestSearchCanReturnPlatformView {
207
+ fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory (
208
+ new flutter::MockAccessibilityBridge ());
209
+ fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr ();
210
+ SemanticsObject* object0 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 0 ];
211
+ SemanticsObject* object1 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 1 ];
212
+ SemanticsObject* object3 = [[SemanticsObject alloc ] initWithBridge: bridge uid: 3 ];
213
+ UIView* platformView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , 100 , 100 )];
214
+ FlutterPlatformViewSemanticsContainer* platformViewSemanticsContainer =
215
+ [[FlutterPlatformViewSemanticsContainer alloc ] initWithBridge: bridge
216
+ uid: 1
217
+ platformView: platformView];
218
+
219
+ object0.children = @[ object1 ];
220
+ object0.childrenInHitTestOrder = @[ object1 ];
221
+ object1.children = @[ platformViewSemanticsContainer, object3 ];
222
+ object1.childrenInHitTestOrder = @[ platformViewSemanticsContainer, object3 ];
223
+
224
+ flutter::SemanticsNode node0;
225
+ node0.id = 0 ;
226
+ node0.rect = SkRect::MakeXYWH (0 , 0 , 200 , 200 );
227
+ node0.label = " 0" ;
228
+ [object0 setSemanticsNode: &node0];
229
+
230
+ flutter::SemanticsNode node1;
231
+ node1.id = 1 ;
232
+ node1.rect = SkRect::MakeXYWH (0 , 0 , 200 , 200 );
233
+ node1.label = " 1" ;
234
+ [object1 setSemanticsNode: &node1];
235
+
236
+ flutter::SemanticsNode node2;
237
+ node2.id = 2 ;
238
+ node2.rect = SkRect::MakeXYWH (0 , 0 , 100 , 100 );
239
+ node2.label = " 2" ;
240
+ [platformViewSemanticsContainer setSemanticsNode: &node2];
241
+
242
+ flutter::SemanticsNode node3;
243
+ node3.id = 3 ;
244
+ node3.rect = SkRect::MakeXYWH (0 , 0 , 200 , 200 );
245
+ node3.label = " 3" ;
246
+ [object3 setSemanticsNode: &node3];
247
+
248
+ CGPoint point = CGPointMake (10 , 10 );
249
+ id hitTestResult = [object0 _accessibilityHitTest: point withEvent: nil ];
250
+
251
+ XCTAssertEqual (hitTestResult, platformView);
252
+ }
253
+
206
254
- (void )testAccessibilityScrollToVisible {
207
255
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory (
208
256
new flutter::MockAccessibilityBridge ());
0 commit comments