| Flutter Linux Embedder |

Functions | Variables
flutter::testing Namespace Reference

## Functions
FlutterSemanticsNode2 | CreateSemanticsNode (int32_t id, const char *label, const std::vector< int32_t > *children=nullptr)
| TEST (AccessibilityBridgeTest, BasicTest)
| TEST (AccessibilityBridgeTest, AccessibilityRootId)
| TEST (AccessibilityBridgeTest, AddOrder)
| TEST (AccessibilityBridgeTest, CanFireChildrenChangedCorrectly)
| TEST (AccessibilityBridgeTest, CanHandleSelectionChangeCorrectly)
| TEST (AccessibilityBridgeTest, DoesNotAssignEditableRootToSelectableText)
| TEST (AccessibilityBridgeTest, SwitchHasSwitchRole)
| TEST (AccessibilityBridgeTest, SliderHasSliderRole)
| TEST (AccessibilityBridgeTest, CanSetCheckboxChecked)
| TEST (AccessibilityBridgeTest, CanReparentNode)
| TEST (AccessibilityBridgeTest, CanReparentMultipleNodes)
| TEST (AccessibilityBridgeTest, CanReparentNodeWithChild)
| TEST (AccessibilityBridgeTest, AXTreeManagerTest)
| TEST (AccessibilityBridgeTest, LineBreakingObjectTest)
| TEST (FlutterPlatformNodeDelegateTest, NodeDelegateHasUniqueId)
| TEST (FlutterPlatformNodeDelegateTest, canPerfomActions)
| TEST (FlutterPlatformNodeDelegateTest, canGetAXNode)
| TEST (FlutterPlatformNodeDelegateTest, canCalculateBoundsCorrectly)
| TEST (FlutterPlatformNodeDelegateTest, canCalculateOffScreenBoundsCorrectly)
| TEST (FlutterPlatformNodeDelegateTest, canUseOwnerBridge)
| TEST (FlutterPlatformNodeDelegateTest, selfIsLowestPlatformAncestor)
| TEST (FlutterPlatformNodeDelegateTest, canGetFromNodeID)

## Variables
FlutterSemanticsFlags | kEmptyFlags = FlutterSemanticsFlags{}

## Function Documentation

## ◆ CreateSemanticsNode()

FlutterSemanticsNode2 flutter::testing::CreateSemanticsNode | ( | int32_t | id,
|  | const char * | label,
|  | const std::vector< int32_t > * | children = `nullptr`
| ) |  |

Definition at line 20 of file accessibility_bridge_unittests.cc.

23 {
24 return {
25 .id = id,
26 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
27 .flags__deprecated__ = static_cast<FlutterSemanticsFlag>(0),
28 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
29 .actions = static_cast<FlutterSemanticsAction>(0),
30 .text_selection_base = -1,
31 .text_selection_extent = -1,
32 .label = label,
33 .hint = "",
34 .value = "",
35 .increased_value = "",
36 .decreased_value = "",
37 .child_count = children ? children->size() : 0,
38 .children_in_traversal_order = children ? children->data() : nullptr,
39 .custom_accessibility_actions_count = 0,
40 .tooltip = "",
41 .flags2 = &kEmptyFlags,
42 };
43 }
id
int64_t id
Definition: fl_pixel_buffer_texture.cc:28
flutter::testing::kEmptyFlags
FlutterSemanticsFlags kEmptyFlags
Definition: accessibility_bridge_unittests.cc:18

References id, and kEmptyFlags.

Referenced by TEST().

## ◆ TEST() [1/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | AccessibilityRootId |
| ) |  |

Definition at line 79 of file accessibility_bridge_unittests.cc.

79 {
80 std::shared_ptr<TestAccessibilityBridge> bridge =
81 std::make_shared<TestAccessibilityBridge>();
82
83 std::vector<int32_t> children{456, 789};
84 FlutterSemanticsNode2 root = CreateSemanticsNode(123, "root", &children);
85 FlutterSemanticsNode2 child1 = CreateSemanticsNode(456, "child 1");
86 FlutterSemanticsNode2 child2 = CreateSemanticsNode(789, "child 2");
87
88 bridge->AddFlutterSemanticsNodeUpdate(root);
89 bridge->AddFlutterSemanticsNodeUpdate(child1);
90 bridge->AddFlutterSemanticsNodeUpdate(child2);
91 bridge->CommitUpdates();
92
93 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(123).lock();
94 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(456).lock();
95 auto child2_node = bridge->GetFlutterPlatformNodeDelegateFromID(789).lock();
96 auto fake_delegate = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
97
98 EXPECT_EQ(bridge->GetRootAsAXNode()->id(), 123);
99 EXPECT_EQ(bridge->RootDelegate()->GetName(), "root");
100
101 EXPECT_EQ(root_node->GetChildCount(), 2);
102 EXPECT_EQ(root_node->GetData().child_ids[0], 456);
103 EXPECT_EQ(root_node->GetData().child_ids[1], 789);
104 EXPECT_EQ(root_node->GetName(), "root");
105
106 EXPECT_EQ(child1_node->GetChildCount(), 0);
107 EXPECT_EQ(child1_node->GetName(), "child 1");
108
109 EXPECT_EQ(child2_node->GetChildCount(), 0);
110 EXPECT_EQ(child2_node->GetName(), "child 2");
111
112 ASSERT_FALSE(fake_delegate);
113 }
flutter::testing::CreateSemanticsNode
FlutterSemanticsNode2 CreateSemanticsNode(int32_t id, const char *label, const std::vector< int32_t > *children=nullptr)
Definition: accessibility_bridge_unittests.cc:20

References CreateSemanticsNode().

## ◆ TEST() [2/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | AddOrder |
| ) |  |

Definition at line 116 of file accessibility_bridge_unittests.cc.

