8#include "gtest/gtest.h"
17bool HasEvent(AXEventGenerator&
src,
20 for (
const auto& targeted_event :
src) {
21 if (targeted_event.event_params.event ==
event_type &&
22 targeted_event.node->id() ==
id)
30TEST(AXEventGeneratorTest, LoadCompleteSameTree) {
33 initial_state.
nodes.resize(1);
34 initial_state.
nodes[0].id = 1;
35 initial_state.
nodes[0].relative_bounds.bounds =
gfx::RectF(0, 0, 800, 600);
37 AXTree tree(initial_state);
43 ASSERT_TRUE(tree.
Unserialize(load_complete_update));
48TEST(AXEventGeneratorTest, LoadCompleteNewTree) {
51 initial_state.
nodes.resize(1);
52 initial_state.
nodes[0].id = 1;
55 AXTree tree(initial_state);
59 load_complete_update.
root_id = 2;
60 load_complete_update.
nodes.resize(1);
61 load_complete_update.
nodes[0].id = 2;
62 load_complete_update.
nodes[0].relative_bounds.bounds =
67 ASSERT_TRUE(tree.
Unserialize(load_complete_update));
74 load_complete_update.
root_id = 3;
75 load_complete_update.
nodes.resize(1);
76 load_complete_update.
nodes[0].id = 3;
77 load_complete_update.
nodes[0].relative_bounds.bounds =
gfx::RectF(0, 0, 0, 0);
81 ASSERT_TRUE(tree.
Unserialize(load_complete_update));
87 load_complete_update.
root_id = 4;
88 load_complete_update.
nodes.resize(1);
89 load_complete_update.
nodes[0].id = 4;
90 load_complete_update.
nodes[0].relative_bounds.bounds =
92 load_complete_update.
nodes[0].AddStringAttribute(
97 ASSERT_TRUE(tree.
Unserialize(load_complete_update));
104TEST(AXEventGeneratorTest, LoadStart) {
107 initial_state.
nodes.resize(1);
108 initial_state.
nodes[0].id = 1;
109 initial_state.
nodes[0].relative_bounds.bounds =
gfx::RectF(0, 0, 800, 600);
111 AXTree tree(initial_state);
116 load_start_update.
nodes.resize(1);
117 load_start_update.
nodes[0].id = 2;
118 load_start_update.
nodes[0].relative_bounds.bounds =
130TEST(AXEventGeneratorTest, DocumentSelectionChanged) {
133 initial_state.
nodes.resize(1);
134 initial_state.
nodes[0].id = 1;
138 AXTree tree(initial_state);
142 update.tree_data.sel_focus_offset = 2;
149TEST(AXEventGeneratorTest, DocumentTitleChanged) {
152 initial_state.
nodes.resize(1);
153 initial_state.
nodes[0].id = 1;
156 AXTree tree(initial_state);
160 update.tree_data.title =
"After";
168TEST(AXEventGeneratorTest, FocusIdUnchanged) {
171 initial_state.
nodes.resize(2);
172 initial_state.
nodes[0].id = 1;
173 initial_state.
nodes[0].child_ids.push_back(2);
174 initial_state.
nodes[1].id = 2;
177 AXTree tree(initial_state);
181 update.tree_data.focus_id = 1;
189TEST(AXEventGeneratorTest, FocusIdChanged) {
192 initial_state.
nodes.resize(2);
193 initial_state.
nodes[0].id = 1;
194 initial_state.
nodes[0].child_ids.push_back(2);
195 initial_state.
nodes[1].id = 2;
198 AXTree tree(initial_state);
202 update.tree_data.focus_id = 2;
209TEST(AXEventGeneratorTest, ExpandedAndRowCount) {
212 initial_state.
nodes.resize(4);
213 initial_state.
nodes[0].id = 1;
215 initial_state.
nodes[0].child_ids.push_back(2);
216 initial_state.
nodes[0].child_ids.push_back(4);
217 initial_state.
nodes[1].id = 2;
219 initial_state.
nodes[1].child_ids.push_back(3);
220 initial_state.
nodes[2].id = 3;
222 initial_state.
nodes[3].id = 4;
225 AXTree tree(initial_state);
230 update.nodes[3].state = 0;
249TEST(AXEventGeneratorTest, SelectedAndSelectedChildren) {
252 initial_state.
nodes.resize(4);
253 initial_state.
nodes[0].id = 1;
255 initial_state.
nodes[0].child_ids.push_back(2);
256 initial_state.
nodes[0].child_ids.push_back(4);
257 initial_state.
nodes[1].id = 2;
259 initial_state.
nodes[1].child_ids.push_back(3);
260 initial_state.
nodes[2].id = 3;
262 initial_state.
nodes[3].id = 4;
266 AXTree tree(initial_state);
272 update.nodes.emplace_back();
292TEST(AXEventGeneratorTest, StringValueChanged) {
295 initial_state.
nodes.resize(1);
296 initial_state.
nodes[0].id = 1;
300 AXTree tree(initial_state);
304 update.nodes[0].string_attributes.clear();
313TEST(AXEventGeneratorTest, FloatValueChanged) {
316 initial_state.
nodes.resize(1);
317 initial_state.
nodes[0].id = 1;
319 initial_state.
nodes[0].AddFloatAttribute(
321 AXTree tree(initial_state);
325 update.nodes[0].float_attributes.clear();
334TEST(AXEventGeneratorTest, InvalidStatusChanged) {
337 initial_state.
nodes.resize(1);
338 initial_state.
nodes[0].id = 1;
342 AXTree tree(initial_state);
352TEST(AXEventGeneratorTest, AddLiveRegionAttribute) {
355 initial_state.
nodes.resize(1);
356 initial_state.
nodes[0].id = 1;
357 AXTree tree(initial_state);
385TEST(AXEventGeneratorTest, CheckedStateChanged) {
388 initial_state.
nodes.resize(1);
389 initial_state.
nodes[0].id = 1;
391 AXTree tree(initial_state);
404TEST(AXEventGeneratorTest, ActiveDescendantChanged) {
407 initial_state.
nodes.resize(3);
408 initial_state.
nodes[0].id = 1;
410 initial_state.
nodes[0].child_ids.push_back(2);
411 initial_state.
nodes[0].child_ids.push_back(3);
412 initial_state.
nodes[0].AddIntAttribute(
414 initial_state.
nodes[1].id = 2;
416 initial_state.
nodes[2].id = 3;
418 AXTree tree(initial_state);
422 update.nodes[0].int_attributes.clear();
432TEST(AXEventGeneratorTest, CreateAlertAndLiveRegion) {
435 initial_state.
nodes.resize(1);
436 initial_state.
nodes[0].id = 1;
437 AXTree tree(initial_state);
442 update.nodes[0].child_ids.push_back(2);
443 update.nodes[0].child_ids.push_back(3);
444 update.nodes[0].child_ids.push_back(4);
475TEST(AXEventGeneratorTest, LiveRegionChanged) {
478 initial_state.
nodes.resize(3);
479 initial_state.
nodes[0].id = 1;
480 initial_state.
nodes[0].AddStringAttribute(
482 initial_state.
nodes[0].AddStringAttribute(
484 initial_state.
nodes[0].child_ids.push_back(2);
485 initial_state.
nodes[0].child_ids.push_back(3);
486 initial_state.
nodes[1].id = 2;
488 initial_state.
nodes[1].AddStringAttribute(
492 initial_state.
nodes[2].id = 3;
494 initial_state.
nodes[2].AddStringAttribute(
498 AXTree tree(initial_state);
502 update.nodes[1].string_attributes.clear();
503 update.nodes[1].AddStringAttribute(
507 update.nodes[2].string_attributes.clear();
508 update.nodes[2].AddStringAttribute(
526TEST(AXEventGeneratorTest, LiveRegionOnlyTextChanges) {
529 initial_state.
nodes.resize(3);
530 initial_state.
nodes[0].id = 1;
531 initial_state.
nodes[0].AddStringAttribute(
533 initial_state.
nodes[0].AddStringAttribute(
535 initial_state.
nodes[0].child_ids.push_back(2);
536 initial_state.
nodes[0].child_ids.push_back(3);
537 initial_state.
nodes[1].id = 2;
539 initial_state.
nodes[1].AddStringAttribute(
543 initial_state.
nodes[2].id = 3;
545 initial_state.
nodes[2].AddStringAttribute(
549 AXTree tree(initial_state);
569TEST(AXEventGeneratorTest, BusyLiveRegionChanged) {
572 initial_state.
nodes.resize(3);
573 initial_state.
nodes[0].id = 1;
574 initial_state.
nodes[0].AddStringAttribute(
576 initial_state.
nodes[0].AddStringAttribute(
580 initial_state.
nodes[0].child_ids.push_back(2);
581 initial_state.
nodes[0].child_ids.push_back(3);
582 initial_state.
nodes[1].id = 2;
584 initial_state.
nodes[1].AddStringAttribute(
588 initial_state.
nodes[2].id = 3;
590 initial_state.
nodes[2].AddStringAttribute(
594 AXTree tree(initial_state);
598 update.nodes[1].string_attributes.clear();
599 update.nodes[1].AddStringAttribute(
603 update.nodes[2].string_attributes.clear();
604 update.nodes[2].AddStringAttribute(
616TEST(AXEventGeneratorTest, AddChild) {
619 initial_state.
nodes.resize(2);
620 initial_state.
nodes[0].id = 1;
621 initial_state.
nodes[0].child_ids.push_back(2);
622 initial_state.
nodes[1].id = 2;
623 AXTree tree(initial_state);
628 update.nodes[0].child_ids.push_back(3);
638TEST(AXEventGeneratorTest, RemoveChild) {
641 initial_state.
nodes.resize(3);
642 initial_state.
nodes[0].id = 1;
643 initial_state.
nodes[0].child_ids.push_back(2);
644 initial_state.
nodes[0].child_ids.push_back(3);
645 initial_state.
nodes[1].id = 2;
646 initial_state.
nodes[2].id = 3;
647 AXTree tree(initial_state);
652 update.nodes[0].child_ids.clear();
653 update.nodes[0].child_ids.push_back(2);
660TEST(AXEventGeneratorTest, ReorderChildren) {
663 initial_state.
nodes.resize(3);
664 initial_state.
nodes[0].id = 1;
665 initial_state.
nodes[0].child_ids.push_back(2);
666 initial_state.
nodes[0].child_ids.push_back(3);
667 initial_state.
nodes[1].id = 2;
668 initial_state.
nodes[2].id = 3;
669 AXTree tree(initial_state);
673 update.nodes[0].child_ids.clear();
674 update.nodes[0].child_ids.push_back(3);
675 update.nodes[0].child_ids.push_back(2);
682TEST(AXEventGeneratorTest, ScrollHorizontalPositionChanged) {
685 initial_state.
nodes.resize(1);
686 initial_state.
nodes[0].id = 1;
687 AXTree tree(initial_state);
694 HasEvent(event_generator,
698TEST(AXEventGeneratorTest, ScrollVerticalPositionChanged) {
701 initial_state.
nodes.resize(1);
702 initial_state.
nodes[0].id = 1;
703 AXTree tree(initial_state);
710 HasEvent(event_generator,
714TEST(AXEventGeneratorTest, TextAttributeChanged) {
717 initial_state.
nodes.resize(17);
718 initial_state.
nodes[0].id = 1;
719 initial_state.
nodes[0].child_ids = {2, 3, 4, 5, 6, 7, 8, 9,
720 10, 11, 12, 13, 14, 15, 16, 17};
721 initial_state.
nodes[1].id = 2;
722 initial_state.
nodes[2].id = 3;
723 initial_state.
nodes[3].id = 4;
724 initial_state.
nodes[4].id = 5;
725 initial_state.
nodes[5].id = 6;
726 initial_state.
nodes[6].id = 7;
727 initial_state.
nodes[7].id = 8;
728 initial_state.
nodes[8].id = 9;
729 initial_state.
nodes[9].id = 10;
730 initial_state.
nodes[10].id = 11;
731 initial_state.
nodes[11].id = 12;
732 initial_state.
nodes[12].id = 13;
733 initial_state.
nodes[13].id = 14;
734 initial_state.
nodes[14].id = 15;
735 initial_state.
nodes[15].id = 16;
736 initial_state.
nodes[16].id = 17;
739 initial_state.
nodes[11].AddIntListAttribute(
742 initial_state.
nodes[11].AddIntListAttribute(
744 initial_state.
nodes[11].AddIntListAttribute(
747 AXTree tree(initial_state);
753 update.nodes[3].AddIntAttribute(
756 update.nodes[4].AddIntAttribute(
759 update.nodes[5].AddIntAttribute(
762 update.nodes[6].AddIntAttribute(
765 update.nodes[7].AddIntAttribute(
768 update.nodes[8].AddIntAttribute(
771 update.nodes[9].AddIntListAttribute(
774 update.nodes[10].AddIntListAttribute(
779 update.nodes[12].AddIntListAttribute(
782 update.nodes[13].AddIntListAttribute(
827TEST(AXEventGeneratorTest, ObjectAttributeChanged) {
830 initial_state.
nodes.resize(3);
831 initial_state.
nodes[0].id = 1;
832 initial_state.
nodes[0].child_ids = {2, 3};
833 initial_state.
nodes[1].id = 2;
834 initial_state.
nodes[2].id = 3;
835 AXTree tree(initial_state);
844 HasEvent(event_generator,
847 HasEvent(event_generator,
855TEST(AXEventGeneratorTest, OtherAttributeChanged) {
858 initial_state.
nodes.resize(6);
859 initial_state.
nodes[0].id = 1;
860 initial_state.
nodes[0].child_ids.push_back(2);
861 initial_state.
nodes[0].child_ids.push_back(3);
862 initial_state.
nodes[0].child_ids.push_back(4);
863 initial_state.
nodes[0].child_ids.push_back(5);
864 initial_state.
nodes[0].child_ids.push_back(6);
865 initial_state.
nodes[1].id = 2;
866 initial_state.
nodes[2].id = 3;
867 initial_state.
nodes[3].id = 4;
868 initial_state.
nodes[4].id = 5;
869 initial_state.
nodes[5].id = 6;
870 AXTree tree(initial_state);
881 std::vector<int> ids = {2};
899TEST(AXEventGeneratorTest, NameChanged) {
902 initial_state.
nodes.resize(2);
903 initial_state.
nodes[0].id = 1;
904 initial_state.
nodes[0].child_ids.push_back(2);
905 initial_state.
nodes[1].id = 2;
906 AXTree tree(initial_state);
917TEST(AXEventGeneratorTest, DescriptionChanged) {
920 initial_state.
nodes.resize(1);
921 initial_state.
nodes[0].id = 1;
922 AXTree tree(initial_state);
933TEST(AXEventGeneratorTest, RoleChanged) {
936 initial_state.
nodes.resize(1);
937 initial_state.
nodes[0].id = 1;
938 AXTree tree(initial_state);
948TEST(AXEventGeneratorTest, MenuItemSelected) {
951 initial_state.
nodes.resize(3);
952 initial_state.
nodes[0].id = 1;
954 initial_state.
nodes[0].child_ids.push_back(2);
955 initial_state.
nodes[0].child_ids.push_back(3);
956 initial_state.
nodes[0].AddIntAttribute(
958 initial_state.
nodes[1].id = 2;
960 initial_state.
nodes[2].id = 3;
962 AXTree tree(initial_state);
966 update.nodes[0].int_attributes.clear();
978TEST(AXEventGeneratorTest, NodeBecomesIgnored) {
981 initial_state.
nodes.resize(5);
982 initial_state.
nodes[0].id = 1;
984 initial_state.
nodes[0].child_ids.push_back(2);
985 initial_state.
nodes[1].id = 2;
987 initial_state.
nodes[1].child_ids.push_back(3);
988 initial_state.
nodes[2].id = 3;
991 initial_state.
nodes[2].child_ids.push_back(4);
992 initial_state.
nodes[3].id = 4;
994 initial_state.
nodes[3].child_ids.push_back(5);
995 initial_state.
nodes[4].id = 5;
998 AXTree tree(initial_state);
1010TEST(AXEventGeneratorTest, NodeBecomesIgnored2) {
1013 initial_state.
nodes.resize(5);
1014 initial_state.
nodes[0].id = 1;
1016 initial_state.
nodes[0].child_ids.push_back(2);
1017 initial_state.
nodes[1].id = 2;
1019 initial_state.
nodes[1].child_ids.push_back(3);
1020 initial_state.
nodes[2].id = 3;
1023 initial_state.
nodes[2].child_ids.push_back(4);
1024 initial_state.
nodes[3].id = 4;
1026 initial_state.
nodes[3].child_ids.push_back(5);
1027 initial_state.
nodes[4].id = 5;
1030 AXTree tree(initial_state);
1038 update.nodes[3].child_ids.clear();
1046TEST(AXEventGeneratorTest, NodeBecomesUnignored) {
1049 initial_state.
nodes.resize(5);
1050 initial_state.
nodes[0].id = 1;
1052 initial_state.
nodes[0].child_ids.push_back(2);
1053 initial_state.
nodes[1].id = 2;
1055 initial_state.
nodes[1].child_ids.push_back(3);
1056 initial_state.
nodes[2].id = 3;
1059 initial_state.
nodes[2].child_ids.push_back(4);
1060 initial_state.
nodes[3].id = 4;
1063 initial_state.
nodes[3].child_ids.push_back(5);
1064 initial_state.
nodes[4].id = 5;
1067 AXTree tree(initial_state);
1071 update.nodes[3].state = 0;
1081TEST(AXEventGeneratorTest, NodeBecomesUnignored2) {
1084 initial_state.
nodes.resize(5);
1085 initial_state.
nodes[0].id = 1;
1087 initial_state.
nodes[0].child_ids.push_back(2);
1088 initial_state.
nodes[1].id = 2;
1090 initial_state.
nodes[1].child_ids.push_back(3);
1091 initial_state.
nodes[2].id = 3;
1094 initial_state.
nodes[2].child_ids.push_back(4);
1095 initial_state.
nodes[3].id = 4;
1098 initial_state.
nodes[3].child_ids.push_back(5);
1099 initial_state.
nodes[4].id = 5;
1102 AXTree tree(initial_state);
1107 update.nodes[3].state = 0;
1110 update.nodes[3].child_ids.clear();
1120TEST(AXEventGeneratorTest, SubtreeBecomesUnignored) {
1123 initial_state.
nodes.resize(3);
1124 initial_state.
nodes[0].id = 1;
1126 initial_state.
nodes[0].child_ids.push_back(2);
1127 initial_state.
nodes[1].id = 2;
1130 initial_state.
nodes[1].child_ids.push_back(3);
1131 initial_state.
nodes[2].id = 3;
1135 AXTree tree(initial_state);
1150TEST(AXEventGeneratorTest, TwoNodesSwapIgnored) {
1153 initial_state.
nodes.resize(3);
1154 initial_state.
nodes[0].id = 1;
1156 initial_state.
nodes[0].child_ids.push_back(2);
1157 initial_state.
nodes[1].id = 2;
1159 initial_state.
nodes[1].child_ids.push_back(3);
1160 initial_state.
nodes[2].id = 3;
1164 AXTree tree(initial_state);
1181TEST(AXEventGeneratorTest, TwoNodesSwapIgnored2) {
1184 initial_state.
nodes.resize(3);
1185 initial_state.
nodes[0].id = 1;
1187 initial_state.
nodes[0].child_ids.push_back(2);
1188 initial_state.
nodes[1].id = 2;
1191 initial_state.
nodes[1].child_ids.push_back(3);
1192 initial_state.
nodes[2].id = 3;
1195 AXTree tree(initial_state);
1212TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly1) {
1226 initial_state.
nodes.resize(3);
1227 initial_state.
nodes[0].id = 1;
1230 initial_state.
nodes[0].child_ids = {2, 3};
1232 initial_state.
nodes[1].id = 2;
1235 initial_state.
nodes[2].id = 3;
1239 AXTree tree(initial_state);
1254TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly2) {
1272 initial_state.
nodes.resize(4);
1273 initial_state.
nodes[0].id = 1;
1275 initial_state.
nodes[0].child_ids = {2};
1277 initial_state.
nodes[1].id = 2;
1279 initial_state.
nodes[1].child_ids = {3, 4};
1281 initial_state.
nodes[2].id = 3;
1284 initial_state.
nodes[3].id = 4;
1288 AXTree tree(initial_state);
1305TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly3) {
1323 initial_state.
nodes.resize(4);
1324 initial_state.
nodes[0].id = 1;
1326 initial_state.
nodes[0].child_ids = {2};
1328 initial_state.
nodes[1].id = 2;
1330 initial_state.
nodes[1].child_ids = {3, 4};
1332 initial_state.
nodes[2].id = 3;
1336 initial_state.
nodes[3].id = 4;
1339 AXTree tree(initial_state);
1357TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly4) {
1388 initial_state.
nodes.resize(8);
1389 initial_state.
nodes[0].id = 1;
1391 initial_state.
nodes[0].child_ids = {2};
1393 initial_state.
nodes[1].id = 2;
1395 initial_state.
nodes[1].child_ids = {3};
1397 initial_state.
nodes[2].id = 3;
1399 initial_state.
nodes[2].child_ids = {4};
1402 initial_state.
nodes[3].id = 4;
1404 initial_state.
nodes[3].child_ids = {5};
1407 initial_state.
nodes[4].id = 5;
1409 initial_state.
nodes[4].child_ids = {6, 7, 8};
1411 initial_state.
nodes[5].id = 6;
1415 initial_state.
nodes[6].id = 7;
1419 initial_state.
nodes[7].id = 8;
1422 AXTree tree(initial_state);
1444TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly5) {
1475 initial_state.
nodes.resize(8);
1476 initial_state.
nodes[0].id = 1;
1478 initial_state.
nodes[0].child_ids = {2};
1480 initial_state.
nodes[1].id = 2;
1482 initial_state.
nodes[1].child_ids = {3};
1484 initial_state.
nodes[2].id = 3;
1486 initial_state.
nodes[2].child_ids = {4};
1489 initial_state.
nodes[3].id = 4;
1491 initial_state.
nodes[3].child_ids = {5};
1494 initial_state.
nodes[4].id = 5;
1496 initial_state.
nodes[4].child_ids = {6, 7, 8};
1498 initial_state.
nodes[5].id = 6;
1502 initial_state.
nodes[6].id = 7;
1505 initial_state.
nodes[7].id = 8;
1508 AXTree tree(initial_state);
1527TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly6) {
1558 initial_state.
nodes.resize(8);
1559 initial_state.
nodes[0].id = 1;
1561 initial_state.
nodes[0].child_ids = {2};
1564 initial_state.
nodes[1].id = 2;
1566 initial_state.
nodes[1].child_ids = {3};
1568 initial_state.
nodes[2].id = 3;
1570 initial_state.
nodes[2].child_ids = {4};
1572 initial_state.
nodes[3].id = 4;
1574 initial_state.
nodes[3].child_ids = {5};
1576 initial_state.
nodes[4].id = 5;
1578 initial_state.
nodes[4].child_ids = {6, 7, 8};
1580 initial_state.
nodes[5].id = 6;
1584 initial_state.
nodes[6].id = 7;
1588 initial_state.
nodes[7].id = 8;
1591 AXTree tree(initial_state);
1614TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly7) {
1641 initial_state.
nodes.resize(6);
1642 initial_state.
nodes[0].id = 1;
1644 initial_state.
nodes[0].child_ids = {2};
1647 initial_state.
nodes[1].id = 2;
1649 initial_state.
nodes[1].child_ids = {3};
1652 initial_state.
nodes[2].id = 3;
1654 initial_state.
nodes[2].child_ids = {4};
1656 initial_state.
nodes[3].id = 4;
1658 initial_state.
nodes[3].child_ids = {5, 6};
1660 initial_state.
nodes[4].id = 5;
1664 initial_state.
nodes[5].id = 6;
1668 AXTree tree(initial_state);
1685TEST(AXEventGeneratorTest, IgnoredChangedFiredOnAncestorOnly8) {
1716 initial_state.
nodes.resize(7);
1717 initial_state.
nodes[0].id = 1;
1719 initial_state.
nodes[0].child_ids = {2, 7};
1721 initial_state.
nodes[1].id = 2;
1723 initial_state.
nodes[1].child_ids = {3};
1726 initial_state.
nodes[2].id = 3;
1728 initial_state.
nodes[2].child_ids = {4};
1731 initial_state.
nodes[3].id = 4;
1733 initial_state.
nodes[3].child_ids = {5};
1736 initial_state.
nodes[4].id = 5;
1738 initial_state.
nodes[4].child_ids = {6};
1741 initial_state.
nodes[5].id = 5;
1745 initial_state.
nodes[6].id = 7;
1748 AXTree tree(initial_state);
1769TEST(AXEventGeneratorTest, ActiveDescendantChangeOnDescendant) {
1772 initial_state.
nodes.resize(5);
1773 initial_state.
nodes[0].id = 1;
1775 initial_state.
nodes[0].child_ids.push_back(2);
1776 initial_state.
nodes[1].id = 2;
1778 initial_state.
nodes[1].child_ids.push_back(3);
1779 initial_state.
nodes[2].id = 3;
1781 initial_state.
nodes[2].AddIntAttribute(
1783 initial_state.
nodes[2].child_ids.push_back(4);
1784 initial_state.
nodes[2].child_ids.push_back(5);
1785 initial_state.
nodes[3].id = 4;
1787 initial_state.
nodes[4].id = 5;
1790 AXTree tree(initial_state);
1793 initial_state.
nodes[2].RemoveIntAttribute(
1795 initial_state.
nodes[2].AddIntAttribute(
1798 update.node_id_to_clear = 2;
1806TEST(AXEventGeneratorTest, ImageAnnotationChanged) {
1809 initial_state.
nodes.resize(1);
1810 initial_state.
nodes[0].id = 1;
1811 AXTree tree(initial_state);
1815 update.nodes[0].AddStringAttribute(
1822TEST(AXEventGeneratorTest, ImageAnnotationStatusChanged) {
1825 initial_state.
nodes.resize(1);
1826 initial_state.
nodes[0].id = 1;
1827 AXTree tree(initial_state);
1831 update.nodes[0].SetImageAnnotationStatus(
1839TEST(AXEventGeneratorTest, StringPropertyChanges) {
1842 initial_state.
nodes.resize(1);
1843 initial_state.
nodes[0].id = 1;
1847 std::string old_value;
1848 std::string new_value;
1856 for (
auto&& attrib : attributes) {
1857 initial_state.
nodes.push_back({});
1858 initial_state.
nodes.back().id = initial_state.
nodes.size();
1859 initial_state.
nodes.back().AddStringAttribute(attrib.id, attrib.old_value);
1860 initial_state.
nodes[0].child_ids.push_back(initial_state.
nodes.size());
1863 AXTree tree(initial_state);
1867 for (
auto&& attrib : attributes) {
1868 initial_state.
nodes[index++].AddStringAttribute(attrib.id,
1886TEST(AXEventGeneratorTest, IntPropertyChanges) {
1889 initial_state.
nodes.resize(1);
1890 initial_state.
nodes[0].id = 1;
1901 for (
auto&& attrib : attributes) {
1902 initial_state.
nodes.push_back({});
1903 initial_state.
nodes.back().id = initial_state.
nodes.size();
1904 initial_state.
nodes.back().AddIntAttribute(attrib.id, attrib.old_value);
1905 initial_state.
nodes[0].child_ids.push_back(initial_state.
nodes.size());
1908 AXTree tree(initial_state);
1912 for (
auto&& attrib : attributes)
1913 initial_state.
nodes[index++].AddIntAttribute(attrib.id, attrib.new_value);
1925TEST(AXEventGeneratorTest, IntListPropertyChanges) {
1928 initial_state.
nodes.resize(1);
1929 initial_state.
nodes[0].id = 1;
1933 std::vector<int> old_value;
1934 std::vector<int> new_value;
1940 for (
auto&& attrib : attributes) {
1941 initial_state.
nodes.push_back({});
1942 initial_state.
nodes.back().id = initial_state.
nodes.size();
1943 initial_state.
nodes.back().AddIntListAttribute(attrib.id, attrib.old_value);
1944 initial_state.
nodes[0].child_ids.push_back(initial_state.
nodes.size());
1947 AXTree tree(initial_state);
1951 for (
auto&& attrib : attributes) {
1952 initial_state.
nodes[index++].AddIntListAttribute(attrib.id,
1976TEST(AXEventGeneratorTest, AriaBusyChanged) {
1979 initial_state.
nodes.resize(1);
1980 initial_state.
nodes[0].id = 1;
1981 AXTree tree(initial_state);
1999TEST(AXEventGeneratorTest, MultiselectableStateChanged) {
2002 initial_state.
nodes.resize(1);
2003 initial_state.
nodes[0].id = 1;
2006 AXTree tree(initial_state);
2022TEST(AXEventGeneratorTest, RequiredStateChanged) {
2025 initial_state.
nodes.resize(1);
2026 initial_state.
nodes[0].id = 1;
2029 AXTree tree(initial_state);
2044TEST(AXEventGeneratorTest, FlowToChanged) {
2047 initial_state.
nodes.resize(6);
2048 initial_state.
nodes[0].id = 1;
2050 initial_state.
nodes[0].child_ids.assign({2, 3, 4, 5, 6});
2051 initial_state.
nodes[1].id = 2;
2053 initial_state.
nodes[1].AddIntListAttribute(
2055 initial_state.
nodes[2].id = 3;
2057 initial_state.
nodes[3].id = 4;
2059 initial_state.
nodes[4].id = 5;
2061 initial_state.
nodes[5].id = 6;
2064 AXTree tree(initial_state);
2084TEST(AXEventGeneratorTest, ControlsChanged) {
2087 initial_state.
nodes.resize(2);
2088 initial_state.
nodes[0].id = 1;
2089 initial_state.
nodes[0].child_ids.push_back(2);
2090 initial_state.
nodes[1].id = 2;
2092 AXTree tree(initial_state);
2096 std::vector<int> ids = {2};
2106TEST(AXEventGeneratorTest, AtomicChanged) {
2109 initial_state.
nodes.resize(1);
2110 initial_state.
nodes[0].id = 1;
2112 AXTree tree(initial_state);
2122TEST(AXEventGeneratorTest, DropeffectChanged) {
2125 initial_state.
nodes.resize(1);
2126 initial_state.
nodes[0].id = 1;
2128 AXTree tree(initial_state);
2138TEST(AXEventGeneratorTest, GrabbedChanged) {
2141 initial_state.
nodes.resize(1);
2142 initial_state.
nodes[0].id = 1;
2144 AXTree tree(initial_state);
2154TEST(AXEventGeneratorTest, HasPopupChanged) {
2157 initial_state.
nodes.resize(1);
2158 initial_state.
nodes[0].id = 1;
2160 AXTree tree(initial_state);
2173TEST(AXEventGeneratorTest, LiveRelevantChanged) {
2176 initial_state.
nodes.resize(1);
2177 initial_state.
nodes[0].id = 1;
2179 AXTree tree(initial_state);
2190TEST(AXEventGeneratorTest, MultilineStateChanged) {
2193 initial_state.
nodes.resize(1);
2194 initial_state.
nodes[0].id = 1;
2196 AXTree tree(initial_state);
ax::mojom::Event event_type
@ LIVE_REGION_NODE_CHANGED
@ ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED
@ DOCUMENT_SELECTION_CHANGED
@ OBJECT_ATTRIBUTE_CHANGED
@ SCROLL_HORIZONTAL_POSITION_CHANGED
@ POSITION_IN_SET_CHANGED
@ IMAGE_ANNOTATION_CHANGED
@ WIN_IACCESSIBLE_STATE_CHANGED
@ MULTILINE_STATE_CHANGED
@ OTHER_ATTRIBUTE_CHANGED
@ MULTISELECTABLE_STATE_CHANGED
@ SCROLL_VERTICAL_POSITION_CHANGED
@ HIERARCHICAL_LEVEL_CHANGED
@ ACTIVE_DESCENDANT_CHANGED
@ SELECTED_CHILDREN_CHANGED
virtual bool Unserialize(const AXTreeUpdate &update)
@ kTextStrikethroughStyle
TEST(AXEnumUtilTest, Event)
AXNode::AXID sel_focus_object_id
std::vector< AXNodeData > nodes
#define EXPECT_TRUE(handle)