1044 {
1045 flutter::MockDelegate mock_delegate;
1048 thread_task_runner,
1049 thread_task_runner,
1050 thread_task_runner,
1051 thread_task_runner);
1052 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1053 mock_delegate,
1054 mock_delegate.settings_.enable_impeller
1057 nil,
1058 runners,
1059 nil,
1060 std::make_shared<fml::SyncSwitch>());
1061 id mockFlutterView = OCMClassMock([
FlutterView class]);
1063 OCMStub([mockFlutterViewController view]).andReturn(mockFlutterView);
1064
1065 NSMutableArray<NSDictionary<NSString*, id>*>* accessibility_notifications =
1066 [[NSMutableArray alloc] init];
1067 auto ios_delegate = std::make_unique<flutter::MockIosDelegate>();
1068 ios_delegate->on_PostAccessibilityNotification_ =
1069 [accessibility_notifications](UIAccessibilityNotifications notification, id argument) {
1070 [accessibility_notifications addObject:@{
1071 @"notification" : @(notification),
1072 @"argument" : argument ? argument : [NSNull null],
1073 }];
1074 };
1075 __block auto bridge =
1076 std::make_unique<flutter::AccessibilityBridge>(mockFlutterViewController,
1078 nil,
1079 std::move(ios_delegate));
1080
1083
1086 node1.
label =
"node1";
1089 nodes[node1.
id] = node1;
1092 node3.
label =
"node3";
1093 nodes[node3.
id] = node3;
1096 root_node.
label =
"root";
1099 nodes[root_node.
id] = root_node;
1100 bridge->UpdateSemantics(nodes, actions);
1101
1102 XCTAssertEqual([accessibility_notifications
count], 1ul);
1103 XCTAssertEqualObjects(accessibility_notifications[0][@"argument"], @"node1");
1104 XCTAssertEqual([accessibility_notifications[0][@"notification"] unsignedIntValue],
1105 UIAccessibilityScreenChangedNotification);
1106
1107
1108 bridge->AccessibilityObjectDidBecomeFocused(0);
1109
1111
1114 new_node1.
label =
"new_node1";
1119 new_nodes[new_node1.
id] = new_node1;
1122 new_node2.
label =
"new_node2";
1125 new_nodes[new_node2.
id] = new_node2;
1128 new_root_node.
label =
"root";
1131 new_nodes[new_root_node.
id] = new_root_node;
1132 bridge->UpdateSemantics(new_nodes, actions);
1133 XCTAssertEqual([accessibility_notifications
count], 3ul);
1134 XCTAssertEqualObjects(accessibility_notifications[1][@"argument"], @"new_node2");
1135 XCTAssertEqual([accessibility_notifications[1][@"notification"] unsignedIntValue],
1136 UIAccessibilityScreenChangedNotification);
1137 SemanticsObject* focusObject = accessibility_notifications[2][@"argument"];
1138 XCTAssertEqual([focusObject uid], 0);
1139 XCTAssertEqual([accessibility_notifications[2][@"notification"] unsignedIntValue],
1140 UIAccessibilityLayoutChangedNotification);
1141}