116 {
117 std::shared_ptr<TestAccessibilityBridge> bridge =
118 std::make_shared<TestAccessibilityBridge>();
119
120 std::vector<int32_t> root_children{34, 56};
121 std::vector<int32_t> child2_children{78};
122 std::vector<int32_t> child3_children{90};
123 FlutterSemanticsNode2 root = CreateSemanticsNode(12, "root", &root_children);
124 FlutterSemanticsNode2 child1 = CreateSemanticsNode(34, "child 1");
125 FlutterSemanticsNode2 child2 =
126 CreateSemanticsNode(56, "child 2", &child2_children);
127 FlutterSemanticsNode2 child3 =
128 CreateSemanticsNode(78, "child 3", &child3_children);
129 FlutterSemanticsNode2 child4 = CreateSemanticsNode(90, "child 4");
130
131 bridge->AddFlutterSemanticsNodeUpdate(child3);
132 bridge->AddFlutterSemanticsNodeUpdate(child2);
133 bridge->AddFlutterSemanticsNodeUpdate(root);
134 bridge->AddFlutterSemanticsNodeUpdate(child1);
135 bridge->AddFlutterSemanticsNodeUpdate(child4);
136 bridge->CommitUpdates();
137
138 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(12).lock();
139 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(34).lock();
140 auto child2_node = bridge->GetFlutterPlatformNodeDelegateFromID(56).lock();
141 auto child3_node = bridge->GetFlutterPlatformNodeDelegateFromID(78).lock();
142 auto child4_node = bridge->GetFlutterPlatformNodeDelegateFromID(90).lock();
143
144 EXPECT_EQ(bridge->GetRootAsAXNode()->id(), 12);
145 EXPECT_EQ(bridge->RootDelegate()->GetName(), "root");
146
147 EXPECT_EQ(root_node->GetChildCount(), 2);
148 EXPECT_EQ(root_node->GetData().child_ids[0], 34);
149 EXPECT_EQ(root_node->GetData().child_ids[1], 56);
150 EXPECT_EQ(root_node->GetName(), "root");
151
152 EXPECT_EQ(child1_node->GetChildCount(), 0);
153 EXPECT_EQ(child1_node->GetName(), "child 1");
154
155 EXPECT_EQ(child2_node->GetChildCount(), 1);
156 EXPECT_EQ(child2_node->GetData().child_ids[0], 78);
157 EXPECT_EQ(child2_node->GetName(), "child 2");
158
159 EXPECT_EQ(child3_node->GetChildCount(), 1);
160 EXPECT_EQ(child3_node->GetData().child_ids[0], 90);
161 EXPECT_EQ(child3_node->GetName(), "child 3");
162
163 EXPECT_EQ(child4_node->GetChildCount(), 0);
164 EXPECT_EQ(child4_node->GetName(), "child 4");
165 }

References CreateSemanticsNode().

## ◆ TEST() [3/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | AXTreeManagerTest |
| ) |  |

Definition at line 566 of file accessibility_bridge_unittests.cc.

566 {
567 std::shared_ptr<TestAccessibilityBridge> bridge =
568 std::make_shared<TestAccessibilityBridge>();
569
570 ui::AXTreeID tree_id = bridge->GetTreeID();
571 ui::AXTreeManager* manager =
572 ui::AXTreeManagerMap::GetInstance().GetManager(tree_id);
573 ASSERT_EQ(manager, static_cast<ui::AXTreeManager*>(bridge.get()));
574 }

## ◆ TEST() [4/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | BasicTest |
| ) |  |

Definition at line 45 of file accessibility_bridge_unittests.cc.

45 {
46 std::shared_ptr<TestAccessibilityBridge> bridge =
47 std::make_shared<TestAccessibilityBridge>();
48
49 std::vector<int32_t> children{1, 2};
50 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root", &children);
51 root.identifier = "identifier";
52 FlutterSemanticsNode2 child1 = CreateSemanticsNode(1, "child 1");
53 FlutterSemanticsNode2 child2 = CreateSemanticsNode(2, "child 2");
54
55 bridge->AddFlutterSemanticsNodeUpdate(root);
56 bridge->AddFlutterSemanticsNodeUpdate(child1);
57 bridge->AddFlutterSemanticsNodeUpdate(child2);
58 bridge->CommitUpdates();
59
60 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
61 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
62 auto child2_node = bridge->GetFlutterPlatformNodeDelegateFromID(2).lock();
63 EXPECT_EQ(root_node->GetChildCount(), 2);
64 EXPECT_EQ(root_node->GetData().child_ids[0], 1);
65 EXPECT_EQ(root_node->GetData().child_ids[1], 2);
66 EXPECT_EQ(root_node->GetName(), "root");
67 EXPECT_EQ(root_node->GetAuthorUniqueId(), u"identifier");
68
69 EXPECT_EQ(child1_node->GetChildCount(), 0);
70 EXPECT_EQ(child1_node->GetName(), "child 1");
71
72 EXPECT_EQ(child2_node->GetChildCount(), 0);
73 EXPECT_EQ(child2_node->GetName(), "child 2");
74 }

References CreateSemanticsNode().

## ◆ TEST() [5/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanFireChildrenChangedCorrectly |
| ) |  |

Definition at line 167 of file accessibility_bridge_unittests.cc.

