6#include "gtest/gtest.h"
8#include "flutter/shell/platform/linux/fl_accessible_node.h"
9#include "flutter/shell/platform/linux/testing/fl_test.h"
12TEST(FlAccessibleNodeTest, BuildTree) {
20 g_autoptr(GPtrArray) children =
21 g_ptr_array_new_with_free_func(g_object_unref);
22 g_ptr_array_add(children, g_object_ref(child1));
23 g_ptr_array_add(children, g_object_ref(child2));
26 EXPECT_EQ(atk_object_get_n_accessible_children(ATK_OBJECT(
root)), 2);
27 EXPECT_EQ(atk_object_get_index_in_parent(ATK_OBJECT(
root)), 0);
28 g_autoptr(AtkObject) c1 =
29 atk_object_ref_accessible_child(ATK_OBJECT(
root), 0);
30 EXPECT_EQ(ATK_OBJECT(child1), c1);
31 g_autoptr(AtkObject) c2 =
32 atk_object_ref_accessible_child(ATK_OBJECT(
root), 1);
33 EXPECT_EQ(ATK_OBJECT(child2), c2);
34 EXPECT_EQ(atk_object_get_parent(ATK_OBJECT(
root)),
nullptr);
36 EXPECT_EQ(atk_object_get_parent(ATK_OBJECT(child1)), ATK_OBJECT(
root));
37 EXPECT_EQ(atk_object_get_index_in_parent(ATK_OBJECT(child1)), 0);
38 EXPECT_EQ(atk_object_get_n_accessible_children(ATK_OBJECT(child1)), 0);
40 EXPECT_EQ(atk_object_get_parent(ATK_OBJECT(child2)), ATK_OBJECT(
root));
41 EXPECT_EQ(atk_object_get_index_in_parent(ATK_OBJECT(child2)), 1);
42 EXPECT_EQ(atk_object_get_n_accessible_children(ATK_OBJECT(child2)), 0);
51 EXPECT_STREQ(atk_object_get_name(ATK_OBJECT(node)),
"test");
55TEST(FlAccessibleNodeTest, SetExtents) {
61 atk_component_get_extents(ATK_COMPONENT(node), &
x, &
y, &
width, &
height,
70TEST(FlAccessibleNodeTest, SetFlags) {
79 AtkStateSet*
state = atk_object_ref_state_set(ATK_OBJECT(node));
85 g_object_unref(
state);
89TEST(FlAccessibleNodeTest, GetRole) {
96 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_PUSH_BUTTON);
100 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_CHECK_BOX);
106 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_RADIO_BUTTON);
110 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TOGGLE_BUTTON);
113 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TEXT);
118 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_PASSWORD_TEXT);
122TEST(FlAccessibleNodeTest, SetActions) {
130 EXPECT_EQ(atk_action_get_n_actions(ATK_ACTION(node)), 2);
131 EXPECT_STREQ(atk_action_get_name(ATK_ACTION(node), 0),
"Tap");
132 EXPECT_STREQ(atk_action_get_name(ATK_ACTION(node), 1),
"LongPress");
@ kFlutterSemanticsActionLongPress
@ kFlutterSemanticsActionTap
@ kFlutterSemanticsFlagHasToggledState
The semantics node has the quality of either being "on" or "off".
@ kFlutterSemanticsFlagIsInMutuallyExclusiveGroup
Whether a semantic node is in a mutually exclusive group.
@ kFlutterSemanticsFlagIsButton
Whether the semantic node represents a button.
@ kFlutterSemanticsFlagIsObscured
Whether the value of the semantics node is obscured.
@ kFlutterSemanticsFlagIsFocused
Whether the semantic node currently holds the user's focus.
@ kFlutterSemanticsFlagIsEnabled
Whether a semantic node that hasEnabledState is currently enabled.
@ kFlutterSemanticsFlagIsFocusable
Whether the semantic node can hold the user's focus.
@ kFlutterSemanticsFlagIsTextField
Whether the semantic node represents a text field.
@ kFlutterSemanticsFlagHasCheckedState
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
TEST(FlAccessibleNodeTest, BuildTree)
static FlEngine * make_mock_engine()
static void SetName(Thread *thread, JSONStream *js)
#define EXPECT_TRUE(handle)