Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
ui::AXPlatformNodeTest Class Reference

#include <ax_platform_node_unittest.h>

Inheritance diagram for ui::AXPlatformNodeTest:
ui::TestAXTreeManager ui::AXTreeManager ui::AXPlatformNodeMacTest ui::AXPlatformNodeWinTest ui::AXFragmentRootTest ui::AXPlatformNodeTextProviderTest ui::AXPlatformNodeTextRangeProviderTest

Public Member Functions

 AXPlatformNodeTest ()
 
 ~AXPlatformNodeTest () override
 
 AXPlatformNodeTest (const AXPlatformNodeTest &)=delete
 
AXPlatformNodeTestoperator= (const AXPlatformNodeTest &)=delete
 
- Public Member Functions inherited from ui::TestAXTreeManager
 TestAXTreeManager ()
 
 TestAXTreeManager (std::unique_ptr< AXTree > tree)
 
virtual ~TestAXTreeManager ()
 
 TestAXTreeManager (const TestAXTreeManager &manager)=delete
 
TestAXTreeManageroperator= (const TestAXTreeManager &manager)=delete
 
void DestroyTree ()
 
AXTreeGetTree () const
 
void SetTree (std::unique_ptr< AXTree > tree)
 
AXNodeGetNodeFromTree (const AXTreeID tree_id, const AXNode::AXID node_id) const override
 
AXNodeGetNodeFromTree (const AXNode::AXID node_id) const override
 
AXTreeID GetTreeID () const override
 
AXTreeID GetParentTreeID () const override
 
AXNodeGetRootAsAXNode () const override
 
AXNodeGetParentNodeFromParentTreeAsAXNode () const override
 
- Public Member Functions inherited from ui::AXTreeManager
virtual ~AXTreeManager ()=default
 

Protected Member Functions

void Init (const AXTreeUpdate &initial_state)
 
void Init (const ui::AXNodeData &node1, const ui::AXNodeData &node2=ui::AXNodeData(), const ui::AXNodeData &node3=ui::AXNodeData(), const ui::AXNodeData &node4=ui::AXNodeData(), const ui::AXNodeData &node5=ui::AXNodeData(), const ui::AXNodeData &node6=ui::AXNodeData(), const ui::AXNodeData &node7=ui::AXNodeData(), const ui::AXNodeData &node8=ui::AXNodeData(), const ui::AXNodeData &node9=ui::AXNodeData(), const ui::AXNodeData &node10=ui::AXNodeData(), const ui::AXNodeData &node11=ui::AXNodeData(), const ui::AXNodeData &node12=ui::AXNodeData())
 
AXTreeUpdate BuildTextField ()
 
AXTreeUpdate BuildTextFieldWithSelectionRange (int32_t start, int32_t stop)
 
AXTreeUpdate BuildContentEditable ()
 
AXTreeUpdate BuildContentEditableWithSelectionRange (int32_t start, int32_t end)
 
AXTreeUpdate Build3X3Table ()
 
AXTreeUpdate BuildAriaColumnAndRowCountGrids ()
 
AXTreeUpdate BuildListBox (bool option_1_is_selected, bool option_2_is_selected, bool option_3_is_selected, const std::vector< ax::mojom::State > &additional_state)
 

Detailed Description

Definition at line 19 of file ax_platform_node_unittest.h.

Constructor & Destructor Documentation

◆ AXPlatformNodeTest() [1/2]

ui::AXPlatformNodeTest::AXPlatformNodeTest ( )
default

◆ ~AXPlatformNodeTest()

ui::AXPlatformNodeTest::~AXPlatformNodeTest ( )
overridedefault

◆ AXPlatformNodeTest() [2/2]

ui::AXPlatformNodeTest::AXPlatformNodeTest ( const AXPlatformNodeTest )
delete

Member Function Documentation

◆ Build3X3Table()

AXTreeUpdate ui::AXPlatformNodeTest::Build3X3Table ( )
protected

◆ BuildAriaColumnAndRowCountGrids()

AXTreeUpdate ui::AXPlatformNodeTest::BuildAriaColumnAndRowCountGrids ( )
protected

Definition at line 292 of file ax_platform_node_unittest.cc.