167 {
168 std::shared_ptr<TestAccessibilityBridge> bridge =
169 std::make_shared<TestAccessibilityBridge>();
170
171 std::vector<int32_t> children{1};
172 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root", &children);
173 FlutterSemanticsNode2 child1 = CreateSemanticsNode(1, "child 1");
174
175 bridge->AddFlutterSemanticsNodeUpdate(root);
176 bridge->AddFlutterSemanticsNodeUpdate(child1);
177
178 bridge->CommitUpdates();
179
180 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
181 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
182 EXPECT_EQ(root_node->GetChildCount(), 1);
183 EXPECT_EQ(root_node->GetData().child_ids[0], 1);
184 EXPECT_EQ(root_node->GetName(), "root");
185
186 EXPECT_EQ(child1_node->GetChildCount(), 0);
187 EXPECT_EQ(child1_node->GetName(), "child 1");
188 bridge->accessibility_events.clear();
189
190 // Add a child to root.
191 root.child_count = 2;
192 int32_t new_children[] = {1, 2};
193 root.children_in_traversal_order = new_children;
194
195 FlutterSemanticsNode2 child2 = CreateSemanticsNode(2, "child 2");
196
197 bridge->AddFlutterSemanticsNodeUpdate(root);
198 bridge->AddFlutterSemanticsNodeUpdate(child2);
199 bridge->CommitUpdates();
200
201 root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
202
203 EXPECT_EQ(root_node->GetChildCount(), 2);
204 EXPECT_EQ(root_node->GetData().child_ids[0], 1);
205 EXPECT_EQ(root_node->GetData().child_ids[1], 2);
206 EXPECT_EQ(bridge->accessibility_events.size(), size_t{2});
207 std::set<ui::AXEventGenerator::Event> actual_event{
208 bridge->accessibility_events.begin(), bridge->accessibility_events.end()};
209 EXPECT_THAT(actual_event,
210 Contains(ui::AXEventGenerator::Event::CHILDREN_CHANGED));
211 EXPECT_THAT(actual_event,
212 Contains(ui::AXEventGenerator::Event::SUBTREE_CREATED));
213 }

References CreateSemanticsNode().

## ◆ TEST() [6/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanHandleSelectionChangeCorrectly |
| ) |  |

Definition at line 215 of file accessibility_bridge_unittests.cc.

215 {
216 std::shared_ptr<TestAccessibilityBridge> bridge =
217 std::make_shared<TestAccessibilityBridge>();
218 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root");
219 auto flags = FlutterSemanticsFlags{
220 .is_focused = FlutterTristate::kFlutterTristateTrue,
221 .is_text_field = true,
222 };
223 root.flags2 = &flags;
224
225 bridge->AddFlutterSemanticsNodeUpdate(root);
226 bridge->CommitUpdates();
227
228 const ui::AXTreeData& tree = bridge->GetAXTreeData();
229 EXPECT_EQ(tree.sel_anchor_object_id, ui::AXNode::kInvalidAXID);
230 bridge->accessibility_events.clear();
231
232 // Update the selection.
233 root.text_selection_base = 0;
234 root.text_selection_extent = 5;
235 bridge->AddFlutterSemanticsNodeUpdate(root);
236
237 bridge->CommitUpdates();
238
239 EXPECT_EQ(tree.sel_anchor_object_id, 0);
240 EXPECT_EQ(tree.sel_anchor_offset, 0);
241 EXPECT_EQ(tree.sel_focus_object_id, 0);
242 EXPECT_EQ(tree.sel_focus_offset, 5);
243 ASSERT_EQ(bridge->accessibility_events.size(), size_t{2});
244 EXPECT_EQ(bridge->accessibility_events[0],
245 ui::AXEventGenerator::Event::DOCUMENT_SELECTION_CHANGED);
246 EXPECT_EQ(bridge->accessibility_events[1],
247 ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED);
248 }

References CreateSemanticsNode().

## ◆ TEST() [7/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanReparentMultipleNodes |
| ) |  |

Definition at line 392 of file accessibility_bridge_unittests.cc.

392 {
393 std::shared_ptr<TestAccessibilityBridge> bridge =
394 std::make_shared<TestAccessibilityBridge>();
395
396 int32_t root_id = 0;
397 int32_t intermediary1_id = 1;
398 int32_t intermediary2_id = 2;
399 int32_t leaf1_id = 3;
400 int32_t leaf2_id = 4;
401 int32_t leaf3_id = 5;
402
403 std::vector<int32_t> root_children{intermediary1_id, intermediary2_id};
404 std::vector<int32_t> intermediary1_children{leaf1_id};
405 std::vector<int32_t> intermediary2_children{leaf2_id, leaf3_id};
406 FlutterSemanticsNode2 root =
407 CreateSemanticsNode(root_id, "root", &root_children);
408 FlutterSemanticsNode2 intermediary1 = CreateSemanticsNode(
409 intermediary1_id, "intermediary 1", &intermediary1_children);
410 FlutterSemanticsNode2 intermediary2 = CreateSemanticsNode(
411 intermediary2_id, "intermediary 2", &intermediary2_children);
412 FlutterSemanticsNode2 leaf1 = CreateSemanticsNode(leaf1_id, "leaf 1");
413 FlutterSemanticsNode2 leaf2 = CreateSemanticsNode(leaf2_id, "leaf 2");
414 FlutterSemanticsNode2 leaf3 = CreateSemanticsNode(leaf3_id, "leaf 3");
415
416 bridge->AddFlutterSemanticsNodeUpdate(root);
417 bridge->AddFlutterSemanticsNodeUpdate(intermediary1);
418 bridge->AddFlutterSemanticsNodeUpdate(intermediary2);
419 bridge->AddFlutterSemanticsNodeUpdate(leaf1);
420 bridge->AddFlutterSemanticsNodeUpdate(leaf2);
421 bridge->AddFlutterSemanticsNodeUpdate(leaf3);
422 bridge->CommitUpdates();
423 bridge->accessibility_events.clear();
424
425 // Swap intermediary 1's and intermediary2's children.
426 int32_t new_intermediary1_children[] = {leaf2_id, leaf3_id};
427 intermediary1.child_count = 2;
428 intermediary1.children_in_traversal_order = new_intermediary1_children;
429
430 int32_t new_intermediary2_children[] = {leaf1_id};
431 intermediary2.child_count = 1;
432 intermediary2.children_in_traversal_order = new_intermediary2_children;
433
434 bridge->AddFlutterSemanticsNodeUpdate(intermediary1);
435 bridge->AddFlutterSemanticsNodeUpdate(intermediary2);
436 bridge->AddFlutterSemanticsNodeUpdate(leaf1);
437 bridge->AddFlutterSemanticsNodeUpdate(leaf2);
438 bridge->AddFlutterSemanticsNodeUpdate(leaf3);
439 bridge->CommitUpdates();
440
441 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(root_id).lock();
442 auto intermediary1_node =
443 bridge->GetFlutterPlatformNodeDelegateFromID(intermediary1_id).lock();
444 auto intermediary2_node =
445 bridge->GetFlutterPlatformNodeDelegateFromID(intermediary2_id).lock();
446 auto leaf1_node =
447 bridge->GetFlutterPlatformNodeDelegateFromID(leaf1_id).lock();
448 auto leaf2_node =
449 bridge->GetFlutterPlatformNodeDelegateFromID(leaf2_id).lock();
450 auto leaf3_node =
451 bridge->GetFlutterPlatformNodeDelegateFromID(leaf3_id).lock();
452
453 EXPECT_EQ(root_node->GetChildCount(), 2);
454 EXPECT_EQ(root_node->GetData().child_ids[0], intermediary1_id);
455 EXPECT_EQ(root_node->GetData().child_ids[1], intermediary2_id);
456 EXPECT_EQ(root_node->GetName(), "root");
457
458 EXPECT_EQ(intermediary1_node->GetChildCount(), 2);
459 EXPECT_EQ(intermediary1_node->GetData().child_ids[0], leaf2_id);
460 EXPECT_EQ(intermediary1_node->GetData().child_ids[1], leaf3_id);
461 EXPECT_EQ(intermediary1_node->GetName(), "intermediary 1");
462
463 EXPECT_EQ(intermediary2_node->GetChildCount(), 1);
464 EXPECT_EQ(intermediary2_node->GetData().child_ids[0], leaf1_id);
465 EXPECT_EQ(intermediary2_node->GetName(), "intermediary 2");
466
467 EXPECT_EQ(leaf1_node->GetChildCount(), 0);
468 EXPECT_EQ(leaf1_node->GetName(), "leaf 1");
469
470 EXPECT_EQ(leaf2_node->GetChildCount(), 0);
471 EXPECT_EQ(leaf2_node->GetName(), "leaf 2");
472
473 EXPECT_EQ(leaf3_node->GetChildCount(), 0);
474 EXPECT_EQ(leaf3_node->GetName(), "leaf 3");
475
476 // Intermediary 1 and intermediary 2 have new children.
477 // Leaf 1, 2, and 3 are all moved.
478 ASSERT_EQ(bridge->accessibility_events.size(), size_t{5});
479 EXPECT_THAT(bridge->accessibility_events,
480 Contains(ui::AXEventGenerator::Event::CHILDREN_CHANGED).Times(2));
481 EXPECT_THAT(bridge->accessibility_events,
482 Contains(ui::AXEventGenerator::Event::SUBTREE_CREATED).Times(3));
483 }

References CreateSemanticsNode().

## ◆ TEST() [8/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanReparentNode |
| ) |  |

Definition at line 329 of file accessibility_bridge_unittests.cc.

329 {
330 std::shared_ptr<TestAccessibilityBridge> bridge =
331 std::make_shared<TestAccessibilityBridge>();
332
333 std::vector<int32_t> root_children{1};
334 std::vector<int32_t> child1_children{2};
335 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root", &root_children);
336 FlutterSemanticsNode2 child1 =
337 CreateSemanticsNode(1, "child 1", &child1_children);
338 FlutterSemanticsNode2 child2 = CreateSemanticsNode(2, "child 2");
339
340 bridge->AddFlutterSemanticsNodeUpdate(root);
341 bridge->AddFlutterSemanticsNodeUpdate(child1);
342 bridge->AddFlutterSemanticsNodeUpdate(child2);
343 bridge->CommitUpdates();
344 bridge->accessibility_events.clear();
345
346 // Reparent child2 from child1 to the root.
347 child1.child_count = 0;
348 child1.children_in_traversal_order = nullptr;
349
350 int32_t new_root_children[] = {1, 2};
351 root.child_count = 2;
352 root.children_in_traversal_order = new_root_children;
353
354 bridge->AddFlutterSemanticsNodeUpdate(root);
355 bridge->AddFlutterSemanticsNodeUpdate(child1);
356 bridge->AddFlutterSemanticsNodeUpdate(child2);
357 bridge->CommitUpdates();
358
359 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
360 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
361 auto child2_node = bridge->GetFlutterPlatformNodeDelegateFromID(2).lock();
362
363 EXPECT_EQ(root_node->GetChildCount(), 2);
364 EXPECT_EQ(root_node->GetData().child_ids[0], 1);
365 EXPECT_EQ(root_node->GetData().child_ids[1], 2);
366 EXPECT_EQ(root_node->GetName(), "root");
367
368 EXPECT_EQ(child1_node->GetChildCount(), 0);
369 EXPECT_EQ(child1_node->GetName(), "child 1");
370
371 EXPECT_EQ(child2_node->GetChildCount(), 0);
372 EXPECT_EQ(child2_node->GetName(), "child 2");
373
374 ASSERT_EQ(bridge->accessibility_events.size(), size_t{5});
375
376 // Child2 is moved from child1 to root.
377 EXPECT_THAT(bridge->accessibility_events,
378 Contains(ui::AXEventGenerator::Event::CHILDREN_CHANGED).Times(2));
379 EXPECT_THAT(bridge->accessibility_events,
380 Contains(ui::AXEventGenerator::Event::SUBTREE_CREATED).Times(1));
381
382 // Child1 is no longer a parent. It loses its group role and disables its
383 // 'clip children' attribute.
384 EXPECT_THAT(
385 bridge->accessibility_events,
386 Contains(ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED).Times(1));
387 EXPECT_THAT(bridge->accessibility_events,
388 Contains(ui::AXEventGenerator::Event::ROLE_CHANGED).Times(1));
389 }

References CreateSemanticsNode().

## ◆ TEST() [9/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanReparentNodeWithChild |
| ) |  |

Definition at line 486 of file accessibility_bridge_unittests.cc.

486 {
487 std::shared_ptr<TestAccessibilityBridge> bridge =
488 std::make_shared<TestAccessibilityBridge>();
489
490 int32_t root_id = 0;
491 int32_t intermediary1_id = 1;
492 int32_t intermediary2_id = 2;
493 int32_t leaf1_id = 3;
494
495 std::vector<int32_t> root_children{intermediary1_id, intermediary2_id};
496 std::vector<int32_t> intermediary1_children{leaf1_id};
497 FlutterSemanticsNode2 root =
498 CreateSemanticsNode(root_id, "root", &root_children);
499 FlutterSemanticsNode2 intermediary1 = CreateSemanticsNode(
500 intermediary1_id, "intermediary 1", &intermediary1_children);
501 FlutterSemanticsNode2 intermediary2 =
502 CreateSemanticsNode(intermediary2_id, "intermediary 2");
503 FlutterSemanticsNode2 leaf1 = CreateSemanticsNode(leaf1_id, "leaf 1");
504
505 bridge->AddFlutterSemanticsNodeUpdate(root);
506 bridge->AddFlutterSemanticsNodeUpdate(intermediary1);
507 bridge->AddFlutterSemanticsNodeUpdate(intermediary2);
508 bridge->AddFlutterSemanticsNodeUpdate(leaf1);
509 bridge->CommitUpdates();
510 bridge->accessibility_events.clear();
511
512 // Move intermediary1 from root to intermediary 2.
513 int32_t new_root_children[] = {intermediary2_id};
514 root.child_count = 1;
515 root.children_in_traversal_order = new_root_children;
516
517 int32_t new_intermediary2_children[] = {intermediary1_id};
518 intermediary2.child_count = 1;
519 intermediary2.children_in_traversal_order = new_intermediary2_children;
520
521 bridge->AddFlutterSemanticsNodeUpdate(root);
522 bridge->AddFlutterSemanticsNodeUpdate(intermediary1);
523 bridge->AddFlutterSemanticsNodeUpdate(intermediary2);
524 bridge->AddFlutterSemanticsNodeUpdate(leaf1);
525 bridge->CommitUpdates();
526
527 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(root_id).lock();
528 auto intermediary1_node =
529 bridge->GetFlutterPlatformNodeDelegateFromID(intermediary1_id).lock();
530 auto intermediary2_node =
531 bridge->GetFlutterPlatformNodeDelegateFromID(intermediary2_id).lock();
532 auto leaf1_node =
533 bridge->GetFlutterPlatformNodeDelegateFromID(leaf1_id).lock();
534
535 EXPECT_EQ(root_node->GetChildCount(), 1);
536 EXPECT_EQ(root_node->GetData().child_ids[0], intermediary2_id);
537 EXPECT_EQ(root_node->GetName(), "root");
538
539 EXPECT_EQ(intermediary2_node->GetChildCount(), 1);
540 EXPECT_EQ(intermediary2_node->GetData().child_ids[0], intermediary1_id);
541 EXPECT_EQ(intermediary2_node->GetName(), "intermediary 2");
542
543 EXPECT_EQ(intermediary1_node->GetChildCount(), 1);
544 EXPECT_EQ(intermediary1_node->GetData().child_ids[0], leaf1_id);
545 EXPECT_EQ(intermediary1_node->GetName(), "intermediary 1");
546
547 EXPECT_EQ(leaf1_node->GetChildCount(), 0);
548 EXPECT_EQ(leaf1_node->GetName(), "leaf 1");
549
550 ASSERT_EQ(bridge->accessibility_events.size(), size_t{5});
551
552 EXPECT_THAT(bridge->accessibility_events,
553 Contains(ui::AXEventGenerator::Event::CHILDREN_CHANGED).Times(2));
554 EXPECT_THAT(bridge->accessibility_events,
555 Contains(ui::AXEventGenerator::Event::SUBTREE_CREATED).Times(1));
556
557 // Intermediary 2 becomes a parent node. It updates to group role and enables
558 // its 'clip children' attribute.
559 EXPECT_THAT(
560 bridge->accessibility_events,
561 Contains(ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED).Times(1));
562 EXPECT_THAT(bridge->accessibility_events,
563 Contains(ui::AXEventGenerator::Event::ROLE_CHANGED).Times(1));
564 }

References CreateSemanticsNode().

## ◆ TEST() [10/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | CanSetCheckboxChecked |
| ) |  |

Definition at line 310 of file accessibility_bridge_unittests.cc.

310 {
311 std::shared_ptr<TestAccessibilityBridge> bridge =
312 std::make_shared<TestAccessibilityBridge>();
313 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root");
314 auto flags = FlutterSemanticsFlags{
315 .is_checked = FlutterCheckState::kFlutterCheckStateTrue,
316 };
317
318 root.flags2 = &flags;
319 bridge->AddFlutterSemanticsNodeUpdate(root);
320 bridge->CommitUpdates();
321
322 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
323 EXPECT_EQ(root_node->GetData().role, ax::mojom::Role::kCheckBox);
324 EXPECT_EQ(root_node->GetData().GetCheckedState(),
325 ax::mojom::CheckedState::kTrue);
326 }

References CreateSemanticsNode().

## ◆ TEST() [11/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | DoesNotAssignEditableRootToSelectableText |
| ) |  |

Definition at line 250 of file accessibility_bridge_unittests.cc.

250 {
251 std::shared_ptr<TestAccessibilityBridge> bridge =
252 std::make_shared<TestAccessibilityBridge>();
253 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root");
254 auto flags = FlutterSemanticsFlags{
255 .is_text_field = true,
256 .is_read_only = true,
257 };
258 root.flags2 = &flags;
259
260 bridge->AddFlutterSemanticsNodeUpdate(root);
261 bridge->CommitUpdates();
262
263 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
264
265 EXPECT_FALSE(root_node->GetData().GetBoolAttribute(
266 ax::mojom::BoolAttribute::kEditableRoot));
267 }

References CreateSemanticsNode().

## ◆ TEST() [12/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | LineBreakingObjectTest |
| ) |  |

Definition at line 576 of file accessibility_bridge_unittests.cc.

576 {
577 std::shared_ptr<TestAccessibilityBridge> bridge =
578 std::make_shared<TestAccessibilityBridge>();
579
580 const int32_t root_id = 0;
581
582 FlutterSemanticsNode2 root = CreateSemanticsNode(root_id, "root", {});
583
584 bridge->AddFlutterSemanticsNodeUpdate(root);
585 bridge->CommitUpdates();
586
587 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(root_id).lock();
588 auto root_data = root_node->GetData();
589 EXPECT_TRUE(root_data.HasBoolAttribute(
590 ax::mojom::BoolAttribute::kIsLineBreakingObject));
591 EXPECT_TRUE(root_data.GetBoolAttribute(
592 ax::mojom::BoolAttribute::kIsLineBreakingObject));
593 }

References CreateSemanticsNode().

## ◆ TEST() [13/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | SliderHasSliderRole |
| ) |  |

Definition at line 286 of file accessibility_bridge_unittests.cc.

286 {
287 std::shared_ptr<TestAccessibilityBridge> bridge =
288 std::make_shared<TestAccessibilityBridge>();
289 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root");
290 auto flags = FlutterSemanticsFlags{
291 .is_enabled = FlutterTristate::kFlutterTristateTrue,
292 .is_focused = FlutterTristate::kFlutterTristateFalse,
293 .is_slider = true,
294 };
295
296 root.flags2 = &flags;
297
298 bridge->AddFlutterSemanticsNodeUpdate(root);
299 bridge->CommitUpdates();
300
301 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
302 EXPECT_EQ(root_node->GetData().role, ax::mojom::Role::kSlider);
303 }

References CreateSemanticsNode().

## ◆ TEST() [14/22]

flutter::testing::TEST | ( | AccessibilityBridgeTest | ,
|  | SwitchHasSwitchRole |
| ) |  |

Definition at line 269 of file accessibility_bridge_unittests.cc.

269 {
270 std::shared_ptr<TestAccessibilityBridge> bridge =
271 std::make_shared<TestAccessibilityBridge>();
272 FlutterSemanticsNode2 root = CreateSemanticsNode(0, "root");
273 auto flags = FlutterSemanticsFlags{
274 .is_enabled = FlutterTristate::kFlutterTristateTrue,
275 .is_toggled = FlutterTristate::kFlutterTristateFalse,
276 };
277
278 root.flags2 = &flags;
279 bridge->AddFlutterSemanticsNodeUpdate(root);
280 bridge->CommitUpdates();
281
282 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
283 EXPECT_EQ(root_node->GetData().role, ax::mojom::Role::kSwitch);
284 }

References CreateSemanticsNode().

## ◆ TEST() [15/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canCalculateBoundsCorrectly |
| ) |  |

Definition at line 121 of file flutter_platform_node_delegate_unittests.cc.

121 {
122 std::shared_ptr<TestAccessibilityBridge> bridge =
123 std::make_shared<TestAccessibilityBridge>();
124 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
125 FlutterSemanticsNode2 root;
126 root.id = 0;
127 root.label = "root";
128 root.hint = "";
129 root.value = "";
130 root.increased_value = "";
131 root.decreased_value = "";
132 root.tooltip = "";
133 root.child_count = 1;
134 root.flags2 = &flags;
135 int32_t children[] = {1};
136 root.children_in_traversal_order = children;
137 root.custom_accessibility_actions_count = 0;
138 root.identifier = "";
139 root.rect = {0, 0, 100, 100}; // LTRB
140 root.transform = {1, 0, 0, 0, 1, 0, 0, 0, 1};
141 bridge->AddFlutterSemanticsNodeUpdate(root);
142
143 FlutterSemanticsNode2 child1;
144 child1.id = 1;
145 child1.label = "child 1";
146 child1.hint = "";
147 child1.value = "";
148 child1.increased_value = "";
149 child1.decreased_value = "";
150 child1.tooltip = "";
151 child1.child_count = 0;
152 child1.flags2 = &flags;
153 child1.custom_accessibility_actions_count = 0;
154 child1.identifier = "";
155 child1.rect = {0, 0, 50, 50}; // LTRB
156 child1.transform = {0.5, 0, 0, 0, 0.5, 0, 0, 0, 1};
157 bridge->AddFlutterSemanticsNodeUpdate(child1);
158
159 bridge->CommitUpdates();
160 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
161 ui::AXOffscreenResult result;
162 gfx::Rect bounds =
163 child1_node->GetBoundsRect(ui::AXCoordinateSystem::kScreenDIPs,
164 ui::AXClippingBehavior::kClipped, &result);
165 EXPECT_EQ(bounds.x(), 0);
166 EXPECT_EQ(bounds.y(), 0);
167 EXPECT_EQ(bounds.width(), 25);
168 EXPECT_EQ(bounds.height(), 25);
169 EXPECT_EQ(result, ui::AXOffscreenResult::kOnscreen);
170 }

## ◆ TEST() [16/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canCalculateOffScreenBoundsCorrectly |
| ) |  |

Definition at line 172 of file flutter_platform_node_delegate_unittests.cc.

