49 {
52
55 .label = "root",
56 .child_count = 0,
57 };
61
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);
65
66
67 AtkObject* child1_object = nullptr;
69 {
71 root_object, "children-changed::add");
72 EXPECT_SIGNAL2(child1_added, ::testing::Eq(0), ::testing::A<AtkObject*>())
73 .WillOnce(::testing::SaveArg<1>(&child1_object));
74
75 int32_t children[] = {111};
81 }
82
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);
85
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);
90
91
92 AtkObject* child2_object = nullptr;
94 {
96 root_object, "children-changed::add");
97 EXPECT_SIGNAL2(child2_added, ::testing::Eq(1), ::testing::A<AtkObject*>())
98 .WillOnce(::testing::SaveArg<1>(&child2_object));
99
100 int32_t children[] = {111, 222};
106 }
107
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);
111
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);
116
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);
121
122
123 {
125 root_object, "children-changed::remove");
127 ::testing::Eq(child1_object));
128
129 const int32_t children[] = {222};
135 }
136
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);
139
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);
144
145
146 {
148 root_object, "children-changed::remove");
150 ::testing::Eq(child2_object));
151
156 }
157
158 EXPECT_EQ(atk_object_get_n_accessible_children(root_object), 0);
159}
static FlEngine * make_mock_engine()
FlViewAccessible * fl_view_accessible_new(FlEngine *engine)
void fl_view_accessible_handle_update_semantics(FlViewAccessible *self, const FlutterSemanticsUpdate2 *update)
#define EXPECT_SIGNAL2(mock, a1, a2)
const int32_t * children_in_traversal_order
Array of child node IDs in traversal order. Has length child_count.
int32_t id
The unique identifier for this node.
size_t child_count
The number of children this node has.
A batch of updates to semantics nodes and custom actions.