292 {
293 AXNodeData root;
294 root.id = 1;
296
297 // Empty Grid
298 AXNodeData empty_grid;
299 empty_grid.id = 2;
300 empty_grid.role = ax::mojom::Role::kGrid;
301 root.child_ids.push_back(empty_grid.id);
302
303 // Grid with a cell that defines aria-rowindex (4) and aria-colindex (5)
304 AXNodeData rowcolindex_grid;
305 rowcolindex_grid.id = 3;
306 rowcolindex_grid.role = ax::mojom::Role::kGrid;
307 root.child_ids.push_back(rowcolindex_grid.id);
308
309 AXNodeData rowcolindex_row;
310 rowcolindex_row.id = 4;
311 rowcolindex_row.role = ax::mojom::Role::kRow;
312 rowcolindex_grid.child_ids.push_back(rowcolindex_row.id);
313
314 AXNodeData rowcolindex_cell;
315 rowcolindex_cell.id = 5;
316 rowcolindex_cell.role = ax::mojom::Role::kCell;
317 rowcolindex_cell.AddIntAttribute(
319 rowcolindex_cell.AddIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex,
320 4);
321 rowcolindex_row.child_ids.push_back(rowcolindex_cell.id);
322
323 // Grid that specifies aria-rowcount (2) and aria-colcount (3)
324 AXNodeData rowcolcount_grid;
325 rowcolcount_grid.id = 6;
326 rowcolcount_grid.role = ax::mojom::Role::kGrid;
327 rowcolcount_grid.AddIntAttribute(ax::mojom::IntAttribute::kAriaRowCount, 2);
328 rowcolcount_grid.AddIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount,
329 3);
330 root.child_ids.push_back(rowcolcount_grid.id);
331
332 // Grid that specifies aria-rowcount and aria-colcount are (-1)
333 // ax::mojom::kUnknownAriaColumnOrRowCount
334 AXNodeData unknown_grid;
335 unknown_grid.id = 7;
336 unknown_grid.role = ax::mojom::Role::kGrid;
337 unknown_grid.AddIntAttribute(ax::mojom::IntAttribute::kAriaRowCount,
339 unknown_grid.AddIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount,
341 root.child_ids.push_back(unknown_grid.id);
342
344 update.root_id = root.id;
345 update.nodes.push_back(root);
346 update.nodes.push_back(empty_grid);
347 update.nodes.push_back(rowcolindex_grid);
348 update.nodes.push_back(rowcolindex_row);
349 update.nodes.push_back(rowcolindex_cell);
350 update.nodes.push_back(rowcolcount_grid);
351 update.nodes.push_back(unknown_grid);
352 return update;
353}
const int32_t kUnknownAriaColumnOrRowCount
AXTreeUpdateBase< AXNodeData, AXTreeData > AXTreeUpdate

◆ BuildContentEditable()

AXTreeUpdate ui::AXPlatformNodeTest::BuildContentEditable ( )
protected

Definition at line 95 of file ax_platform_node_unittest.cc.

95 {
96 AXNodeData content_editable_node;
97 content_editable_node.id = 1;
98 content_editable_node.role = ax::mojom::Role::kGroup;
99 content_editable_node.AddState(ax::mojom::State::kRichlyEditable);
100 content_editable_node.AddBoolAttribute(
102 content_editable_node.SetValue("How now brown cow.");
103
105 update.root_id = content_editable_node.id;
106 update.nodes.push_back(content_editable_node);
107 return update;
108}

◆ BuildContentEditableWithSelectionRange()

AXTreeUpdate ui::AXPlatformNodeTest::BuildContentEditableWithSelectionRange ( int32_t  start,
int32_t  end 
)
protected

Definition at line 110 of file ax_platform_node_unittest.cc.

112 {
113 AXNodeData content_editable_node;
114 content_editable_node.id = 1;
115 content_editable_node.role = ax::mojom::Role::kGroup;
116 content_editable_node.AddState(ax::mojom::State::kRichlyEditable);
117 content_editable_node.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected,
118 true);
119 content_editable_node.AddBoolAttribute(
121 content_editable_node.SetValue("How now brown cow.");
122
124 update.root_id = content_editable_node.id;
125 update.nodes.push_back(content_editable_node);
126
127 update.has_tree_data = true;
128 update.tree_data.sel_anchor_object_id = content_editable_node.id;
129 update.tree_data.sel_focus_object_id = content_editable_node.id;
130 update.tree_data.sel_anchor_offset = start;
131 update.tree_data.sel_focus_offset = end;
132
133 return update;
134}
glong glong end

◆ BuildListBox()

AXTreeUpdate ui::AXPlatformNodeTest::BuildListBox ( bool  option_1_is_selected,
bool  option_2_is_selected,
bool  option_3_is_selected,
const std::vector< ax::mojom::State > &  additional_state 
)
protected

Definition at line 355 of file ax_platform_node_unittest.cc.

359 {
360 AXNodeData listbox;
361 listbox.id = 1;
362 listbox.role = ax::mojom::Role::kListBox;
363 listbox.SetName("ListBox");
364 for (auto state : additional_state)
365 listbox.AddState(state);
366
367 AXNodeData option_1;
368 option_1.id = 2;
369 option_1.role = ax::mojom::Role::kListBoxOption;
370 option_1.SetName("Option1");
371 if (option_1_is_selected)
372 option_1.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, true);
373 listbox.child_ids.push_back(option_1.id);
374
375 AXNodeData option_2;
376 option_2.id = 3;
377 option_2.role = ax::mojom::Role::kListBoxOption;
378 option_2.SetName("Option2");
379 if (option_2_is_selected)
380 option_2.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, true);
381 listbox.child_ids.push_back(option_2.id);
382
383 AXNodeData option_3;
384 option_3.id = 4;
385 option_3.role = ax::mojom::Role::kListBoxOption;
386 option_3.SetName("Option3");
387 if (option_3_is_selected)
388 option_3.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, true);
389 listbox.child_ids.push_back(option_3.id);
390
392 update.root_id = listbox.id;
393 update.nodes.push_back(listbox);
394 update.nodes.push_back(option_1);
395 update.nodes.push_back(option_2);
396 update.nodes.push_back(option_3);
397 return update;
398}
AtkStateType state