172 {
173 std::shared_ptr<TestAccessibilityBridge> bridge =
174 std::make_shared<TestAccessibilityBridge>();
175 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
176 FlutterSemanticsNode2 root;
177 root.id = 0;
178 root.label = "root";
179 root.hint = "";
180 root.value = "";
181 root.increased_value = "";
182 root.decreased_value = "";
183 root.tooltip = "";
184 root.child_count = 1;
185 root.flags2 = &flags;
186 int32_t children[] = {1};
187 root.children_in_traversal_order = children;
188 root.custom_accessibility_actions_count = 0;
189 root.identifier = "";
190 root.rect = {0, 0, 100, 100}; // LTRB
191 root.transform = {1, 0, 0, 0, 1, 0, 0, 0, 1};
192 bridge->AddFlutterSemanticsNodeUpdate(root);
193
194 FlutterSemanticsNode2 child1;
195 child1.id = 1;
196 child1.label = "child 1";
197 child1.hint = "";
198 child1.value = "";
199 child1.increased_value = "";
200 child1.decreased_value = "";
201 child1.tooltip = "";
202 child1.child_count = 0;
203 child1.flags2 = &flags;
204 child1.custom_accessibility_actions_count = 0;
205 child1.identifier = "";
206 child1.rect = {90, 90, 100, 100}; // LTRB
207 child1.transform = {2, 0, 0, 0, 2, 0, 0, 0, 1};
208 bridge->AddFlutterSemanticsNodeUpdate(child1);
209
210 bridge->CommitUpdates();
211 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
212 ui::AXOffscreenResult result;
213 gfx::Rect bounds =
214 child1_node->GetBoundsRect(ui::AXCoordinateSystem::kScreenDIPs,
215 ui::AXClippingBehavior::kUnclipped, &result);
216 EXPECT_EQ(bounds.x(), 180);
217 EXPECT_EQ(bounds.y(), 180);
218 EXPECT_EQ(bounds.width(), 20);
219 EXPECT_EQ(bounds.height(), 20);
220 EXPECT_EQ(result, ui::AXOffscreenResult::kOffscreen);
221 }

## ◆ TEST() [17/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canGetAXNode |
| ) |  |

Definition at line 91 of file flutter_platform_node_delegate_unittests.cc.

91 {
92 // Set up a flutter accessibility node.
93 std::shared_ptr<TestAccessibilityBridge> bridge =
94 std::make_shared<TestAccessibilityBridge>();
95 FlutterSemanticsNode2 root;
96 root.id = 0;
97 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
98 flags.is_text_field = true;
99 root.flags2 = &flags;
100 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
101 root.actions = static_cast<FlutterSemanticsAction>(0);
102 root.text_selection_base = -1;
103 root.text_selection_extent = -1;
104 root.label = "root";
105 root.hint = "";
106 root.value = "";
107 root.increased_value = "";
108 root.decreased_value = "";
109 root.tooltip = "";
110 root.child_count = 0;
111 root.custom_accessibility_actions_count = 0;
112 root.identifier = "";
113 bridge->AddFlutterSemanticsNodeUpdate(root);
114
115 bridge->CommitUpdates();
116
117 auto accessibility = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
118 EXPECT_EQ(accessibility->GetData().id, 0);
119 }

## ◆ TEST() [18/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canGetFromNodeID |
| ) |  |

Definition at line 300 of file flutter_platform_node_delegate_unittests.cc.

300 {
301 std::shared_ptr<TestAccessibilityBridge> bridge =
302 std::make_shared<TestAccessibilityBridge>();
303 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
304 FlutterSemanticsNode2 root;
305 root.id = 0;
306 root.label = "root";
307 root.hint = "";
308 root.value = "";
309 root.increased_value = "";
310 root.decreased_value = "";
311 root.tooltip = "";
312 root.child_count = 1;
313 root.flags2 = &flags;
314 int32_t children[] = {1};
315 root.children_in_traversal_order = children;
316 root.custom_accessibility_actions_count = 0;
317 root.identifier = "";
318 bridge->AddFlutterSemanticsNodeUpdate(root);
319
320 FlutterSemanticsNode2 child1;
321 child1.id = 1;
322 child1.label = "child 1";
323 child1.hint = "";
324 child1.value = "";
325 child1.increased_value = "";
326 child1.decreased_value = "";
327 child1.tooltip = "";
328 child1.child_count = 0;
329 child1.flags2 = &flags;
330 child1.custom_accessibility_actions_count = 0;
331 child1.identifier = "";
332 bridge->AddFlutterSemanticsNodeUpdate(child1);
333
334 bridge->CommitUpdates();
335 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
336 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
337 auto node_by_id = root_node->GetFromNodeID(1);
338 EXPECT_EQ(child1_node->GetPlatformNode(), node_by_id);
339 }

## ◆ TEST() [19/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canPerfomActions |
| ) |  |

Definition at line 43 of file flutter_platform_node_delegate_unittests.cc.

43 {
44 std::shared_ptr<TestAccessibilityBridge> bridge =
45 std::make_shared<TestAccessibilityBridge>();
46 FlutterSemanticsNode2 root;
47 root.id = 0;
48 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
49 flags.is_text_field = true;
50 root.flags2 = &flags;
51 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
52 root.actions = static_cast<FlutterSemanticsAction>(0);
53 root.text_selection_base = -1;
54 root.text_selection_extent = -1;
55 root.label = "root";
56 root.hint = "";
57 root.value = "";
58 root.increased_value = "";
59 root.decreased_value = "";
60 root.tooltip = "";
61 root.child_count = 0;
62 root.custom_accessibility_actions_count = 0;
63 root.identifier = "";
64 bridge->AddFlutterSemanticsNodeUpdate(root);
65
66 bridge->CommitUpdates();
67
68 auto accessibility = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
69 // Performs an AXAction.
70 ui::AXActionData action_data;
71 action_data.action = ax::mojom::Action::kDoDefault;
72 accessibility->AccessibilityPerformAction(action_data);
73 EXPECT_EQ(bridge->performed_actions.size(), size_t{1});
74 EXPECT_EQ(bridge->performed_actions[0],
75 FlutterSemanticsAction::kFlutterSemanticsActionTap);
76
77 action_data.action = ax::mojom::Action::kFocus;
78 accessibility->AccessibilityPerformAction(action_data);
79 EXPECT_EQ(bridge->performed_actions.size(), size_t{2});
80 EXPECT_EQ(
81 bridge->performed_actions[1],
82 FlutterSemanticsAction::kFlutterSemanticsActionDidGainAccessibilityFocus);
83
84 action_data.action = ax::mojom::Action::kScrollToMakeVisible;
85 accessibility->AccessibilityPerformAction(action_data);
86 EXPECT_EQ(bridge->performed_actions.size(), size_t{3});
87 EXPECT_EQ(bridge->performed_actions[2],
88 FlutterSemanticsAction::kFlutterSemanticsActionShowOnScreen);
89 }

