| Flutter Linux Embedder |

Functions
fl_accessible_node_test.cc File Reference
`#include "gtest/gtest.h"`
`#include "flutter/shell/platform/linux/fl_accessible_node.h"`

Go to the source code of this file.

## Functions
| TEST (FlAccessibleNodeTest, BuildTree)
| TEST (FlAccessibleNodeTest, SetName)
| TEST (FlAccessibleNodeTest, SetExtents)
| TEST (FlAccessibleNodeTest, SetFlags)
| TEST (FlAccessibleNodeTest, GetRole)
| TEST (FlAccessibleNodeTest, SetActions)

## Function Documentation

## ◆ TEST() [1/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | BuildTree |
| ) |  |

Definition at line 11 of file fl_accessible_node_test.cc.

11 {
12 g_autoptr(FlDartProject) project = fl_dart_project_new();
13 g_autoptr(FlEngine) engine = fl_engine_new(project);
14
15 g_autoptr(FlAccessibleNode) root = fl_accessible_node_new(engine, 0);
16 g_autoptr(FlAccessibleNode) child1 = fl_accessible_node_new(engine, 1);
17 fl_accessible_node_set_parent(child1, ATK_OBJECT(root), 0);
18 g_autoptr(FlAccessibleNode) child2 = fl_accessible_node_new(engine, 1);
19 fl_accessible_node_set_parent(child2, ATK_OBJECT(root), 1);
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));
24 fl_accessible_node_set_children(root, children);
25
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);
35
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);
39
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);
43 }

References fl_accessible_node_new(), fl_accessible_node_set_children(), fl_accessible_node_set_parent(), fl_dart_project_new(), and fl_engine_new().

## ◆ TEST() [2/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | GetRole |
| ) |  |

Definition at line 92 of file fl_accessible_node_test.cc.

92 {
93 g_autoptr(FlDartProject) project = fl_dart_project_new();
94 g_autoptr(FlEngine) engine = fl_engine_new(project);
95
96 g_autoptr(FlAccessibleNode) node = fl_accessible_node_new(engine, 0);
97
98 fl_accessible_node_set_flags(
99 node, static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsButton));
100 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_PUSH_BUTTON);
101
102 fl_accessible_node_set_flags(node, static_cast<FlutterSemanticsFlag>(
103 kFlutterSemanticsFlagHasCheckedState));
104 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_CHECK_BOX);
105
106 fl_accessible_node_set_flags(
107 node, static_cast<FlutterSemanticsFlag>(
108 kFlutterSemanticsFlagHasCheckedState |
109 kFlutterSemanticsFlagIsInMutuallyExclusiveGroup));
110 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_RADIO_BUTTON);
111
112 fl_accessible_node_set_flags(node, static_cast<FlutterSemanticsFlag>(
113 kFlutterSemanticsFlagHasToggledState));
114 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TOGGLE_BUTTON);
115
116 fl_accessible_node_set_flags(node, kFlutterSemanticsFlagIsTextField);
117 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TEXT);
118
119 fl_accessible_node_set_flags(
120 node, static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsTextField |
121 kFlutterSemanticsFlagIsObscured));
122 EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_PASSWORD_TEXT);
123 }

References fl_accessible_node_new(), fl_accessible_node_set_flags(), fl_dart_project_new(), and fl_engine_new().

## ◆ TEST() [3/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | SetActions |
| ) |  |

Definition at line 126 of file fl_accessible_node_test.cc.

126 {
127 g_autoptr(FlDartProject) project = fl_dart_project_new();
128 g_autoptr(FlEngine) engine = fl_engine_new(project);
129
130 g_autoptr(FlAccessibleNode) node = fl_accessible_node_new(engine, 0);
131 fl_accessible_node_set_actions(
132 node, static_cast<FlutterSemanticsAction>(
133 kFlutterSemanticsActionTap | kFlutterSemanticsActionLongPress));
134
135 EXPECT_EQ(atk_action_get_n_actions(ATK_ACTION(node)), 2);
136 EXPECT_STREQ(atk_action_get_name(ATK_ACTION(node), 0), "Tap");
137 EXPECT_STREQ(atk_action_get_name(ATK_ACTION(node), 1), "LongPress");
138 }