◆ BuildTextField()

AXTreeUpdate ui::AXPlatformNodeTest::BuildTextField ( )
protected

Definition at line 63 of file ax_platform_node_unittest.cc.

63 {
64 AXNodeData text_field_node;
65 text_field_node.id = 1;
66 text_field_node.role = ax::mojom::Role::kTextField;
67 text_field_node.AddState(ax::mojom::State::kEditable);
68 text_field_node.SetValue("How now brown cow.");
69
71 update.root_id = text_field_node.id;
72 update.nodes.push_back(text_field_node);
73 return update;
74}

◆ BuildTextFieldWithSelectionRange()

AXTreeUpdate ui::AXPlatformNodeTest::BuildTextFieldWithSelectionRange ( int32_t  start,
int32_t  stop 
)
protected

Definition at line 76 of file ax_platform_node_unittest.cc.

78 {
79 AXNodeData text_field_node;
80 text_field_node.id = 1;
81 text_field_node.role = ax::mojom::Role::kTextField;
82 text_field_node.AddState(ax::mojom::State::kEditable);
83 text_field_node.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, true);
84 text_field_node.AddIntAttribute(ax::mojom::IntAttribute::kTextSelStart,
85 start);
86 text_field_node.AddIntAttribute(ax::mojom::IntAttribute::kTextSelEnd, stop);
87 text_field_node.SetValue("How now brown cow.");
88
90 update.root_id = text_field_node.id;
91 update.nodes.push_back(text_field_node);
92 return update;
93}

◆ Init() [1/2]

void ui::AXPlatformNodeTest::Init ( const AXTreeUpdate initial_state)
protected

Definition at line 16 of file ax_platform_node_unittest.cc.

16 {
17 SetTree(std::make_unique<AXTree>(initial_state));
18}
void SetTree(std::unique_ptr< AXTree > tree)

◆ Init() [2/2]

void ui::AXPlatformNodeTest::Init ( const ui::AXNodeData node1,
const ui::AXNodeData node2 = ui::AXNodeData(),
const ui::AXNodeData node3 = ui::AXNodeData(),
const ui::AXNodeData node4 = ui::AXNodeData(),
const ui::AXNodeData node5 = ui::AXNodeData(),
const ui::AXNodeData node6 = ui::AXNodeData(),
const ui::AXNodeData node7 = ui::AXNodeData(),
const ui::AXNodeData node8 = ui::AXNodeData(),
const ui::AXNodeData node9 = ui::AXNodeData(),
const ui::AXNodeData node10 = ui::AXNodeData(),
const ui::AXNodeData node11 = ui::AXNodeData(),
const ui::AXNodeData node12 = ui::AXNodeData() 
)
protected

Definition at line 20 of file ax_platform_node_unittest.cc.

32 {
33 static ui::AXNodeData empty_data;
34 int32_t no_id = empty_data.id;
36 update.root_id = node1.id;
37 update.nodes.push_back(node1);
38 if (node2.id != no_id)
39 update.nodes.push_back(node2);
40 if (node3.id != no_id)
41 update.nodes.push_back(node3);
42 if (node4.id != no_id)
43 update.nodes.push_back(node4);
44 if (node5.id != no_id)
45 update.nodes.push_back(node5);
46 if (node6.id != no_id)
47 update.nodes.push_back(node6);
48 if (node7.id != no_id)
49 update.nodes.push_back(node7);
50 if (node8.id != no_id)
51 update.nodes.push_back(node8);
52 if (node9.id != no_id)
53 update.nodes.push_back(node9);
54 if (node10.id != no_id)
55 update.nodes.push_back(node10);
56 if (node11.id != no_id)
57 update.nodes.push_back(node11);
58 if (node12.id != no_id)
59 update.nodes.push_back(node12);
60 Init(update);
61}
void Init()

◆ operator=()

AXPlatformNodeTest & ui::AXPlatformNodeTest::operator= ( const AXPlatformNodeTest )
delete

The documentation for this class was generated from the following files: