53 FlutterSemanticsNode2 root_node = {
58 FlutterSemanticsNode2* nodes[1] = {&root_node};
59 FlutterSemanticsUpdate2 update = {.node_count = 1, .nodes = nodes};
62 AtkObject* root_object =
63 atk_object_ref_accessible_child(ATK_OBJECT(accessible), 0);
64 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 0);
67 AtkObject* child1_object =
nullptr;
68 FlutterSemanticsNode2 child1_node = {.id = 111, .label =
"child 1"};
70 flutter::testing::MockSignalHandler2<gint, AtkObject*> child1_added(
71 root_object,
"children-changed::add");
72 EXPECT_SIGNAL2(child1_added, ::testing::Eq(0), ::testing::A<AtkObject*>())
73 .WillOnce(::testing::SaveArg<1>(&child1_object));
75 int32_t children[] = {111};
76 root_node.child_count = 1;
77 root_node.children_in_traversal_order = children;
78 FlutterSemanticsNode2* nodes[2] = {&root_node, &child1_node};
79 FlutterSemanticsUpdate2 update = {.node_count = 2, .nodes = nodes};
83 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 1);
84 EXPECT_EQ(atk_object_ref_accessible_child(root_object, 0), child1_object);
86 EXPECT_STREQ(atk_object_get_name(child1_object),
"child 1");
87 EXPECT_EQ(atk_object_get_parent(child1_object), root_object);
88 EXPECT_EQ(atk_object_get_index_in_parent(child1_object), 0);
89 EXPECT_EQ(atk_object_get_n_accessible_children(child1_object), 0);
92 AtkObject* child2_object =
nullptr;
93 FlutterSemanticsNode2 child2_node = {.id = 222, .label =
"child 2"};
95 flutter::testing::MockSignalHandler2<gint, AtkObject*> child2_added(
96 root_object,
"children-changed::add");
97 EXPECT_SIGNAL2(child2_added, ::testing::Eq(1), ::testing::A<AtkObject*>())
98 .WillOnce(::testing::SaveArg<1>(&child2_object));
100 int32_t children[] = {111, 222};
101 root_node.child_count = 2;
102 root_node.children_in_traversal_order = children;
103 FlutterSemanticsNode2* nodes[3] = {&root_node, &child1_node, &child2_node};
104 FlutterSemanticsUpdate2 update = {.node_count = 3, .nodes = nodes};
108 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 2);
109 EXPECT_EQ(atk_object_ref_accessible_child(root_object, 0), child1_object);
110 EXPECT_EQ(atk_object_ref_accessible_child(root_object, 1), child2_object);
112 EXPECT_STREQ(atk_object_get_name(child1_object),
"child 1");
113 EXPECT_EQ(atk_object_get_parent(child1_object), root_object);
114 EXPECT_EQ(atk_object_get_index_in_parent(child1_object), 0);
115 EXPECT_EQ(atk_object_get_n_accessible_children(child1_object), 0);
117 EXPECT_STREQ(atk_object_get_name(child2_object),
"child 2");
118 EXPECT_EQ(atk_object_get_parent(child2_object), root_object);
119 EXPECT_EQ(atk_object_get_index_in_parent(child2_object), 1);
120 EXPECT_EQ(atk_object_get_n_accessible_children(child2_object), 0);
124 flutter::testing::MockSignalHandler2<gint, AtkObject*> child1_removed(
125 root_object,
"children-changed::remove");
126 EXPECT_SIGNAL2(child1_removed, ::testing::Eq(0),
127 ::testing::Eq(child1_object));
129 const int32_t children[] = {222};
130 root_node.child_count = 1;
131 root_node.children_in_traversal_order = children;
132 FlutterSemanticsNode2* nodes[3] = {&root_node, &child2_node};
133 FlutterSemanticsUpdate2 update = {.node_count = 2, .nodes = nodes};
137 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 1);
138 EXPECT_EQ(atk_object_ref_accessible_child(root_object, 0), child2_object);
140 EXPECT_STREQ(atk_object_get_name(child2_object),
"child 2");
141 EXPECT_EQ(atk_object_get_parent(child2_object), root_object);
142 EXPECT_EQ(atk_object_get_index_in_parent(child2_object), 0);
143 EXPECT_EQ(atk_object_get_n_accessible_children(child2_object), 0);
147 flutter::testing::MockSignalHandler2<gint, AtkObject*> child2_removed(
148 root_object,
"children-changed::remove");
149 EXPECT_SIGNAL2(child2_removed, ::testing::Eq(0),
150 ::testing::Eq(child2_object));
152 root_node.child_count = 0;
153 FlutterSemanticsNode2* nodes[1] = {&root_node};
154 FlutterSemanticsUpdate2 update = {.node_count = 1, .nodes = nodes};
158 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 0);