## ◆ TEST() [20/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | canUseOwnerBridge |
| ) |  |

Definition at line 223 of file flutter_platform_node_delegate_unittests.cc.

223 {
224 std::shared_ptr<TestAccessibilityBridge> bridge =
225 std::make_shared<TestAccessibilityBridge>();
226 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
227 FlutterSemanticsNode2 root{sizeof(FlutterSemanticsNode2), 0};
228 root.label = "root";
229 root.hint = "";
230 root.value = "";
231 root.increased_value = "";
232 root.decreased_value = "";
233 root.tooltip = "";
234 root.heading_level = 0;
235 root.child_count = 1;
236 root.flags2 = &flags;
237 int32_t children[] = {1};
238 root.children_in_traversal_order = children;
239 root.custom_accessibility_actions_count = 0;
240 root.identifier = "";
241 root.rect = {0, 0, 100, 100}; // LTRB
242 root.transform = {1, 0, 0, 0, 1, 0, 0, 0, 1};
243 bridge->AddFlutterSemanticsNodeUpdate(root);
244
245 FlutterSemanticsNode2 child1{sizeof(FlutterSemanticsNode2), 1};
246 child1.label = "child 1";
247 child1.hint = "";
248 child1.value = "";
249 child1.increased_value = "";
250 child1.decreased_value = "";
251 child1.tooltip = "";
252 child1.heading_level = 0;
253 child1.child_count = 0;
254 child1.flags2 = &flags;
255 child1.custom_accessibility_actions_count = 0;
256 child1.identifier = "";
257 child1.rect = {0, 0, 50, 50}; // LTRB
258 child1.transform = {0.5, 0, 0, 0, 0.5, 0, 0, 0, 1};
259 bridge->AddFlutterSemanticsNodeUpdate(child1);
260
261 bridge->CommitUpdates();
262 auto child1_node = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
263 auto owner_bridge = child1_node->GetOwnerBridge().lock();
264
265 bool result = false;
266 gfx::RectF bounds = owner_bridge->RelativeToGlobalBounds(
267 child1_node->GetAXNode(), result, true);
268 EXPECT_EQ(bounds.x(), 0);
269 EXPECT_EQ(bounds.y(), 0);
270 EXPECT_EQ(bounds.width(), 25);
271 EXPECT_EQ(bounds.height(), 25);
272 EXPECT_EQ(result, false);
273 }

## ◆ TEST() [21/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | NodeDelegateHasUniqueId |
| ) |  |

Definition at line 15 of file flutter_platform_node_delegate_unittests.cc.

15 {
16 std::shared_ptr<TestAccessibilityBridge> bridge =
17 std::make_shared<TestAccessibilityBridge>();
18
19 // Add node 0: root.
20 FlutterSemanticsNode2 node0{sizeof(FlutterSemanticsNode2), 0};
21 std::vector<int32_t> node0_children{1};
22 FlutterSemanticsFlags emptyFlags = FlutterSemanticsFlags{};
23 node0.child_count = node0_children.size();
24 node0.children_in_traversal_order = node0_children.data();
25 node0.children_in_hit_test_order = node0_children.data();
26 node0.flags2 = &emptyFlags;
27
28 // Add node 1: text child of node 0.
29 FlutterSemanticsNode2 node1{sizeof(FlutterSemanticsNode2), 1};
30 node1.label = "prefecture";
31 node1.value = "Kyoto";
32 node1.flags2 = &emptyFlags;
33
34 bridge->AddFlutterSemanticsNodeUpdate(node0);
35 bridge->AddFlutterSemanticsNodeUpdate(node1);
36 bridge->CommitUpdates();
37
38 auto node0_delegate = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
39 auto node1_delegate = bridge->GetFlutterPlatformNodeDelegateFromID(1).lock();
40 EXPECT_TRUE(node0_delegate->GetUniqueId() != node1_delegate->GetUniqueId());
41 }

## ◆ TEST() [22/22]

flutter::testing::TEST | ( | FlutterPlatformNodeDelegateTest | ,
|  | selfIsLowestPlatformAncestor |
| ) |  |

Definition at line 275 of file flutter_platform_node_delegate_unittests.cc.

275 {
276 std::shared_ptr<TestAccessibilityBridge> bridge =
277 std::make_shared<TestAccessibilityBridge>();
278 FlutterSemanticsFlags flags = FlutterSemanticsFlags{0};
279 FlutterSemanticsNode2 root;
280 root.id = 0;
281 root.label = "root";
282 root.hint = "";
283 root.value = "";
284 root.increased_value = "";
285 root.decreased_value = "";
286 root.tooltip = "";
287 root.child_count = 0;
288 root.flags2 = &flags;
289 root.children_in_traversal_order = nullptr;
290 root.custom_accessibility_actions_count = 0;
291 root.identifier = "";
292 bridge->AddFlutterSemanticsNodeUpdate(root);
293
294 bridge->CommitUpdates();
295 auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(0).lock();
296 auto lowest_platform_ancestor = root_node->GetLowestPlatformAncestor();
297 EXPECT_EQ(root_node->GetNativeViewAccessible(), lowest_platform_ancestor);
298 }

## Variable Documentation

## ◆ kEmptyFlags

FlutterSemanticsFlags flutter::testing::kEmptyFlags = FlutterSemanticsFlags{}

Definition at line 18 of file accessibility_bridge_unittests.cc.

Referenced by CreateSemanticsNode().