References fl_accessible_node_new(), fl_accessible_node_set_actions(), fl_dart_project_new(), and fl_engine_new().

## ◆ TEST() [4/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | SetExtents |
| ) |  |

Definition at line 56 of file fl_accessible_node_test.cc.

56 {
57 g_autoptr(FlDartProject) project = fl_dart_project_new();
58 g_autoptr(FlEngine) engine = fl_engine_new(project);
59
60 g_autoptr(FlAccessibleNode) node = fl_accessible_node_new(engine, 0);
61 fl_accessible_node_set_extents(node, 1, 2, 3, 4);
62 gint x, y, width, height;
63 atk_component_get_extents(ATK_COMPONENT(node), &x, &y, &width, &height,
64 ATK_XY_PARENT);
65 EXPECT_EQ(x, 1);
66 EXPECT_EQ(y, 2);
67 EXPECT_EQ(width, 3);
68 EXPECT_EQ(height, 4);
69 }

References fl_accessible_node_new(), fl_accessible_node_set_extents(), fl_dart_project_new(), fl_engine_new(), height, and width.

## ◆ TEST() [5/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | SetFlags |
| ) |  |

Definition at line 72 of file fl_accessible_node_test.cc.

72 {
73 g_autoptr(FlDartProject) project = fl_dart_project_new();
74 g_autoptr(FlEngine) engine = fl_engine_new(project);
75
76 g_autoptr(FlAccessibleNode) node = fl_accessible_node_new(engine, 0);
77 fl_accessible_node_set_flags(
78 node, static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsEnabled |
79 kFlutterSemanticsFlagIsFocusable |
80 kFlutterSemanticsFlagIsFocused));
81
82 AtkStateSet* state = atk_object_ref_state_set(ATK_OBJECT(node));
83 EXPECT_TRUE(atk_state_set_contains_state(state, ATK_STATE_ENABLED));
84 EXPECT_TRUE(atk_state_set_contains_state(state, ATK_STATE_SENSITIVE));
85 EXPECT_TRUE(atk_state_set_contains_state(state, ATK_STATE_FOCUSABLE));
86 EXPECT_TRUE(atk_state_set_contains_state(state, ATK_STATE_FOCUSED));
87 EXPECT_TRUE(!atk_state_set_contains_state(state, ATK_STATE_CHECKED));
88 g_object_unref(state);
89 }

References fl_accessible_node_new(), fl_accessible_node_set_flags(), fl_dart_project_new(), fl_engine_new(), and state.

## ◆ TEST() [6/6]

TEST | ( | FlAccessibleNodeTest | ,
|  | SetName |
| ) |  |

Definition at line 46 of file fl_accessible_node_test.cc.

46 {
47 g_autoptr(FlDartProject) project = fl_dart_project_new();
48 g_autoptr(FlEngine) engine = fl_engine_new(project);
49
50 g_autoptr(FlAccessibleNode) node = fl_accessible_node_new(engine, 0);
51 fl_accessible_node_set_name(node, "test");
52 EXPECT_STREQ(atk_object_get_name(ATK_OBJECT(node)), "test");
53 }

References fl_accessible_node_new(), fl_accessible_node_set_name(), fl_dart_project_new(), and fl_engine_new().

fl_accessible_node_set_flags
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.cc:543
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:488
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
Definition: fl_accessible_node.cc:499
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
state
AtkStateType state
Definition: fl_accessible_node.cc:10
fl_accessible_node_set_extents
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:532
fl_accessible_node_new
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
Definition: fl_accessible_node.cc:482
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
fl_engine_new
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition: fl_engine.cc:524
fl_accessible_node_set_name
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
Definition: fl_accessible_node.cc:526
fl_accessible_node_set_actions
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:550
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38