23#include "gtest/gtest.h"
43constexpr const char16_t* kGraphemeClusters[] = {
51 u
"\x0928\x094D\x0926\x0940",
54 u
"\x0E23\x0E39\x0E49",
61 AXPositionTest() =
default;
62 ~AXPositionTest()
override =
default;
65 static const char* TEXT_VALUE;
67 void SetUp()
override;
71 std::unique_ptr<AXTree> CreateMultipageDocument(
82 std::unique_ptr<AXTree> CreateMultilingualDocument(
83 std::vector<int>* text_offsets)
const;
85 void AssertTextLengthEquals(
const AXTree* tree,
87 int expected_text_length)
const;
91 std::unique_ptr<AXTree> CreateAXTree(
92 const std::vector<AXNodeData>& nodes)
const;
113struct ExpandToEnclosingTextBoundaryTestParam {
114 ExpandToEnclosingTextBoundaryTestParam() =
default;
116 ExpandToEnclosingTextBoundaryTestParam(
119 std::string p_expected_anchor_position,
120 std::string p_expected_focus_position)
121 : boundary(p_boundary),
122 expand_behavior(p_expand_behavior),
123 expected_anchor_position(std::move(p_expected_anchor_position)),
124 expected_focus_position(std::move(p_expected_focus_position)) {}
127 ExpandToEnclosingTextBoundaryTestParam(
128 const ExpandToEnclosingTextBoundaryTestParam& other) =
default;
129 ExpandToEnclosingTextBoundaryTestParam& operator=(
130 const ExpandToEnclosingTextBoundaryTestParam& other) =
default;
132 ~ExpandToEnclosingTextBoundaryTestParam() =
default;
142 std::string expected_anchor_position;
145 std::string expected_focus_position;
150class AXPositionExpandToEnclosingTextBoundaryTestWithParam
151 :
public AXPositionTest,
152 public testing::WithParamInterface<
153 ExpandToEnclosingTextBoundaryTestParam> {
155 AXPositionExpandToEnclosingTextBoundaryTestWithParam() =
default;
156 ~AXPositionExpandToEnclosingTextBoundaryTestWithParam()
override =
default;
159 AXPositionExpandToEnclosingTextBoundaryTestWithParam);
167struct CreatePositionAtTextBoundaryTestParam {
168 CreatePositionAtTextBoundaryTestParam() =
default;
173 std::string p_expected_text_position)
174 : boundary(p_boundary),
175 direction(p_direction),
176 boundary_behavior(p_boundary_behavior),
177 expected_text_position(std::move(p_expected_text_position)) {}
180 CreatePositionAtTextBoundaryTestParam(
181 const CreatePositionAtTextBoundaryTestParam& other) =
default;
182 CreatePositionAtTextBoundaryTestParam& operator=(
183 const CreatePositionAtTextBoundaryTestParam& other) =
default;
185 ~CreatePositionAtTextBoundaryTestParam() =
default;
200 std::string expected_text_position;
205class AXPositionCreatePositionAtTextBoundaryTestWithParam
206 :
public AXPositionTest,
207 public testing::WithParamInterface<
208 CreatePositionAtTextBoundaryTestParam> {
210 AXPositionCreatePositionAtTextBoundaryTestWithParam() =
default;
211 ~AXPositionCreatePositionAtTextBoundaryTestWithParam()
override =
default;
214 AXPositionCreatePositionAtTextBoundaryTestWithParam);
222struct TextNavigationTestParam {
223 TextNavigationTestParam() =
default;
225 TextNavigationTestParam(
229 std::vector<std::string> p_expectations)
230 : TestMethod(std::move(p_TestMethod)),
231 start_node_id(p_start_node_id),
232 start_offset(p_start_offset),
233 expectations(std::move(p_expectations)) {}
236 TextNavigationTestParam(
const TextNavigationTestParam& other) =
default;
237 TextNavigationTestParam& operator=(
const TextNavigationTestParam& other) =
240 ~TextNavigationTestParam() =
default;
254 std::vector<std::string> expectations;
264class AXPositionTextNavigationTestWithParam
265 :
public AXPositionTest,
266 public testing::WithParamInterface<TextNavigationTestParam> {
268 AXPositionTextNavigationTestWithParam() =
default;
269 ~AXPositionTextNavigationTestWithParam()
override =
default;
274const char* AXPositionTest::TEXT_VALUE =
"Line 1\nLine 2";
276void AXPositionTest::SetUp() {
293 button_.id = BUTTON_ID;
294 check_box_.id = CHECK_BOX_ID;
295 text_field_.id = TEXT_FIELD_ID;
296 static_text1_.id = STATIC_TEXT1_ID;
297 inline_box1_.id = INLINE_BOX1_ID;
298 line_break_.id = LINE_BREAK_ID;
299 static_text2_.id = STATIC_TEXT2_ID;
300 inline_box2_.id = INLINE_BOX2_ID;
309 button_.SetName(
"Button");
310 button_.relative_bounds.bounds =
gfx::RectF(20, 20, 200, 30);
311 root_.child_ids.push_back(button_.id);
317 check_box_.SetName(
"Check box");
318 check_box_.relative_bounds.bounds =
gfx::RectF(20, 50, 200, 30);
319 root_.child_ids.push_back(check_box_.id);
325 text_field_.SetValue(TEXT_VALUE);
326 text_field_.SetName(TEXT_VALUE);
327 text_field_.AddIntListAttribute(
329 std::vector<int32_t>{0, 7});
330 text_field_.child_ids.push_back(static_text1_.id);
331 text_field_.child_ids.push_back(line_break_.id);
332 text_field_.child_ids.push_back(static_text2_.id);
333 root_.child_ids.push_back(text_field_.id);
337 static_text1_.SetName(
"Line 1");
338 static_text1_.child_ids.push_back(inline_box1_.id);
339 static_text1_.AddIntAttribute(
345 inline_box1_.SetName(
"Line 1");
347 std::vector<int32_t>{0, 5});
349 std::vector<int32_t>{4, 6});
357 line_break_.SetName(
"\n");
363 static_text2_.SetName(
"Line 2");
364 static_text2_.child_ids.push_back(inline_box2_.id);
369 inline_box2_.SetName(
"Line 2");
371 std::vector<int32_t>{0, 5});
373 std::vector<int32_t>{4, 6});
377 initial_state.
nodes = {root_, button_, check_box_,
378 text_field_, static_text1_, inline_box1_,
379 line_break_, static_text2_, inline_box2_};
386 SetTree(std::make_unique<AXTree>(initial_state));
389std::unique_ptr<AXTree> AXPositionTest::CreateMultipageDocument(
405 page_1_text_data.
id = 3;
407 page_1_text_data.
SetName(
"some text on page 1");
417 page_2_text_data.
id = 5;
419 page_2_text_data.
SetName(
"some text on page 2");
430 page_3_text_data.
id = 7;
432 page_3_text_data.
SetName(
"some more text on page 3");
437 return CreateAXTree({root_data, page_1_data, page_1_text_data, page_2_data,
438 page_2_text_data, page_3_data, page_3_text_data});
441std::unique_ptr<AXTree> AXPositionTest::CreateMultilingualDocument(
442 std::vector<int>* text_offsets)
const {
443 EXPECT_NE(
nullptr, text_offsets);
444 text_offsets->push_back(0);
446 std::u16string english_text;
447 for (
int i = 0;
i < 3; ++
i) {
448 std::u16string grapheme = kGraphemeClusters[
i];
449 EXPECT_EQ(1u, grapheme.length())
450 <<
"All English characters should be one UTF16 code unit in length.";
451 text_offsets->push_back(text_offsets->back() +
452 static_cast<int>(grapheme.length()));
453 english_text.append(grapheme);
456 std::u16string hindi_text;
457 for (
int i = 3;
i < 5; ++
i) {
458 std::u16string grapheme = kGraphemeClusters[
i];
459 EXPECT_LE(2u, grapheme.length()) <<
"All Hindi characters should be two "
460 "or more UTF16 code units in length.";
461 text_offsets->push_back(text_offsets->back() +
462 static_cast<int>(grapheme.length()));
463 hindi_text.append(grapheme);
466 std::u16string thai_text;
467 for (
int i = 5;
i < 8; ++
i) {
468 std::u16string grapheme = kGraphemeClusters[
i];
469 EXPECT_LT(0u, grapheme.length())
470 <<
"One of the Thai characters should be one UTF16 code unit, "
471 "whilst others should be two or more.";
472 text_offsets->push_back(text_offsets->back() +
473 static_cast<int>(grapheme.length()));
474 thai_text.append(grapheme);
484 text_data1.
SetName(english_text);
489 text_data2.
SetName(hindi_text);
498 return CreateAXTree({root_data, text_data1, text_data2, text_data3});
501void AXPositionTest::AssertTextLengthEquals(
const AXTree* tree,
503 int expected_text_length)
const {
507 ASSERT_NE(
nullptr, text_position);
508 ASSERT_TRUE(text_position->IsTextPosition());
509 ASSERT_EQ(expected_text_length, text_position->MaxTextOffset());
510 ASSERT_EQ(expected_text_length,
511 static_cast<int>(text_position->GetText().length()));
514std::unique_ptr<AXTree> AXPositionTest::CreateAXTree(
515 const std::vector<AXNodeData>& nodes)
const {
516 EXPECT_FALSE(nodes.empty());
521 update.
nodes = nodes;
522 return std::make_unique<AXTree>(update);
529 ASSERT_NE(
nullptr, null_position);
531 ASSERT_NE(
nullptr, copy_position);
532 EXPECT_TRUE(copy_position->IsNullPosition());
535 GetTreeID(), root_.id, 1 );
536 ASSERT_NE(
nullptr, tree_position);
537 copy_position = tree_position->Clone();
538 ASSERT_NE(
nullptr, copy_position);
539 EXPECT_TRUE(copy_position->IsTreePosition());
540 EXPECT_EQ(root_.id, copy_position->anchor_id());
541 EXPECT_EQ(1, copy_position->child_index());
546 ASSERT_NE(
nullptr, tree_position);
547 copy_position = tree_position->Clone();
548 ASSERT_NE(
nullptr, copy_position);
549 EXPECT_TRUE(copy_position->IsTreePosition());
550 EXPECT_EQ(root_.id, copy_position->anchor_id());
555 GetTreeID(), text_field_.id, 0 ,
557 ASSERT_NE(
nullptr, text_position);
558 ASSERT_TRUE(text_position->IsTextPosition());
559 copy_position = text_position->Clone();
560 ASSERT_NE(
nullptr, copy_position);
561 EXPECT_TRUE(copy_position->IsTextPosition());
562 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
563 EXPECT_EQ(0, copy_position->text_offset());
567 GetTreeID(), text_field_.id, 0 ,
569 ASSERT_NE(
nullptr, text_position);
570 ASSERT_TRUE(text_position->IsTextPosition());
571 copy_position = text_position->Clone();
572 ASSERT_NE(
nullptr, copy_position);
573 EXPECT_TRUE(copy_position->IsTextPosition());
574 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
575 EXPECT_EQ(0, copy_position->text_offset());
582 ASSERT_NE(
nullptr, null_position);
585 ASSERT_NE(
nullptr, copy_position);
586 EXPECT_TRUE(copy_position->IsNullPosition());
589 GetTreeID(), root_.id, 1 );
590 ASSERT_NE(
nullptr, tree_position);
592 ASSERT_NE(
nullptr, copy_position);
593 EXPECT_TRUE(copy_position->IsTreePosition());
594 EXPECT_EQ(root_.id, copy_position->anchor_id());
595 EXPECT_EQ(1, copy_position->child_index());
600 ASSERT_NE(
nullptr, tree_position);
602 ASSERT_NE(
nullptr, copy_position);
603 EXPECT_TRUE(copy_position->IsTreePosition());
604 EXPECT_EQ(root_.id, copy_position->anchor_id());
609 GetTreeID(), text_field_.id, 0 ,
611 ASSERT_NE(
nullptr, text_position);
612 ASSERT_TRUE(text_position->IsTextPosition());
614 ASSERT_NE(
nullptr, copy_position);
615 EXPECT_TRUE(copy_position->IsTextPosition());
616 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
617 EXPECT_EQ(0, copy_position->text_offset());
621 GetTreeID(), text_field_.id, 0 ,
623 ASSERT_NE(
nullptr, text_position);
624 ASSERT_TRUE(text_position->IsTextPosition());
626 ASSERT_NE(
nullptr, copy_position);
627 EXPECT_TRUE(copy_position->IsTextPosition());
628 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
629 EXPECT_EQ(0, copy_position->text_offset());
640 static_text_data_1.
id = 2;
642 static_text_data_1.
SetName(
"some text");
645 static_text_data_2.
id = 3;
647 static_text_data_2.
SetName(u
"\xfffc");
650 static_text_data_3.
id = 4;
652 static_text_data_3.
SetName(
"more text");
654 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id,
655 static_text_data_3.
id};
657 SetTree(CreateAXTree(
658 {root_data, static_text_data_1, static_text_data_2, static_text_data_3}));
661 GetTreeID(), root_data.
id, 0 ,
663 ASSERT_TRUE(text_position_1->IsTextPosition());
665 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
666 "annotated_text=<s>ome text\xEF\xBF\xBCmore text",
667 text_position_1->ToString());
670 GetTreeID(), root_data.
id, 5 ,
672 ASSERT_TRUE(text_position_2->IsTextPosition());
674 "TextPosition anchor_id=1 text_offset=5 affinity=downstream "
675 "annotated_text=some <t>ext\xEF\xBF\xBCmore text",
676 text_position_2->ToString());
679 GetTreeID(), root_data.
id, 9 ,
681 ASSERT_TRUE(text_position_3->IsTextPosition());
683 "TextPosition anchor_id=1 text_offset=9 affinity=downstream "
684 "annotated_text=some text<\xEF\xBF\xBC>more text",
685 text_position_3->ToString());
688 GetTreeID(), root_data.
id, 10 ,
690 ASSERT_TRUE(text_position_4->IsTextPosition());
692 "TextPosition anchor_id=1 text_offset=10 affinity=downstream "
693 "annotated_text=some text\xEF\xBF\xBC<m>ore text",
694 text_position_4->ToString());
697 GetTreeID(), root_data.
id, 19 ,
699 ASSERT_TRUE(text_position_5->IsTextPosition());
701 "TextPosition anchor_id=1 text_offset=19 affinity=downstream "
702 "annotated_text=some text\xEF\xBF\xBCmore text<>",
703 text_position_5->ToString());
706 GetTreeID(), static_text_data_2.
id, 0 ,
708 ASSERT_TRUE(text_position_6->IsTextPosition());
710 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
711 "annotated_text=<\xEF\xBF\xBC>",
712 text_position_6->ToString());
715 GetTreeID(), static_text_data_2.
id, 1 ,
717 ASSERT_TRUE(text_position_7->IsTextPosition());
719 "TextPosition anchor_id=3 text_offset=1 affinity=downstream "
720 "annotated_text=\xEF\xBF\xBC<>",
721 text_position_7->ToString());
724 GetTreeID(), static_text_data_3.
id, 0 ,
726 ASSERT_TRUE(text_position_8->IsTextPosition());
728 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
729 "annotated_text=<m>ore text",
730 text_position_8->ToString());
733 GetTreeID(), static_text_data_3.
id, 5 ,
735 ASSERT_TRUE(text_position_9->IsTextPosition());
737 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
738 "annotated_text=more <t>ext",
739 text_position_9->ToString());
742 GetTreeID(), static_text_data_3.
id, 9 ,
744 ASSERT_TRUE(text_position_10->IsTextPosition());
746 "TextPosition anchor_id=4 text_offset=9 affinity=downstream "
747 "annotated_text=more text<>",
748 text_position_10->ToString());
761 static_text_data_1.
id = 2;
763 static_text_data_1.
SetName(
"One");
766 inline_box_data_1.
id = 3;
768 inline_box_data_1.
SetName(
"One");
772 container_data.
id = 4;
777 static_text_data_2.
id = 5;
779 static_text_data_2.
SetName(
"Two");
782 inline_box_data_2.
id = 6;
784 inline_box_data_2.
SetName(
"Two");
786 static_text_data_1.
child_ids = {inline_box_data_1.
id};
787 container_data.
child_ids = {static_text_data_2.
id};
788 static_text_data_2.
child_ids = {inline_box_data_2.
id};
789 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
792 CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
793 container_data, static_text_data_2, inline_box_data_2}));
800 GetTreeID(), root_data.
id, 0 ,
802 ASSERT_TRUE(text_position_1->IsTextPosition());
805 EXPECT_TRUE(text_position_1->IsIgnored());
809 GetTreeID(), root_data.
id, 2 ,
811 ASSERT_TRUE(text_position_2->IsTextPosition());
813 EXPECT_TRUE(text_position_2->IsIgnored());
817 GetTreeID(), root_data.
id, 3 ,
819 ASSERT_TRUE(text_position_3->IsTextPosition());
823 EXPECT_FALSE(text_position_3->IsIgnored());
827 GetTreeID(), root_data.
id, 4 ,
829 ASSERT_TRUE(text_position_4->IsTextPosition());
831 EXPECT_FALSE(text_position_4->IsIgnored());
836 GetTreeID(), container_data.
id, 0 ,
838 ASSERT_TRUE(text_position_5->IsTextPosition());
839 EXPECT_TRUE(text_position_5->IsIgnored());
844 GetTreeID(), static_text_data_2.
id, 0 ,
846 ASSERT_TRUE(text_position_6->IsTextPosition());
847 EXPECT_FALSE(text_position_6->IsIgnored());
851 GetTreeID(), inline_box_data_1.
id, 1 ,
853 ASSERT_TRUE(text_position_7->IsTextPosition());
854 EXPECT_TRUE(text_position_7->IsIgnored());
865 GetTreeID(), root_data.
id, 0 );
866 ASSERT_TRUE(tree_position_1->IsTreePosition());
867 EXPECT_FALSE(tree_position_1->IsIgnored());
871 GetTreeID(), root_data.
id, 1 );
872 ASSERT_TRUE(tree_position_2->IsTreePosition());
873 EXPECT_TRUE(tree_position_2->IsIgnored());
877 GetTreeID(), inline_box_data_1.
id, 0 );
878 ASSERT_TRUE(tree_position_3->IsTreePosition());
879 EXPECT_TRUE(tree_position_3->IsIgnored());
884 ASSERT_TRUE(tree_position_4->IsTreePosition());
885 EXPECT_TRUE(tree_position_4->IsIgnored());
890 GetTreeID(), root_data.
id, 2 );
891 ASSERT_TRUE(tree_position_5->IsTreePosition());
892 EXPECT_TRUE(tree_position_5->IsIgnored());
897 ASSERT_TRUE(tree_position_6->IsTreePosition());
898 EXPECT_FALSE(tree_position_6->IsIgnored());
901TEST_F(AXPositionTest, GetTextFromNullPosition) {
903 ASSERT_NE(
nullptr, text_position);
904 ASSERT_TRUE(text_position->IsNullPosition());
905 ASSERT_EQ(u
"", text_position->GetText());
910 GetTreeID(), root_.id, 0 ,
912 ASSERT_NE(
nullptr, text_position);
913 ASSERT_TRUE(text_position->IsTextPosition());
914 ASSERT_EQ(u
"Line 1\nLine 2", text_position->GetText());
917TEST_F(AXPositionTest, GetTextFromButton) {
919 GetTreeID(), button_.id, 0 ,
921 ASSERT_NE(
nullptr, text_position);
922 ASSERT_TRUE(text_position->IsTextPosition());
923 ASSERT_EQ(u
"", text_position->GetText());
926TEST_F(AXPositionTest, GetTextFromCheckbox) {
928 GetTreeID(), check_box_.id, 0 ,
930 ASSERT_NE(
nullptr, text_position);
931 ASSERT_TRUE(text_position->IsTextPosition());
932 ASSERT_EQ(u
"", text_position->GetText());
935TEST_F(AXPositionTest, GetTextFromTextField) {
937 GetTreeID(), text_field_.id, 0 ,
939 ASSERT_NE(
nullptr, text_position);
940 ASSERT_TRUE(text_position->IsTextPosition());
941 ASSERT_EQ(u
"Line 1\nLine 2", text_position->GetText());
944TEST_F(AXPositionTest, GetTextFromStaticText) {
946 GetTreeID(), static_text1_.id, 0 ,
948 ASSERT_NE(
nullptr, text_position);
949 ASSERT_TRUE(text_position->IsTextPosition());
950 ASSERT_EQ(u
"Line 1", text_position->GetText());
953TEST_F(AXPositionTest, GetTextFromInlineTextBox) {
955 GetTreeID(), inline_box1_.id, 0 ,
957 ASSERT_NE(
nullptr, text_position);
958 ASSERT_TRUE(text_position->IsTextPosition());
959 ASSERT_EQ(u
"Line 1", text_position->GetText());
962TEST_F(AXPositionTest, GetTextFromLineBreak) {
964 GetTreeID(), line_break_.id, 0 ,
966 ASSERT_NE(
nullptr, text_position);
967 ASSERT_TRUE(text_position->IsTextPosition());
968 ASSERT_EQ(u
"\n", text_position->GetText());
971TEST_F(AXPositionTest, GetMaxTextOffsetFromNullPosition) {
973 ASSERT_NE(
nullptr, text_position);
974 ASSERT_TRUE(text_position->IsNullPosition());
978TEST_F(AXPositionTest, GetMaxTextOffsetFromRoot) {
980 GetTreeID(), root_.id, 0 ,
982 ASSERT_NE(
nullptr, text_position);
983 ASSERT_TRUE(text_position->IsTextPosition());
984 ASSERT_EQ(13, text_position->MaxTextOffset());
987TEST_F(AXPositionTest, GetMaxTextOffsetFromButton) {
989 GetTreeID(), button_.id, 0 ,
991 ASSERT_NE(
nullptr, text_position);
992 ASSERT_TRUE(text_position->IsTextPosition());
993 ASSERT_EQ(0, text_position->MaxTextOffset());
996TEST_F(AXPositionTest, GetMaxTextOffsetFromCheckbox) {
998 GetTreeID(), check_box_.id, 0 ,
1000 ASSERT_NE(
nullptr, text_position);
1001 ASSERT_TRUE(text_position->IsTextPosition());
1002 ASSERT_EQ(0, text_position->MaxTextOffset());
1005TEST_F(AXPositionTest, GetMaxTextOffsetFromTextfield) {
1007 GetTreeID(), text_field_.id, 0 ,
1009 ASSERT_NE(
nullptr, text_position);
1010 ASSERT_TRUE(text_position->IsTextPosition());
1011 ASSERT_EQ(13, text_position->MaxTextOffset());
1014TEST_F(AXPositionTest, GetMaxTextOffsetFromStaticText) {
1016 GetTreeID(), static_text1_.id, 0 ,
1018 ASSERT_NE(
nullptr, text_position);
1019 ASSERT_TRUE(text_position->IsTextPosition());
1020 ASSERT_EQ(6, text_position->MaxTextOffset());
1023TEST_F(AXPositionTest, GetMaxTextOffsetFromInlineTextBox) {
1025 GetTreeID(), inline_box1_.id, 0 ,
1027 ASSERT_NE(
nullptr, text_position);
1028 ASSERT_TRUE(text_position->IsTextPosition());
1029 ASSERT_EQ(6, text_position->MaxTextOffset());
1032TEST_F(AXPositionTest, GetMaxTextOffsetFromLineBreak) {
1034 GetTreeID(), line_break_.id, 0 ,
1036 ASSERT_NE(
nullptr, text_position);
1037 ASSERT_TRUE(text_position->IsTextPosition());
1038 ASSERT_EQ(1, text_position->MaxTextOffset());
1041TEST_F(AXPositionTest, GetMaxTextOffsetUpdate) {
1049 text_data.
SetName(
"some text");
1052 more_text_data.
id = 3;
1054 more_text_data.
SetName(
"more text");
1058 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1060 AssertTextLengthEquals(GetTree(), text_data.
id, 9);
1061 AssertTextLengthEquals(GetTree(), root_data.
id, 18);
1063 text_data.
SetName(
"Adjusted line 1");
1064 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1066 AssertTextLengthEquals(GetTree(), text_data.
id, 15);
1067 AssertTextLengthEquals(GetTree(), root_data.
id, 24);
1070 text_data.
SetValue(
"Value should override name");
1071 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1073 AssertTextLengthEquals(GetTree(), text_data.
id, 26);
1074 AssertTextLengthEquals(GetTree(), root_data.
id, 35);
1078 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1080 AssertTextLengthEquals(GetTree(), text_data.
id, 15);
1081 AssertTextLengthEquals(GetTree(), root_data.
id, 24);
1084TEST_F(AXPositionTest, GetMaxTextOffsetAndGetTextWithGeneratedContent) {
1099 text_field_2.
id = 2;
1100 static_text_3.
id = 3;
1101 inline_box_4.
id = 4;
1102 static_text_5.
id = 5;
1103 inline_box_6.
id = 6;
1110 text_field_2.
child_ids = {static_text_3.
id, static_text_5.
id};
1113 static_text_3.
SetName(
"Placeholder from generated content");
1117 inline_box_4.
SetName(
"Placeholder from generated content");
1120 static_text_5.
SetName(
"3.14");
1126 SetTree(CreateAXTree({root_1, text_field_2, static_text_3, inline_box_4,
1127 static_text_5, inline_box_6}));
1130 GetTreeID(), text_field_2.
id, 0 ,
1132 ASSERT_NE(
nullptr, text_position);
1133 EXPECT_TRUE(text_position->IsTextPosition());
1134 EXPECT_EQ(38, text_position->MaxTextOffset());
1135 EXPECT_EQ(u
"Placeholder from generated content3.14",
1136 text_position->GetText());
1139TEST_F(AXPositionTest, AtStartOfAnchorWithNullPosition) {
1141 ASSERT_NE(
nullptr, null_position);
1142 EXPECT_FALSE(null_position->AtStartOfAnchor());
1145TEST_F(AXPositionTest, AtStartOfAnchorWithTreePosition) {
1147 GetTreeID(), root_.id, 0 );
1148 ASSERT_NE(
nullptr, tree_position);
1149 EXPECT_TRUE(tree_position->AtStartOfAnchor());
1153 ASSERT_NE(
nullptr, tree_position);
1154 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1158 ASSERT_NE(
nullptr, tree_position);
1159 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1164 ASSERT_NE(
nullptr, tree_position);
1165 EXPECT_TRUE(tree_position->AtStartOfAnchor());
1169 GetTreeID(), inline_box1_.id, 0 );
1170 ASSERT_NE(
nullptr, tree_position);
1171 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1174TEST_F(AXPositionTest, AtStartOfAnchorWithTextPosition) {
1176 GetTreeID(), inline_box1_.id, 0 ,
1178 ASSERT_NE(
nullptr, text_position);
1179 ASSERT_TRUE(text_position->IsTextPosition());
1180 EXPECT_TRUE(text_position->AtStartOfAnchor());
1183 GetTreeID(), inline_box1_.id, 1 ,
1185 ASSERT_NE(
nullptr, text_position);
1186 ASSERT_TRUE(text_position->IsTextPosition());
1187 EXPECT_FALSE(text_position->AtStartOfAnchor());
1190 GetTreeID(), inline_box1_.id, 6 ,
1192 ASSERT_NE(
nullptr, text_position);
1193 ASSERT_TRUE(text_position->IsTextPosition());
1194 EXPECT_FALSE(text_position->AtStartOfAnchor());
1197TEST_F(AXPositionTest, AtEndOfAnchorWithNullPosition) {
1199 ASSERT_NE(
nullptr, null_position);
1200 EXPECT_FALSE(null_position->AtEndOfAnchor());
1203TEST_F(AXPositionTest, AtEndOfAnchorWithTreePosition) {
1205 GetTreeID(), root_.id, 3 );
1206 ASSERT_NE(
nullptr, tree_position);
1207 EXPECT_TRUE(tree_position->AtEndOfAnchor());
1211 ASSERT_NE(
nullptr, tree_position);
1212 EXPECT_FALSE(tree_position->AtEndOfAnchor());
1216 ASSERT_NE(
nullptr, tree_position);
1217 EXPECT_FALSE(tree_position->AtEndOfAnchor());
1220TEST_F(AXPositionTest, AtEndOfAnchorWithTextPosition) {
1222 GetTreeID(), inline_box1_.id, 6 ,
1224 ASSERT_NE(
nullptr, text_position);
1225 ASSERT_TRUE(text_position->IsTextPosition());
1226 EXPECT_TRUE(text_position->AtEndOfAnchor());
1229 GetTreeID(), inline_box1_.id, 5 ,
1231 ASSERT_NE(
nullptr, text_position);
1232 ASSERT_TRUE(text_position->IsTextPosition());
1233 EXPECT_FALSE(text_position->AtEndOfAnchor());
1236 GetTreeID(), inline_box1_.id, 0 ,
1238 ASSERT_NE(
nullptr, text_position);
1239 ASSERT_TRUE(text_position->IsTextPosition());
1240 EXPECT_FALSE(text_position->AtEndOfAnchor());
1243TEST_F(AXPositionTest, AtStartOfLineWithTextPosition) {
1247 GetTreeID(), inline_box1_.id, 0 ,
1249 ASSERT_NE(
nullptr, text_position);
1250 ASSERT_TRUE(text_position->IsTextPosition());
1251 EXPECT_TRUE(text_position->AtStartOfLine());
1254 GetTreeID(), inline_box1_.id, 1 ,
1256 ASSERT_NE(
nullptr, text_position);
1257 ASSERT_TRUE(text_position->IsTextPosition());
1258 EXPECT_FALSE(text_position->AtStartOfLine());
1261 GetTreeID(), line_break_.id, 0 ,
1263 ASSERT_NE(
nullptr, text_position);
1264 ASSERT_TRUE(text_position->IsTextPosition());
1265 EXPECT_FALSE(text_position->AtStartOfLine());
1270 GetTreeID(), line_break_.id, 1 ,
1272 ASSERT_NE(
nullptr, text_position);
1273 ASSERT_TRUE(text_position->IsTextPosition());
1274 EXPECT_TRUE(text_position->AtStartOfLine());
1279 GetTreeID(), inline_box2_.id, 0 ,
1281 ASSERT_NE(
nullptr, text_position);
1282 ASSERT_TRUE(text_position->IsTextPosition());
1283 EXPECT_TRUE(text_position->AtStartOfLine());
1286 GetTreeID(), inline_box2_.id, 1 ,
1288 ASSERT_NE(
nullptr, text_position);
1289 ASSERT_TRUE(text_position->IsTextPosition());
1290 EXPECT_FALSE(text_position->AtStartOfLine());
1293TEST_F(AXPositionTest, AtStartOfLineStaticTextExtraPrecedingSpace) {
1323 static_text1.
id = 3;
1328 inline_text1.
id = 4;
1335 SetTree(CreateAXTree({root, static_text1, inline_text1}));
1341 GetTreeID(), static_text1.
id, 1 ,
1343 ASSERT_FALSE(text_position->AtStartOfLine());
1346TEST_F(AXPositionTest, AtEndOfLineWithTextPosition) {
1348 GetTreeID(), inline_box1_.id, 5 ,
1350 ASSERT_NE(
nullptr, text_position);
1351 ASSERT_TRUE(text_position->IsTextPosition());
1352 EXPECT_FALSE(text_position->AtEndOfLine());
1355 GetTreeID(), inline_box1_.id, 6 ,
1357 ASSERT_NE(
nullptr, text_position);
1358 ASSERT_TRUE(text_position->IsTextPosition());
1359 EXPECT_TRUE(text_position->AtEndOfLine());
1364 GetTreeID(), line_break_.id, 0 ,
1366 ASSERT_NE(
nullptr, text_position);
1367 ASSERT_TRUE(text_position->IsTextPosition());
1368 EXPECT_TRUE(text_position->AtEndOfLine());
1373 GetTreeID(), line_break_.id, 1 ,
1375 ASSERT_NE(
nullptr, text_position);
1376 ASSERT_TRUE(text_position->IsTextPosition());
1377 EXPECT_FALSE(text_position->AtEndOfLine());
1380 GetTreeID(), inline_box2_.id, 5 ,
1382 ASSERT_NE(
nullptr, text_position);
1383 ASSERT_TRUE(text_position->IsTextPosition());
1384 EXPECT_FALSE(text_position->AtEndOfLine());
1387 GetTreeID(), inline_box2_.id, 6 ,
1389 ASSERT_NE(
nullptr, text_position);
1390 ASSERT_TRUE(text_position->IsTextPosition());
1391 EXPECT_TRUE(text_position->AtEndOfLine());
1400 update.
nodes = {inline_box1_, line_break_};
1401 ASSERT_TRUE(GetTree()->Unserialize(update));
1404 GetTreeID(), text_field_.id, 1 );
1405 ASSERT_NE(
nullptr, tree_position);
1406 ASSERT_TRUE(tree_position->IsTreePosition());
1407 EXPECT_TRUE(tree_position->AtStartOfLine());
1410 GetTreeID(), line_break_.id, 0 ,
1412 ASSERT_NE(
nullptr, text_position);
1413 ASSERT_TRUE(text_position->IsTextPosition());
1414 EXPECT_TRUE(text_position->AtStartOfLine());
1419 GetTreeID(), line_break_.id, 1 ,
1421 ASSERT_NE(
nullptr, text_position);
1422 ASSERT_TRUE(text_position->IsTextPosition());
1423 EXPECT_TRUE(text_position->AtStartOfLine());
1432 update.
nodes = {inline_box1_, line_break_};
1433 ASSERT_TRUE(GetTree()->Unserialize(update));
1436 GetTreeID(), text_field_.id, 1 );
1437 ASSERT_NE(
nullptr, tree_position);
1438 ASSERT_TRUE(tree_position->IsTreePosition());
1439 EXPECT_FALSE(tree_position->AtEndOfLine());
1442 GetTreeID(), line_break_.id, 0 ,
1444 ASSERT_NE(
nullptr, text_position);
1445 ASSERT_TRUE(text_position->IsTextPosition());
1446 EXPECT_FALSE(text_position->AtEndOfLine());
1449 GetTreeID(), line_break_.id, 1 ,
1451 ASSERT_NE(
nullptr, text_position);
1452 ASSERT_TRUE(text_position->IsTextPosition());
1453 EXPECT_TRUE(text_position->AtEndOfLine());
1456TEST_F(AXPositionTest, AtStartAndEndOfLineWhenAtEndOfTextSpan) {
1498 static_text_data_1.
id = 2;
1500 static_text_data_1.
SetName(
"Hello testing ");
1503 inline_box_data_1.
id = 3;
1505 inline_box_data_1.
SetName(
"hello");
1508 inline_box_data_2.
id = 4;
1511 inline_box_data_2.
id);
1513 inline_box_data_1.
id);
1516 inline_box_data_2.
SetName(
" ");
1519 inline_box_data_3.
id = 5;
1521 inline_box_data_3.
SetName(
"testing");
1524 inline_box_data_4.
id = 6;
1527 inline_box_data_4.
id);
1529 inline_box_data_3.
id);
1530 inline_box_data_4.
SetName(
" ");
1533 static_text_data_2.
id = 7;
1535 static_text_data_2.
SetName(
"here.");
1538 inline_box_data_5.
id = 8;
1540 inline_box_data_5.
SetName(
"here.");
1542 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id,
1543 inline_box_data_3.
id, inline_box_data_4.
id};
1544 static_text_data_2.
child_ids = {inline_box_data_5.
id};
1545 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id};
1547 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
1548 inline_box_data_2, inline_box_data_3, inline_box_data_4,
1549 static_text_data_2, inline_box_data_5}));
1553 GetTreeID(), inline_box_data_2.
id, 0 );
1554 ASSERT_NE(
nullptr, tree_position);
1555 ASSERT_TRUE(tree_position->IsTreePosition());
1556 EXPECT_TRUE(tree_position->AtStartOfLine());
1557 EXPECT_FALSE(tree_position->AtEndOfLine());
1562 GetTreeID(), inline_box_data_4.
id, 0 );
1563 ASSERT_NE(
nullptr, tree_position);
1564 ASSERT_TRUE(tree_position->IsTreePosition());
1565 EXPECT_FALSE(tree_position->AtStartOfLine());
1566 EXPECT_TRUE(tree_position->AtEndOfLine());
1569 GetTreeID(), inline_box_data_2.
id, 1 ,
1571 ASSERT_NE(
nullptr, text_position);
1572 ASSERT_TRUE(text_position->IsTextPosition());
1573 EXPECT_TRUE(text_position->AtStartOfLine());
1574 EXPECT_FALSE(text_position->AtEndOfLine());
1577 GetTreeID(), inline_box_data_4.
id, 1 ,
1579 ASSERT_NE(
nullptr, text_position);
1580 ASSERT_TRUE(text_position->IsTextPosition());
1581 EXPECT_FALSE(text_position->AtStartOfLine());
1582 EXPECT_TRUE(text_position->AtEndOfLine());
1585TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {
1602 text_field_data_1.
id = 2;
1611 text_field_data_1.
SetValue(
" Text field one ");
1614 static_text_data_1.
id = 3;
1616 static_text_data_1.
SetName(
" Text field one ");
1619 inline_box_data_1.
id = 4;
1621 inline_box_data_1.
SetName(
" ");
1624 inline_box_data_2.
id = 5;
1627 inline_box_data_2.
id);
1629 inline_box_data_1.
id);
1630 inline_box_data_2.
SetName(
"Text field one");
1633 inline_box_data_3.
id = 6;
1636 inline_box_data_3.
id);
1638 inline_box_data_2.
id);
1639 inline_box_data_3.
SetName(
" ");
1642 text_field_data_2.
id = 7;
1651 text_field_data_2.
SetValue(
" Text field two ");
1654 static_text_data_2.
id = 8;
1656 static_text_data_2.
SetName(
" Text field two ");
1659 inline_box_data_4.
id = 9;
1661 inline_box_data_4.
SetName(
" ");
1664 inline_box_data_5.
id = 10;
1666 inline_box_data_5.
SetName(
"Text field two");
1669 inline_box_data_6.
id = 11;
1671 inline_box_data_6.
SetName(
" ");
1673 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id,
1674 inline_box_data_3.
id};
1675 static_text_data_2.
child_ids = {inline_box_data_4.
id, inline_box_data_5.
id,
1676 inline_box_data_6.
id};
1677 text_field_data_1.
child_ids = {static_text_data_1.
id};
1678 text_field_data_2.
child_ids = {static_text_data_2.
id};
1679 root_data.
child_ids = {text_field_data_1.
id, text_field_data_2.
id};
1682 CreateAXTree({root_data, text_field_data_1, static_text_data_1,
1683 inline_box_data_1, inline_box_data_2, inline_box_data_3,
1684 text_field_data_2, static_text_data_2, inline_box_data_4,
1685 inline_box_data_5, inline_box_data_6}));
1688 GetTreeID(), text_field_data_1.
id, 0 );
1689 ASSERT_NE(
nullptr, tree_position);
1690 ASSERT_TRUE(tree_position->IsTreePosition());
1691 EXPECT_TRUE(tree_position->AtStartOfLine());
1692 EXPECT_FALSE(tree_position->AtEndOfLine());
1695 GetTreeID(), text_field_data_1.
id, 1 );
1696 ASSERT_NE(
nullptr, tree_position);
1697 ASSERT_TRUE(tree_position->IsTreePosition());
1698 EXPECT_FALSE(tree_position->AtStartOfLine());
1699 EXPECT_TRUE(tree_position->AtEndOfLine());
1702 GetTreeID(), text_field_data_2.
id, 0 );
1703 ASSERT_NE(
nullptr, tree_position);
1704 ASSERT_TRUE(tree_position->IsTreePosition());
1705 EXPECT_TRUE(tree_position->AtStartOfLine());
1706 EXPECT_FALSE(tree_position->AtEndOfLine());
1709 GetTreeID(), text_field_data_2.
id, 1 );
1710 ASSERT_NE(
nullptr, tree_position);
1711 ASSERT_TRUE(tree_position->IsTreePosition());
1712 EXPECT_FALSE(tree_position->AtStartOfLine());
1713 EXPECT_TRUE(tree_position->AtEndOfLine());
1716 GetTreeID(), text_field_data_1.
id, 0 ,
1718 ASSERT_NE(
nullptr, text_position);
1719 ASSERT_TRUE(text_position->IsTextPosition());
1720 EXPECT_TRUE(text_position->AtStartOfLine());
1721 EXPECT_FALSE(text_position->AtEndOfLine());
1724 GetTreeID(), text_field_data_1.
id, 16 ,
1726 ASSERT_NE(
nullptr, text_position);
1727 ASSERT_TRUE(text_position->IsTextPosition());
1728 EXPECT_FALSE(text_position->AtStartOfLine());
1729 EXPECT_TRUE(text_position->AtEndOfLine());
1732 GetTreeID(), text_field_data_2.
id, 0 ,
1734 ASSERT_NE(
nullptr, text_position);
1735 ASSERT_TRUE(text_position->IsTextPosition());
1736 EXPECT_TRUE(text_position->AtStartOfLine());
1737 EXPECT_FALSE(text_position->AtEndOfLine());
1740 GetTreeID(), text_field_data_2.
id, 16 ,
1742 ASSERT_NE(
nullptr, text_position);
1743 ASSERT_TRUE(text_position->IsTextPosition());
1744 EXPECT_FALSE(text_position->AtStartOfLine());
1745 EXPECT_TRUE(text_position->AtEndOfLine());
1748TEST_F(AXPositionTest, AtStartOfParagraphWithTextPosition) {
1752 GetTreeID(), inline_box1_.id, 0 ,
1754 ASSERT_NE(
nullptr, text_position);
1755 ASSERT_TRUE(text_position->IsTextPosition());
1756 EXPECT_TRUE(text_position->AtStartOfParagraph());
1759 GetTreeID(), inline_box1_.id, 1 ,
1761 ASSERT_NE(
nullptr, text_position);
1762 ASSERT_TRUE(text_position->IsTextPosition());
1763 EXPECT_FALSE(text_position->AtStartOfParagraph());
1766 GetTreeID(), line_break_.id, 0 ,
1768 ASSERT_NE(
nullptr, text_position);
1769 ASSERT_TRUE(text_position->IsTextPosition());
1770 EXPECT_FALSE(text_position->AtStartOfParagraph());
1777 GetTreeID(), line_break_.id, 1 ,
1779 ASSERT_NE(
nullptr, text_position);
1780 ASSERT_TRUE(text_position->IsTextPosition());
1781 EXPECT_FALSE(text_position->AtStartOfParagraph());
1786 GetTreeID(), inline_box2_.id, 0 ,
1788 ASSERT_NE(
nullptr, text_position);
1789 ASSERT_TRUE(text_position->IsTextPosition());
1790 EXPECT_TRUE(text_position->AtStartOfParagraph());
1793 GetTreeID(), inline_box2_.id, 1 ,
1795 ASSERT_NE(
nullptr, text_position);
1796 ASSERT_TRUE(text_position->IsTextPosition());
1797 EXPECT_FALSE(text_position->AtStartOfParagraph());
1800TEST_F(AXPositionTest, AtEndOfParagraphWithTextPosition) {
1804 GetTreeID(), inline_box1_.id, 6 ,
1806 ASSERT_NE(
nullptr, text_position);
1807 ASSERT_TRUE(text_position->IsTextPosition());
1808 EXPECT_FALSE(text_position->AtEndOfParagraph());
1813 GetTreeID(), line_break_.id, 0 ,
1815 ASSERT_NE(
nullptr, text_position);
1816 ASSERT_TRUE(text_position->IsTextPosition());
1817 EXPECT_FALSE(text_position->AtEndOfParagraph());
1822 GetTreeID(), line_break_.id, 1 ,
1824 ASSERT_NE(
nullptr, text_position);
1825 ASSERT_TRUE(text_position->IsTextPosition());
1826 EXPECT_TRUE(text_position->AtEndOfParagraph());
1829 GetTreeID(), inline_box2_.id, 5 ,
1831 ASSERT_NE(
nullptr, text_position);
1832 ASSERT_TRUE(text_position->IsTextPosition());
1833 EXPECT_FALSE(text_position->AtEndOfParagraph());
1838 GetTreeID(), inline_box2_.id, 6 ,
1840 ASSERT_NE(
nullptr, text_position);
1841 ASSERT_TRUE(text_position->IsTextPosition());
1842 EXPECT_TRUE(text_position->AtEndOfParagraph());
1845TEST_F(AXPositionTest, ParagraphEdgesWithPreservedNewLine) {
1867 static_text_data_1.
id = 2;
1869 static_text_data_1.
SetName(
"some text");
1872 some_text_data.
id = 3;
1874 some_text_data.
SetName(
"some text");
1877 container_data.
id = 4;
1883 static_text_data_2.
id = 5;
1885 static_text_data_2.
SetName(
"\nmore text");
1888 preserved_newline_data.
id = 6;
1890 preserved_newline_data.
SetName(
"\n");
1895 more_text_data.
id = 7;
1897 more_text_data.
SetName(
"more text");
1899 static_text_data_1.
child_ids = {some_text_data.
id};
1900 container_data.
child_ids = {static_text_data_2.
id};
1901 static_text_data_2.
child_ids = {preserved_newline_data.
id, more_text_data.
id};
1902 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
1904 SetTree(CreateAXTree({root_data, static_text_data_1, some_text_data,
1905 container_data, static_text_data_2,
1906 preserved_newline_data, more_text_data}));
1910 GetTreeID(), root_data.
id, 8 ,
1912 EXPECT_FALSE(text_position1->AtEndOfParagraph());
1913 EXPECT_FALSE(text_position1->AtStartOfParagraph());
1917 GetTreeID(), root_data.
id, 9 ,
1919 EXPECT_FALSE(text_position2->AtEndOfParagraph());
1920 EXPECT_FALSE(text_position2->AtStartOfParagraph());
1924 GetTreeID(), root_data.
id, 9 ,
1926 EXPECT_FALSE(text_position3->AtEndOfParagraph());
1927 EXPECT_FALSE(text_position3->AtStartOfParagraph());
1931 GetTreeID(), root_data.
id, 10 ,
1933 EXPECT_FALSE(text_position4->AtEndOfParagraph());
1934 EXPECT_TRUE(text_position4->AtStartOfParagraph());
1938 GetTreeID(), root_data.
id, 10 ,
1940 EXPECT_TRUE(text_position5->AtEndOfParagraph());
1941 EXPECT_FALSE(text_position5->AtStartOfParagraph());
1945 GetTreeID(), container_data.
id, 0 ,
1947 EXPECT_FALSE(text_position6->AtEndOfParagraph());
1948 EXPECT_FALSE(text_position6->AtStartOfParagraph());
1952 GetTreeID(), container_data.
id, 1 ,
1954 EXPECT_FALSE(text_position7->AtEndOfParagraph());
1955 EXPECT_TRUE(text_position7->AtStartOfParagraph());
1959 GetTreeID(), container_data.
id, 1 ,
1961 EXPECT_TRUE(text_position8->AtEndOfParagraph());
1962 EXPECT_FALSE(text_position8->AtStartOfParagraph());
1966 GetTreeID(), static_text_data_2.
id, 1 ,
1968 EXPECT_FALSE(text_position9->AtEndOfParagraph());
1969 EXPECT_TRUE(text_position9->AtStartOfParagraph());
1973 GetTreeID(), static_text_data_2.
id, 1 ,
1975 EXPECT_TRUE(text_position10->AtEndOfParagraph());
1976 EXPECT_FALSE(text_position10->AtStartOfParagraph());
1979 GetTreeID(), preserved_newline_data.
id, 0 ,
1981 EXPECT_FALSE(text_position11->AtEndOfParagraph());
1982 EXPECT_FALSE(text_position11->AtStartOfParagraph());
1985 GetTreeID(), preserved_newline_data.
id, 1 ,
1987 EXPECT_TRUE(text_position12->AtEndOfParagraph());
1988 EXPECT_FALSE(text_position12->AtStartOfParagraph());
1991 GetTreeID(), more_text_data.
id, 0 ,
1993 EXPECT_FALSE(text_position13->AtEndOfParagraph());
1994 EXPECT_TRUE(text_position13->AtStartOfParagraph());
1997 GetTreeID(), more_text_data.
id, 1 ,
1999 EXPECT_FALSE(text_position14->AtEndOfParagraph());
2000 EXPECT_FALSE(text_position14->AtStartOfParagraph());
2005 PreviousParagraphEndStopAtAnchorBoundaryWithConsecutiveParentChildLineBreakingObjects) {
2019 static_text_data_a.
id = 2;
2021 static_text_data_a.
SetName(
"first");
2024 container_data_a.
id = 3;
2030 container_data_b.
id = 4;
2036 static_text_data_b.
id = 5;
2038 static_text_data_b.
SetName(
"second");
2040 root_data.
child_ids = {static_text_data_a.
id, container_data_a.
id};
2041 container_data_a.
child_ids = {container_data_b.
id, static_text_data_b.
id};
2043 SetTree(CreateAXTree({root_data, static_text_data_a, container_data_a,
2044 container_data_b, static_text_data_b}));
2047 GetTreeID(), root_data.
id, 11 ,
2050 test_position = test_position->CreatePreviousParagraphEndPosition(
2052 EXPECT_TRUE(test_position->IsTextPosition());
2053 EXPECT_EQ(root_data.
id, test_position->anchor_id());
2054 EXPECT_EQ(5, test_position->text_offset());
2057TEST_F(AXPositionTest, AtStartOrEndOfParagraphOnAListMarker) {
2100 static_text1.
id = 2;
2104 list_marker_legacy.
id = 6;
2105 static_text2.
id = 7;
2107 static_text3.
id = 9;
2108 inline_box3.
id = 10;
2110 list_marker_ng.
id = 12;
2111 static_text4.
id = 13;
2112 inline_box4.
id = 14;
2113 static_text5.
id = 15;
2114 inline_box5.
id = 16;
2122 static_text1.
SetName(
"Before list.");
2125 inline_box1.
SetName(
"Before list.");
2131 list_item1.
child_ids = {list_marker_legacy.
id, static_text3.
id};
2149 static_text3.
SetName(
"First item.");
2152 inline_box3.
SetName(
"First item.");
2157 list_item2.
child_ids = {list_marker_ng.
id, static_text4.
id};
2162 list_marker_ng.
SetName(
"2. ");
2168 static_text4.
SetName(
"Second item.");
2171 inline_box4.
SetName(
"Second item.");
2177 static_text5.
SetName(
"After list.");
2180 inline_box5.
SetName(
"After list.");
2182 SetTree(CreateAXTree({root, static_text1, inline_box1, list, list_item1,
2183 list_marker_legacy, static_text2, inline_box2,
2184 static_text3, inline_box3, list_item2, list_marker_ng,
2185 static_text4, inline_box4, static_text5, inline_box5}));
2191 GetTreeID(), static_text1.
id, 12 ,
2193 ASSERT_NE(
nullptr, text_position);
2194 EXPECT_FALSE(text_position->AtStartOfParagraph());
2195 EXPECT_TRUE(text_position->AtEndOfParagraph());
2201 GetTreeID(), inline_box1.
id, 12 ,
2203 ASSERT_NE(
nullptr, text_position);
2204 EXPECT_FALSE(text_position->AtStartOfParagraph());
2205 EXPECT_TRUE(text_position->AtEndOfParagraph());
2209 GetTreeID(), list.
id, 0 ,
2211 ASSERT_NE(
nullptr, text_position);
2212 EXPECT_TRUE(text_position->AtStartOfParagraph());
2213 EXPECT_FALSE(text_position->AtEndOfParagraph());
2219 GetTreeID(), list.
id, 14 ,
2221 ASSERT_NE(
nullptr, text_position);
2222 EXPECT_TRUE(text_position->AtStartOfParagraph());
2223 EXPECT_FALSE(text_position->AtEndOfParagraph());
2227 GetTreeID(), list.
id, 14 ,
2229 ASSERT_NE(
nullptr, text_position);
2230 EXPECT_FALSE(text_position->AtStartOfParagraph());
2231 EXPECT_TRUE(text_position->AtEndOfParagraph());
2235 GetTreeID(), list_marker_legacy.
id, 0 ,
2237 ASSERT_NE(
nullptr, text_position);
2238 EXPECT_TRUE(text_position->AtStartOfParagraph());
2239 EXPECT_FALSE(text_position->AtEndOfParagraph());
2242 GetTreeID(), list_marker_legacy.
id, 1 ,
2244 ASSERT_NE(
nullptr, text_position);
2245 EXPECT_FALSE(text_position->AtStartOfParagraph());
2246 EXPECT_FALSE(text_position->AtEndOfParagraph());
2250 GetTreeID(), static_text2.
id, 0 ,
2252 ASSERT_NE(
nullptr, text_position);
2253 EXPECT_TRUE(text_position->AtStartOfParagraph());
2254 EXPECT_FALSE(text_position->AtEndOfParagraph());
2257 GetTreeID(), static_text2.
id, 2 ,
2259 ASSERT_NE(
nullptr, text_position);
2260 EXPECT_FALSE(text_position->AtStartOfParagraph());
2261 EXPECT_FALSE(text_position->AtEndOfParagraph());
2265 GetTreeID(), inline_box2.
id, 0 ,
2267 ASSERT_NE(
nullptr, text_position);
2268 EXPECT_TRUE(text_position->AtStartOfParagraph());
2269 EXPECT_FALSE(text_position->AtEndOfParagraph());
2272 GetTreeID(), inline_box2.
id, 3 ,
2274 ASSERT_NE(
nullptr, text_position);
2275 EXPECT_FALSE(text_position->AtStartOfParagraph());
2276 EXPECT_FALSE(text_position->AtEndOfParagraph());
2280 GetTreeID(), list_marker_ng.
id, 0 ,
2282 ASSERT_NE(
nullptr, text_position);
2283 EXPECT_TRUE(text_position->AtStartOfParagraph());
2284 EXPECT_FALSE(text_position->AtEndOfParagraph());
2287 GetTreeID(), list_marker_ng.
id, 3 ,
2289 ASSERT_NE(
nullptr, text_position);
2290 EXPECT_FALSE(text_position->AtStartOfParagraph());
2291 EXPECT_FALSE(text_position->AtEndOfParagraph());
2296 GetTreeID(), static_text3.
id, 0 ,
2298 ASSERT_NE(
nullptr, text_position);
2299 EXPECT_FALSE(text_position->AtStartOfParagraph());
2300 EXPECT_FALSE(text_position->AtEndOfParagraph());
2305 GetTreeID(), inline_box3.
id, 0 ,
2307 ASSERT_NE(
nullptr, text_position);
2308 EXPECT_FALSE(text_position->AtStartOfParagraph());
2309 EXPECT_FALSE(text_position->AtEndOfParagraph());
2313 GetTreeID(), static_text3.
id, 11 ,
2315 ASSERT_NE(
nullptr, text_position);
2316 EXPECT_FALSE(text_position->AtStartOfParagraph());
2317 EXPECT_TRUE(text_position->AtEndOfParagraph());
2321 GetTreeID(), inline_box3.
id, 11 ,
2323 ASSERT_NE(
nullptr, text_position);
2324 EXPECT_FALSE(text_position->AtStartOfParagraph());
2325 EXPECT_TRUE(text_position->AtEndOfParagraph());
2330 GetTreeID(), static_text4.
id, 0 ,
2332 ASSERT_NE(
nullptr, text_position);
2333 EXPECT_FALSE(text_position->AtStartOfParagraph());
2334 EXPECT_FALSE(text_position->AtEndOfParagraph());
2339 GetTreeID(), inline_box4.
id, 0 ,
2341 ASSERT_NE(
nullptr, text_position);
2342 EXPECT_FALSE(text_position->AtStartOfParagraph());
2343 EXPECT_FALSE(text_position->AtEndOfParagraph());
2347 GetTreeID(), static_text4.
id, 12 ,
2349 ASSERT_NE(
nullptr, text_position);
2350 EXPECT_FALSE(text_position->AtStartOfParagraph());
2351 EXPECT_TRUE(text_position->AtEndOfParagraph());
2355 GetTreeID(), inline_box4.
id, 12 ,
2357 ASSERT_NE(
nullptr, text_position);
2358 EXPECT_FALSE(text_position->AtStartOfParagraph());
2359 EXPECT_TRUE(text_position->AtEndOfParagraph());
2363 GetTreeID(), inline_box5.
id, 0 ,
2365 ASSERT_NE(
nullptr, text_position);
2366 EXPECT_TRUE(text_position->AtStartOfParagraph());
2367 EXPECT_FALSE(text_position->AtEndOfParagraph());
2371 AtStartOrEndOfParagraphWithLeadingAndTrailingDocumentWhitespace) {
2398 container_data_a.
id = 2;
2404 static_text_data_a.
id = 3;
2406 static_text_data_a.
SetName(
"\n");
2409 inline_text_data_a.
id = 4;
2411 inline_text_data_a.
SetName(
"\n");
2416 container_data_b.
id = 5;
2422 static_text_data_b.
id = 6;
2424 static_text_data_b.
SetName(
"some text");
2427 inline_text_data_b_1.
id = 7;
2429 inline_text_data_b_1.
SetName(
"some");
2432 inline_text_data_b_2.
id = 8;
2434 inline_text_data_b_2.
SetName(
" ");
2437 inline_text_data_b_3.
id = 9;
2439 inline_text_data_b_3.
SetName(
"text");
2442 container_data_c.
id = 10;
2448 static_text_data_c.
id = 11;
2450 static_text_data_c.
SetName(
"\n");
2453 inline_text_data_c.
id = 12;
2455 inline_text_data_c.
SetName(
"\n");
2459 root_data.
child_ids = {container_data_a.
id, container_data_b.
id,
2460 container_data_c.
id};
2461 container_data_a.
child_ids = {static_text_data_a.
id};
2462 static_text_data_a.
child_ids = {inline_text_data_a.
id};
2463 container_data_b.
child_ids = {static_text_data_b.
id};
2464 static_text_data_b.
child_ids = {inline_text_data_b_1.
id,
2465 inline_text_data_b_2.
id,
2466 inline_text_data_b_3.
id};
2467 container_data_c.
child_ids = {static_text_data_c.
id};
2468 static_text_data_c.
child_ids = {inline_text_data_c.
id};
2470 SetTree(CreateAXTree(
2471 {root_data, container_data_a, container_data_b, container_data_c,
2472 static_text_data_a, static_text_data_b, static_text_data_c,
2473 inline_text_data_a, inline_text_data_b_1, inline_text_data_b_2,
2474 inline_text_data_b_3, inline_text_data_c}));
2478 GetTreeID(), inline_text_data_a.
id, 0 ,
2480 EXPECT_FALSE(text_position1->AtEndOfParagraph());
2481 EXPECT_TRUE(text_position1->AtStartOfParagraph());
2489 GetTreeID(), inline_text_data_a.
id, 1 ,
2491 EXPECT_TRUE(text_position2->AtEndOfParagraph());
2492 EXPECT_FALSE(text_position2->AtStartOfParagraph());
2496 GetTreeID(), inline_text_data_b_1.
id, 0 ,
2498 EXPECT_FALSE(text_position3->AtEndOfParagraph());
2499 EXPECT_TRUE(text_position3->AtStartOfParagraph());
2503 GetTreeID(), inline_text_data_b_1.
id, 4 ,
2505 EXPECT_FALSE(text_position4->AtEndOfParagraph());
2506 EXPECT_FALSE(text_position4->AtStartOfParagraph());
2510 GetTreeID(), inline_text_data_b_2.
id, 0 ,
2512 EXPECT_FALSE(text_position5->AtEndOfParagraph());
2513 EXPECT_FALSE(text_position5->AtStartOfParagraph());
2517 GetTreeID(), inline_text_data_b_2.
id, 1 ,
2519 EXPECT_FALSE(text_position6->AtEndOfParagraph());
2520 EXPECT_FALSE(text_position6->AtStartOfParagraph());
2524 GetTreeID(), inline_text_data_b_3.
id, 0 ,
2526 EXPECT_FALSE(text_position7->AtEndOfParagraph());
2527 EXPECT_FALSE(text_position7->AtStartOfParagraph());
2531 GetTreeID(), inline_text_data_b_3.
id, 4 ,
2533 EXPECT_FALSE(text_position8->AtEndOfParagraph());
2534 EXPECT_FALSE(text_position8->AtStartOfParagraph());
2538 GetTreeID(), inline_text_data_c.
id, 0 ,
2540 EXPECT_FALSE(text_position9->AtEndOfParagraph());
2541 EXPECT_FALSE(text_position9->AtStartOfParagraph());
2545 GetTreeID(), inline_text_data_c.
id, 1 ,
2547 EXPECT_TRUE(text_position10->AtEndOfParagraph());
2548 EXPECT_FALSE(text_position10->AtStartOfParagraph());
2551TEST_F(AXPositionTest, AtStartOrEndOfParagraphWithIgnoredNodes) {
2578 container_data_a.
id = 2;
2585 static_text_data_a.
id = 3;
2587 static_text_data_a.
SetName(
"ignored text");
2591 inline_text_data_a.
id = 4;
2593 inline_text_data_a.
SetName(
"ignored text");
2597 container_data_b.
id = 5;
2603 static_text_data_b.
id = 6;
2605 static_text_data_b.
SetName(
"some text");
2608 inline_text_data_b_1.
id = 7;
2610 inline_text_data_b_1.
SetName(
"some");
2613 inline_text_data_b_2.
id = 8;
2615 inline_text_data_b_2.
SetName(
" ");
2618 inline_text_data_b_3.
id = 9;
2620 inline_text_data_b_3.
SetName(
"text");
2623 container_data_c.
id = 10;
2630 static_text_data_c.
id = 11;
2632 static_text_data_c.
SetName(
"ignored text");
2636 inline_text_data_c.
id = 12;
2638 inline_text_data_c.
SetName(
"ignored text");
2641 root_data.
child_ids = {container_data_a.
id, container_data_b.
id,
2642 container_data_c.
id};
2643 container_data_a.
child_ids = {static_text_data_a.
id};
2644 static_text_data_a.
child_ids = {inline_text_data_a.
id};
2645 container_data_b.
child_ids = {static_text_data_b.
id};
2646 static_text_data_b.
child_ids = {inline_text_data_b_1.
id,
2647 inline_text_data_b_2.
id,
2648 inline_text_data_b_3.
id};
2649 container_data_c.
child_ids = {static_text_data_c.
id};
2650 static_text_data_c.
child_ids = {inline_text_data_c.
id};
2652 SetTree(CreateAXTree(
2653 {root_data, container_data_a, container_data_b, container_data_c,
2654 static_text_data_a, static_text_data_b, static_text_data_c,
2655 inline_text_data_a, inline_text_data_b_1, inline_text_data_b_2,
2656 inline_text_data_b_3, inline_text_data_c}));
2660 GetTreeID(), inline_text_data_a.
id, 0 ,
2662 EXPECT_FALSE(text_position1->AtEndOfParagraph());
2663 EXPECT_FALSE(text_position1->AtStartOfParagraph());
2672 GetTreeID(), inline_text_data_a.
id, 12 ,
2674 EXPECT_FALSE(text_position2->AtEndOfParagraph());
2675 EXPECT_FALSE(text_position2->AtStartOfParagraph());
2679 GetTreeID(), inline_text_data_b_1.
id, 0 ,
2681 EXPECT_FALSE(text_position3->AtEndOfParagraph());
2682 EXPECT_TRUE(text_position3->AtStartOfParagraph());
2686 GetTreeID(), inline_text_data_b_1.
id, 4 ,
2688 EXPECT_FALSE(text_position4->AtEndOfParagraph());
2689 EXPECT_FALSE(text_position4->AtStartOfParagraph());
2693 GetTreeID(), inline_text_data_b_2.
id, 0 ,
2695 EXPECT_FALSE(text_position5->AtEndOfParagraph());
2696 EXPECT_FALSE(text_position5->AtStartOfParagraph());
2700 GetTreeID(), inline_text_data_b_2.
id, 1 ,
2702 EXPECT_FALSE(text_position6->AtEndOfParagraph());
2703 EXPECT_FALSE(text_position6->AtStartOfParagraph());
2707 GetTreeID(), inline_text_data_b_3.
id, 0 ,
2709 EXPECT_FALSE(text_position7->AtEndOfParagraph());
2710 EXPECT_FALSE(text_position7->AtStartOfParagraph());
2714 GetTreeID(), inline_text_data_b_3.
id, 4 ,
2716 EXPECT_TRUE(text_position8->AtEndOfParagraph());
2717 EXPECT_FALSE(text_position8->AtStartOfParagraph());
2721 GetTreeID(), inline_text_data_c.
id, 0 ,
2723 EXPECT_FALSE(text_position9->AtEndOfParagraph());
2724 EXPECT_FALSE(text_position9->AtStartOfParagraph());
2728 GetTreeID(), inline_text_data_c.
id, 12 ,
2730 EXPECT_FALSE(text_position10->AtEndOfParagraph());
2731 EXPECT_FALSE(text_position10->AtStartOfParagraph());
2734TEST_F(AXPositionTest, AtStartOrEndOfParagraphWithEmbeddedObjectCharacter) {
2761 static_text_3.
id = 3;
2762 inline_box_4.
id = 4;
2764 static_text_6.
id = 6;
2765 inline_box_7.
id = 7;
2777 static_text_3.
SetName(
"Hello");
2780 inline_box_4.
SetName(
"Hello");
2787 static_text_6.
SetName(
"world");
2790 inline_box_7.
SetName(
"world");
2792 SetTree(CreateAXTree({root_1, link_2, static_text_3, inline_box_4, image_5,
2793 static_text_6, inline_box_7}));
2797 GetTreeID(), inline_box_4.
id, 0 ,
2799 EXPECT_FALSE(text_position->AtEndOfParagraph());
2800 EXPECT_TRUE(text_position->AtStartOfParagraph());
2809 GetTreeID(), inline_box_4.
id, 5 ,
2811 EXPECT_TRUE(text_position->AtEndOfParagraph());
2812 EXPECT_FALSE(text_position->AtStartOfParagraph());
2816 GetTreeID(), image_5.
id, 0 ,
2818 EXPECT_FALSE(text_position->AtEndOfParagraph());
2819 EXPECT_TRUE(text_position->AtStartOfParagraph());
2823 GetTreeID(), image_5.
id, 1 ,
2825 EXPECT_TRUE(text_position->AtEndOfParagraph());
2826 EXPECT_FALSE(text_position->AtStartOfParagraph());
2830 GetTreeID(), inline_box_7.
id, 0 ,
2832 EXPECT_FALSE(text_position->AtEndOfParagraph());
2833 EXPECT_TRUE(text_position->AtStartOfParagraph());
2837 GetTreeID(), inline_box_7.
id, 5 ,
2839 EXPECT_TRUE(text_position->AtEndOfParagraph());
2840 EXPECT_FALSE(text_position->AtStartOfParagraph());
2843TEST_F(AXPositionTest, LowestCommonAncestor) {
2845 ASSERT_NE(
nullptr, null_position);
2848 GetTreeID(), root_.id, 3 );
2849 ASSERT_NE(
nullptr, root_position);
2853 ASSERT_NE(
nullptr, button_position);
2855 GetTreeID(), text_field_.id, 2 );
2856 ASSERT_NE(
nullptr, text_field_position);
2858 GetTreeID(), static_text1_.id, 0 );
2859 ASSERT_NE(
nullptr, static_text1_position);
2861 GetTreeID(), static_text2_.id, 0 );
2862 ASSERT_NE(
nullptr, static_text2_position);
2864 GetTreeID(), inline_box1_.id, 0 ,
2866 ASSERT_NE(
nullptr, inline_box1_position);
2867 ASSERT_TRUE(inline_box1_position->IsTextPosition());
2869 GetTreeID(), inline_box2_.id, 0 ,
2871 ASSERT_NE(
nullptr, inline_box2_position);
2872 ASSERT_TRUE(inline_box2_position->IsTextPosition());
2875 root_position->LowestCommonAncestor(*null_position.get());
2876 EXPECT_NE(
nullptr, test_position);
2877 EXPECT_TRUE(test_position->IsNullPosition());
2879 test_position = root_position->LowestCommonAncestor(*root_position.get());
2880 EXPECT_NE(
nullptr, test_position);
2881 EXPECT_TRUE(test_position->IsTreePosition());
2882 EXPECT_EQ(root_.id, test_position->anchor_id());
2885 EXPECT_EQ(3, test_position->child_index());
2888 button_position->LowestCommonAncestor(*text_field_position.get());
2889 EXPECT_NE(
nullptr, test_position);
2890 EXPECT_TRUE(test_position->IsTreePosition());
2891 EXPECT_EQ(root_.id, test_position->anchor_id());
2893 EXPECT_EQ(0, test_position->child_index());
2896 static_text2_position->LowestCommonAncestor(*static_text1_position.get());
2897 EXPECT_NE(
nullptr, test_position);
2898 EXPECT_TRUE(test_position->IsTreePosition());
2899 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2901 EXPECT_EQ(2, test_position->child_index());
2904 static_text1_position->LowestCommonAncestor(*text_field_position.get());
2905 EXPECT_NE(
nullptr, test_position);
2906 EXPECT_TRUE(test_position->IsTreePosition());
2907 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2909 EXPECT_EQ(0, test_position->child_index());
2912 inline_box1_position->LowestCommonAncestor(*inline_box2_position.get());
2913 EXPECT_NE(
nullptr, test_position);
2914 EXPECT_TRUE(test_position->IsTextPosition());
2915 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2916 EXPECT_EQ(0, test_position->text_offset());
2919 inline_box2_position->LowestCommonAncestor(*inline_box1_position.get());
2920 EXPECT_NE(
nullptr, test_position);
2921 EXPECT_TRUE(test_position->IsTextPosition());
2922 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2924 EXPECT_EQ(7, test_position->text_offset());
2927TEST_F(AXPositionTest, AsTreePositionWithNullPosition) {
2929 ASSERT_NE(
nullptr, null_position);
2931 ASSERT_NE(
nullptr, test_position);
2932 EXPECT_TRUE(test_position->IsNullPosition());
2935TEST_F(AXPositionTest, AsTreePositionWithTreePosition) {
2937 GetTreeID(), root_.id, 1 );
2938 ASSERT_NE(
nullptr, tree_position);
2940 ASSERT_NE(
nullptr, test_position);
2941 EXPECT_TRUE(test_position->IsTreePosition());
2942 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2943 EXPECT_EQ(root_.id, test_position->anchor_id());
2944 EXPECT_EQ(1, test_position->child_index());
2948TEST_F(AXPositionTest, AsTreePositionWithTextPosition) {
2951 GetTreeID(), text_field_.id, 12 ,
2953 ASSERT_NE(
nullptr, text_position);
2954 ASSERT_TRUE(text_position->IsTextPosition());
2956 ASSERT_NE(
nullptr, test_position);
2957 EXPECT_TRUE(test_position->IsTreePosition());
2958 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2959 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2962 EXPECT_EQ(2, test_position->child_index());
2964 EXPECT_EQ(12, test_position->text_offset());
2968 GetTreeID(), inline_box2_.id, 0 ,
2970 ASSERT_NE(
nullptr, text_position);
2971 ASSERT_TRUE(text_position->IsTextPosition());
2972 test_position = text_position->AsTreePosition();
2973 ASSERT_NE(
nullptr, test_position);
2974 EXPECT_TRUE(test_position->IsTreePosition());
2975 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2976 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
2978 EXPECT_EQ(0, test_position->text_offset());
2982 GetTreeID(), inline_box2_.id, 6 ,
2984 ASSERT_NE(
nullptr, text_position);
2985 ASSERT_TRUE(text_position->IsTextPosition());
2986 test_position = text_position->AsTreePosition();
2987 ASSERT_NE(
nullptr, test_position);
2988 EXPECT_TRUE(test_position->IsTreePosition());
2989 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2990 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
2991 EXPECT_EQ(0, test_position->child_index());
2992 EXPECT_EQ(6, test_position->text_offset());
2995TEST_F(AXPositionTest, AsTextPositionWithNullPosition) {
2997 ASSERT_NE(
nullptr, null_position);
2999 ASSERT_NE(
nullptr, test_position);
3000 EXPECT_TRUE(test_position->IsNullPosition());
3003TEST_F(AXPositionTest, AsTextPositionWithTreePosition) {
3007 GetTreeID(), text_field_.id, 1 );
3008 ASSERT_NE(
nullptr, tree_position);
3010 ASSERT_NE(
nullptr, test_position);
3011 EXPECT_TRUE(test_position->IsTextPosition());
3012 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3013 EXPECT_EQ(text_field_.id, test_position->anchor_id());
3016 EXPECT_EQ(6, test_position->text_offset());
3018 EXPECT_EQ(1, test_position->child_index());
3027 ASSERT_NE(
nullptr, tree_position);
3028 test_position = tree_position->AsTextPosition();
3029 ASSERT_NE(
nullptr, test_position);
3030 EXPECT_TRUE(test_position->IsTextPosition());
3031 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3032 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3033 EXPECT_EQ(0, test_position->text_offset());
3039 GetTreeID(), inline_box1_.id, 0 );
3040 ASSERT_NE(
nullptr, tree_position);
3041 test_position = tree_position->AsTextPosition();
3042 ASSERT_NE(
nullptr, test_position);
3043 EXPECT_TRUE(test_position->IsTextPosition());
3044 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3045 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3046 EXPECT_EQ(6, test_position->text_offset());
3047 EXPECT_EQ(0, test_position->child_index());
3051TEST_F(AXPositionTest, AsTextPositionWithTextPosition) {
3053 GetTreeID(), text_field_.id, 0 ,
3055 ASSERT_NE(
nullptr, text_position);
3056 ASSERT_TRUE(text_position->IsTextPosition());
3058 ASSERT_NE(
nullptr, test_position);
3059 EXPECT_TRUE(test_position->IsTextPosition());
3060 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3061 EXPECT_EQ(text_field_.id, test_position->anchor_id());
3062 EXPECT_EQ(0, test_position->text_offset());
3067TEST_F(AXPositionTest, AsLeafTreePositionWithNullPosition) {
3069 ASSERT_NE(
nullptr, null_position);
3071 ASSERT_NE(
nullptr, test_position);
3072 EXPECT_TRUE(test_position->IsNullPosition());
3075TEST_F(AXPositionTest, AsLeafTreePositionWithTreePosition) {
3079 GetTreeID(), text_field_.id, 0 );
3080 ASSERT_NE(
nullptr, tree_position);
3082 ASSERT_NE(
nullptr, test_position);
3083 EXPECT_TRUE(test_position->IsLeafTreePosition());
3084 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3085 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3091 GetTreeID(), text_field_.id, 1 );
3092 ASSERT_NE(
nullptr, tree_position);
3093 test_position = tree_position->AsLeafTreePosition();
3094 ASSERT_NE(
nullptr, test_position);
3095 EXPECT_TRUE(test_position->IsLeafTreePosition());
3096 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3097 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3103 GetTreeID(), text_field_.id, 2 );
3104 ASSERT_NE(
nullptr, tree_position);
3105 test_position = tree_position->AsLeafTreePosition();
3106 ASSERT_NE(
nullptr, test_position);
3107 EXPECT_TRUE(test_position->IsLeafTreePosition());
3108 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3109 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3113TEST_F(AXPositionTest, AsLeafTreePositionWithTextPosition) {
3117 GetTreeID(), root_.id, 13 ,
3119 ASSERT_NE(
nullptr, text_position);
3120 ASSERT_TRUE(text_position->IsTextPosition());
3122 ASSERT_NE(
nullptr, test_position);
3123 EXPECT_TRUE(test_position->IsLeafTreePosition());
3124 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3125 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3126 EXPECT_EQ(0, test_position->child_index());
3129 GetTreeID(), root_.id, 0 ,
3131 ASSERT_NE(
nullptr, text_position);
3132 ASSERT_TRUE(text_position->IsTextPosition());
3133 test_position = text_position->AsLeafTreePosition();
3134 ASSERT_NE(
nullptr, test_position);
3135 EXPECT_TRUE(test_position->IsLeafTreePosition());
3136 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3137 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3141 GetTreeID(), text_field_.id, 0 ,
3143 ASSERT_NE(
nullptr, text_position);
3144 ASSERT_TRUE(text_position->IsTextPosition());
3145 test_position = text_position->AsLeafTreePosition();
3146 ASSERT_NE(
nullptr, test_position);
3147 EXPECT_TRUE(test_position->IsLeafTreePosition());
3148 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3149 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3153 GetTreeID(), text_field_.id, 0 ,
3155 ASSERT_NE(
nullptr, text_position);
3156 ASSERT_TRUE(text_position->IsTextPosition());
3157 test_position = text_position->AsLeafTreePosition();
3158 ASSERT_NE(
nullptr, test_position);
3159 EXPECT_TRUE(test_position->IsLeafTreePosition());
3160 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3161 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3169 GetTreeID(), root_.id, 6 ,
3171 ASSERT_NE(
nullptr, text_position);
3172 ASSERT_TRUE(text_position->IsTextPosition());
3173 test_position = text_position->AsLeafTreePosition();
3174 ASSERT_NE(
nullptr, test_position);
3175 EXPECT_TRUE(test_position->IsLeafTreePosition());
3176 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3177 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3178 EXPECT_EQ(0, test_position->child_index());
3184 GetTreeID(), text_field_.id, 6 ,
3186 ASSERT_NE(
nullptr, text_position);
3187 test_position = text_position->AsLeafTreePosition();
3188 ASSERT_NE(
nullptr, test_position);
3189 EXPECT_TRUE(test_position->IsLeafTreePosition());
3190 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3191 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3192 EXPECT_EQ(0, test_position->child_index());
3197 GetTreeID(), root_.id, 6 ,
3199 ASSERT_NE(
nullptr, text_position);
3200 test_position = text_position->AsLeafTreePosition();
3201 ASSERT_NE(
nullptr, test_position);
3202 EXPECT_TRUE(test_position->IsLeafTreePosition());
3203 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3204 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3210 GetTreeID(), text_field_.id, 6 ,
3212 ASSERT_NE(
nullptr, text_position);
3213 test_position = text_position->AsLeafTreePosition();
3214 ASSERT_NE(
nullptr, test_position);
3215 EXPECT_TRUE(test_position->IsLeafTreePosition());
3216 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3217 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3223 GetTreeID(), text_field_.id, 13 ,
3225 ASSERT_NE(
nullptr, text_position);
3226 test_position = text_position->AsLeafTreePosition();
3227 ASSERT_NE(
nullptr, test_position);
3228 EXPECT_TRUE(test_position->IsLeafTreePosition());
3229 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3230 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3231 EXPECT_EQ(0, test_position->child_index());
3236 GetTreeID(), root_.id, 10 ,
3238 ASSERT_NE(
nullptr, text_position);
3239 test_position = text_position->AsLeafTreePosition();
3240 ASSERT_NE(
nullptr, test_position);
3241 EXPECT_TRUE(test_position->IsLeafTreePosition());
3242 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3243 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3247TEST_F(AXPositionTest, AsLeafTextPositionWithNullPosition) {
3249 ASSERT_NE(
nullptr, null_position);
3251 ASSERT_NE(
nullptr, test_position);
3252 EXPECT_TRUE(test_position->IsNullPosition());
3255TEST_F(AXPositionTest, AsLeafTextPositionWithTreePosition) {
3259 GetTreeID(), text_field_.id, 0 );
3260 ASSERT_NE(
nullptr, tree_position);
3262 ASSERT_NE(
nullptr, test_position);
3263 EXPECT_TRUE(test_position->IsLeafTextPosition());
3264 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3265 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3266 EXPECT_EQ(0, test_position->text_offset());
3272 GetTreeID(), text_field_.id, 1 );
3273 ASSERT_NE(
nullptr, tree_position);
3274 test_position = tree_position->AsLeafTextPosition();
3275 ASSERT_NE(
nullptr, test_position);
3276 EXPECT_TRUE(test_position->IsLeafTextPosition());
3277 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3278 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3279 EXPECT_EQ(0, test_position->text_offset());
3285 GetTreeID(), text_field_.id, 2 );
3286 ASSERT_NE(
nullptr, tree_position);
3287 test_position = tree_position->AsLeafTextPosition();
3288 ASSERT_NE(
nullptr, test_position);
3289 EXPECT_TRUE(test_position->IsLeafTextPosition());
3290 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3291 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3292 EXPECT_EQ(0, test_position->text_offset());
3296TEST_F(AXPositionTest, AsLeafTextPositionWithTextPosition) {
3300 GetTreeID(), root_.id, 13 ,
3302 ASSERT_NE(
nullptr, text_position);
3303 ASSERT_TRUE(text_position->IsTextPosition());
3304 ASSERT_FALSE(text_position->IsLeafTextPosition());
3306 ASSERT_NE(
nullptr, test_position);
3307 EXPECT_TRUE(test_position->IsLeafTextPosition());
3308 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3309 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3310 EXPECT_EQ(6, test_position->text_offset());
3314 GetTreeID(), root_.id, 0 ,
3316 ASSERT_NE(
nullptr, text_position);
3317 test_position = text_position->AsLeafTextPosition();
3318 ASSERT_NE(
nullptr, test_position);
3319 EXPECT_TRUE(test_position->IsTextPosition());
3320 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3321 EXPECT_EQ(button_.id, test_position->anchor_id());
3322 EXPECT_EQ(0, test_position->text_offset());
3326 GetTreeID(), text_field_.id, 0 ,
3328 ASSERT_NE(
nullptr, text_position);
3329 test_position = text_position->AsLeafTextPosition();
3330 ASSERT_NE(
nullptr, test_position);
3331 EXPECT_TRUE(test_position->IsLeafTextPosition());
3332 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3333 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3334 EXPECT_EQ(0, test_position->text_offset());
3338 GetTreeID(), text_field_.id, 0 ,
3340 ASSERT_NE(
nullptr, text_position);
3341 test_position = text_position->AsLeafTextPosition();
3342 ASSERT_NE(
nullptr, test_position);
3343 EXPECT_TRUE(test_position->IsLeafTextPosition());
3344 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3345 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3346 EXPECT_EQ(0, test_position->text_offset());
3354 GetTreeID(), root_.id, 6 ,
3356 ASSERT_NE(
nullptr, text_position);
3357 test_position = text_position->AsLeafTextPosition();
3358 ASSERT_NE(
nullptr, test_position);
3359 EXPECT_TRUE(test_position->IsLeafTextPosition());
3360 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3361 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3362 EXPECT_EQ(6, test_position->text_offset());
3369 GetTreeID(), text_field_.id, 6 ,
3371 ASSERT_NE(
nullptr, text_position);
3372 test_position = text_position->AsLeafTextPosition();
3373 ASSERT_NE(
nullptr, test_position);
3374 EXPECT_TRUE(test_position->IsLeafTextPosition());
3375 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3376 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3377 EXPECT_EQ(6, test_position->text_offset());
3383 GetTreeID(), root_.id, 6 ,
3385 ASSERT_NE(
nullptr, text_position);
3386 test_position = text_position->AsLeafTextPosition();
3387 ASSERT_NE(
nullptr, test_position);
3388 EXPECT_TRUE(test_position->IsLeafTextPosition());
3389 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3390 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3391 EXPECT_EQ(0, test_position->text_offset());
3397 GetTreeID(), text_field_.id, 6 ,
3399 ASSERT_NE(
nullptr, text_position);
3400 test_position = text_position->AsLeafTextPosition();
3401 ASSERT_NE(
nullptr, test_position);
3402 EXPECT_TRUE(test_position->IsLeafTextPosition());
3403 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3404 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3405 EXPECT_EQ(0, test_position->text_offset());
3411 GetTreeID(), text_field_.id, 13 ,
3413 ASSERT_NE(
nullptr, text_position);
3414 test_position = text_position->AsLeafTextPosition();
3415 ASSERT_NE(
nullptr, test_position);
3416 EXPECT_TRUE(test_position->IsLeafTextPosition());
3417 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3418 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3419 EXPECT_EQ(6, test_position->text_offset());
3425 GetTreeID(), root_.id, 10 ,
3427 ASSERT_NE(
nullptr, text_position);
3428 test_position = text_position->AsLeafTextPosition();
3429 ASSERT_NE(
nullptr, test_position);
3430 EXPECT_TRUE(test_position->IsLeafTextPosition());
3431 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3432 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3433 EXPECT_EQ(3, test_position->text_offset());
3439 GetTreeID(), root_.id, 10 ,
3441 ASSERT_NE(
nullptr, text_position);
3442 test_position = text_position->AsLeafTextPosition();
3443 ASSERT_NE(
nullptr, test_position);
3444 EXPECT_TRUE(test_position->IsLeafTextPosition());
3445 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3446 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3447 EXPECT_EQ(3, test_position->text_offset());
3451TEST_F(AXPositionTest, AsLeafTextPositionWithTextPositionAndEmptyTextSandwich) {
3462 text_data.
SetName(
"some text");
3470 more_text_data.
id = 4;
3472 more_text_data.
SetName(
"more text");
3474 root_data.
child_ids = {text_data.
id, button_data.
id, more_text_data.
id};
3476 SetTree(CreateAXTree({root_data, text_data, button_data, more_text_data}));
3481 GetTreeID(), root_data.
id, 9 ,
3483 ASSERT_NE(
nullptr, text_position);
3484 ASSERT_TRUE(text_position->IsTextPosition());
3485 ASSERT_FALSE(text_position->IsLeafTextPosition());
3487 ASSERT_NE(
nullptr, test_position);
3488 EXPECT_TRUE(test_position->IsLeafTextPosition());
3489 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3490 EXPECT_EQ(button_data.
id, test_position->anchor_id());
3491 EXPECT_EQ(0, test_position->text_offset());
3495 GetTreeID(), root_data.
id, 9 ,
3497 ASSERT_NE(
nullptr, text_position);
3498 test_position = text_position->AsLeafTextPosition();
3499 ASSERT_NE(
nullptr, test_position);
3500 EXPECT_TRUE(test_position->IsLeafTextPosition());
3501 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3502 EXPECT_EQ(text_data.
id, test_position->anchor_id());
3503 EXPECT_EQ(9, test_position->text_offset());
3513 static_text_data_1.
id = 2;
3515 static_text_data_1.
SetName(
"12");
3518 inline_box_data_1.
id = 3;
3520 inline_box_data_1.
SetName(
"1");
3523 inline_box_data_2.
id = 4;
3525 inline_box_data_2.
SetName(
"2");
3529 container_data.
id = 5;
3534 static_text_data_2.
id = 6;
3536 static_text_data_2.
SetName(
"3");
3539 inline_box_data_3.
id = 7;
3541 inline_box_data_3.
SetName(
"3");
3543 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id};
3544 container_data.
child_ids = {static_text_data_2.
id};
3545 static_text_data_2.
child_ids = {inline_box_data_3.
id};
3546 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
3548 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
3549 inline_box_data_2, container_data, static_text_data_2,
3550 inline_box_data_3}));
3562 GetTreeID(), container_data.
id, 0 ,
3564 ASSERT_TRUE(text_position->IsIgnored());
3567 ASSERT_NE(
nullptr, test_position);
3568 EXPECT_TRUE(test_position->IsTextPosition());
3569 EXPECT_EQ(root_data.
id, test_position->anchor_id());
3570 EXPECT_EQ(2, test_position->text_offset());
3575 GetTreeID(), container_data.
id, 1 ,
3577 ASSERT_TRUE(text_position->IsIgnored());
3579 test_position = text_position->AsUnignoredPosition(
3581 ASSERT_NE(
nullptr, test_position);
3582 EXPECT_TRUE(test_position->IsTextPosition());
3583 EXPECT_EQ(root_data.
id, test_position->anchor_id());
3584 EXPECT_EQ(3, test_position->text_offset());
3589 GetTreeID(), container_data.
id, 0 );
3590 ASSERT_TRUE(tree_position->IsIgnored());
3591 test_position = tree_position->AsUnignoredPosition(
3593 ASSERT_NE(
nullptr, test_position);
3594 EXPECT_TRUE(test_position->IsTreePosition());
3595 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3600 GetTreeID(), container_data.
id, 1 );
3601 ASSERT_TRUE(tree_position->IsIgnored());
3603 test_position = tree_position->AsUnignoredPosition(
3605 ASSERT_NE(
nullptr, test_position);
3606 EXPECT_TRUE(test_position->IsTreePosition());
3607 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3608 EXPECT_EQ(0, test_position->child_index());
3613 GetTreeID(), static_text_data_1.
id, 2 );
3614 ASSERT_TRUE(tree_position->IsIgnored());
3615 test_position = tree_position->AsUnignoredPosition(
3617 ASSERT_NE(
nullptr, test_position);
3618 EXPECT_TRUE(test_position->IsTreePosition());
3619 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3620 EXPECT_EQ(0, test_position->child_index());
3628 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
3629 inline_box_data_2, container_data, static_text_data_2,
3630 inline_box_data_3}));
3633 GetTreeID(), root_data.
id, 0 ,
3635 ASSERT_TRUE(text_position->IsIgnored());
3636 test_position = text_position->AsUnignoredPosition(
3638 ASSERT_NE(
nullptr, test_position);
3639 EXPECT_TRUE(test_position->IsTextPosition());
3640 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3641 EXPECT_EQ(0, test_position->text_offset());
3645 GetTreeID(), root_data.
id, 0 ,
3647 ASSERT_TRUE(text_position->IsIgnored());
3649 test_position = text_position->AsUnignoredPosition(
3651 ASSERT_NE(
nullptr, test_position);
3652 EXPECT_TRUE(test_position->IsTextPosition());
3653 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3654 EXPECT_EQ(0, test_position->text_offset());
3659 ASSERT_TRUE(tree_position->IsIgnored());
3660 test_position = tree_position->AsUnignoredPosition(
3662 ASSERT_NE(
nullptr, test_position);
3663 EXPECT_TRUE(test_position->IsTreePosition());
3664 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3668 test_position = tree_position->AsUnignoredPosition(
3670 ASSERT_NE(
nullptr, test_position);
3671 EXPECT_TRUE(test_position->IsTreePosition());
3672 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3678 ASSERT_TRUE(tree_position->IsIgnored());
3679 test_position = tree_position->AsUnignoredPosition(
3681 ASSERT_NE(
nullptr, test_position);
3682 EXPECT_TRUE(test_position->IsTreePosition());
3683 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3684 EXPECT_EQ(0, test_position->child_index());
3687 test_position = tree_position->AsUnignoredPosition(
3689 ASSERT_NE(
nullptr, test_position);
3690 EXPECT_TRUE(test_position->IsTreePosition());
3691 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3692 EXPECT_EQ(0, test_position->child_index());
3696 GetTreeID(), container_data.
id, 0 );
3697 ASSERT_TRUE(tree_position->IsIgnored());
3698 test_position = tree_position->AsUnignoredPosition(
3700 ASSERT_NE(
nullptr, test_position);
3701 EXPECT_TRUE(test_position->IsTreePosition());
3702 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3707 GetTreeID(), container_data.
id, 1 );
3708 ASSERT_TRUE(tree_position->IsIgnored());
3710 test_position = tree_position->AsUnignoredPosition(
3712 ASSERT_NE(
nullptr, test_position);
3713 EXPECT_TRUE(test_position->IsTreePosition());
3714 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3715 EXPECT_EQ(0, test_position->child_index());
3721 GetTreeID(), root_data.
id, 1 ,
3723 ASSERT_TRUE(text_position->IsIgnored());
3724 test_position = text_position->AsUnignoredPosition(
3726 ASSERT_NE(
nullptr, test_position);
3727 EXPECT_TRUE(test_position->IsTextPosition());
3728 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3729 EXPECT_EQ(0, test_position->text_offset());
3733 GetTreeID(), inline_box_data_2.
id, 0 ,
3735 ASSERT_TRUE(text_position->IsIgnored());
3736 test_position = text_position->AsUnignoredPosition(
3738 ASSERT_NE(
nullptr, test_position);
3739 EXPECT_TRUE(test_position->IsTextPosition());
3740 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3741 EXPECT_EQ(0, test_position->text_offset());
3745 GetTreeID(), inline_box_data_2.
id, 0 ,
3747 ASSERT_TRUE(text_position->IsIgnored());
3748 test_position = text_position->AsUnignoredPosition(
3750 ASSERT_NE(
nullptr, test_position);
3751 EXPECT_TRUE(test_position->IsTextPosition());
3752 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3754 EXPECT_EQ(1, test_position->text_offset());
3759 ASSERT_TRUE(tree_position->IsIgnored());
3760 test_position = tree_position->AsUnignoredPosition(
3762 ASSERT_NE(
nullptr, test_position);
3763 EXPECT_TRUE(test_position->IsTreePosition());
3764 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3766 ASSERT_TRUE(tree_position->IsIgnored());
3768 test_position = tree_position->AsUnignoredPosition(
3770 ASSERT_NE(
nullptr, test_position);
3771 EXPECT_TRUE(test_position->IsTreePosition());
3772 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3773 EXPECT_EQ(0, test_position->child_index());
3776TEST_F(AXPositionTest, CreatePositionAtTextBoundaryDocumentStartEndIsIgnored) {
3797 root_data.
id = ROOT_ID;
3801 static_text_data_1.
id = STATIC_TEXT1_ID;
3803 static_text_data_1.
SetName(
"One");
3806 inline_box_data_1.
id = INLINE_BOX1_ID;
3808 inline_box_data_1.
SetName(
"One");
3813 std::vector<int32_t>{3});
3818 static_text_data_2.
id = STATIC_TEXT2_ID;
3820 static_text_data_2.
SetName(
"Two");
3823 inline_box_data_2.
id = INLINE_BOX2_ID;
3825 inline_box_data_2.
SetName(
"Two");
3829 std::vector<int32_t>{3});
3836 static_text_data_3.
id = STATIC_TEXT3_ID;
3838 static_text_data_3.
SetName(
"Three");
3841 inline_box_data_3.
id = INLINE_BOX3_ID;
3843 inline_box_data_3.
SetName(
"Three");
3847 std::vector<int32_t>{5});
3854 static_text_data_4.
id = STATIC_TEXT4_ID;
3856 static_text_data_4.
SetName(
"Four");
3859 inline_box_data_4.
id = INLINE_BOX4_ID;
3861 inline_box_data_4.
SetName(
"Four");
3866 std::vector<int32_t>{4});
3870 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id,
3871 static_text_data_3.
id, static_text_data_4.
id};
3872 static_text_data_1.
child_ids = {inline_box_data_1.
id};
3873 static_text_data_2.
child_ids = {inline_box_data_2.
id};
3874 static_text_data_3.
child_ids = {inline_box_data_3.
id};
3875 static_text_data_4.
child_ids = {inline_box_data_4.
id};
3878 CreateAXTree({root_data, static_text_data_1, static_text_data_2,
3879 static_text_data_3, static_text_data_4, inline_box_data_1,
3880 inline_box_data_2, inline_box_data_3, inline_box_data_4}));
3883 GetTreeID(), inline_box_data_2.
id, 0 ,
3885 ASSERT_FALSE(text_position->IsIgnored());
3886 TestPositionType test_position = text_position->CreatePositionAtTextBoundary(
3889 ASSERT_NE(
nullptr, test_position);
3890 EXPECT_TRUE(test_position->IsTextPosition());
3891 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3892 EXPECT_EQ(0, test_position->text_offset());
3894 test_position = text_position->CreatePositionAtTextBoundary(
3897 ASSERT_NE(
nullptr, test_position);
3898 EXPECT_TRUE(test_position->IsTextPosition());
3899 EXPECT_EQ(inline_box_data_2.
id, test_position->anchor_id());
3900 EXPECT_EQ(0, test_position->text_offset());
3904 GetTreeID(), inline_box_data_3.
id, 0 ,
3906 ASSERT_FALSE(text_position->IsIgnored());
3907 test_position = text_position->CreatePositionAtTextBoundary(
3910 ASSERT_NE(
nullptr, test_position);
3911 EXPECT_TRUE(test_position->IsTextPosition());
3912 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3913 EXPECT_EQ(5, test_position->text_offset());
3915 test_position = text_position->CreatePositionAtTextBoundary(
3918 ASSERT_NE(
nullptr, test_position);
3919 EXPECT_TRUE(test_position->IsTextPosition());
3920 EXPECT_EQ(inline_box_data_2.
id, test_position->anchor_id());
3921 EXPECT_EQ(0, test_position->text_offset());
3925TEST_F(AXPositionTest, CreatePositionAtInvalidGraphemeBoundary) {
3926 std::vector<int> text_offsets;
3927 SetTree(CreateMultilingualDocument(&text_offsets));
3930 GetTreeID(), GetTree()->root()->
id(), 4 ,
3932 ASSERT_NE(
nullptr, test_position);
3933 EXPECT_TRUE(test_position->IsTextPosition());
3934 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
3935 EXPECT_EQ(4, test_position->text_offset());
3939 GetTreeID(), GetTree()->root()->
id(), 10 ,
3941 ASSERT_NE(
nullptr, test_position);
3942 EXPECT_TRUE(test_position->IsTextPosition());
3943 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
3944 EXPECT_EQ(10, test_position->text_offset());
3948TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithNullPosition) {
3950 ASSERT_NE(
nullptr, null_position);
3952 null_position->CreatePositionAtStartOfAnchor();
3953 EXPECT_NE(
nullptr, test_position);
3954 EXPECT_TRUE(test_position->IsNullPosition());
3957TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithTreePosition) {
3959 GetTreeID(), root_.id, 0 );
3960 ASSERT_NE(
nullptr, tree_position);
3962 tree_position->CreatePositionAtStartOfAnchor();
3963 EXPECT_NE(
nullptr, test_position);
3964 EXPECT_TRUE(test_position->IsTreePosition());
3965 EXPECT_EQ(root_.id, test_position->anchor_id());
3966 EXPECT_EQ(0, test_position->child_index());
3970 ASSERT_NE(
nullptr, tree_position);
3971 test_position = tree_position->CreatePositionAtStartOfAnchor();
3972 EXPECT_NE(
nullptr, test_position);
3973 EXPECT_TRUE(test_position->IsTreePosition());
3974 EXPECT_EQ(root_.id, test_position->anchor_id());
3975 EXPECT_EQ(0, test_position->child_index());
3979 GetTreeID(), inline_box1_.id, 0 );
3980 ASSERT_NE(
nullptr, tree_position);
3981 test_position = tree_position->CreatePositionAtStartOfAnchor();
3982 EXPECT_NE(
nullptr, test_position);
3983 EXPECT_TRUE(test_position->IsTreePosition());
3984 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3988TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithTextPosition) {
3990 GetTreeID(), inline_box1_.id, 0 ,
3992 ASSERT_NE(
nullptr, text_position);
3993 ASSERT_TRUE(text_position->IsTextPosition());
3995 text_position->CreatePositionAtStartOfAnchor();
3996 ASSERT_NE(
nullptr, test_position);
3997 EXPECT_TRUE(test_position->IsTextPosition());
3998 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3999 EXPECT_EQ(0, test_position->text_offset());
4003 GetTreeID(), inline_box1_.id, 1 ,
4005 ASSERT_NE(
nullptr, text_position);
4006 ASSERT_TRUE(text_position->IsTextPosition());
4007 test_position = text_position->CreatePositionAtStartOfAnchor();
4008 EXPECT_NE(
nullptr, test_position);
4009 EXPECT_TRUE(test_position->IsTextPosition());
4010 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4011 EXPECT_EQ(0, test_position->text_offset());
4016TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithNullPosition) {
4018 ASSERT_NE(
nullptr, null_position);
4019 TestPositionType test_position = null_position->CreatePositionAtEndOfAnchor();
4020 EXPECT_NE(
nullptr, test_position);
4021 EXPECT_TRUE(test_position->IsNullPosition());
4024TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithTreePosition) {
4026 GetTreeID(), root_.id, 3 );
4027 ASSERT_NE(
nullptr, tree_position);
4028 TestPositionType test_position = tree_position->CreatePositionAtEndOfAnchor();
4029 EXPECT_NE(
nullptr, test_position);
4030 EXPECT_TRUE(test_position->IsTreePosition());
4031 EXPECT_EQ(root_.id, test_position->anchor_id());
4032 EXPECT_EQ(3, test_position->child_index());
4036 ASSERT_NE(
nullptr, tree_position);
4037 test_position = tree_position->CreatePositionAtEndOfAnchor();
4038 EXPECT_NE(
nullptr, test_position);
4039 EXPECT_TRUE(test_position->IsTreePosition());
4040 EXPECT_EQ(root_.id, test_position->anchor_id());
4041 EXPECT_EQ(3, test_position->child_index());
4044TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithTextPosition) {
4046 GetTreeID(), inline_box1_.id, 6 ,
4048 ASSERT_NE(
nullptr, text_position);
4049 ASSERT_TRUE(text_position->IsTextPosition());
4050 TestPositionType test_position = text_position->CreatePositionAtEndOfAnchor();
4051 EXPECT_NE(
nullptr, test_position);
4052 EXPECT_TRUE(test_position->IsTextPosition());
4053 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4054 EXPECT_EQ(6, test_position->text_offset());
4058 GetTreeID(), inline_box1_.id, 5 ,
4060 ASSERT_NE(
nullptr, text_position);
4061 ASSERT_TRUE(text_position->IsTextPosition());
4062 test_position = text_position->CreatePositionAtEndOfAnchor();
4063 EXPECT_NE(
nullptr, test_position);
4064 EXPECT_TRUE(test_position->IsTextPosition());
4065 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4066 EXPECT_EQ(6, test_position->text_offset());
4071TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithNullPosition) {
4073 ASSERT_NE(
nullptr, null_position);
4075 null_position->CreatePreviousFormatStartPosition(
4077 EXPECT_NE(
nullptr, test_position);
4078 EXPECT_TRUE(test_position->IsNullPosition());
4079 test_position = null_position->CreatePreviousFormatStartPosition(
4081 EXPECT_NE(
nullptr, test_position);
4082 EXPECT_TRUE(test_position->IsNullPosition());
4083 test_position = null_position->CreatePreviousFormatStartPosition(
4085 EXPECT_NE(
nullptr, test_position);
4086 EXPECT_TRUE(test_position->IsNullPosition());
4089TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithTreePosition) {
4091 GetTreeID(), static_text1_.id, 1 );
4092 ASSERT_NE(
nullptr, tree_position);
4093 ASSERT_TRUE(tree_position->IsTreePosition());
4096 tree_position->CreatePreviousFormatStartPosition(
4098 EXPECT_NE(
nullptr, test_position);
4099 EXPECT_TRUE(test_position->IsTreePosition());
4100 EXPECT_EQ(static_text1_.id, test_position->anchor_id());
4101 EXPECT_EQ(0, test_position->child_index());
4103 test_position = test_position->CreatePreviousFormatStartPosition(
4105 EXPECT_NE(
nullptr, test_position);
4106 EXPECT_TRUE(test_position->IsTreePosition());
4107 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4110 test_position = test_position->CreatePreviousFormatStartPosition(
4112 EXPECT_NE(
nullptr, test_position);
4113 EXPECT_TRUE(test_position->IsTreePosition());
4114 EXPECT_EQ(button_.id, test_position->anchor_id());
4118 test_position = test_position->CreatePreviousFormatStartPosition(
4120 EXPECT_NE(
nullptr, test_position);
4121 EXPECT_TRUE(test_position->IsTreePosition());
4122 EXPECT_EQ(button_.id, test_position->anchor_id());
4127 test_position = test_position->CreatePreviousFormatStartPosition(
4129 EXPECT_NE(
nullptr, test_position);
4130 EXPECT_TRUE(test_position->IsTreePosition());
4131 EXPECT_EQ(button_.id, test_position->anchor_id());
4134 test_position = test_position->CreatePreviousFormatStartPosition(
4136 EXPECT_NE(
nullptr, test_position);
4137 EXPECT_TRUE(test_position->IsNullPosition());
4140TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithTextPosition) {
4142 GetTreeID(), inline_box1_.id, 2 ,
4144 ASSERT_NE(
nullptr, text_position);
4145 ASSERT_TRUE(text_position->IsTextPosition());
4148 text_position->CreatePreviousFormatStartPosition(
4150 EXPECT_NE(
nullptr, test_position);
4151 EXPECT_TRUE(test_position->IsTextPosition());
4152 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4153 EXPECT_EQ(0, test_position->text_offset());
4156 test_position = test_position->CreatePreviousFormatStartPosition(
4158 EXPECT_NE(
nullptr, test_position);
4159 EXPECT_TRUE(test_position->IsTextPosition());
4160 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4161 EXPECT_EQ(0, test_position->text_offset());
4163 test_position = test_position->CreatePreviousFormatStartPosition(
4165 EXPECT_NE(
nullptr, test_position);
4166 EXPECT_TRUE(test_position->IsTextPosition());
4167 EXPECT_EQ(button_.id, test_position->anchor_id());
4168 EXPECT_EQ(0, test_position->text_offset());
4171 test_position = test_position->CreatePreviousFormatStartPosition(
4173 EXPECT_NE(
nullptr, test_position);
4174 EXPECT_TRUE(test_position->IsTextPosition());
4175 EXPECT_EQ(button_.id, test_position->anchor_id());
4176 EXPECT_EQ(0, test_position->text_offset());
4180 test_position = test_position->CreatePreviousFormatStartPosition(
4182 EXPECT_NE(
nullptr, test_position);
4183 EXPECT_TRUE(test_position->IsTextPosition());
4184 EXPECT_EQ(button_.id, test_position->anchor_id());
4185 EXPECT_EQ(0, test_position->text_offset());
4187 test_position = test_position->CreatePreviousFormatStartPosition(
4189 EXPECT_NE(
nullptr, test_position);
4190 EXPECT_TRUE(test_position->IsNullPosition());
4193TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithNullPosition) {
4195 ASSERT_NE(
nullptr, null_position);
4196 TestPositionType test_position = null_position->CreateNextFormatEndPosition(
4198 EXPECT_NE(
nullptr, test_position);
4199 EXPECT_TRUE(test_position->IsNullPosition());
4200 test_position = null_position->CreateNextFormatEndPosition(
4202 EXPECT_NE(
nullptr, test_position);
4203 EXPECT_TRUE(test_position->IsNullPosition());
4206TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithTreePosition) {
4208 GetTreeID(), button_.id, 0 );
4209 ASSERT_NE(
nullptr, tree_position);
4210 ASSERT_TRUE(tree_position->IsTreePosition());
4212 TestPositionType test_position = tree_position->CreateNextFormatEndPosition(
4214 EXPECT_NE(
nullptr, test_position);
4215 EXPECT_TRUE(test_position->IsTreePosition());
4216 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4217 EXPECT_EQ(0, test_position->child_index());
4219 test_position = test_position->CreateNextFormatEndPosition(
4221 EXPECT_NE(
nullptr, test_position);
4222 EXPECT_TRUE(test_position->IsTreePosition());
4223 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4224 EXPECT_EQ(0, test_position->child_index());
4226 test_position = test_position->CreateNextFormatEndPosition(
4228 EXPECT_NE(
nullptr, test_position);
4229 EXPECT_TRUE(test_position->IsTreePosition());
4230 EXPECT_EQ(line_break_.id, test_position->anchor_id());
4231 EXPECT_EQ(0, test_position->child_index());
4233 test_position = test_position->CreateNextFormatEndPosition(
4235 EXPECT_NE(
nullptr, test_position);
4236 EXPECT_TRUE(test_position->IsTreePosition());
4237 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4238 EXPECT_EQ(0, test_position->child_index());
4241 test_position = test_position->CreateNextFormatEndPosition(
4243 EXPECT_NE(
nullptr, test_position);
4244 EXPECT_TRUE(test_position->IsTreePosition());
4245 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4246 EXPECT_EQ(0, test_position->child_index());
4250 test_position = test_position->CreateNextFormatEndPosition(
4252 EXPECT_NE(
nullptr, test_position);
4253 EXPECT_TRUE(test_position->IsTreePosition());
4254 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4255 EXPECT_EQ(0, test_position->child_index());
4257 test_position = test_position->CreateNextFormatEndPosition(
4259 EXPECT_NE(
nullptr, test_position);
4260 EXPECT_TRUE(test_position->IsNullPosition());
4263TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithTextPosition) {
4265 GetTreeID(), button_.id, 0 ,
4267 ASSERT_NE(
nullptr, text_position);
4268 ASSERT_TRUE(text_position->IsTextPosition());
4270 TestPositionType test_position = text_position->CreateNextFormatEndPosition(
4272 EXPECT_NE(
nullptr, test_position);
4273 EXPECT_TRUE(test_position->IsTextPosition());
4274 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4275 EXPECT_EQ(0, test_position->text_offset());
4277 test_position = test_position->CreateNextFormatEndPosition(
4279 EXPECT_NE(
nullptr, test_position);
4280 EXPECT_TRUE(test_position->IsTextPosition());
4281 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4282 EXPECT_EQ(6, test_position->text_offset());
4284 test_position = test_position->CreateNextFormatEndPosition(
4286 EXPECT_NE(
nullptr, test_position);
4287 EXPECT_TRUE(test_position->IsTextPosition());
4288 EXPECT_EQ(line_break_.id, test_position->anchor_id());
4289 EXPECT_EQ(1, test_position->text_offset());
4291 test_position = test_position->CreateNextFormatEndPosition(
4293 EXPECT_NE(
nullptr, test_position);
4294 EXPECT_TRUE(test_position->IsTextPosition());
4295 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4296 EXPECT_EQ(6, test_position->text_offset());
4299 test_position = test_position->CreateNextFormatEndPosition(
4301 EXPECT_NE(
nullptr, test_position);
4302 EXPECT_TRUE(test_position->IsTextPosition());
4303 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4304 EXPECT_EQ(6, test_position->text_offset());
4308 test_position = test_position->CreateNextFormatEndPosition(
4310 EXPECT_NE(
nullptr, test_position);
4311 EXPECT_TRUE(test_position->IsTextPosition());
4312 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4313 EXPECT_EQ(6, test_position->text_offset());
4315 test_position = test_position->CreateNextFormatEndPosition(
4317 EXPECT_NE(
nullptr, test_position);
4318 EXPECT_TRUE(test_position->IsNullPosition());
4321TEST_F(AXPositionTest, CreatePositionAtFormatBoundaryWithTextPosition) {
4332 text_data.
SetName(
"some text");
4335 more_text_data.
id = 3;
4337 more_text_data.
SetName(
"more text");
4341 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
4345 GetTreeID(), text_data.
id, 8 ,
4347 ASSERT_NE(
nullptr, text_position);
4349 text_position->CreatePreviousFormatStartPosition(
4351 EXPECT_NE(
nullptr, test_position);
4352 EXPECT_TRUE(test_position->IsTextPosition());
4353 EXPECT_EQ(text_data.
id, test_position->anchor_id());
4354 EXPECT_EQ(0, test_position->text_offset());
4358 GetTreeID(), more_text_data.
id, 0 ,
4360 ASSERT_NE(
nullptr, text_position);
4361 test_position = text_position->CreateNextFormatEndPosition(
4363 EXPECT_NE(
nullptr, test_position);
4364 EXPECT_TRUE(test_position->IsTextPosition());
4365 EXPECT_EQ(more_text_data.
id, test_position->anchor_id());
4366 EXPECT_EQ(9, test_position->text_offset());
4369TEST_F(AXPositionTest, MoveByFormatWithIgnoredNodes) {
4422 generic_container_2.
id = 2;
4424 static_text_4.
id = 4;
4425 inline_box_5.
id = 5;
4427 generic_container_7.
id = 7;
4428 generic_container_8.
id = 8;
4430 static_text_10.
id = 10;
4431 inline_box_11.
id = 11;
4432 static_text_12.
id = 12;
4433 inline_box_13.
id = 13;
4434 generic_container_14.
id = 14;
4435 generic_container_15.
id = 15;
4437 static_text_17.
id = 17;
4438 inline_box_18.
id = 18;
4439 generic_container_19.
id = 19;
4440 generic_container_20.
id = 20;
4441 static_text_21.
id = 21;
4442 inline_box_22.
id = 22;
4444 static_text_24.
id = 24;
4445 inline_box_25.
id = 25;
4448 root_1.
child_ids = {generic_container_2.
id, generic_container_8.
id,
4449 generic_container_15.
id, generic_container_19.
id};
4459 static_text_4.
SetName(
"Button");
4462 inline_box_5.
SetName(
"Button");
4472 generic_container_8.
child_ids = {heading_9.
id, static_text_12.
id,
4473 generic_container_14.
id};
4480 static_text_10.
SetName(
"Heading");
4483 inline_box_11.
SetName(
"Heading");
4487 static_text_12.
SetName(
"3.14");
4490 inline_box_13.
SetName(
"3.14");
4503 static_text_17.
SetName(
"Heading");
4506 inline_box_18.
SetName(
"Heading");
4509 generic_container_19.
child_ids = {generic_container_20.
id, static_text_21.
id,
4517 static_text_21.
SetName(
"3.14");
4520 inline_box_22.
SetName(
"3.14");
4527 static_text_24.
SetName(
"Heading");
4530 inline_box_25.
SetName(
"Heading");
4532 SetTree(CreateAXTree({root_1,
4533 generic_container_2,
4538 generic_container_7,
4539 generic_container_8,
4545 generic_container_14,
4546 generic_container_15,
4550 generic_container_19,
4551 generic_container_20,
4569 GetTreeID(), inline_box_5.
id, 6 ,
4571 ASSERT_NE(
nullptr, text_position);
4572 EXPECT_TRUE(text_position->IsTextPosition());
4573 EXPECT_EQ(inline_box_5.
id, text_position->anchor_id());
4574 EXPECT_EQ(6, text_position->text_offset());
4576 text_position = text_position->CreateNextFormatEndPosition(
4578 ASSERT_NE(
nullptr, text_position);
4579 EXPECT_TRUE(text_position->IsTextPosition());
4580 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4581 EXPECT_EQ(7, text_position->text_offset());
4585 GetTreeID(), inline_box_11.
id, 0 ,
4587 ASSERT_NE(
nullptr, text_position);
4588 EXPECT_TRUE(text_position->IsTextPosition());
4589 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4590 EXPECT_EQ(0, text_position->text_offset());
4592 text_position = text_position->CreatePreviousFormatStartPosition(
4594 ASSERT_NE(
nullptr, text_position);
4595 EXPECT_TRUE(text_position->IsTextPosition());
4596 EXPECT_EQ(inline_box_5.
id, text_position->anchor_id());
4597 EXPECT_EQ(0, text_position->text_offset());
4605 GetTreeID(), inline_box_11.
id, 7 ,
4607 ASSERT_NE(
nullptr, text_position);
4608 EXPECT_TRUE(text_position->IsTextPosition());
4609 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4610 EXPECT_EQ(7, text_position->text_offset());
4612 text_position = text_position->CreateNextFormatEndPosition(
4614 ASSERT_NE(
nullptr, text_position);
4615 EXPECT_TRUE(text_position->IsTextPosition());
4616 EXPECT_EQ(inline_box_13.
id, text_position->anchor_id());
4617 EXPECT_EQ(4, text_position->text_offset());
4621 GetTreeID(), inline_box_25.
id, 0 ,
4623 ASSERT_NE(
nullptr, text_position);
4624 EXPECT_TRUE(text_position->IsTextPosition());
4625 EXPECT_EQ(inline_box_25.
id, text_position->anchor_id());
4626 EXPECT_EQ(0, text_position->text_offset());
4628 text_position = text_position->CreatePreviousFormatStartPosition(
4630 ASSERT_NE(
nullptr, text_position);
4631 EXPECT_TRUE(text_position->IsTextPosition());
4632 EXPECT_EQ(inline_box_22.
id, text_position->anchor_id());
4633 EXPECT_EQ(0, text_position->text_offset());
4637TEST_F(AXPositionTest, CreatePositionAtPageBoundaryWithTextPosition) {
4638 AXNodeData root_data, page_1_data, page_1_text_data, page_2_data,
4639 page_2_text_data, page_3_data, page_3_text_data;
4640 SetTree(CreateMultipageDocument(root_data, page_1_data, page_1_text_data,
4641 page_2_data, page_2_text_data, page_3_data,
4646 GetTreeID(), page_1_text_data.
id, 0 ,
4648 ASSERT_NE(
nullptr, text_position);
4649 ASSERT_TRUE(text_position->IsTextPosition());
4652 TestPositionType test_position = text_position->CreateNextPageStartPosition(
4654 EXPECT_NE(
nullptr, test_position);
4655 EXPECT_TRUE(test_position->IsTextPosition());
4656 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4657 EXPECT_EQ(0, test_position->text_offset());
4659 test_position = text_position->CreateNextPageStartPosition(
4661 EXPECT_NE(
nullptr, test_position);
4662 EXPECT_TRUE(test_position->IsTextPosition());
4663 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4664 EXPECT_EQ(0, test_position->text_offset());
4666 test_position = text_position->CreateNextPageStartPosition(
4668 EXPECT_NE(
nullptr, test_position);
4669 EXPECT_TRUE(test_position->IsTextPosition());
4670 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4671 EXPECT_EQ(0, test_position->text_offset());
4674 test_position = test_position->CreateNextPageEndPosition(
4676 EXPECT_NE(
nullptr, test_position);
4677 EXPECT_TRUE(test_position->IsTextPosition());
4678 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4679 EXPECT_EQ(19, test_position->text_offset());
4681 test_position = test_position->CreateNextPageEndPosition(
4683 EXPECT_NE(
nullptr, test_position);
4684 EXPECT_TRUE(test_position->IsTextPosition());
4685 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4686 EXPECT_EQ(24, test_position->text_offset());
4688 test_position = test_position->CreateNextPageEndPosition(
4690 EXPECT_NE(
nullptr, test_position);
4691 EXPECT_TRUE(test_position->IsTextPosition());
4692 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4693 EXPECT_EQ(24, test_position->text_offset());
4696 test_position = test_position->CreateNextPageStartPosition(
4698 EXPECT_NE(
nullptr, test_position);
4699 EXPECT_TRUE(test_position->IsTextPosition());
4700 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4701 EXPECT_EQ(24, test_position->text_offset());
4703 test_position = test_position->CreateNextPageEndPosition(
4705 EXPECT_NE(
nullptr, test_position);
4706 EXPECT_TRUE(test_position->IsTextPosition());
4707 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4708 EXPECT_EQ(24, test_position->text_offset());
4711 TestPositionType null_position = test_position->CreateNextPageStartPosition(
4713 EXPECT_NE(
nullptr, null_position);
4714 EXPECT_TRUE(null_position->IsNullPosition());
4716 null_position = test_position->CreateNextPageEndPosition(
4718 EXPECT_NE(
nullptr, null_position);
4719 EXPECT_TRUE(null_position->IsNullPosition());
4722 text_position = test_position->CreatePreviousPageEndPosition(
4724 EXPECT_NE(
nullptr, text_position);
4725 EXPECT_TRUE(text_position->IsTextPosition());
4726 EXPECT_EQ(page_3_text_data.
id, text_position->anchor_id());
4727 EXPECT_EQ(24, text_position->text_offset());
4729 test_position = text_position->CreatePreviousPageEndPosition(
4731 EXPECT_NE(
nullptr, test_position);
4732 EXPECT_TRUE(test_position->IsTextPosition());
4733 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4734 EXPECT_EQ(19, test_position->text_offset());
4736 test_position = text_position->CreatePreviousPageEndPosition(
4738 EXPECT_NE(
nullptr, test_position);
4739 EXPECT_TRUE(test_position->IsTextPosition());
4740 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4741 EXPECT_EQ(19, test_position->text_offset());
4743 test_position = test_position->CreatePreviousPageStartPosition(
4745 EXPECT_NE(
nullptr, test_position);
4746 EXPECT_TRUE(test_position->IsTextPosition());
4747 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4748 EXPECT_EQ(0, test_position->text_offset());
4750 test_position = test_position->CreatePreviousPageStartPosition(
4752 EXPECT_NE(
nullptr, test_position);
4753 EXPECT_TRUE(test_position->IsTextPosition());
4754 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4755 EXPECT_EQ(0, test_position->text_offset());
4757 test_position = test_position->CreatePreviousPageStartPosition(
4759 EXPECT_NE(
nullptr, test_position);
4760 EXPECT_TRUE(test_position->IsTextPosition());
4761 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4762 EXPECT_EQ(0, test_position->text_offset());
4765 test_position = test_position->CreatePreviousPageStartPosition(
4767 EXPECT_NE(
nullptr, test_position);
4768 EXPECT_TRUE(test_position->IsTextPosition());
4769 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4770 EXPECT_EQ(0, test_position->text_offset());
4772 test_position = test_position->CreatePreviousPageEndPosition(
4774 EXPECT_NE(
nullptr, test_position);
4775 EXPECT_TRUE(test_position->IsTextPosition());
4776 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4777 EXPECT_EQ(0, test_position->text_offset());
4780 null_position = test_position->CreatePreviousPageStartPosition(
4782 EXPECT_NE(
nullptr, null_position);
4783 EXPECT_TRUE(null_position->IsNullPosition());
4785 null_position = test_position->CreatePreviousPageEndPosition(
4787 EXPECT_NE(
nullptr, null_position);
4788 EXPECT_TRUE(null_position->IsNullPosition());
4791TEST_F(AXPositionTest, CreatePositionAtPageBoundaryWithTreePosition) {
4792 AXNodeData root_data, page_1_data, page_1_text_data, page_2_data,
4793 page_2_text_data, page_3_data, page_3_text_data;
4794 SetTree(CreateMultipageDocument(root_data, page_1_data, page_1_text_data,
4795 page_2_data, page_2_text_data, page_3_data,
4800 GetTreeID(), page_1_data.
id, 0 );
4801 ASSERT_NE(
nullptr, tree_position);
4802 ASSERT_TRUE(tree_position->IsTreePosition());
4805 TestPositionType test_position = tree_position->CreateNextPageStartPosition(
4807 EXPECT_NE(
nullptr, test_position);
4808 EXPECT_TRUE(test_position->IsTreePosition());
4809 EXPECT_EQ(page_1_data.
id, test_position->anchor_id());
4810 EXPECT_EQ(0, test_position->child_index());
4812 test_position = tree_position->CreateNextPageStartPosition(
4814 EXPECT_NE(
nullptr, test_position);
4815 EXPECT_TRUE(test_position->IsTreePosition());
4816 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4819 test_position = tree_position->CreateNextPageStartPosition(
4821 EXPECT_NE(
nullptr, test_position);
4822 EXPECT_TRUE(test_position->IsTreePosition());
4823 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4827 test_position = tree_position->CreateNextPageEndPosition(
4829 EXPECT_NE(
nullptr, test_position);
4830 EXPECT_TRUE(test_position->IsTreePosition());
4831 EXPECT_EQ(page_1_data.
id, test_position->anchor_id());
4832 EXPECT_EQ(1, test_position->child_index());
4834 test_position = test_position->CreateNextPageEndPosition(
4836 EXPECT_NE(
nullptr, test_position);
4837 EXPECT_TRUE(test_position->IsTreePosition());
4838 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4839 EXPECT_EQ(0, test_position->child_index());
4841 test_position = test_position->CreateNextPageEndPosition(
4843 EXPECT_NE(
nullptr, test_position);
4844 EXPECT_TRUE(test_position->IsTreePosition());
4845 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4846 EXPECT_EQ(0, test_position->child_index());
4849 test_position = test_position->CreateNextPageStartPosition(
4851 EXPECT_NE(
nullptr, test_position);
4852 EXPECT_TRUE(test_position->IsTreePosition());
4853 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4854 EXPECT_EQ(0, test_position->child_index());
4856 test_position = test_position->CreateNextPageEndPosition(
4858 EXPECT_NE(
nullptr, test_position);
4859 EXPECT_TRUE(test_position->IsTreePosition());
4860 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4861 EXPECT_EQ(0, test_position->child_index());
4864 TestPositionType null_position = test_position->CreateNextPageStartPosition(
4866 EXPECT_NE(
nullptr, null_position);
4867 EXPECT_TRUE(null_position->IsNullPosition());
4869 null_position = test_position->CreateNextPageEndPosition(
4871 EXPECT_NE(
nullptr, null_position);
4872 EXPECT_TRUE(null_position->IsNullPosition());
4875 tree_position = test_position->CreatePreviousPageEndPosition(
4877 EXPECT_NE(
nullptr, tree_position);
4878 EXPECT_TRUE(tree_position->IsTreePosition());
4879 EXPECT_EQ(page_3_text_data.
id, tree_position->anchor_id());
4880 EXPECT_EQ(0, tree_position->child_index());
4882 test_position = tree_position->CreatePreviousPageEndPosition(
4884 EXPECT_NE(
nullptr, test_position);
4885 EXPECT_TRUE(test_position->IsTreePosition());
4886 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4887 EXPECT_EQ(0, test_position->child_index());
4889 test_position = tree_position->CreatePreviousPageEndPosition(
4891 EXPECT_NE(
nullptr, test_position);
4892 EXPECT_TRUE(test_position->IsTreePosition());
4893 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4894 EXPECT_EQ(0, test_position->child_index());
4896 test_position = test_position->CreatePreviousPageStartPosition(
4898 EXPECT_NE(
nullptr, test_position);
4899 EXPECT_TRUE(test_position->IsTreePosition());
4900 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4903 test_position = test_position->CreatePreviousPageStartPosition(
4905 EXPECT_NE(
nullptr, test_position);
4906 EXPECT_TRUE(test_position->IsTreePosition());
4907 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4910 test_position = test_position->CreatePreviousPageStartPosition(
4912 EXPECT_NE(
nullptr, test_position);
4913 EXPECT_TRUE(test_position->IsTreePosition());
4914 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4918 test_position = test_position->CreatePreviousPageStartPosition(
4920 EXPECT_NE(
nullptr, test_position);
4921 EXPECT_TRUE(test_position->IsTreePosition());
4922 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4925 test_position = test_position->CreatePreviousPageEndPosition(
4927 EXPECT_NE(
nullptr, test_position);
4928 EXPECT_TRUE(test_position->IsTreePosition());
4929 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4933 null_position = test_position->CreatePreviousPageStartPosition(
4935 EXPECT_NE(
nullptr, null_position);
4936 EXPECT_TRUE(null_position->IsNullPosition());
4938 null_position = test_position->CreatePreviousPageEndPosition(
4940 EXPECT_NE(
nullptr, null_position);
4941 EXPECT_TRUE(null_position->IsNullPosition());
4944TEST_F(AXPositionTest, CreatePagePositionWithNullPosition) {
4946 ASSERT_NE(
nullptr, null_position);
4948 null_position->CreatePreviousPageStartPosition(
4950 EXPECT_NE(
nullptr, test_position);
4951 EXPECT_TRUE(test_position->IsNullPosition());
4953 test_position = null_position->CreateNextPageStartPosition(
4955 EXPECT_NE(
nullptr, test_position);
4956 EXPECT_TRUE(test_position->IsNullPosition());
4958 test_position = null_position->CreatePreviousPageEndPosition(
4960 EXPECT_NE(
nullptr, test_position);
4961 EXPECT_TRUE(test_position->IsNullPosition());
4963 test_position = null_position->CreatePreviousPageStartPosition(
4965 EXPECT_NE(
nullptr, test_position);
4966 EXPECT_TRUE(test_position->IsNullPosition());
4969TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithNullPosition) {
4971 ASSERT_NE(
nullptr, null_position);
4973 null_position->CreatePositionAtStartOfDocument();
4974 EXPECT_NE(
nullptr, test_position);
4975 EXPECT_TRUE(test_position->IsNullPosition());
4978TEST_F(AXPositionTest, CreatePagePositionWithNonPaginatedDocument) {
4980 GetTreeID(), static_text1_.id, 0 ,
4982 ASSERT_NE(
nullptr, text_position);
4988 text_position->CreatePreviousPageStartPosition(
4990 EXPECT_NE(
nullptr, test_position);
4991 EXPECT_TRUE(test_position->IsTextPosition());
4992 EXPECT_EQ(button_.id, test_position->anchor_id());
4993 EXPECT_EQ(0, test_position->text_offset());
4997 test_position = text_position->CreateNextPageStartPosition(
4999 EXPECT_NE(
nullptr, test_position);
5000 EXPECT_TRUE(test_position->IsNullPosition());
5004 test_position = text_position->CreatePreviousPageEndPosition(
5006 EXPECT_NE(
nullptr, test_position);
5007 EXPECT_TRUE(test_position->IsNullPosition());
5011 test_position = text_position->CreateNextPageEndPosition(
5013 EXPECT_NE(
nullptr, test_position);
5014 EXPECT_TRUE(test_position->IsTextPosition());
5015 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5016 EXPECT_EQ(6, test_position->text_offset());
5020 test_position = test_position->CreatePreviousPageStartPosition(
5022 EXPECT_NE(
nullptr, test_position);
5023 EXPECT_TRUE(test_position->IsTextPosition());
5024 EXPECT_EQ(button_.id, test_position->anchor_id());
5025 EXPECT_EQ(0, test_position->text_offset());
5029 test_position = test_position->CreateNextPageStartPosition(
5031 EXPECT_NE(
nullptr, test_position);
5032 EXPECT_TRUE(test_position->IsNullPosition());
5036 test_position = text_position->CreatePreviousPageEndPosition(
5038 EXPECT_NE(
nullptr, test_position);
5039 EXPECT_TRUE(test_position->IsNullPosition());
5043 test_position = text_position->CreatePreviousPageStartPosition(
5045 EXPECT_NE(
nullptr, test_position);
5046 EXPECT_TRUE(test_position->IsNullPosition());
5049TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithTreePosition) {
5051 GetTreeID(), root_.id, 0 );
5052 ASSERT_NE(
nullptr, tree_position);
5054 tree_position->CreatePositionAtStartOfDocument();
5055 EXPECT_NE(
nullptr, test_position);
5056 EXPECT_EQ(root_.id, test_position->anchor_id());
5060 ASSERT_NE(
nullptr, tree_position);
5061 test_position = tree_position->CreatePositionAtStartOfDocument();
5062 EXPECT_NE(
nullptr, test_position);
5063 EXPECT_EQ(root_.id, test_position->anchor_id());
5066 GetTreeID(), inline_box1_.id, 0 );
5067 ASSERT_NE(
nullptr, tree_position);
5068 test_position = tree_position->CreatePositionAtStartOfDocument();
5069 EXPECT_NE(
nullptr, test_position);
5070 EXPECT_EQ(root_.id, test_position->anchor_id());
5073TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithTextPosition) {
5075 GetTreeID(), inline_box1_.id, 0 ,
5077 ASSERT_NE(
nullptr, text_position);
5079 text_position->CreatePositionAtStartOfDocument();
5080 EXPECT_NE(
nullptr, test_position);
5081 EXPECT_EQ(root_.id, test_position->anchor_id());
5084 GetTreeID(), inline_box1_.id, 1 ,
5086 ASSERT_NE(
nullptr, text_position);
5087 test_position = text_position->CreatePositionAtStartOfDocument();
5088 EXPECT_NE(
nullptr, test_position);
5089 EXPECT_EQ(root_.id, test_position->anchor_id());
5094TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithNullPosition) {
5096 ASSERT_NE(
nullptr, null_position);
5098 null_position->CreatePositionAtEndOfDocument();
5099 EXPECT_NE(
nullptr, test_position);
5100 EXPECT_TRUE(test_position->IsNullPosition());
5103TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithTreePosition) {
5105 GetTreeID(), root_.id, 3 );
5106 ASSERT_NE(
nullptr, tree_position);
5108 tree_position->CreatePositionAtEndOfDocument();
5109 EXPECT_NE(
nullptr, test_position);
5110 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5114 ASSERT_NE(
nullptr, tree_position);
5115 test_position = tree_position->CreatePositionAtEndOfDocument();
5116 EXPECT_NE(
nullptr, test_position);
5117 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5120 GetTreeID(), inline_box1_.id, 0 );
5121 ASSERT_NE(
nullptr, tree_position);
5122 test_position = tree_position->CreatePositionAtEndOfDocument();
5123 EXPECT_NE(
nullptr, test_position);
5124 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5127TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithTextPosition) {
5129 GetTreeID(), inline_box1_.id, 6 ,
5131 ASSERT_NE(
nullptr, text_position);
5133 text_position->CreatePositionAtEndOfDocument();
5134 EXPECT_NE(
nullptr, test_position);
5135 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5138 GetTreeID(), inline_box1_.id, 5 ,
5140 ASSERT_NE(
nullptr, text_position);
5141 test_position = text_position->CreatePositionAtEndOfDocument();
5142 EXPECT_NE(
nullptr, test_position);
5143 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5150 GetTreeID(), inline_box1_.id, 6 ,
5152 ASSERT_NE(
nullptr, text_position);
5153 EXPECT_FALSE(text_position->AtLastNodeInTree());
5154 EXPECT_FALSE(text_position->AsTreePosition()->AtLastNodeInTree());
5157 text_position->CreatePositionAtEndOfDocument();
5158 ASSERT_NE(
nullptr, test_position);
5159 EXPECT_TRUE(test_position->AtLastNodeInTree());
5160 EXPECT_TRUE(test_position->AsTreePosition()->AtLastNodeInTree());
5161 EXPECT_FALSE(text_position->CreateNullPosition()->AtLastNodeInTree());
5167 ASSERT_NE(
nullptr, on_last_node_but_not_at_maxtextoffset);
5168 EXPECT_TRUE(on_last_node_but_not_at_maxtextoffset->AtLastNodeInTree());
5169 EXPECT_TRUE(on_last_node_but_not_at_maxtextoffset->AsTreePosition()
5170 ->AtLastNodeInTree());
5173TEST_F(AXPositionTest, CreateChildPositionAtWithNullPosition) {
5175 ASSERT_NE(
nullptr, null_position);
5177 EXPECT_NE(
nullptr, test_position);
5178 EXPECT_TRUE(test_position->IsNullPosition());
5181TEST_F(AXPositionTest, CreateChildPositionAtWithTreePosition) {
5183 GetTreeID(), root_.id, 2 );
5184 ASSERT_NE(
nullptr, tree_position);
5186 EXPECT_NE(
nullptr, test_position);
5187 EXPECT_TRUE(test_position->IsTreePosition());
5188 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5195 ASSERT_NE(
nullptr, tree_position);
5196 test_position = tree_position->CreateChildPositionAt(0);
5197 EXPECT_NE(
nullptr, test_position);
5198 EXPECT_TRUE(test_position->IsNullPosition());
5201TEST_F(AXPositionTest, CreateChildPositionAtWithTextPosition) {
5203 GetTreeID(), static_text1_.id, 5 ,
5205 ASSERT_NE(
nullptr, text_position);
5206 ASSERT_TRUE(text_position->IsTextPosition());
5208 EXPECT_NE(
nullptr, test_position);
5209 EXPECT_TRUE(test_position->IsTextPosition());
5210 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5211 EXPECT_EQ(0, test_position->text_offset());
5214 GetTreeID(), static_text2_.id, 4 ,
5216 ASSERT_NE(
nullptr, text_position);
5217 ASSERT_TRUE(text_position->IsTextPosition());
5218 test_position = text_position->CreateChildPositionAt(1);
5219 EXPECT_NE(
nullptr, test_position);
5220 EXPECT_TRUE(test_position->IsNullPosition());
5223TEST_F(AXPositionTest, CreateParentPositionWithNullPosition) {
5225 ASSERT_NE(
nullptr, null_position);
5227 EXPECT_NE(
nullptr, test_position);
5228 EXPECT_TRUE(test_position->IsNullPosition());
5231TEST_F(AXPositionTest, CreateParentPositionWithTreePosition) {
5233 GetTreeID(), check_box_.id, 0 );
5234 ASSERT_NE(
nullptr, tree_position);
5236 EXPECT_NE(
nullptr, test_position);
5237 EXPECT_TRUE(test_position->IsTreePosition());
5238 EXPECT_EQ(root_.id, test_position->anchor_id());
5240 EXPECT_EQ(1, test_position->child_index());
5245 ASSERT_NE(
nullptr, tree_position);
5246 test_position = tree_position->CreateParentPosition();
5247 EXPECT_NE(
nullptr, test_position);
5248 EXPECT_TRUE(test_position->IsNullPosition());
5251TEST_F(AXPositionTest, CreateParentPositionWithTextPosition) {
5255 GetTreeID(), check_box_.id, 0 ,
5257 ASSERT_NE(
nullptr, text_position);
5258 ASSERT_TRUE(text_position->IsTextPosition());
5260 EXPECT_NE(
nullptr, test_position);
5261 EXPECT_TRUE(test_position->IsTextPosition());
5262 EXPECT_EQ(root_.id, test_position->anchor_id());
5263 EXPECT_EQ(0, test_position->text_offset());
5270 GetTreeID(), inline_box2_.id, 5 ,
5272 ASSERT_NE(
nullptr, text_position);
5273 ASSERT_TRUE(text_position->IsTextPosition());
5274 test_position = text_position->CreateParentPosition();
5275 EXPECT_NE(
nullptr, test_position);
5276 EXPECT_TRUE(test_position->IsTextPosition());
5277 EXPECT_EQ(static_text2_.id, test_position->anchor_id());
5278 EXPECT_EQ(5, test_position->text_offset());
5281 test_position = test_position->CreateParentPosition();
5282 EXPECT_NE(
nullptr, test_position);
5283 EXPECT_TRUE(test_position->IsTextPosition());
5284 EXPECT_EQ(text_field_.id, test_position->anchor_id());
5287 EXPECT_EQ(12, test_position->text_offset());
5291TEST_F(AXPositionTest, CreateNextAndPreviousLeafTextPositionWithNullPosition) {
5293 ASSERT_NE(
nullptr, null_position);
5294 TestPositionType test_position = null_position->CreateNextLeafTextPosition();
5295 EXPECT_NE(
nullptr, test_position);
5296 EXPECT_TRUE(test_position->IsNullPosition());
5297 test_position = null_position->CreatePreviousLeafTextPosition();
5298 EXPECT_NE(
nullptr, test_position);
5299 EXPECT_TRUE(test_position->IsNullPosition());
5302TEST_F(AXPositionTest, CreateNextLeafTextPosition) {
5304 GetTreeID(), root_.id, 1 );
5305 ASSERT_NE(
nullptr, check_box_position);
5307 check_box_position->CreateNextLeafTextPosition();
5308 EXPECT_NE(
nullptr, test_position);
5309 EXPECT_TRUE(test_position->IsTextPosition());
5310 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5311 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5312 EXPECT_EQ(0, test_position->text_offset());
5317 GetTreeID(), root_.id, 0 ,
5319 ASSERT_NE(
nullptr, root_position);
5320 ASSERT_TRUE(root_position->IsTextPosition());
5321 test_position = root_position->CreateNextLeafTextPosition();
5322 EXPECT_NE(
nullptr, test_position);
5323 EXPECT_TRUE(test_position->IsTextPosition());
5324 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5325 EXPECT_EQ(button_.id, test_position->anchor_id());
5326 EXPECT_EQ(0, test_position->text_offset());
5329 GetTreeID(), button_.id, 0 ,
5331 ASSERT_NE(
nullptr, button_position);
5332 ASSERT_TRUE(button_position->IsTextPosition());
5333 test_position = button_position->CreateNextLeafTextPosition();
5334 EXPECT_NE(
nullptr, test_position);
5335 EXPECT_TRUE(test_position->IsTextPosition());
5336 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5337 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5338 EXPECT_EQ(0, test_position->text_offset());
5340 test_position = test_position->CreateNextLeafTextPosition();
5341 EXPECT_NE(
nullptr, test_position);
5342 EXPECT_TRUE(test_position->IsTextPosition());
5343 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5344 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5345 EXPECT_EQ(0, test_position->text_offset());
5347 test_position = test_position->CreateNextLeafTextPosition();
5348 EXPECT_NE(
nullptr, test_position);
5349 EXPECT_TRUE(test_position->IsTextPosition());
5350 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5351 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5352 EXPECT_EQ(0, test_position->text_offset());
5354 test_position = test_position->CreateNextLeafTextPosition();
5355 EXPECT_NE(
nullptr, test_position);
5356 EXPECT_TRUE(test_position->IsTextPosition());
5357 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5358 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5359 EXPECT_EQ(0, test_position->text_offset());
5361 test_position = test_position->CreateNextLeafTextPosition();
5362 EXPECT_NE(
nullptr, test_position);
5363 EXPECT_TRUE(test_position->IsNullPosition());
5366 GetTreeID(), root_.id, 2 );
5367 ASSERT_NE(
nullptr, text_field_position);
5368 test_position = text_field_position->CreateNextLeafTextPosition();
5369 EXPECT_NE(
nullptr, test_position);
5370 EXPECT_TRUE(test_position->IsTextPosition());
5371 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5372 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5373 EXPECT_EQ(0, test_position->text_offset());
5378 GetTreeID(), root_.id, 10 ,
5380 ASSERT_NE(
nullptr, root_position2);
5381 ASSERT_TRUE(root_position2->IsTextPosition());
5382 test_position = root_position2->CreateNextLeafTextPosition();
5383 EXPECT_NE(
nullptr, test_position);
5384 EXPECT_TRUE(test_position->IsTextPosition());
5385 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5386 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5387 EXPECT_EQ(3, test_position->text_offset());
5390TEST_F(AXPositionTest, CreatePreviousLeafTextPosition) {
5392 GetTreeID(), inline_box2_.id, 5 ,
5394 ASSERT_NE(
nullptr, text_position);
5395 ASSERT_TRUE(text_position->IsTextPosition());
5397 text_position->CreatePreviousLeafTextPosition();
5398 EXPECT_NE(
nullptr, test_position);
5399 EXPECT_TRUE(test_position->IsTextPosition());
5400 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5401 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5402 EXPECT_EQ(0, test_position->text_offset());
5407 ASSERT_NE(
nullptr, before_text_position);
5408 test_position = before_text_position->CreatePreviousLeafTextPosition();
5409 EXPECT_NE(
nullptr, test_position);
5410 EXPECT_TRUE(test_position->IsTextPosition());
5411 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5412 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5413 EXPECT_EQ(0, test_position->text_offset());
5415 test_position = test_position->CreatePreviousLeafTextPosition();
5416 EXPECT_NE(
nullptr, test_position);
5417 EXPECT_TRUE(test_position->IsTextPosition());
5418 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5419 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5420 EXPECT_EQ(0, test_position->text_offset());
5422 test_position = test_position->CreatePreviousLeafTextPosition();
5423 EXPECT_NE(
nullptr, test_position);
5424 EXPECT_TRUE(test_position->IsTextPosition());
5425 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5426 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5427 EXPECT_EQ(0, test_position->text_offset());
5429 test_position = test_position->CreatePreviousLeafTextPosition();
5430 EXPECT_NE(
nullptr, test_position);
5431 EXPECT_TRUE(test_position->IsTextPosition());
5432 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5433 EXPECT_EQ(button_.id, test_position->anchor_id());
5434 EXPECT_EQ(0, test_position->text_offset());
5436 test_position = test_position->CreatePreviousLeafTextPosition();
5437 EXPECT_NE(
nullptr, test_position);
5438 EXPECT_TRUE(test_position->IsNullPosition());
5441 GetTreeID(), text_field_.id, 2 );
5442 ASSERT_NE(
nullptr, text_field_position);
5443 test_position = text_field_position->CreatePreviousLeafTextPosition();
5444 EXPECT_NE(
nullptr, test_position);
5445 EXPECT_TRUE(test_position->IsTextPosition());
5446 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5447 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5448 EXPECT_EQ(0, test_position->text_offset());
5453 GetTreeID(), check_box_.id, 0 ,
5455 ASSERT_NE(
nullptr, check_box_position);
5456 ASSERT_TRUE(check_box_position->IsTextPosition());
5457 test_position = check_box_position->CreatePreviousLeafTextPosition();
5458 EXPECT_NE(
nullptr, test_position);
5459 EXPECT_TRUE(test_position->IsTextPosition());
5460 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5461 EXPECT_EQ(button_.id, test_position->anchor_id());
5462 EXPECT_EQ(0, test_position->text_offset());
5467 GetTreeID(), root_.id, 10 ,
5469 ASSERT_NE(
nullptr, root_position2);
5470 ASSERT_TRUE(root_position2->IsTextPosition());
5471 test_position = root_position2->CreatePreviousLeafTextPosition();
5472 EXPECT_NE(
nullptr, test_position);
5473 EXPECT_TRUE(test_position->IsTextPosition());
5474 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5475 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5476 EXPECT_EQ(3, test_position->text_offset());
5479TEST_F(AXPositionTest, CreateNextLeafTreePosition) {
5481 GetTreeID(), root_.id, 0 );
5482 ASSERT_TRUE(root_position->IsTreePosition());
5495 TestPositionType test_position = root_position->CreateNextLeafTreePosition();
5496 EXPECT_TRUE(test_position->IsTreePosition());
5497 EXPECT_EQ(*test_position, *button_position);
5499 test_position = test_position->CreateNextLeafTreePosition();
5500 EXPECT_TRUE(test_position->IsTreePosition());
5501 EXPECT_EQ(*test_position, *checkbox_position);
5503 test_position = test_position->CreateNextLeafTreePosition();
5504 EXPECT_TRUE(test_position->IsTreePosition());
5505 EXPECT_EQ(*test_position, *inline_box1_position);
5507 test_position = test_position->CreateNextLeafTreePosition();
5508 EXPECT_TRUE(test_position->IsTreePosition());
5509 EXPECT_EQ(*test_position, *line_break_position);
5511 test_position = test_position->CreateNextLeafTreePosition();
5512 EXPECT_TRUE(test_position->IsTreePosition());
5513 EXPECT_EQ(*test_position, *inline_box2_position);
5515 test_position = test_position->CreateNextLeafTreePosition();
5516 EXPECT_TRUE(test_position->IsNullPosition());
5519 GetTreeID(), root_.id, 2 ,
5521 EXPECT_TRUE(root_text_position->IsTextPosition());
5523 test_position = root_text_position->CreateNextLeafTreePosition();
5524 EXPECT_TRUE(test_position->IsTreePosition());
5525 EXPECT_EQ(*test_position, *inline_box1_position);
5531 EXPECT_TRUE(inline_box1_text_position->IsTextPosition());
5533 test_position = inline_box1_text_position->CreateNextLeafTreePosition();
5534 EXPECT_TRUE(test_position->IsTreePosition());
5535 EXPECT_EQ(*test_position, *line_break_position);
5538TEST_F(AXPositionTest, CreatePreviousLeafTreePosition) {
5541 ASSERT_TRUE(inline_box2_position->IsTreePosition());
5553 inline_box2_position->CreatePreviousLeafTreePosition();
5554 EXPECT_TRUE(test_position->IsTreePosition());
5555 EXPECT_EQ(*test_position, *line_break_position);
5557 test_position = test_position->CreatePreviousLeafTreePosition();
5558 EXPECT_TRUE(test_position->IsTreePosition());
5559 EXPECT_EQ(*test_position, *inline_box1_position);
5561 test_position = test_position->CreatePreviousLeafTreePosition();
5562 EXPECT_TRUE(test_position->IsTreePosition());
5563 EXPECT_EQ(*test_position, *checkbox_position);
5565 test_position = test_position->CreatePreviousLeafTreePosition();
5566 EXPECT_TRUE(test_position->IsTreePosition());
5567 EXPECT_EQ(*test_position, *button_position);
5569 test_position = test_position->CreatePreviousLeafTreePosition();
5570 EXPECT_TRUE(test_position->IsNullPosition());
5576 EXPECT_TRUE(inline_box2_text_position->IsTextPosition());
5578 test_position = inline_box2_text_position->CreatePreviousLeafTreePosition();
5579 EXPECT_TRUE(test_position->IsTreePosition());
5580 EXPECT_EQ(*test_position, *line_break_position);
5584 AsLeafTextPositionBeforeAndAfterCharacterWithNullPosition) {
5586 ASSERT_NE(
nullptr, null_position);
5587 ASSERT_TRUE(null_position->IsNullPosition());
5589 null_position->AsLeafTextPositionBeforeCharacter();
5590 EXPECT_NE(
nullptr, test_position);
5591 EXPECT_TRUE(test_position->IsNullPosition());
5592 test_position = null_position->AsLeafTextPositionAfterCharacter();
5593 EXPECT_NE(
nullptr, test_position);
5594 EXPECT_TRUE(test_position->IsNullPosition());
5598 AsLeafTextPositionBeforeAndAfterCharacterAtInvalidGraphemeBoundary) {
5601 <<
"Skipping, current accessibility library cannot handle grapheme";
5603 std::vector<int> text_offsets;
5604 SetTree(CreateMultilingualDocument(&text_offsets));
5607 GetTreeID(), GetTree()->root()->
id(), 4 ,
5609 test_position = test_position->AsLeafTextPositionAfterCharacter();
5610 ASSERT_NE(
nullptr, test_position);
5611 EXPECT_TRUE(test_position->IsTextPosition());
5612 EXPECT_EQ(GetTree()->root()->children()[1]->
id(), test_position->anchor_id());
5614 EXPECT_EQ(2, test_position->text_offset());
5618 GetTreeID(), GetTree()->root()->
id(), 10 ,
5620 test_position = test_position->AsLeafTextPositionBeforeCharacter();
5621 ASSERT_NE(
nullptr, test_position);
5622 EXPECT_TRUE(test_position->IsTextPosition());
5623 EXPECT_EQ(GetTree()->root()->children()[2]->
id(), test_position->anchor_id());
5625 EXPECT_EQ(0, test_position->text_offset());
5629 GetTreeID(), GetTree()->root()->
id(), 10 ,
5631 test_position = test_position->AsLeafTextPositionBeforeCharacter();
5632 ASSERT_NE(
nullptr, test_position);
5633 EXPECT_TRUE(test_position->IsTextPosition());
5634 EXPECT_EQ(GetTree()->root()->children()[2]->
id(), test_position->anchor_id());
5637 EXPECT_EQ(0, test_position->text_offset());
5645TEST_F(AXPositionTest, AsLeafTextPositionBeforeCharacterNoAdjustment) {
5648 GetTreeID(), root_.id, 6 ,
5650 ASSERT_NE(
nullptr, text_position);
5651 ASSERT_TRUE(text_position->IsTextPosition());
5653 text_position->AsLeafTextPositionBeforeCharacter();
5654 EXPECT_NE(
nullptr, test_position);
5655 EXPECT_TRUE(test_position->IsTextPosition());
5656 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5657 EXPECT_EQ(0, test_position->text_offset());
5661 GetTreeID(), text_field_.id, 6 ,
5663 ASSERT_NE(
nullptr, text_position);
5664 ASSERT_TRUE(text_position->IsTextPosition());
5665 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5666 EXPECT_NE(
nullptr, test_position);
5667 EXPECT_TRUE(test_position->IsTextPosition());
5668 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5669 EXPECT_EQ(0, test_position->text_offset());
5673 GetTreeID(), text_field_.id, 13 ,
5675 ASSERT_NE(
nullptr, text_position);
5676 ASSERT_TRUE(text_position->IsTextPosition());
5677 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5678 EXPECT_NE(
nullptr, test_position);
5679 EXPECT_TRUE(test_position->IsNullPosition());
5682 GetTreeID(), static_text1_.id, 6 ,
5684 ASSERT_NE(
nullptr, text_position);
5685 ASSERT_TRUE(text_position->IsTextPosition());
5686 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5687 EXPECT_NE(
nullptr, test_position);
5688 EXPECT_TRUE(test_position->IsTextPosition());
5689 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5690 EXPECT_EQ(0, test_position->text_offset());
5693 GetTreeID(), inline_box1_.id, 6 ,
5695 ASSERT_NE(
nullptr, text_position);
5696 ASSERT_TRUE(text_position->IsTextPosition());
5697 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5698 EXPECT_NE(
nullptr, test_position);
5699 EXPECT_TRUE(test_position->IsTextPosition());
5700 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5701 EXPECT_EQ(0, test_position->text_offset());
5704 GetTreeID(), line_break_.id, 1 ,
5706 ASSERT_NE(
nullptr, text_position);
5707 ASSERT_TRUE(text_position->IsTextPosition());
5708 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5709 EXPECT_NE(
nullptr, test_position);
5710 EXPECT_TRUE(test_position->IsTextPosition());
5711 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5712 EXPECT_EQ(0, test_position->text_offset());
5715TEST_F(AXPositionTest, AsLeafTextPositionAfterCharacterNoAdjustment) {
5718 GetTreeID(), root_.id, 13 ,
5720 ASSERT_NE(
nullptr, text_position);
5721 ASSERT_TRUE(text_position->IsTextPosition());
5723 text_position->AsLeafTextPositionAfterCharacter();
5724 EXPECT_NE(
nullptr, test_position);
5725 EXPECT_TRUE(test_position->IsTextPosition());
5726 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5727 EXPECT_EQ(6, test_position->text_offset());
5731 GetTreeID(), root_.id, 7 ,
5733 ASSERT_NE(
nullptr, text_position);
5734 ASSERT_TRUE(text_position->IsTextPosition());
5735 test_position = text_position->AsLeafTextPositionAfterCharacter();
5736 EXPECT_NE(
nullptr, test_position);
5737 EXPECT_TRUE(test_position->IsTextPosition());
5738 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5739 EXPECT_EQ(1, test_position->text_offset());
5743 GetTreeID(), text_field_.id, 6 ,
5745 ASSERT_NE(
nullptr, text_position);
5746 ASSERT_TRUE(text_position->IsTextPosition());
5747 test_position = text_position->AsLeafTextPositionAfterCharacter();
5748 EXPECT_NE(
nullptr, test_position);
5749 EXPECT_TRUE(test_position->IsTextPosition());
5750 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5751 EXPECT_EQ(6, test_position->text_offset());
5755 GetTreeID(), text_field_.id, 13 ,
5757 ASSERT_NE(
nullptr, text_position);
5758 ASSERT_TRUE(text_position->IsTextPosition());
5759 test_position = text_position->AsLeafTextPositionAfterCharacter();
5760 EXPECT_NE(
nullptr, test_position);
5761 EXPECT_TRUE(test_position->IsTextPosition());
5762 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5763 EXPECT_EQ(6, test_position->text_offset());
5766 GetTreeID(), line_break_.id, 0 ,
5768 ASSERT_NE(
nullptr, text_position);
5769 ASSERT_TRUE(text_position->IsTextPosition());
5770 test_position = text_position->AsLeafTextPositionAfterCharacter();
5771 EXPECT_NE(
nullptr, test_position);
5772 EXPECT_TRUE(test_position->IsTextPosition());
5773 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5774 EXPECT_EQ(6, test_position->text_offset());
5777 GetTreeID(), line_break_.id, 1 ,
5779 ASSERT_NE(
nullptr, text_position);
5780 ASSERT_TRUE(text_position->IsTextPosition());
5781 test_position = text_position->AsLeafTextPositionAfterCharacter();
5782 EXPECT_NE(
nullptr, test_position);
5783 EXPECT_TRUE(test_position->IsTextPosition());
5784 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5785 EXPECT_EQ(1, test_position->text_offset());
5788 GetTreeID(), inline_box2_.id, 6 ,
5790 ASSERT_NE(
nullptr, text_position);
5791 ASSERT_TRUE(text_position->IsTextPosition());
5792 test_position = text_position->AsLeafTextPositionAfterCharacter();
5793 EXPECT_NE(
nullptr, test_position);
5794 EXPECT_TRUE(test_position->IsTextPosition());
5795 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5796 EXPECT_EQ(6, test_position->text_offset());
5799TEST_F(AXPositionTest, AsLeafTextPositionBeforeCharacter) {
5801 GetTreeID(), inline_box1_.id, 3 ,
5803 ASSERT_NE(
nullptr, text_position);
5804 ASSERT_TRUE(text_position->IsTextPosition());
5806 text_position->AsLeafTextPositionBeforeCharacter();
5807 EXPECT_NE(
nullptr, test_position);
5808 EXPECT_TRUE(test_position->IsTextPosition());
5809 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5810 EXPECT_EQ(3, test_position->text_offset());
5813 GetTreeID(), line_break_.id, 1 ,
5815 ASSERT_NE(
nullptr, text_position);
5816 ASSERT_TRUE(text_position->IsTextPosition());
5817 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5818 EXPECT_NE(
nullptr, test_position);
5819 EXPECT_TRUE(test_position->IsTextPosition());
5820 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5821 EXPECT_EQ(0, test_position->text_offset());
5824 GetTreeID(), inline_box2_.id, 0 ,
5826 ASSERT_NE(
nullptr, text_position);
5827 ASSERT_TRUE(text_position->IsTextPosition());
5828 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5829 EXPECT_NE(
nullptr, test_position);
5830 EXPECT_TRUE(test_position->IsTextPosition());
5831 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5832 EXPECT_EQ(0, test_position->text_offset());
5835 GetTreeID(), inline_box2_.id, 6 ,
5837 ASSERT_NE(
nullptr, text_position);
5838 ASSERT_TRUE(text_position->IsTextPosition());
5839 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5840 EXPECT_NE(
nullptr, test_position);
5841 EXPECT_TRUE(test_position->IsNullPosition());
5844 GetTreeID(), root_.id, 13 ,
5846 ASSERT_NE(
nullptr, text_position);
5847 ASSERT_TRUE(text_position->IsTextPosition());
5848 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5849 EXPECT_NE(
nullptr, test_position);
5850 EXPECT_TRUE(test_position->IsNullPosition());
5853TEST_F(AXPositionTest, AsLeafTextPositionAfterCharacter) {
5855 GetTreeID(), inline_box1_.id, 0 ,
5857 ASSERT_NE(
nullptr, text_position);
5858 ASSERT_TRUE(text_position->IsTextPosition());
5860 text_position->AsLeafTextPositionAfterCharacter();
5861 EXPECT_NE(
nullptr, test_position);
5862 EXPECT_TRUE(test_position->IsNullPosition());
5865 GetTreeID(), inline_box1_.id, 5 ,
5867 ASSERT_NE(
nullptr, text_position);
5868 ASSERT_TRUE(text_position->IsTextPosition());
5869 test_position = text_position->AsLeafTextPositionAfterCharacter();
5870 EXPECT_NE(
nullptr, test_position);
5871 EXPECT_TRUE(test_position->IsTextPosition());
5872 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5873 EXPECT_EQ(5, test_position->text_offset());
5876 GetTreeID(), line_break_.id, 1 ,
5878 ASSERT_NE(
nullptr, text_position);
5879 ASSERT_TRUE(text_position->IsTextPosition());
5880 test_position = text_position->AsLeafTextPositionAfterCharacter();
5881 EXPECT_NE(
nullptr, test_position);
5882 EXPECT_TRUE(test_position->IsTextPosition());
5883 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5884 EXPECT_EQ(1, test_position->text_offset());
5887 GetTreeID(), inline_box2_.id, 0 ,
5889 ASSERT_NE(
nullptr, text_position);
5890 ASSERT_TRUE(text_position->IsTextPosition());
5891 test_position = text_position->AsLeafTextPositionAfterCharacter();
5892 EXPECT_NE(
nullptr, test_position);
5893 EXPECT_TRUE(test_position->IsTextPosition());
5894 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5895 EXPECT_EQ(1, test_position->text_offset());
5898 GetTreeID(), root_.id, 0 ,
5900 ASSERT_NE(
nullptr, text_position);
5901 ASSERT_TRUE(text_position->IsTextPosition());
5902 test_position = text_position->AsLeafTextPositionAfterCharacter();
5903 EXPECT_NE(
nullptr, test_position);
5904 EXPECT_TRUE(test_position->IsNullPosition());
5907TEST_F(AXPositionTest, CreateNextAndPreviousCharacterPositionWithNullPosition) {
5909 ASSERT_NE(
nullptr, null_position);
5910 TestPositionType test_position = null_position->CreateNextCharacterPosition(
5912 EXPECT_NE(
nullptr, test_position);
5913 EXPECT_TRUE(test_position->IsNullPosition());
5914 test_position = null_position->CreatePreviousCharacterPosition(
5916 EXPECT_NE(
nullptr, test_position);
5917 EXPECT_TRUE(test_position->IsNullPosition());
5928 text_data.
SetName(
"some text");
5932 SetTree(CreateAXTree({root_data, text_data}));
5936 GetTreeID(), text_data.
id, 9 ,
5938 ASSERT_NE(
nullptr, text_position);
5939 EXPECT_TRUE(text_position->IsTextPosition());
5940 EXPECT_TRUE(text_position->IsValid());
5941 EXPECT_EQ(9, text_position->text_offset());
5944 TestPositionType test_position = text_position->CreateNextCharacterPosition(
5946 EXPECT_TRUE(test_position->IsValid());
5947 ASSERT_NE(
nullptr, test_position);
5948 EXPECT_TRUE(test_position->IsTextPosition());
5949 EXPECT_EQ(text_data.
id, test_position->anchor_id());
5950 EXPECT_EQ(9, test_position->text_offset());
5951 test_position = text_position->CreateNextCharacterPosition(
5953 ASSERT_NE(
nullptr, test_position);
5954 EXPECT_TRUE(test_position->IsNullPosition());
5957 EXPECT_TRUE(text_position->IsValid());
5958 test_position = text_position->AsValidPosition();
5959 EXPECT_TRUE(test_position->IsValid());
5960 EXPECT_EQ(*test_position, *text_position);
5964 text_data.
SetName(
"some tex");
5966 shorten_text_update.
nodes = {text_data};
5967 ASSERT_TRUE(GetTree()->Unserialize(shorten_text_update));
5969 EXPECT_FALSE(text_position->IsValid());
5970 text_position = text_position->AsValidPosition();
5971 EXPECT_TRUE(text_position->IsValid());
5972 EXPECT_EQ(8, text_position->text_offset());
5976 test_position = text_position->CreateNextCharacterPosition(
5978 EXPECT_TRUE(test_position->IsValid());
5979 ASSERT_NE(
nullptr, test_position);
5980 EXPECT_TRUE(test_position->IsTextPosition());
5981 EXPECT_EQ(text_data.
id, test_position->anchor_id());
5982 EXPECT_EQ(8, test_position->text_offset());
5983 test_position = text_position->CreateNextCharacterPosition(
5985 ASSERT_NE(
nullptr, test_position);
5986 EXPECT_TRUE(test_position->IsNullPosition());
5990 EXPECT_TRUE(text_position->IsValid());
5992 ASSERT_NE(
nullptr, tree_position);
5993 EXPECT_TRUE(tree_position->IsTreePosition());
5994 EXPECT_TRUE(tree_position->IsValid());
5995 EXPECT_EQ(0, tree_position->child_index());
5999 remove_node_update.
nodes = {root_data};
6000 ASSERT_TRUE(GetTree()->Unserialize(remove_node_update));
6001 EXPECT_FALSE(text_position->IsValid());
6002 EXPECT_FALSE(tree_position->IsValid());
6004 text_position = text_position->AsValidPosition();
6005 EXPECT_TRUE(text_position->IsValid());
6006 tree_position = tree_position->AsValidPosition();
6007 EXPECT_TRUE(tree_position->IsValid());
6009 EXPECT_TRUE(text_position->IsNullPosition());
6010 EXPECT_TRUE(tree_position->IsNullPosition());
6013TEST_F(AXPositionTest, AsValidPositionInDescendantOfEmptyObject) {
6027 static_text_3.
id = 3;
6028 inline_box_4.
id = 4;
6037 static_text_3.
SetName(
"3.14");
6043 SetTree(CreateAXTree({root_1, button_2, static_text_3, inline_box_4}));
6047 ASSERT_NE(
nullptr, text_position);
6048 EXPECT_TRUE(text_position->IsTextPosition());
6049 EXPECT_TRUE(text_position->IsValid());
6050 EXPECT_EQ(*text_position, *text_position->AsValidPosition());
6054 ASSERT_NE(
nullptr, tree_position);
6055 EXPECT_TRUE(tree_position->IsTreePosition());
6056 EXPECT_TRUE(tree_position->IsValid());
6057 EXPECT_EQ(*tree_position, *tree_position->AsValidPosition());
6062 update.
nodes = {static_text_3, inline_box_4};
6063 ASSERT_TRUE(GetTree()->Unserialize(update));
6065 EXPECT_FALSE(text_position->IsValid());
6066 text_position = text_position->AsValidPosition();
6067 EXPECT_TRUE(text_position->IsValid());
6068 EXPECT_EQ(1, text_position->text_offset());
6070 EXPECT_FALSE(tree_position->IsValid());
6071 tree_position = tree_position->AsValidPosition();
6072 EXPECT_TRUE(tree_position->IsValid());
6073 EXPECT_EQ(0, tree_position->child_index());
6076TEST_F(AXPositionTest, CreateNextCharacterPosition) {
6078 GetTreeID(), inline_box1_.id, 4 ,
6080 ASSERT_NE(
nullptr, text_position);
6081 ASSERT_TRUE(text_position->IsTextPosition());
6083 TestPositionType test_position = text_position->CreateNextCharacterPosition(
6085 EXPECT_NE(
nullptr, test_position);
6086 EXPECT_TRUE(test_position->IsTextPosition());
6087 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6088 EXPECT_EQ(4, test_position->text_offset());
6089 test_position = text_position->CreateNextCharacterPosition(
6091 EXPECT_NE(
nullptr, test_position);
6092 EXPECT_TRUE(test_position->IsTextPosition());
6093 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6094 EXPECT_EQ(5, test_position->text_offset());
6095 test_position = text_position->CreateNextCharacterPosition(
6097 EXPECT_NE(
nullptr, test_position);
6098 EXPECT_TRUE(test_position->IsTextPosition());
6099 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6100 EXPECT_EQ(5, test_position->text_offset());
6101 test_position = text_position->CreateNextCharacterPosition(
6103 EXPECT_NE(
nullptr, test_position);
6104 EXPECT_TRUE(test_position->IsTextPosition());
6105 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6106 EXPECT_EQ(5, test_position->text_offset());
6109 GetTreeID(), inline_box1_.id, 5 ,
6111 ASSERT_NE(
nullptr, text_position);
6112 ASSERT_TRUE(text_position->IsTextPosition());
6114 test_position = text_position->CreateNextCharacterPosition(
6116 EXPECT_NE(
nullptr, test_position);
6117 EXPECT_TRUE(test_position->IsTextPosition());
6118 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6119 EXPECT_EQ(5, test_position->text_offset());
6120 test_position = text_position->CreateNextCharacterPosition(
6122 EXPECT_NE(
nullptr, test_position);
6123 EXPECT_TRUE(test_position->IsTextPosition());
6124 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6125 EXPECT_EQ(6, test_position->text_offset());
6126 test_position = text_position->CreateNextCharacterPosition(
6128 EXPECT_NE(
nullptr, test_position);
6129 EXPECT_TRUE(test_position->IsTextPosition());
6130 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6131 EXPECT_EQ(6, test_position->text_offset());
6132 test_position = text_position->CreateNextCharacterPosition(
6134 EXPECT_NE(
nullptr, test_position);
6135 EXPECT_TRUE(test_position->IsTextPosition());
6136 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6137 EXPECT_EQ(6, test_position->text_offset());
6140 GetTreeID(), inline_box1_.id, 6 ,
6142 ASSERT_NE(
nullptr, text_position);
6143 ASSERT_TRUE(text_position->IsTextPosition());
6145 test_position = text_position->CreateNextCharacterPosition(
6147 EXPECT_NE(
nullptr, test_position);
6148 EXPECT_TRUE(test_position->IsTextPosition());
6149 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6150 EXPECT_EQ(6, test_position->text_offset());
6151 test_position = text_position->CreateNextCharacterPosition(
6153 EXPECT_NE(
nullptr, test_position);
6154 EXPECT_TRUE(test_position->IsTextPosition());
6155 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6156 EXPECT_EQ(1, test_position->text_offset());
6157 test_position = text_position->CreateNextCharacterPosition(
6159 EXPECT_NE(
nullptr, test_position);
6160 EXPECT_TRUE(test_position->IsTextPosition());
6161 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6162 EXPECT_EQ(6, test_position->text_offset());
6163 test_position = text_position->CreateNextCharacterPosition(
6165 EXPECT_NE(
nullptr, test_position);
6166 EXPECT_TRUE(test_position->IsTextPosition());
6167 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6168 EXPECT_EQ(1, test_position->text_offset());
6171 GetTreeID(), inline_box2_.id, 6 ,
6173 ASSERT_NE(
nullptr, text_position);
6174 ASSERT_TRUE(text_position->IsTextPosition());
6176 test_position = text_position->CreateNextCharacterPosition(
6178 EXPECT_NE(
nullptr, test_position);
6179 EXPECT_TRUE(test_position->IsNullPosition());
6180 test_position = text_position->CreateNextCharacterPosition(
6182 EXPECT_NE(
nullptr, test_position);
6183 EXPECT_TRUE(test_position->IsTextPosition());
6184 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6185 EXPECT_EQ(6, test_position->text_offset());
6186 test_position = text_position->CreateNextCharacterPosition(
6188 EXPECT_NE(
nullptr, test_position);
6189 EXPECT_TRUE(test_position->IsTextPosition());
6190 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6191 EXPECT_EQ(6, test_position->text_offset());
6192 test_position = text_position->CreateNextCharacterPosition(
6194 EXPECT_NE(
nullptr, test_position);
6195 EXPECT_TRUE(test_position->IsTextPosition());
6196 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6197 EXPECT_EQ(6, test_position->text_offset());
6200 GetTreeID(), check_box_.id, 0 ,
6202 ASSERT_NE(
nullptr, text_position);
6203 ASSERT_TRUE(text_position->IsTextPosition());
6205 test_position = text_position->CreateNextCharacterPosition(
6207 EXPECT_NE(
nullptr, test_position);
6208 EXPECT_TRUE(test_position->IsTextPosition());
6209 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6210 EXPECT_EQ(1, test_position->text_offset());
6211 test_position = text_position->CreateNextCharacterPosition(
6213 EXPECT_NE(
nullptr, test_position);
6214 EXPECT_TRUE(test_position->IsTextPosition());
6215 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6216 EXPECT_EQ(0, test_position->text_offset());
6217 test_position = text_position->CreateNextCharacterPosition(
6219 EXPECT_NE(
nullptr, test_position);
6220 EXPECT_TRUE(test_position->IsTextPosition());
6221 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6222 EXPECT_EQ(0, test_position->text_offset());
6223 test_position = text_position->CreateNextCharacterPosition(
6225 EXPECT_NE(
nullptr, test_position);
6226 EXPECT_TRUE(test_position->IsTextPosition());
6227 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6228 EXPECT_EQ(1, test_position->text_offset());
6231 GetTreeID(), text_field_.id, 0 ,
6233 ASSERT_NE(
nullptr, text_position);
6234 ASSERT_TRUE(text_position->IsTextPosition());
6236 test_position = text_position->CreateNextCharacterPosition(
6238 EXPECT_NE(
nullptr, test_position);
6239 EXPECT_TRUE(test_position->IsTextPosition());
6240 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6241 EXPECT_EQ(1, test_position->text_offset());
6246 GetTreeID(), text_field_.id, 12 ,
6248 ASSERT_NE(
nullptr, text_position);
6249 ASSERT_TRUE(text_position->IsTextPosition());
6251 test_position = text_position->CreateNextCharacterPosition(
6253 EXPECT_NE(
nullptr, test_position);
6254 EXPECT_TRUE(test_position->IsTextPosition());
6255 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6256 EXPECT_EQ(13, test_position->text_offset());
6261TEST_F(AXPositionTest, CreatePreviousCharacterPosition) {
6263 GetTreeID(), inline_box2_.id, 5 ,
6265 ASSERT_NE(
nullptr, text_position);
6266 ASSERT_TRUE(text_position->IsTextPosition());
6269 text_position->CreatePreviousCharacterPosition(
6271 EXPECT_NE(
nullptr, test_position);
6272 EXPECT_TRUE(test_position->IsTextPosition());
6273 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6274 EXPECT_EQ(5, test_position->text_offset());
6275 test_position = text_position->CreatePreviousCharacterPosition(
6277 EXPECT_NE(
nullptr, test_position);
6278 EXPECT_TRUE(test_position->IsTextPosition());
6279 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6280 EXPECT_EQ(4, test_position->text_offset());
6281 test_position = text_position->CreatePreviousCharacterPosition(
6283 EXPECT_NE(
nullptr, test_position);
6284 EXPECT_TRUE(test_position->IsTextPosition());
6285 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6286 EXPECT_EQ(4, test_position->text_offset());
6287 test_position = text_position->CreatePreviousCharacterPosition(
6289 EXPECT_NE(
nullptr, test_position);
6290 EXPECT_TRUE(test_position->IsTextPosition());
6291 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6292 EXPECT_EQ(4, test_position->text_offset());
6295 GetTreeID(), inline_box2_.id, 1 ,
6297 ASSERT_NE(
nullptr, text_position);
6298 ASSERT_TRUE(text_position->IsTextPosition());
6300 test_position = text_position->CreatePreviousCharacterPosition(
6302 EXPECT_NE(
nullptr, test_position);
6303 EXPECT_TRUE(test_position->IsTextPosition());
6304 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6305 EXPECT_EQ(1, test_position->text_offset());
6306 test_position = text_position->CreatePreviousCharacterPosition(
6308 EXPECT_NE(
nullptr, test_position);
6309 EXPECT_TRUE(test_position->IsTextPosition());
6310 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6311 EXPECT_EQ(0, test_position->text_offset());
6312 test_position = text_position->CreatePreviousCharacterPosition(
6314 EXPECT_NE(
nullptr, test_position);
6315 EXPECT_TRUE(test_position->IsTextPosition());
6316 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6317 EXPECT_EQ(0, test_position->text_offset());
6318 test_position = text_position->CreatePreviousCharacterPosition(
6320 EXPECT_NE(
nullptr, test_position);
6321 EXPECT_TRUE(test_position->IsTextPosition());
6322 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6323 EXPECT_EQ(0, test_position->text_offset());
6326 GetTreeID(), inline_box2_.id, 0 ,
6328 ASSERT_NE(
nullptr, text_position);
6329 ASSERT_TRUE(text_position->IsTextPosition());
6331 test_position = text_position->CreatePreviousCharacterPosition(
6333 EXPECT_NE(
nullptr, test_position);
6334 EXPECT_TRUE(test_position->IsTextPosition());
6335 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6336 EXPECT_EQ(0, test_position->text_offset());
6337 test_position = text_position->CreatePreviousCharacterPosition(
6339 EXPECT_NE(
nullptr, test_position);
6340 EXPECT_TRUE(test_position->IsTextPosition());
6341 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6342 EXPECT_EQ(0, test_position->text_offset());
6343 test_position = text_position->CreatePreviousCharacterPosition(
6345 EXPECT_NE(
nullptr, test_position);
6346 EXPECT_TRUE(test_position->IsTextPosition());
6347 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6348 EXPECT_EQ(0, test_position->text_offset());
6349 test_position = text_position->CreatePreviousCharacterPosition(
6351 EXPECT_NE(
nullptr, test_position);
6352 EXPECT_TRUE(test_position->IsTextPosition());
6353 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6354 EXPECT_EQ(0, test_position->text_offset());
6357 GetTreeID(), inline_box1_.id, 0 ,
6359 ASSERT_NE(
nullptr, text_position);
6360 ASSERT_TRUE(text_position->IsTextPosition());
6362 test_position = text_position->CreatePreviousCharacterPosition(
6364 EXPECT_NE(
nullptr, test_position);
6365 EXPECT_TRUE(test_position->IsNullPosition());
6366 test_position = text_position->CreatePreviousCharacterPosition(
6368 EXPECT_NE(
nullptr, test_position);
6369 EXPECT_TRUE(test_position->IsTextPosition());
6370 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6371 EXPECT_EQ(0, test_position->text_offset());
6372 test_position = text_position->CreatePreviousCharacterPosition(
6374 EXPECT_NE(
nullptr, test_position);
6375 EXPECT_TRUE(test_position->IsTextPosition());
6376 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6377 EXPECT_EQ(0, test_position->text_offset());
6378 test_position = text_position->CreatePreviousCharacterPosition(
6380 EXPECT_NE(
nullptr, test_position);
6381 EXPECT_TRUE(test_position->IsTextPosition());
6382 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6383 EXPECT_EQ(0, test_position->text_offset());
6386 GetTreeID(), check_box_.id, 0 ,
6388 ASSERT_NE(
nullptr, text_position);
6389 ASSERT_TRUE(text_position->IsTextPosition());
6391 test_position = text_position->CreatePreviousCharacterPosition(
6393 EXPECT_NE(
nullptr, test_position);
6394 EXPECT_TRUE(test_position->IsNullPosition());
6395 test_position = text_position->CreatePreviousCharacterPosition(
6397 EXPECT_NE(
nullptr, test_position);
6398 EXPECT_TRUE(test_position->IsTextPosition());
6399 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6400 EXPECT_EQ(0, test_position->text_offset());
6401 test_position = text_position->CreatePreviousCharacterPosition(
6403 EXPECT_NE(
nullptr, test_position);
6404 EXPECT_TRUE(test_position->IsTextPosition());
6405 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6406 EXPECT_EQ(0, test_position->text_offset());
6407 test_position = text_position->CreatePreviousCharacterPosition(
6409 EXPECT_NE(
nullptr, test_position);
6410 EXPECT_TRUE(test_position->IsTextPosition());
6411 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6412 EXPECT_EQ(0, test_position->text_offset());
6415 GetTreeID(), text_field_.id, 1 ,
6417 ASSERT_NE(
nullptr, text_position);
6418 ASSERT_TRUE(text_position->IsTextPosition());
6420 test_position = text_position->CreatePreviousCharacterPosition(
6422 EXPECT_NE(
nullptr, test_position);
6423 EXPECT_TRUE(test_position->IsTextPosition());
6424 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6425 EXPECT_EQ(0, test_position->text_offset());
6430TEST_F(AXPositionTest, CreateNextCharacterPositionAtGraphemeBoundary) {
6433 <<
"Skipping, current accessibility library cannot handle grapheme";
6435 std::vector<int> text_offsets;
6436 SetTree(CreateMultilingualDocument(&text_offsets));
6439 GetTreeID(), GetTree()->root()->
id(), 0 ,
6441 ASSERT_NE(
nullptr, test_position);
6442 ASSERT_TRUE(test_position->IsTextPosition());
6444 for (
auto iter = (text_offsets.begin() + 1); iter != text_offsets.end();
6446 const int text_offset = *iter;
6447 test_position = test_position->CreateNextCharacterPosition(
6449 ASSERT_NE(
nullptr, test_position);
6450 EXPECT_TRUE(test_position->IsTextPosition());
6453 message <<
"Expecting character boundary at " << text_offset <<
" in\n"
6457 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6458 EXPECT_EQ(text_offset, test_position->text_offset());
6463 GetTreeID(), GetTree()->root()->
id(), 3 ,
6465 test_position = test_position->CreateNextCharacterPosition(
6467 ASSERT_NE(
nullptr, test_position);
6468 EXPECT_TRUE(test_position->IsTextPosition());
6469 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6470 EXPECT_EQ(3, test_position->text_offset());
6474 GetTreeID(), GetTree()->root()->
id(), 4 ,
6476 test_position = test_position->CreateNextCharacterPosition(
6478 ASSERT_NE(
nullptr, test_position);
6479 EXPECT_TRUE(test_position->IsTextPosition());
6480 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6481 EXPECT_EQ(5, test_position->text_offset());
6485 GetTreeID(), GetTree()->root()->
id(), 9 ,
6487 test_position = test_position->CreateNextCharacterPosition(
6489 ASSERT_NE(
nullptr, test_position);
6490 EXPECT_TRUE(test_position->IsTextPosition());
6491 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6492 EXPECT_EQ(9, test_position->text_offset());
6496 GetTreeID(), GetTree()->root()->
id(), 10 ,
6498 test_position = test_position->CreateNextCharacterPosition(
6500 ASSERT_NE(
nullptr, test_position);
6501 EXPECT_TRUE(test_position->IsTextPosition());
6502 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6503 EXPECT_EQ(12, test_position->text_offset());
6509TEST_F(AXPositionTest, CreatePreviousCharacterPositionAtGraphemeBoundary) {
6512 <<
"Skipping, current accessibility library cannot handle grapheme";
6514 std::vector<int> text_offsets;
6515 SetTree(CreateMultilingualDocument(&text_offsets));
6519 text_offsets.back() ,
6521 ASSERT_NE(
nullptr, test_position);
6522 ASSERT_TRUE(test_position->IsTextPosition());
6524 for (
auto iter = (text_offsets.rbegin() + 1); iter != text_offsets.rend();
6526 const int text_offset = *iter;
6527 test_position = test_position->CreatePreviousCharacterPosition(
6529 ASSERT_NE(
nullptr, test_position);
6530 EXPECT_TRUE(test_position->IsTextPosition());
6533 message <<
"Expecting character boundary at " << text_offset <<
" in\n"
6537 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6538 EXPECT_EQ(text_offset, test_position->text_offset());
6543 GetTreeID(), GetTree()->root()->
id(), 3 ,
6545 test_position = test_position->CreatePreviousCharacterPosition(
6547 ASSERT_NE(
nullptr, test_position);
6548 EXPECT_TRUE(test_position->IsTextPosition());
6549 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6550 EXPECT_EQ(3, test_position->text_offset());
6554 GetTreeID(), GetTree()->root()->
id(), 4 ,
6556 test_position = test_position->CreatePreviousCharacterPosition(
6558 ASSERT_NE(
nullptr, test_position);
6559 EXPECT_TRUE(test_position->IsTextPosition());
6560 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6561 EXPECT_EQ(3, test_position->text_offset());
6565 GetTreeID(), GetTree()->root()->
id(), 9 ,
6567 test_position = test_position->CreatePreviousCharacterPosition(
6569 ASSERT_NE(
nullptr, test_position);
6570 EXPECT_TRUE(test_position->IsTextPosition());
6571 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6572 EXPECT_EQ(9, test_position->text_offset());
6576 GetTreeID(), GetTree()->root()->
id(), 10 ,
6578 test_position = test_position->CreatePreviousCharacterPosition(
6580 ASSERT_NE(
nullptr, test_position);
6581 EXPECT_TRUE(test_position->IsTextPosition());
6582 EXPECT_EQ(GetTree()->root()->
id(), test_position->anchor_id());
6583 EXPECT_EQ(9, test_position->text_offset());
6589TEST_F(AXPositionTest, ReciprocalCreateNextAndPreviousCharacterPosition) {
6591 GetTreeID(), root_.id, 0 );
6593 ASSERT_NE(
nullptr, text_position);
6594 ASSERT_TRUE(text_position->IsTextPosition());
6596 size_t next_character_moves = 0;
6597 while (!text_position->IsNullPosition()) {
6599 text_position->CreateNextCharacterPosition(
6601 ASSERT_NE(
nullptr, moved_position);
6603 text_position = std::move(moved_position);
6604 ++next_character_moves;
6608 GetTreeID(), root_.id, root_.child_ids.size() );
6609 text_position = tree_position->AsTextPosition();
6610 ASSERT_NE(
nullptr, text_position);
6611 ASSERT_TRUE(text_position->IsTextPosition());
6613 size_t previous_character_moves = 0;
6614 while (!text_position->IsNullPosition()) {
6616 text_position->CreatePreviousCharacterPosition(
6618 ASSERT_NE(
nullptr, moved_position);
6620 text_position = std::move(moved_position);
6621 ++previous_character_moves;
6624 EXPECT_EQ(next_character_moves, previous_character_moves);
6625 EXPECT_EQ(strlen(TEXT_VALUE), next_character_moves - 1);
6628TEST_F(AXPositionTest, CreateNextAndPreviousWordStartPositionWithNullPosition) {
6630 ASSERT_NE(
nullptr, null_position);
6631 TestPositionType test_position = null_position->CreateNextWordStartPosition(
6633 EXPECT_NE(
nullptr, test_position);
6634 EXPECT_TRUE(test_position->IsNullPosition());
6635 test_position = null_position->CreatePreviousWordStartPosition(
6637 EXPECT_NE(
nullptr, test_position);
6638 EXPECT_TRUE(test_position->IsNullPosition());
6641TEST_F(AXPositionTest, CreateNextAndPreviousWordEndPositionWithNullPosition) {
6643 ASSERT_NE(
nullptr, null_position);
6646 EXPECT_NE(
nullptr, test_position);
6647 EXPECT_TRUE(test_position->IsNullPosition());
6648 test_position = null_position->CreatePreviousWordEndPosition(
6650 EXPECT_NE(
nullptr, test_position);
6651 EXPECT_TRUE(test_position->IsNullPosition());
6656 ASSERT_NE(
nullptr, null_position1);
6658 ASSERT_NE(
nullptr, null_position2);
6659 EXPECT_EQ(*null_position1, *null_position2);
6663 GetTreeID(), root_.id, 0 );
6664 ASSERT_NE(
nullptr, button_position1);
6666 GetTreeID(), root_.id, 0 );
6667 ASSERT_NE(
nullptr, button_position2);
6668 EXPECT_EQ(*button_position1, *button_position2);
6673 GetTreeID(), root_.id, 4 );
6674 ASSERT_NE(
nullptr, tree_position1);
6677 ASSERT_NE(
nullptr, tree_position2);
6678 EXPECT_EQ(*tree_position1, *tree_position2);
6684 ASSERT_NE(
nullptr, tree_position1);
6687 ASSERT_NE(
nullptr, tree_position2);
6688 EXPECT_NE(*tree_position1, *tree_position2);
6692 GetTreeID(), text_field_.id, 3 );
6693 ASSERT_NE(
nullptr, tree_position1);
6695 GetTreeID(), text_field_.id, 3 );
6696 ASSERT_NE(
nullptr, tree_position2);
6697 EXPECT_EQ(*tree_position1, *tree_position2);
6702 ASSERT_NE(
nullptr, tree_position1);
6705 ASSERT_NE(
nullptr, tree_position2);
6706 EXPECT_EQ(*tree_position1, *tree_position2);
6711 GetTreeID(), inline_box1_.id, 15 ,
6713 ASSERT_NE(
nullptr, text_position1);
6714 ASSERT_TRUE(text_position1->IsNullPosition());
6716 GetTreeID(), text_field_.id, -1 ,
6718 ASSERT_NE(
nullptr, text_position2);
6719 ASSERT_TRUE(text_position2->IsNullPosition());
6720 EXPECT_EQ(*text_position1, *text_position2);
6723 GetTreeID(), inline_box1_.id, 0 ,
6725 ASSERT_NE(
nullptr, text_position1);
6726 ASSERT_TRUE(text_position1->IsTextPosition());
6728 GetTreeID(), inline_box1_.id, 0 ,
6730 ASSERT_NE(
nullptr, text_position2);
6731 ASSERT_TRUE(text_position2->IsTextPosition());
6732 EXPECT_EQ(*text_position1, *text_position2);
6736 GetTreeID(), inline_box1_.id, 0 ,
6738 ASSERT_NE(
nullptr, text_position2);
6739 ASSERT_TRUE(text_position2->IsTextPosition());
6740 EXPECT_EQ(*text_position1, *text_position2);
6744 GetTreeID(), inline_box1_.id, 5 ,
6746 ASSERT_NE(
nullptr, text_position1);
6747 ASSERT_TRUE(text_position1->IsTextPosition());
6748 EXPECT_NE(*text_position1, *text_position2);
6752 GetTreeID(), line_break_.id, 1 ,
6754 ASSERT_NE(
nullptr, text_position1);
6755 ASSERT_TRUE(text_position1->IsTextPosition());
6757 GetTreeID(), line_break_.id, 1 ,
6759 ASSERT_NE(
nullptr, text_position2);
6760 ASSERT_TRUE(text_position2->IsTextPosition());
6761 EXPECT_EQ(*text_position1, *text_position2);
6766 GetTreeID(), inline_box2_.id, 0 ,
6768 ASSERT_NE(
nullptr, text_position1);
6769 ASSERT_TRUE(text_position1->IsTextPosition());
6771 GetTreeID(), line_break_.id, 1 ,
6773 ASSERT_NE(
nullptr, text_position2);
6774 ASSERT_TRUE(text_position2->IsTextPosition());
6775 EXPECT_EQ(*text_position1, *text_position2);
6780 GetTreeID(), static_text1_.id, 6 ,
6782 ASSERT_NE(
nullptr, text_position1);
6783 ASSERT_TRUE(text_position1->IsTextPosition());
6785 GetTreeID(), inline_box1_.id, 6 ,
6787 ASSERT_NE(
nullptr, text_position2);
6788 ASSERT_TRUE(text_position2->IsTextPosition());
6789 EXPECT_EQ(*text_position1, *text_position2);
6793 GetTreeID(), static_text2_.id, 6 ,
6795 ASSERT_NE(
nullptr, text_position1);
6796 ASSERT_TRUE(text_position1->IsTextPosition());
6798 GetTreeID(), inline_box2_.id, 6 ,
6800 ASSERT_NE(
nullptr, text_position2);
6801 ASSERT_TRUE(text_position2->IsTextPosition());
6805 text_position1->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6807 text_position2->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6809 EXPECT_EQ(*text_position1, *text_position2);
6812TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetSameAnchorId) {
6814 GetTreeID(), root_.id, 0 ,
6816 ASSERT_NE(
nullptr, text_position_one);
6817 ASSERT_TRUE(text_position_one->IsTextPosition());
6820 GetTreeID(), root_.id, 0 ,
6822 ASSERT_NE(
nullptr, text_position_two);
6823 ASSERT_TRUE(text_position_two->IsTextPosition());
6825 ASSERT_TRUE(*text_position_one == *text_position_two);
6826 ASSERT_TRUE(*text_position_two == *text_position_one);
6829TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetDifferentAnchorIdRoot) {
6831 GetTreeID(), root_.id, 0 ,
6833 ASSERT_NE(
nullptr, text_position_one);
6834 ASSERT_TRUE(text_position_one->IsTextPosition());
6837 GetTreeID(), check_box_.id, 0 ,
6839 ASSERT_NE(
nullptr, text_position_two);
6840 ASSERT_TRUE(text_position_two->IsTextPosition());
6842 ASSERT_TRUE(*text_position_one == *text_position_two);
6843 ASSERT_TRUE(*text_position_two == *text_position_one);
6846TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetDifferentAnchorIdLeaf) {
6848 GetTreeID(), button_.id, 0 ,
6850 ASSERT_NE(
nullptr, text_position_one);
6851 ASSERT_TRUE(text_position_one->IsTextPosition());
6854 GetTreeID(), check_box_.id, 0 ,
6856 ASSERT_NE(
nullptr, text_position_two);
6857 ASSERT_TRUE(text_position_two->IsTextPosition());
6859 ASSERT_TRUE(*text_position_one == *text_position_two);
6860 ASSERT_TRUE(*text_position_two == *text_position_one);
6863TEST_F(AXPositionTest, OperatorsLessThanAndGreaterThan) {
6865 ASSERT_NE(
nullptr, null_position1);
6867 ASSERT_NE(
nullptr, null_position2);
6868 EXPECT_FALSE(*null_position1 < *null_position2);
6869 EXPECT_FALSE(*null_position1 > *null_position2);
6872 GetTreeID(), root_.id, 0 );
6873 ASSERT_NE(
nullptr, button_position1);
6875 GetTreeID(), root_.id, 1 );
6876 ASSERT_NE(
nullptr, button_position2);
6877 EXPECT_LT(*button_position1, *button_position2);
6878 EXPECT_GT(*button_position2, *button_position1);
6881 GetTreeID(), text_field_.id, 2 );
6882 ASSERT_NE(
nullptr, tree_position1);
6885 GetTreeID(), text_field_.id, 3 );
6886 ASSERT_NE(
nullptr, tree_position2);
6887 EXPECT_LT(*tree_position1, *tree_position2);
6888 EXPECT_GT(*tree_position2, *tree_position1);
6893 ASSERT_NE(
nullptr, tree_position1);
6896 GetTreeID(), inline_box1_.id, 0 );
6897 ASSERT_NE(
nullptr, tree_position2);
6898 EXPECT_LT(*tree_position1, *tree_position2);
6899 EXPECT_GT(*tree_position2, *tree_position1);
6903 GetTreeID(), inline_box1_.id, 2 ,
6905 ASSERT_NE(
nullptr, text_position1);
6906 ASSERT_TRUE(text_position1->IsTextPosition());
6908 GetTreeID(), inline_box1_.id, 0 ,
6910 ASSERT_NE(
nullptr, text_position2);
6911 ASSERT_TRUE(text_position2->IsTextPosition());
6912 EXPECT_GT(*text_position1, *text_position2);
6913 EXPECT_LT(*text_position2, *text_position1);
6917 GetTreeID(), inline_box1_.id, 0 ,
6919 ASSERT_NE(
nullptr, text_position2);
6920 ASSERT_TRUE(text_position2->IsTextPosition());
6921 EXPECT_GT(*text_position1, *text_position2);
6922 EXPECT_LT(*text_position2, *text_position1);
6926 GetTreeID(), line_break_.id, 1 ,
6928 ASSERT_NE(
nullptr, text_position1);
6929 ASSERT_TRUE(text_position1->IsTextPosition());
6932 GetTreeID(), line_break_.id, 0 ,
6934 ASSERT_NE(
nullptr, text_position2);
6935 ASSERT_TRUE(text_position2->IsTextPosition());
6936 EXPECT_GT(*text_position1, *text_position2);
6937 EXPECT_LT(*text_position2, *text_position1);
6941 GetTreeID(), text_field_.id, 6 ,
6943 ASSERT_NE(
nullptr, text_position1);
6944 ASSERT_TRUE(text_position1->IsTextPosition());
6946 GetTreeID(), inline_box1_.id, 5 ,
6948 ASSERT_NE(
nullptr, text_position2);
6949 ASSERT_TRUE(text_position2->IsTextPosition());
6950 EXPECT_GT(*text_position1, *text_position2);
6951 EXPECT_LT(*text_position2, *text_position1);
6955 GetTreeID(), inline_box2_.id, 0 ,
6957 ASSERT_NE(
nullptr, text_position1);
6958 ASSERT_TRUE(text_position1->IsTextPosition());
6960 GetTreeID(), line_break_.id, 0 ,
6962 ASSERT_NE(
nullptr, text_position2);
6963 ASSERT_TRUE(text_position2->IsTextPosition());
6964 EXPECT_GT(*text_position1, *text_position2);
6965 EXPECT_LT(*text_position2, *text_position1);
6969 GetTreeID(), line_break_.id, 1 ,
6971 ASSERT_NE(
nullptr, text_position2);
6972 ASSERT_TRUE(text_position2->IsTextPosition());
6973 EXPECT_EQ(*text_position1, *text_position2);
6977 GetTreeID(), inline_box2_.id, 6 ,
6979 ASSERT_NE(
nullptr, text_position1);
6980 ASSERT_TRUE(text_position1->IsTextPosition());
6984 text_position1->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6987 GetTreeID(), static_text2_.id, 0 ,
6989 ASSERT_NE(
nullptr, text_position2);
6990 ASSERT_TRUE(text_position2->IsTextPosition());
6991 EXPECT_GT(*text_position1, *text_position2);
6992 EXPECT_LT(*text_position2, *text_position1);
6997 ASSERT_NE(
nullptr, null_position1);
6999 ASSERT_NE(
nullptr, null_position2);
7001 swap(*null_position1, *null_position2);
7002 EXPECT_TRUE(null_position1->IsNullPosition());
7003 EXPECT_TRUE(null_position2->IsNullPosition());
7006 GetTreeID(), root_.id, 2 );
7007 ASSERT_NE(
nullptr, tree_position1);
7009 GetTreeID(), text_field_.id, 3 );
7010 ASSERT_NE(
nullptr, tree_position2);
7012 swap(*tree_position1, *tree_position2);
7013 EXPECT_TRUE(tree_position1->IsTreePosition());
7014 EXPECT_EQ(GetTreeID(), tree_position1->tree_id());
7015 EXPECT_EQ(text_field_.id, tree_position1->anchor_id());
7016 EXPECT_EQ(3, tree_position1->child_index());
7017 EXPECT_TRUE(tree_position1->IsTreePosition());
7018 EXPECT_EQ(GetTreeID(), tree_position2->tree_id());
7019 EXPECT_EQ(root_.id, tree_position2->anchor_id());
7020 EXPECT_EQ(2, tree_position2->child_index());
7022 swap(*tree_position1, *null_position1);
7023 EXPECT_TRUE(tree_position1->IsNullPosition());
7024 EXPECT_TRUE(null_position1->IsTreePosition());
7025 EXPECT_EQ(GetTreeID(), null_position1->tree_id());
7026 EXPECT_EQ(text_field_.id, null_position1->anchor_id());
7027 EXPECT_EQ(3, null_position1->child_index());
7030 GetTreeID(), line_break_.id, 1 ,
7032 ASSERT_NE(
nullptr, text_position);
7034 swap(*text_position, *null_position1);
7035 EXPECT_TRUE(null_position1->IsTextPosition());
7036 EXPECT_EQ(GetTreeID(), text_position->tree_id());
7037 EXPECT_EQ(line_break_.id, null_position1->anchor_id());
7038 EXPECT_EQ(1, null_position1->text_offset());
7040 EXPECT_TRUE(text_position->IsTreePosition());
7041 EXPECT_EQ(GetTreeID(), text_position->tree_id());
7042 EXPECT_EQ(text_field_.id, text_position->anchor_id());
7043 EXPECT_EQ(3, text_position->child_index());
7046TEST_F(AXPositionTest, CreateNextAnchorPosition) {
7056 text_data.
SetName(
"some text");
7059 text_field_data.
id = 3;
7063 empty_text_data.
id = 4;
7068 more_text_data.
id = 5;
7070 more_text_data.
SetName(
"more text");
7072 root_data.
child_ids = {text_data.
id, text_field_data.
id, more_text_data.
id};
7075 SetTree(CreateAXTree({root_data, text_data, text_field_data, empty_text_data,
7081 GetTreeID(), text_data.
id, 8 ,
7083 ASSERT_NE(
nullptr, text_position1);
7084 ASSERT_FALSE(text_position1->CreateNextAnchorPosition()
7085 ->CreateNextAnchorPosition()
7086 ->IsNullPosition());
7089TEST_F(AXPositionTest, CreateLinePositionsMultipleAnchorsInSingleLine) {
7112 static_text1.
id = 2;
7114 inline_block.
id = 4;
7115 static_text2.
id = 5;
7117 static_text3.
id = 7;
7124 static_text1.
SetName(
"before");
7128 inline_box1.
SetName(
"before");
7136 static_text2.
SetName(
"inside");
7140 inline_box2.
SetName(
"inside");
7147 static_text3.
SetName(
"after");
7155 SetTree(CreateAXTree({root, static_text1, inline_box1, inline_block,
7156 static_text2, inline_box2, static_text3, inline_box3}));
7159 GetTreeID(), inline_block.
id, 3 ,
7161 ASSERT_NE(
nullptr, text_position);
7162 ASSERT_TRUE(text_position->IsTextPosition());
7165 text_position->CreateNextLineStartPosition(
7167 ASSERT_NE(
nullptr, next_line_start_position);
7168 EXPECT_TRUE(next_line_start_position->IsTextPosition());
7169 EXPECT_EQ(inline_box3.
id, next_line_start_position->anchor_id());
7170 EXPECT_EQ(5, next_line_start_position->text_offset());
7173 text_position->CreatePreviousLineStartPosition(
7175 ASSERT_NE(
nullptr, previous_line_start_position);
7176 EXPECT_TRUE(previous_line_start_position->IsTextPosition());
7177 EXPECT_EQ(inline_box1.
id, previous_line_start_position->anchor_id());
7178 EXPECT_EQ(0, previous_line_start_position->text_offset());
7181 text_position->CreateNextLineEndPosition(
7183 ASSERT_NE(
nullptr, next_line_end_position);
7184 EXPECT_TRUE(next_line_end_position->IsTextPosition());
7185 EXPECT_EQ(inline_box3.
id, next_line_end_position->anchor_id());
7186 EXPECT_EQ(5, next_line_end_position->text_offset());
7189 text_position->CreatePreviousLineEndPosition(
7191 ASSERT_NE(
nullptr, previous_line_end_position);
7192 EXPECT_TRUE(previous_line_end_position->IsTextPosition());
7193 EXPECT_EQ(inline_box1.
id, previous_line_end_position->anchor_id());
7194 EXPECT_EQ(0, previous_line_end_position->text_offset());
7197TEST_F(AXPositionTest, CreateNextWordPositionInList) {
7232 list_marker1.
id = 4;
7233 static_text1.
id = 5;
7235 static_text2.
id = 7;
7238 list_marker2.
id = 10;
7239 static_text3.
id = 11;
7240 inline_box3.
id = 12;
7241 static_text4.
id = 13;
7242 inline_box4.
id = 14;
7265 std::vector<int32_t>{0});
7267 std::vector<int32_t>{3});
7270 static_text2.
SetName(
"first item");
7274 inline_box2.
SetName(
"first item");
7276 std::vector<int32_t>{0, 6});
7278 std::vector<int32_t>{5});
7295 std::vector<int32_t>{0});
7297 std::vector<int32_t>{3});
7300 static_text4.
SetName(
"second item");
7304 inline_box4.
SetName(
"second item");
7306 std::vector<int32_t>{0, 7});
7308 std::vector<int32_t>{6});
7310 SetTree(CreateAXTree({root, list, list_item1, list_marker1, static_text1,
7311 inline_box1, static_text2, inline_box2, list_item2,
7312 list_marker2, static_text3, inline_box3, static_text4,
7316 GetTreeID(), inline_box1.
id, 0 ,
7318 ASSERT_NE(
nullptr, text_position);
7319 ASSERT_TRUE(text_position->IsTextPosition());
7320 ASSERT_EQ(inline_box1.
id, text_position->anchor_id());
7321 ASSERT_EQ(0, text_position->text_offset());
7324 text_position = text_position->CreateNextWordStartPosition(
7326 ASSERT_NE(
nullptr, text_position);
7327 ASSERT_TRUE(text_position->IsTextPosition());
7328 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7329 ASSERT_EQ(0, text_position->text_offset());
7332 text_position = text_position->CreateNextWordStartPosition(
7334 ASSERT_NE(
nullptr, text_position);
7335 ASSERT_TRUE(text_position->IsTextPosition());
7336 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7337 ASSERT_EQ(6, text_position->text_offset());
7340 text_position = text_position->CreateNextWordStartPosition(
7342 ASSERT_NE(
nullptr, text_position);
7343 ASSERT_TRUE(text_position->IsTextPosition());
7344 ASSERT_EQ(inline_box3.
id, text_position->anchor_id());
7345 ASSERT_EQ(0, text_position->text_offset());
7348 text_position = text_position->CreateNextWordStartPosition(
7350 ASSERT_NE(
nullptr, text_position);
7351 ASSERT_TRUE(text_position->IsTextPosition());
7352 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7353 ASSERT_EQ(0, text_position->text_offset());
7356 text_position = text_position->CreateNextWordStartPosition(
7358 ASSERT_NE(
nullptr, text_position);
7359 ASSERT_TRUE(text_position->IsTextPosition());
7360 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7361 ASSERT_EQ(7, text_position->text_offset());
7364TEST_F(AXPositionTest, CreatePreviousWordPositionInList) {
7399 list_marker1.
id = 4;
7400 static_text1.
id = 5;
7402 static_text2.
id = 7;
7405 list_marker2.
id = 10;
7406 static_text3.
id = 11;
7407 inline_box3.
id = 12;
7408 static_text4.
id = 13;
7409 inline_box4.
id = 14;
7432 std::vector<int32_t>{0});
7434 std::vector<int32_t>{3});
7437 static_text2.
SetName(
"first item");
7441 inline_box2.
SetName(
"first item");
7443 std::vector<int32_t>{0, 6});
7445 std::vector<int32_t>{5});
7462 std::vector<int32_t>{0});
7464 std::vector<int32_t>{3});
7467 static_text4.
SetName(
"second item");
7471 inline_box4.
SetName(
"second item");
7473 std::vector<int32_t>{0, 7});
7475 std::vector<int32_t>{6});
7477 SetTree(CreateAXTree({root, list, list_item1, list_marker1, static_text1,
7478 inline_box1, static_text2, inline_box2, list_item2,
7479 list_marker2, static_text3, inline_box3, static_text4,
7483 GetTreeID(), inline_box4.
id, 11 ,
7485 ASSERT_NE(
nullptr, text_position);
7486 ASSERT_TRUE(text_position->IsTextPosition());
7487 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7488 ASSERT_EQ(11, text_position->text_offset());
7491 text_position = text_position->CreatePreviousWordStartPosition(
7493 ASSERT_NE(
nullptr, text_position);
7494 ASSERT_TRUE(text_position->IsTextPosition());
7495 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7496 ASSERT_EQ(7, text_position->text_offset());
7499 text_position = text_position->CreatePreviousWordStartPosition(
7501 ASSERT_NE(
nullptr, text_position);
7502 ASSERT_TRUE(text_position->IsTextPosition());
7503 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7504 ASSERT_EQ(0, text_position->text_offset());
7507 text_position = text_position->CreatePreviousWordStartPosition(
7509 ASSERT_NE(
nullptr, text_position);
7510 ASSERT_TRUE(text_position->IsTextPosition());
7511 ASSERT_EQ(inline_box3.
id, text_position->anchor_id());
7512 ASSERT_EQ(0, text_position->text_offset());
7515 text_position = text_position->CreatePreviousWordStartPosition(
7517 ASSERT_NE(
nullptr, text_position);
7518 ASSERT_TRUE(text_position->IsTextPosition());
7519 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7520 ASSERT_EQ(6, text_position->text_offset());
7523 text_position = text_position->CreatePreviousWordStartPosition(
7525 ASSERT_NE(
nullptr, text_position);
7526 ASSERT_TRUE(text_position->IsTextPosition());
7527 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7528 ASSERT_EQ(0, text_position->text_offset());
7531 text_position = text_position->CreatePreviousWordStartPosition(
7533 ASSERT_NE(
nullptr, text_position);
7534 ASSERT_TRUE(text_position->IsTextPosition());
7535 ASSERT_EQ(inline_box1.
id, text_position->anchor_id());
7536 ASSERT_EQ(0, text_position->text_offset());
7539TEST_F(AXPositionTest, EmptyObjectReplacedByCharacterTextNavigation) {
7574 static_text_2.
id = 2;
7575 inline_box_3.
id = 3;
7576 text_field_4.
id = 4;
7577 generic_container_5.
id = 5;
7578 static_text_6.
id = 6;
7579 inline_box_7.
id = 7;
7581 static_text_9.
id = 9;
7582 inline_box_10.
id = 10;
7583 generic_container_11.
id = 11;
7584 generic_container_12.
id = 12;
7585 static_text_13.
id = 13;
7587 generic_container_15.
id = 15;
7591 static_text_6.
id, heading_8.
id,
7592 generic_container_11.
id, generic_container_12.
id,
7593 static_text_13.
id, button_14.
id};
7596 static_text_2.
SetName(
"Hello ");
7600 inline_box_3.
SetName(
"Hello ");
7602 std::vector<int32_t>{0});
7604 std::vector<int32_t>{6});
7607 text_field_4.
child_ids = {generic_container_5.
id};
7612 static_text_6.
SetName(
" world");
7616 inline_box_7.
SetName(
" world");
7618 std::vector<int32_t>{1});
7620 std::vector<int32_t>{6});
7627 static_text_9.
SetName(
"3.14");
7630 inline_box_10.
SetName(
"3.14");
7642 static_text_13.
SetName(
"hey");
7650 SetTree(CreateAXTree({root_1, static_text_2, inline_box_3, text_field_4,
7651 generic_container_5, static_text_6, inline_box_7,
7652 heading_8, static_text_9, inline_box_10,
7653 generic_container_11, generic_container_12,
7654 static_text_13, button_14, generic_container_15}));
7658 GetTreeID(), inline_box_3.
id, 0 ,
7663 std::string expectations =
7664 "TextPosition anchor_id=5 text_offset=0 affinity=downstream "
7665 "annotated_text=<\xEF\xBF\xBC>";
7666 ASSERT_EQ(result_position->ToString(), expectations);
7668 position = std::move(result_position);
7672 "TextPosition anchor_id=7 text_offset=1 affinity=downstream "
7673 "annotated_text= <w>orld";
7674 ASSERT_EQ(result_position->ToString(), expectations);
7677 position = std::move(result_position);
7678 result_position = position->CreatePreviousWordStartPosition(
7681 "TextPosition anchor_id=5 text_offset=0 affinity=downstream "
7682 "annotated_text=<\xEF\xBF\xBC>";
7683 ASSERT_EQ(result_position->ToString(), expectations);
7685 position = std::move(result_position);
7686 result_position = position->CreatePreviousWordStartPosition(
7689 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
7690 "annotated_text=<H>ello ";
7691 ASSERT_EQ(result_position->ToString(), expectations);
7694 position = std::move(result_position);
7698 "TextPosition anchor_id=3 text_offset=6 affinity=downstream "
7699 "annotated_text=Hello <>";
7700 ASSERT_EQ(result_position->ToString(), expectations);
7702 position = std::move(result_position);
7706 "TextPosition anchor_id=5 text_offset=1 affinity=downstream "
7707 "annotated_text=\xEF\xBF\xBC<>";
7708 ASSERT_EQ(result_position->ToString(), expectations);
7710 position = std::move(result_position);
7714 "TextPosition anchor_id=7 text_offset=6 affinity=downstream "
7715 "annotated_text= world<>";
7716 ASSERT_EQ(result_position->ToString(), expectations);
7719 position = std::move(result_position);
7720 result_position = position->CreatePreviousWordEndPosition(
7723 "TextPosition anchor_id=5 text_offset=1 affinity=downstream "
7724 "annotated_text=\xEF\xBF\xBC<>";
7725 ASSERT_EQ(result_position->ToString(), expectations);
7727 position = std::move(result_position);
7728 result_position = position->CreatePreviousWordEndPosition(
7731 "TextPosition anchor_id=3 text_offset=6 affinity=downstream "
7732 "annotated_text=Hello <>";
7733 ASSERT_EQ(result_position->ToString(), expectations);
7737 GetTreeID(), generic_container_5.
id, 0 ,
7740 std::u16string expected_text;
7742 ASSERT_EQ(expected_text, position->GetText());
7747 GetTreeID(), root_1.
id, 0 ,
7754 ASSERT_EQ(expected_text, position->GetText());
7758 GetTreeID(), generic_container_5.
id, 0 ,
7761 ASSERT_EQ(1, position->MaxTextOffset());
7765 position = position->CreateParentPosition();
7767 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
7768 "annotated_text=<\xEF\xBF\xBC>";
7769 ASSERT_EQ(position->ToString(), expectations);
7770 ASSERT_EQ(1, position->MaxTextOffset());
7772 position = position->CreateParentPosition();
7774 "TextPosition anchor_id=1 text_offset=6 affinity=downstream "
7775 "annotated_text=Hello <\xEF\xBF\xBC> "
7776 "world3.14\xEF\xBF\xBChey\xEF\xBF\xBC";
7777 ASSERT_EQ(position->ToString(), expectations);
7778 ASSERT_EQ(22, position->MaxTextOffset());
7783 GetTreeID(), root_1.
id, 0 ,
7785 ASSERT_EQ(22, position->MaxTextOffset());
7795 GetTreeID(), generic_container_12.
id, 0 ,
7797 ASSERT_NE(
nullptr, text_position);
7799 text_position = text_position->CreatePreviousFormatStartPosition(
7801 EXPECT_NE(
nullptr, text_position);
7802 EXPECT_TRUE(text_position->IsTextPosition());
7803 EXPECT_EQ(generic_container_12.
id, text_position->anchor_id());
7804 EXPECT_EQ(0, text_position->text_offset());
7815 GetTreeID(), static_text_13.
id, 3 ,
7817 ASSERT_NE(
nullptr, text_position);
7819 text_position = text_position->CreateNextParagraphEndPosition(
7821 EXPECT_NE(
nullptr, text_position);
7822 EXPECT_TRUE(text_position->IsTextPosition());
7823 EXPECT_TRUE(text_position->IsLeafTextPosition());
7824 EXPECT_EQ(button_14.
id, text_position->anchor_id());
7825 EXPECT_EQ(1, text_position->text_offset());
7828TEST_F(AXPositionTest, TextNavigationWithCollapsedCombobox) {
7854 static_text_2.
id = 2;
7855 inline_box_3.
id = 3;
7856 popup_button_4.
id = 4;
7857 menu_list_popup_5.
id = 5;
7858 menu_list_option_6.
id = 6;
7859 static_text_7.
id = 7;
7860 inline_box_8.
id = 8;
7863 root_1.
child_ids = {static_text_2.
id, popup_button_4.
id, static_text_7.
id};
7876 popup_button_4.
child_ids = {menu_list_popup_5.
id};
7880 menu_list_popup_5.
child_ids = {menu_list_option_6.
id};
7883 menu_list_option_6.
SetName(
"Option");
7886 static_text_7.
SetName(
"3.14");
7895 SetTree(CreateAXTree({root_1, static_text_2, inline_box_3, popup_button_4,
7896 menu_list_popup_5, menu_list_option_6, static_text_7,
7902 ASSERT_NE(
nullptr, position);
7904 position = position->CreateNextParagraphStartPosition(
7906 ASSERT_NE(
nullptr, position);
7907 EXPECT_EQ(popup_button_4.
id, position->anchor_id());
7908 EXPECT_EQ(0, position->text_offset());
7910 position = position->CreateNextParagraphStartPosition(
7912 ASSERT_NE(
nullptr, position);
7913 EXPECT_EQ(inline_box_8.
id, position->anchor_id());
7914 EXPECT_EQ(0, position->text_offset());
7919 ASSERT_NE(
nullptr, position);
7921 position = position->CreatePreviousParagraphEndPosition(
7923 ASSERT_NE(
nullptr, position);
7924 EXPECT_EQ(popup_button_4.
id, position->anchor_id());
7927 EXPECT_EQ(1, position->text_offset());
7929 position = position->CreatePreviousParagraphEndPosition(
7931 ASSERT_NE(
nullptr, position);
7932 EXPECT_EQ(inline_box_3.
id, position->anchor_id());
7933 EXPECT_EQ(2, position->text_offset());
7939 update.
nodes = {popup_button_4};
7940 ASSERT_TRUE(GetTree()->Unserialize(update));
7945 ASSERT_NE(
nullptr, position);
7947 position = position->CreateNextParagraphStartPosition(
7949 ASSERT_NE(
nullptr, position);
7950 EXPECT_EQ(menu_list_option_6.
id, position->anchor_id());
7951 EXPECT_EQ(0, position->text_offset());
7953 position = position->CreateNextParagraphStartPosition(
7955 ASSERT_NE(
nullptr, position);
7956 EXPECT_EQ(inline_box_8.
id, position->anchor_id());
7957 EXPECT_EQ(0, position->text_offset());
7962 ASSERT_NE(
nullptr, position);
7964 position = position->CreatePreviousParagraphEndPosition(
7966 ASSERT_NE(
nullptr, position);
7967 EXPECT_EQ(menu_list_option_6.
id, position->anchor_id());
7968 EXPECT_EQ(1, position->text_offset());
7970 position = position->CreatePreviousParagraphEndPosition(
7972 ASSERT_NE(
nullptr, position);
7973 EXPECT_EQ(inline_box_3.
id, position->anchor_id());
7974 EXPECT_EQ(2, position->text_offset());
7981TEST_P(AXPositionExpandToEnclosingTextBoundaryTestWithParam,
7982 TextPositionBeforeLine2) {
7986 GetTreeID(), text_field_.id, 7 ,
7988 ASSERT_TRUE(text_position->IsTextPosition());
7990 GetParam().boundary, GetParam().expand_behavior);
7991 EXPECT_EQ(GetParam().expected_anchor_position, range.anchor()->ToString());
7992 EXPECT_EQ(GetParam().expected_focus_position, range.focus()->ToString());
7995TEST_P(AXPositionCreatePositionAtTextBoundaryTestWithParam,
7996 TextPositionBeforeStaticText) {
7998 GetTreeID(), static_text2_.id, 0 ,
8000 ASSERT_TRUE(text_position->IsTextPosition());
8001 text_position = text_position->CreatePositionAtTextBoundary(
8002 GetParam().boundary, GetParam().direction, GetParam().boundary_behavior);
8003 EXPECT_NE(
nullptr, text_position);
8004 EXPECT_EQ(GetParam().expected_text_position, text_position->ToString());
8008 TraverseTreeStartingWithAffinityDownstream) {
8010 GetTreeID(), GetParam().start_node_id, GetParam().start_offset,
8012 ASSERT_TRUE(text_position->IsTextPosition());
8013 for (
const std::string& expectation : GetParam().expectations) {
8014 text_position = GetParam().TestMethod(text_position);
8015 EXPECT_NE(
nullptr, text_position);
8016 EXPECT_EQ(expectation, text_position->ToString());
8021 TraverseTreeStartingWithAffinityUpstream) {
8023 GetTreeID(), GetParam().start_node_id, GetParam().start_offset,
8025 ASSERT_TRUE(text_position->IsTextPosition());
8026 for (
const std::string& expectation : GetParam().expectations) {
8027 text_position = GetParam().TestMethod(text_position);
8028 EXPECT_NE(
nullptr, text_position);
8029 EXPECT_EQ(expectation, text_position->ToString());
8038 ExpandToEnclosingTextBoundary,
8039 AXPositionExpandToEnclosingTextBoundaryTestWithParam,
8041 ExpandToEnclosingTextBoundaryTestParam{
8044 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8045 "annotated_text=Line 1<\n>Line 2",
8046 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8047 "annotated_text=Line 1\n<L>ine 2"},
8048 ExpandToEnclosingTextBoundaryTestParam{
8051 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8052 "annotated_text=Line 1\n<L>ine 2",
8053 "TextPosition anchor_id=4 text_offset=8 affinity=downstream "
8054 "annotated_text=Line 1\nL<i>ne 2"},
8055 ExpandToEnclosingTextBoundaryTestParam{
8057 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8058 "annotated_text=<L>ine 1\nLine 2",
8059 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8060 "annotated_text=Line 1\nLine 2<>"},
8061 ExpandToEnclosingTextBoundaryTestParam{
8064 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8065 "annotated_text=<L>ine 1\nLine 2",
8066 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8067 "annotated_text=Line 1\nLine 2<>"},
8068 ExpandToEnclosingTextBoundaryTestParam{
8071 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8072 "annotated_text=Line 1<\n>Line 2",
8073 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8074 "annotated_text=Line 1\nLine 2<>"},
8075 ExpandToEnclosingTextBoundaryTestParam{
8078 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8079 "annotated_text=Line 1<\n>Line 2",
8080 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8081 "annotated_text=Line 1\nLine 2<>"},
8082 ExpandToEnclosingTextBoundaryTestParam{
8085 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8086 "annotated_text=<L>ine 1\nLine 2",
8087 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8088 "annotated_text=Line 1\n<L>ine 2"},
8089 ExpandToEnclosingTextBoundaryTestParam{
8092 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8093 "annotated_text=Line 1\n<L>ine 2",
8094 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8095 "annotated_text=Line 1\nLine 2<>"},
8096 ExpandToEnclosingTextBoundaryTestParam{
8099 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8100 "annotated_text=<L>ine 1\nLine 2",
8101 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8102 "annotated_text=Line 1<\n>Line 2"},
8103 ExpandToEnclosingTextBoundaryTestParam{
8106 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8107 "annotated_text=Line 1\n<L>ine 2",
8108 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8109 "annotated_text=Line 1\nLine 2<>"},
8110 ExpandToEnclosingTextBoundaryTestParam{
8112 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8113 "annotated_text=<L>ine 1\nLine 2",
8114 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8115 "annotated_text=Line 1\nLine 2<>"},
8116 ExpandToEnclosingTextBoundaryTestParam{
8119 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8120 "annotated_text=<L>ine 1\nLine 2",
8121 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8122 "annotated_text=Line 1\nLine 2<>"},
8123 ExpandToEnclosingTextBoundaryTestParam{
8126 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8127 "annotated_text=<L>ine 1\nLine 2",
8128 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8129 "annotated_text=Line 1\n<L>ine 2"},
8130 ExpandToEnclosingTextBoundaryTestParam{
8133 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8134 "annotated_text=Line 1\n<L>ine 2",
8135 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8136 "annotated_text=Line 1\nLine 2<>"},
8137 ExpandToEnclosingTextBoundaryTestParam{
8140 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8141 "annotated_text=<L>ine 1\nLine 2",
8142 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8143 "annotated_text=Line 1\n<L>ine 2"},
8144 ExpandToEnclosingTextBoundaryTestParam{
8147 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8148 "annotated_text=Line 1\n<L>ine 2",
8149 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8150 "annotated_text=Line 1\nLine 2<>"},
8151 ExpandToEnclosingTextBoundaryTestParam{
8154 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8155 "annotated_text=<L>ine 1\nLine 2",
8156 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8157 "annotated_text=Line 1\n<L>ine 2"},
8158 ExpandToEnclosingTextBoundaryTestParam{
8161 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8162 "annotated_text=Line 1\n<L>ine 2",
8163 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8164 "annotated_text=Line 1\nLine 2<>"},
8166 ExpandToEnclosingTextBoundaryTestParam{
8169 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8170 "annotated_text=<L>ine 1\nLine 2",
8171 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8172 "annotated_text=Line 2<>"},
8173 ExpandToEnclosingTextBoundaryTestParam{
8176 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8177 "annotated_text=<L>ine 1\nLine 2",
8178 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8179 "annotated_text=Line 2<>"},
8180 ExpandToEnclosingTextBoundaryTestParam{
8183 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8184 "annotated_text=Line 1<\n>Line 2",
8185 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8186 "annotated_text=Line 1\nLine< >2"},
8187 ExpandToEnclosingTextBoundaryTestParam{
8190 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8191 "annotated_text=Line 1<\n>Line 2",
8192 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8193 "annotated_text=Line 1\nLine< >2"},
8194 ExpandToEnclosingTextBoundaryTestParam{
8197 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
8198 "annotated_text=Line <1>\nLine 2",
8199 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8200 "annotated_text=Line 1\n<L>ine 2"},
8201 ExpandToEnclosingTextBoundaryTestParam{
8204 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8205 "annotated_text=Line 1\n<L>ine 2",
8206 "TextPosition anchor_id=4 text_offset=12 affinity=downstream "
8207 "annotated_text=Line 1\nLine <2>"},
8208 ExpandToEnclosingTextBoundaryTestParam{
8211 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
8212 "annotated_text=Line <1>\nLine 2",
8213 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8214 "annotated_text=Line 1<\n>Line 2"},
8215 ExpandToEnclosingTextBoundaryTestParam{
8218 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8219 "annotated_text=Line 1\n<L>ine 2",
8220 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8221 "annotated_text=Line 1\nLine< >2"}));
8226 CreatePositionAtTextBoundary,
8227 AXPositionCreatePositionAtTextBoundaryTestWithParam,
8229 CreatePositionAtTextBoundaryTestParam{
8233 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8234 "annotated_text=<\n>"},
8235 CreatePositionAtTextBoundaryTestParam{
8239 "TextPosition anchor_id=8 text_offset=1 affinity=downstream "
8240 "annotated_text=L<i>ne 2"},
8241 CreatePositionAtTextBoundaryTestParam{
8245 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8246 "annotated_text=<\n>"},
8247 CreatePositionAtTextBoundaryTestParam{
8251 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8252 "annotated_text=Line 2<>"},
8253 CreatePositionAtTextBoundaryTestParam{
8257 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8258 "annotated_text=<\n>"},
8259 CreatePositionAtTextBoundaryTestParam{
8263 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8264 "annotated_text=Line 2<>"},
8265 CreatePositionAtTextBoundaryTestParam{
8269 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8270 "annotated_text=<L>ine 1"},
8271 CreatePositionAtTextBoundaryTestParam{
8275 CreatePositionAtTextBoundaryTestParam{
8279 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8280 "annotated_text=<L>ine 1"},
8281 CreatePositionAtTextBoundaryTestParam{
8285 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8286 "annotated_text=Line 2<>"},
8287 CreatePositionAtTextBoundaryTestParam{
8291 "TextPosition anchor_id=8 text_offset=0 affinity=downstream "
8292 "annotated_text=<L>ine 2"},
8293 CreatePositionAtTextBoundaryTestParam{
8297 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8298 "annotated_text=Line 2<>"},
8299 CreatePositionAtTextBoundaryTestParam{
8303 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
8304 "annotated_text=<>"},
8305 CreatePositionAtTextBoundaryTestParam{
8309 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8310 "annotated_text=Line 2<>"},
8311 CreatePositionAtTextBoundaryTestParam{
8315 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8316 "annotated_text=<L>ine 1"},
8317 CreatePositionAtTextBoundaryTestParam{
8321 CreatePositionAtTextBoundaryTestParam{
8325 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8326 "annotated_text=<L>ine 1"},
8327 CreatePositionAtTextBoundaryTestParam{
8331 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8332 "annotated_text=Line 2<>"},
8334 CreatePositionAtTextBoundaryTestParam{
8338 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8339 "annotated_text=<L>ine 1\nLine 2"},
8340 CreatePositionAtTextBoundaryTestParam{
8344 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8345 "annotated_text=Line 2<>"},
8346 CreatePositionAtTextBoundaryTestParam{
8350 "TextPosition anchor_id=6 text_offset=6 affinity=downstream "
8351 "annotated_text=Line 1<>"},
8352 CreatePositionAtTextBoundaryTestParam{
8356 "TextPosition anchor_id=8 text_offset=4 affinity=downstream "
8357 "annotated_text=Line< >2"},
8358 CreatePositionAtTextBoundaryTestParam{
8362 "TextPosition anchor_id=6 text_offset=5 affinity=downstream "
8363 "annotated_text=Line <1>"},
8364 CreatePositionAtTextBoundaryTestParam{
8368 "TextPosition anchor_id=8 text_offset=5 affinity=downstream "
8369 "annotated_text=Line <2>"},
8370 CreatePositionAtTextBoundaryTestParam{
8374 "TextPosition anchor_id=6 text_offset=5 affinity=downstream "
8375 "annotated_text=Line <1>"},
8376 CreatePositionAtTextBoundaryTestParam{
8380 "TextPosition anchor_id=8 text_offset=4 affinity=downstream "
8381 "annotated_text=Line< >2"}));
8384 CreateNextWordStartPositionWithBoundaryBehaviorCrossBoundary,
8385 AXPositionTextNavigationTestWithParam,
8387 TextNavigationTestParam{
8389 return position->CreateNextWordStartPosition(
8394 {
"TextPosition anchor_id=1 text_offset=5 "
8395 "affinity=downstream annotated_text=Line <1>\nLine 2",
8396 "TextPosition anchor_id=1 text_offset=7 "
8397 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8398 "TextPosition anchor_id=1 text_offset=12 "
8399 "affinity=downstream annotated_text=Line 1\nLine <2>",
8401 TextNavigationTestParam{
8403 return position->CreateNextWordStartPosition(
8408 {
"TextPosition anchor_id=4 text_offset=5 "
8409 "affinity=downstream annotated_text=Line <1>\nLine 2",
8410 "TextPosition anchor_id=4 text_offset=7 "
8411 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8412 "TextPosition anchor_id=4 text_offset=12 "
8413 "affinity=downstream annotated_text=Line 1\nLine <2>",
8416 return position->CreateNextWordStartPosition(
8421 {
"TextPosition anchor_id=5 text_offset=5 "
8422 "affinity=downstream annotated_text=Line <1>",
8423 "TextPosition anchor_id=9 text_offset=0 "
8424 "affinity=downstream annotated_text=<L>ine 2",
8425 "TextPosition anchor_id=9 text_offset=5 "
8426 "affinity=downstream annotated_text=Line <2>",
8429 return position->CreateNextWordStartPosition(
8434 {
"TextPosition anchor_id=9 text_offset=5 "
8435 "affinity=downstream annotated_text=Line <2>",
8439 CreateNextWordStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8440 AXPositionTextNavigationTestWithParam,
8442 TextNavigationTestParam{
8444 return position->CreateNextWordStartPosition(
8449 {
"TextPosition anchor_id=1 text_offset=5 "
8450 "affinity=downstream annotated_text=Line <1>\nLine 2",
8451 "TextPosition anchor_id=1 text_offset=7 "
8452 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8453 "TextPosition anchor_id=1 text_offset=12 "
8454 "affinity=downstream annotated_text=Line 1\nLine <2>",
8455 "TextPosition anchor_id=1 text_offset=13 "
8456 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8457 TextNavigationTestParam{
8459 return position->CreateNextWordStartPosition(
8464 {
"TextPosition anchor_id=4 text_offset=5 "
8465 "affinity=downstream annotated_text=Line <1>\nLine 2",
8466 "TextPosition anchor_id=4 text_offset=7 "
8467 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8468 "TextPosition anchor_id=4 text_offset=12 "
8469 "affinity=downstream annotated_text=Line 1\nLine <2>",
8470 "TextPosition anchor_id=4 text_offset=13 "
8471 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8472 TextNavigationTestParam{
8474 return position->CreateNextWordStartPosition(
8479 {
"TextPosition anchor_id=5 text_offset=5 "
8480 "affinity=downstream annotated_text=Line <1>",
8481 "TextPosition anchor_id=5 text_offset=6 "
8482 "affinity=downstream annotated_text=Line 1<>"}},
8483 TextNavigationTestParam{
8485 return position->CreateNextWordStartPosition(
8490 {
"TextPosition anchor_id=9 text_offset=5 "
8491 "affinity=downstream annotated_text=Line <2>",
8492 "TextPosition anchor_id=9 text_offset=6 "
8493 "affinity=downstream annotated_text=Line 2<>"}}));
8496 CreateNextWordStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8497 AXPositionTextNavigationTestWithParam,
8499 TextNavigationTestParam{
8501 return position->CreateNextWordStartPosition(
8506 {
"TextPosition anchor_id=1 text_offset=0 "
8507 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8508 "TextPosition anchor_id=1 text_offset=0 "
8509 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8510 TextNavigationTestParam{
8512 return position->CreateNextWordStartPosition(
8517 {
"TextPosition anchor_id=4 text_offset=0 "
8518 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8519 "TextPosition anchor_id=4 text_offset=0 "
8520 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8521 TextNavigationTestParam{
8523 return position->CreateNextWordStartPosition(
8528 {
"TextPosition anchor_id=5 text_offset=5 "
8529 "affinity=downstream annotated_text=Line <1>",
8530 "TextPosition anchor_id=5 text_offset=5 "
8531 "affinity=downstream annotated_text=Line <1>"}},
8532 TextNavigationTestParam{
8534 return position->CreateNextWordStartPosition(
8539 {
"TextPosition anchor_id=9 text_offset=5 "
8540 "affinity=downstream annotated_text=Line <2>",
8541 "TextPosition anchor_id=9 text_offset=5 "
8542 "affinity=downstream annotated_text=Line <2>"}}));
8545 CreateNextWordStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
8546 AXPositionTextNavigationTestWithParam,
8548 TextNavigationTestParam{
8550 return position->CreateNextWordStartPosition(
8555 {
"TextPosition anchor_id=1 text_offset=5 "
8556 "affinity=downstream annotated_text=Line <1>\nLine 2",
8557 "TextPosition anchor_id=1 text_offset=7 "
8558 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8559 "TextPosition anchor_id=1 text_offset=12 "
8560 "affinity=downstream annotated_text=Line 1\nLine <2>",
8561 "TextPosition anchor_id=1 text_offset=13 "
8562 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8563 "TextPosition anchor_id=1 text_offset=13 "
8564 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8565 TextNavigationTestParam{
8567 return position->CreateNextWordStartPosition(
8572 {
"TextPosition anchor_id=4 text_offset=5 "
8573 "affinity=downstream annotated_text=Line <1>\nLine 2",
8574 "TextPosition anchor_id=4 text_offset=7 "
8575 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8576 "TextPosition anchor_id=4 text_offset=12 "
8577 "affinity=downstream annotated_text=Line 1\nLine <2>",
8578 "TextPosition anchor_id=4 text_offset=13 "
8579 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8580 "TextPosition anchor_id=4 text_offset=13 "
8581 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8582 TextNavigationTestParam{
8584 return position->CreateNextWordStartPosition(
8589 {
"TextPosition anchor_id=5 text_offset=5 "
8590 "affinity=downstream annotated_text=Line <1>",
8591 "TextPosition anchor_id=9 text_offset=0 "
8592 "affinity=downstream annotated_text=<L>ine 2",
8593 "TextPosition anchor_id=9 text_offset=5 "
8594 "affinity=downstream annotated_text=Line <2>",
8595 "TextPosition anchor_id=9 text_offset=6 "
8596 "affinity=downstream annotated_text=Line 2<>",
8597 "TextPosition anchor_id=9 text_offset=6 "
8598 "affinity=downstream annotated_text=Line 2<>"}},
8599 TextNavigationTestParam{
8601 return position->CreateNextWordStartPosition(
8606 {
"TextPosition anchor_id=9 text_offset=5 "
8607 "affinity=downstream annotated_text=Line <2>",
8608 "TextPosition anchor_id=9 text_offset=6 "
8609 "affinity=downstream annotated_text=Line 2<>",
8610 "TextPosition anchor_id=9 text_offset=6 "
8611 "affinity=downstream annotated_text=Line 2<>"}}));
8614 CreatePreviousWordStartPositionWithBoundaryBehaviorCrossBoundary,
8615 AXPositionTextNavigationTestWithParam,
8617 TextNavigationTestParam{
8619 return position->CreatePreviousWordStartPosition(
8624 {
"TextPosition anchor_id=1 text_offset=12 "
8625 "affinity=downstream annotated_text=Line 1\nLine <2>",
8626 "TextPosition anchor_id=1 text_offset=7 "
8627 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8628 "TextPosition anchor_id=1 text_offset=5 "
8629 "affinity=downstream annotated_text=Line <1>\nLine 2",
8630 "TextPosition anchor_id=1 text_offset=0 "
8631 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8633 TextNavigationTestParam{
8635 return position->CreatePreviousWordStartPosition(
8640 {
"TextPosition anchor_id=4 text_offset=12 "
8641 "affinity=downstream annotated_text=Line 1\nLine <2>",
8642 "TextPosition anchor_id=4 text_offset=7 "
8643 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8644 "TextPosition anchor_id=4 text_offset=5 "
8645 "affinity=downstream annotated_text=Line <1>\nLine 2",
8646 "TextPosition anchor_id=4 text_offset=0 "
8647 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8649 TextNavigationTestParam{
8651 return position->CreatePreviousWordStartPosition(
8656 {
"TextPosition anchor_id=5 text_offset=0 "
8657 "affinity=downstream annotated_text=<L>ine 1",
8659 TextNavigationTestParam{
8661 return position->CreatePreviousWordStartPosition(
8666 {
"TextPosition anchor_id=9 text_offset=0 "
8667 "affinity=downstream annotated_text=<L>ine 2",
8668 "TextPosition anchor_id=6 text_offset=5 "
8669 "affinity=downstream annotated_text=Line <1>",
8670 "TextPosition anchor_id=6 text_offset=0 "
8671 "affinity=downstream annotated_text=<L>ine 1",
8675 CreatePreviousWordStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8676 AXPositionTextNavigationTestWithParam,
8678 TextNavigationTestParam{
8680 return position->CreatePreviousWordStartPosition(
8685 {
"TextPosition anchor_id=1 text_offset=12 "
8686 "affinity=downstream annotated_text=Line 1\nLine <2>",
8687 "TextPosition anchor_id=1 text_offset=7 "
8688 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8689 "TextPosition anchor_id=1 text_offset=5 "
8690 "affinity=downstream annotated_text=Line <1>\nLine 2",
8691 "TextPosition anchor_id=1 text_offset=0 "
8692 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8693 "TextPosition anchor_id=1 text_offset=0 "
8694 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8695 TextNavigationTestParam{
8697 return position->CreatePreviousWordStartPosition(
8702 {
"TextPosition anchor_id=4 text_offset=12 "
8703 "affinity=downstream annotated_text=Line 1\nLine <2>",
8704 "TextPosition anchor_id=4 text_offset=7 "
8705 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8706 "TextPosition anchor_id=4 text_offset=5 "
8707 "affinity=downstream annotated_text=Line <1>\nLine 2",
8708 "TextPosition anchor_id=4 text_offset=0 "
8709 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8710 "TextPosition anchor_id=4 text_offset=0 "
8711 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8712 TextNavigationTestParam{
8714 return position->CreatePreviousWordStartPosition(
8719 {
"TextPosition anchor_id=5 text_offset=0 "
8720 "affinity=downstream annotated_text=<L>ine 1",
8721 "TextPosition anchor_id=5 text_offset=0 "
8722 "affinity=downstream annotated_text=<L>ine 1"}},
8723 TextNavigationTestParam{
8725 return position->CreatePreviousWordStartPosition(
8730 {
"TextPosition anchor_id=9 text_offset=0 "
8731 "affinity=downstream annotated_text=<L>ine 2",
8732 "TextPosition anchor_id=9 text_offset=0 "
8733 "affinity=downstream annotated_text=<L>ine 2"}}));
8736 CreatePreviousWordStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8737 AXPositionTextNavigationTestWithParam,
8739 TextNavigationTestParam{
8741 return position->CreatePreviousWordStartPosition(
8746 {
"TextPosition anchor_id=1 text_offset=12 "
8747 "affinity=downstream annotated_text=Line 1\nLine <2>",
8748 "TextPosition anchor_id=1 text_offset=12 "
8749 "affinity=downstream annotated_text=Line 1\nLine <2>"}},
8750 TextNavigationTestParam{
8752 return position->CreatePreviousWordStartPosition(
8757 {
"TextPosition anchor_id=4 text_offset=12 "
8758 "affinity=downstream annotated_text=Line 1\nLine <2>",
8759 "TextPosition anchor_id=4 text_offset=12 "
8760 "affinity=downstream annotated_text=Line 1\nLine <2>"}},
8761 TextNavigationTestParam{
8763 return position->CreatePreviousWordStartPosition(
8768 {
"TextPosition anchor_id=5 text_offset=5 "
8769 "affinity=downstream annotated_text=Line <1>"}},
8770 TextNavigationTestParam{
8772 return position->CreatePreviousWordStartPosition(
8777 {
"TextPosition anchor_id=9 text_offset=0 "
8778 "affinity=downstream annotated_text=<L>ine 2",
8779 "TextPosition anchor_id=9 text_offset=0 "
8780 "affinity=downstream annotated_text=<L>ine 2"}}));
8783 CreatePreviousWordStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
8784 AXPositionTextNavigationTestWithParam,
8786 TextNavigationTestParam{
8788 return position->CreatePreviousWordStartPosition(
8793 {
"TextPosition anchor_id=1 text_offset=12 "
8794 "affinity=downstream annotated_text=Line 1\nLine <2>",
8795 "TextPosition anchor_id=1 text_offset=7 "
8796 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8797 "TextPosition anchor_id=1 text_offset=5 "
8798 "affinity=downstream annotated_text=Line <1>\nLine 2",
8799 "TextPosition anchor_id=1 text_offset=0 "
8800 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8801 "TextPosition anchor_id=1 text_offset=0 "
8802 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8803 TextNavigationTestParam{
8805 return position->CreatePreviousWordStartPosition(
8810 {
"TextPosition anchor_id=4 text_offset=12 "
8811 "affinity=downstream annotated_text=Line 1\nLine <2>",
8812 "TextPosition anchor_id=4 text_offset=7 "
8813 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8814 "TextPosition anchor_id=4 text_offset=5 "
8815 "affinity=downstream annotated_text=Line <1>\nLine 2",
8816 "TextPosition anchor_id=4 text_offset=0 "
8817 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8818 "TextPosition anchor_id=4 text_offset=0 "
8819 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8820 TextNavigationTestParam{
8822 return position->CreatePreviousWordStartPosition(
8827 {
"TextPosition anchor_id=5 text_offset=0 "
8828 "affinity=downstream annotated_text=<L>ine 1",
8829 "TextPosition anchor_id=5 text_offset=0 "
8830 "affinity=downstream annotated_text=<L>ine 1"}},
8831 TextNavigationTestParam{
8833 return position->CreatePreviousWordStartPosition(
8838 {
"TextPosition anchor_id=9 text_offset=0 "
8839 "affinity=downstream annotated_text=<L>ine 2",
8840 "TextPosition anchor_id=6 text_offset=5 "
8841 "affinity=downstream annotated_text=Line <1>",
8842 "TextPosition anchor_id=6 text_offset=0 "
8843 "affinity=downstream annotated_text=<L>ine 1",
8844 "TextPosition anchor_id=6 text_offset=0 "
8845 "affinity=downstream annotated_text=<L>ine 1"}}));
8848 CreateNextWordEndPositionWithBoundaryBehaviorCrossBoundary,
8849 AXPositionTextNavigationTestWithParam,
8851 TextNavigationTestParam{
8853 return position->CreateNextWordEndPosition(
8858 {
"TextPosition anchor_id=1 text_offset=4 "
8859 "affinity=downstream annotated_text=Line< >1\nLine 2",
8860 "TextPosition anchor_id=1 text_offset=6 "
8861 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8862 "TextPosition anchor_id=1 text_offset=11 "
8863 "affinity=downstream annotated_text=Line 1\nLine< >2",
8864 "TextPosition anchor_id=1 text_offset=13 "
8865 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8867 TextNavigationTestParam{
8869 return position->CreateNextWordEndPosition(
8874 {
"TextPosition anchor_id=4 text_offset=4 "
8875 "affinity=downstream annotated_text=Line< >1\nLine 2",
8876 "TextPosition anchor_id=4 text_offset=6 "
8877 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8878 "TextPosition anchor_id=4 text_offset=11 "
8879 "affinity=downstream annotated_text=Line 1\nLine< >2",
8880 "TextPosition anchor_id=4 text_offset=13 "
8881 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8884 return position->CreateNextWordEndPosition(
8889 {
"TextPosition anchor_id=5 text_offset=4 "
8890 "affinity=downstream annotated_text=Line< >1",
8891 "TextPosition anchor_id=5 text_offset=6 "
8892 "affinity=downstream annotated_text=Line 1<>",
8893 "TextPosition anchor_id=9 text_offset=4 "
8894 "affinity=downstream annotated_text=Line< >2",
8895 "TextPosition anchor_id=9 text_offset=6 "
8896 "affinity=downstream annotated_text=Line 2<>",
8899 return position->CreateNextWordEndPosition(
8904 {
"TextPosition anchor_id=9 text_offset=6 "
8905 "affinity=downstream annotated_text=Line 2<>",
8909 CreateNextWordEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8910 AXPositionTextNavigationTestWithParam,
8912 TextNavigationTestParam{
8914 return position->CreateNextWordEndPosition(
8919 {
"TextPosition anchor_id=1 text_offset=4 "
8920 "affinity=downstream annotated_text=Line< >1\nLine 2",
8921 "TextPosition anchor_id=1 text_offset=6 "
8922 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8923 "TextPosition anchor_id=1 text_offset=11 "
8924 "affinity=downstream annotated_text=Line 1\nLine< >2",
8925 "TextPosition anchor_id=1 text_offset=13 "
8926 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8927 "TextPosition anchor_id=1 text_offset=13 "
8928 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8929 TextNavigationTestParam{
8931 return position->CreateNextWordEndPosition(
8936 {
"TextPosition anchor_id=4 text_offset=4 "
8937 "affinity=downstream annotated_text=Line< >1\nLine 2",
8938 "TextPosition anchor_id=4 text_offset=6 "
8939 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8940 "TextPosition anchor_id=4 text_offset=11 "
8941 "affinity=downstream annotated_text=Line 1\nLine< >2",
8942 "TextPosition anchor_id=4 text_offset=13 "
8943 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8944 "TextPosition anchor_id=4 text_offset=13 "
8945 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8946 TextNavigationTestParam{
8948 return position->CreateNextWordEndPosition(
8953 {
"TextPosition anchor_id=5 text_offset=4 "
8954 "affinity=downstream annotated_text=Line< >1",
8955 "TextPosition anchor_id=5 text_offset=6 "
8956 "affinity=downstream annotated_text=Line 1<>",
8957 "TextPosition anchor_id=5 text_offset=6 "
8958 "affinity=downstream annotated_text=Line 1<>"}},
8959 TextNavigationTestParam{
8961 return position->CreateNextWordEndPosition(
8966 {
"TextPosition anchor_id=9 text_offset=6 "
8967 "affinity=downstream annotated_text=Line 2<>",
8968 "TextPosition anchor_id=9 text_offset=6 "
8969 "affinity=downstream annotated_text=Line 2<>"}}));
8972 CreateNextWordEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8973 AXPositionTextNavigationTestWithParam,
8975 TextNavigationTestParam{
8977 return position->CreateNextWordEndPosition(
8982 {
"TextPosition anchor_id=1 text_offset=4 "
8983 "affinity=downstream annotated_text=Line< >1\nLine 2",
8984 "TextPosition anchor_id=1 text_offset=4 "
8985 "affinity=downstream annotated_text=Line< >1\nLine 2"}},
8986 TextNavigationTestParam{
8988 return position->CreateNextWordEndPosition(
8993 {
"TextPosition anchor_id=4 text_offset=4 "
8994 "affinity=downstream annotated_text=Line< >1\nLine 2",
8995 "TextPosition anchor_id=4 text_offset=4 "
8996 "affinity=downstream annotated_text=Line< >1\nLine 2"}},
8997 TextNavigationTestParam{
8999 return position->CreateNextWordEndPosition(
9004 {
"TextPosition anchor_id=5 text_offset=4 "
9005 "affinity=downstream annotated_text=Line< >1",
9006 "TextPosition anchor_id=5 text_offset=4 "
9007 "affinity=downstream annotated_text=Line< >1"}},
9008 TextNavigationTestParam{
9010 return position->CreateNextWordEndPosition(
9015 {
"TextPosition anchor_id=9 text_offset=4 "
9016 "affinity=downstream annotated_text=Line< >2"}}));
9019 CreateNextWordEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9020 AXPositionTextNavigationTestWithParam,
9022 TextNavigationTestParam{
9024 return position->CreateNextWordEndPosition(
9029 {
"TextPosition anchor_id=1 text_offset=4 "
9030 "affinity=downstream annotated_text=Line< >1\nLine 2",
9031 "TextPosition anchor_id=1 text_offset=6 "
9032 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9033 "TextPosition anchor_id=1 text_offset=11 "
9034 "affinity=downstream annotated_text=Line 1\nLine< >2",
9035 "TextPosition anchor_id=1 text_offset=13 "
9036 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9037 "TextPosition anchor_id=1 text_offset=13 "
9038 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9039 TextNavigationTestParam{
9041 return position->CreateNextWordEndPosition(
9046 {
"TextPosition anchor_id=4 text_offset=4 "
9047 "affinity=downstream annotated_text=Line< >1\nLine 2",
9048 "TextPosition anchor_id=4 text_offset=6 "
9049 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9050 "TextPosition anchor_id=4 text_offset=11 "
9051 "affinity=downstream annotated_text=Line 1\nLine< >2",
9052 "TextPosition anchor_id=4 text_offset=13 "
9053 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9054 "TextPosition anchor_id=4 text_offset=13 "
9055 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9056 TextNavigationTestParam{
9058 return position->CreateNextWordEndPosition(
9063 {
"TextPosition anchor_id=5 text_offset=4 "
9064 "affinity=downstream annotated_text=Line< >1",
9065 "TextPosition anchor_id=5 text_offset=6 "
9066 "affinity=downstream annotated_text=Line 1<>",
9067 "TextPosition anchor_id=9 text_offset=4 "
9068 "affinity=downstream annotated_text=Line< >2",
9069 "TextPosition anchor_id=9 text_offset=6 "
9070 "affinity=downstream annotated_text=Line 2<>",
9071 "TextPosition anchor_id=9 text_offset=6 "
9072 "affinity=downstream annotated_text=Line 2<>"}},
9073 TextNavigationTestParam{
9075 return position->CreateNextWordEndPosition(
9080 {
"TextPosition anchor_id=9 text_offset=6 "
9081 "affinity=downstream annotated_text=Line 2<>",
9082 "TextPosition anchor_id=9 text_offset=6 "
9083 "affinity=downstream annotated_text=Line 2<>"}}));
9086 CreatePreviousWordEndPositionWithBoundaryBehaviorCrossBoundary,
9087 AXPositionTextNavigationTestWithParam,
9089 TextNavigationTestParam{
9091 return position->CreatePreviousWordEndPosition(
9096 {
"TextPosition anchor_id=1 text_offset=11 "
9097 "affinity=downstream annotated_text=Line 1\nLine< >2",
9098 "TextPosition anchor_id=1 text_offset=6 "
9099 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9100 "TextPosition anchor_id=1 text_offset=4 "
9101 "affinity=downstream annotated_text=Line< >1\nLine 2",
9103 TextNavigationTestParam{
9105 return position->CreatePreviousWordEndPosition(
9110 {
"TextPosition anchor_id=4 text_offset=11 "
9111 "affinity=downstream annotated_text=Line 1\nLine< >2",
9112 "TextPosition anchor_id=4 text_offset=6 "
9113 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9114 "TextPosition anchor_id=4 text_offset=4 "
9115 "affinity=downstream annotated_text=Line< >1\nLine 2",
9117 TextNavigationTestParam{
9119 return position->CreatePreviousWordEndPosition(
9124 {
"TextPosition anchor_id=5 text_offset=4 "
9125 "affinity=downstream annotated_text=Line< >1",
9127 TextNavigationTestParam{
9129 return position->CreatePreviousWordEndPosition(
9134 {
"TextPosition anchor_id=6 text_offset=6 "
9135 "affinity=downstream annotated_text=Line 1<>",
9136 "TextPosition anchor_id=6 text_offset=4 "
9137 "affinity=downstream annotated_text=Line< >1",
9141 CreatePreviousWordEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9142 AXPositionTextNavigationTestWithParam,
9144 TextNavigationTestParam{
9146 return position->CreatePreviousWordEndPosition(
9152 "TextPosition anchor_id=1 text_offset=11 "
9153 "affinity=downstream annotated_text=Line 1\nLine< >2",
9154 "TextPosition anchor_id=1 text_offset=6 "
9155 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9156 "TextPosition anchor_id=1 text_offset=4 "
9157 "affinity=downstream annotated_text=Line< >1\nLine 2",
9158 "TextPosition anchor_id=1 text_offset=0 "
9159 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9161 TextNavigationTestParam{
9163 return position->CreatePreviousWordEndPosition(
9168 {
"TextPosition anchor_id=4 text_offset=11 "
9169 "affinity=downstream annotated_text=Line 1\nLine< >2",
9170 "TextPosition anchor_id=4 text_offset=6 "
9171 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9172 "TextPosition anchor_id=4 text_offset=4 "
9173 "affinity=downstream annotated_text=Line< >1\nLine 2",
9174 "TextPosition anchor_id=4 text_offset=0 "
9175 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9176 TextNavigationTestParam{
9178 return position->CreatePreviousWordEndPosition(
9183 {
"TextPosition anchor_id=5 text_offset=4 "
9184 "affinity=downstream annotated_text=Line< >1",
9185 "TextPosition anchor_id=5 text_offset=0 "
9186 "affinity=downstream annotated_text=<L>ine 1"}},
9187 TextNavigationTestParam{
9189 return position->CreatePreviousWordEndPosition(
9194 {
"TextPosition anchor_id=9 text_offset=0 "
9195 "affinity=downstream annotated_text=<L>ine 2"}}));
9198 CreatePreviousWordEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9199 AXPositionTextNavigationTestWithParam,
9201 TextNavigationTestParam{
9203 return position->CreatePreviousWordEndPosition(
9208 {
"TextPosition anchor_id=1 text_offset=13 "
9209 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9210 TextNavigationTestParam{
9212 return position->CreatePreviousWordEndPosition(
9217 {
"TextPosition anchor_id=4 text_offset=13 "
9218 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9219 TextNavigationTestParam{
9221 return position->CreatePreviousWordEndPosition(
9226 {
"TextPosition anchor_id=5 text_offset=4 "
9227 "affinity=downstream annotated_text=Line< >1",
9228 "TextPosition anchor_id=5 text_offset=4 "
9229 "affinity=downstream annotated_text=Line< >1"}},
9230 TextNavigationTestParam{
9232 return position->CreatePreviousWordEndPosition(
9237 {
"TextPosition anchor_id=9 text_offset=4 "
9238 "affinity=downstream annotated_text=Line< >2"}}));
9241 CreatePreviousWordEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9242 AXPositionTextNavigationTestWithParam,
9244 TextNavigationTestParam{
9246 return position->CreatePreviousWordEndPosition(
9251 {
"TextPosition anchor_id=1 text_offset=11 "
9252 "affinity=downstream annotated_text=Line 1\nLine< >2",
9253 "TextPosition anchor_id=1 text_offset=6 "
9254 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9255 "TextPosition anchor_id=1 text_offset=4 "
9256 "affinity=downstream annotated_text=Line< >1\nLine 2",
9257 "TextPosition anchor_id=1 text_offset=0 "
9258 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9259 "TextPosition anchor_id=1 text_offset=0 "
9260 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9261 TextNavigationTestParam{
9263 return position->CreatePreviousWordEndPosition(
9268 {
"TextPosition anchor_id=4 text_offset=11 "
9269 "affinity=downstream annotated_text=Line 1\nLine< >2",
9270 "TextPosition anchor_id=4 text_offset=6 "
9271 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9272 "TextPosition anchor_id=4 text_offset=4 "
9273 "affinity=downstream annotated_text=Line< >1\nLine 2",
9274 "TextPosition anchor_id=2 text_offset=0 "
9275 "affinity=downstream annotated_text=<>",
9276 "TextPosition anchor_id=2 text_offset=0 "
9277 "affinity=downstream annotated_text=<>"}},
9278 TextNavigationTestParam{
9280 return position->CreatePreviousWordEndPosition(
9285 {
"TextPosition anchor_id=5 text_offset=4 "
9286 "affinity=downstream annotated_text=Line< >1",
9287 "TextPosition anchor_id=2 text_offset=0 "
9288 "affinity=downstream annotated_text=<>",
9289 "TextPosition anchor_id=2 text_offset=0 "
9290 "affinity=downstream annotated_text=<>"}},
9291 TextNavigationTestParam{
9293 return position->CreatePreviousWordEndPosition(
9298 {
"TextPosition anchor_id=6 text_offset=6 "
9299 "affinity=downstream annotated_text=Line 1<>",
9300 "TextPosition anchor_id=6 text_offset=4 "
9301 "affinity=downstream annotated_text=Line< >1",
9302 "TextPosition anchor_id=2 text_offset=0 "
9303 "affinity=downstream annotated_text=<>",
9304 "TextPosition anchor_id=2 text_offset=0 "
9305 "affinity=downstream annotated_text=<>"}}));
9308 CreateNextLineStartPositionWithBoundaryBehaviorCrossBoundary,
9309 AXPositionTextNavigationTestWithParam,
9311 TextNavigationTestParam{
9313 return position->CreateNextLineStartPosition(
9318 {
"TextPosition anchor_id=1 text_offset=7 "
9319 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9321 TextNavigationTestParam{
9323 return position->CreateNextLineStartPosition(
9328 {
"TextPosition anchor_id=4 text_offset=7 "
9329 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9332 return position->CreateNextLineStartPosition(
9337 {
"TextPosition anchor_id=9 text_offset=0 "
9338 "affinity=downstream annotated_text=<L>ine 2",
9341 return position->CreateNextLineStartPosition(
9346 {
"NullPosition"}}));
9349 CreateNextLineStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9350 AXPositionTextNavigationTestWithParam,
9352 TextNavigationTestParam{
9354 return position->CreateNextLineStartPosition(
9359 {
"TextPosition anchor_id=1 text_offset=7 "
9360 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9361 "TextPosition anchor_id=1 text_offset=13 "
9362 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9363 TextNavigationTestParam{
9365 return position->CreateNextLineStartPosition(
9370 {
"TextPosition anchor_id=4 text_offset=7 "
9371 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9372 "TextPosition anchor_id=4 text_offset=13 "
9373 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9374 TextNavigationTestParam{
9376 return position->CreateNextLineStartPosition(
9381 {
"TextPosition anchor_id=5 text_offset=6 "
9382 "affinity=downstream annotated_text=Line 1<>"}},
9383 TextNavigationTestParam{
9385 return position->CreateNextLineStartPosition(
9390 {
"TextPosition anchor_id=9 text_offset=6 "
9391 "affinity=downstream annotated_text=Line 2<>"}}));
9394 CreateNextLineStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9395 AXPositionTextNavigationTestWithParam,
9397 TextNavigationTestParam{
9399 return position->CreateNextLineStartPosition(
9404 {
"TextPosition anchor_id=1 text_offset=0 "
9405 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9406 "TextPosition anchor_id=1 text_offset=0 "
9407 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9408 TextNavigationTestParam{
9410 return position->CreateNextLineStartPosition(
9415 {
"TextPosition anchor_id=4 text_offset=0 "
9416 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9417 "TextPosition anchor_id=4 text_offset=0 "
9418 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9419 TextNavigationTestParam{
9421 return position->CreateNextLineStartPosition(
9426 {
"TextPosition anchor_id=9 text_offset=0 "
9427 "affinity=downstream annotated_text=<L>ine 2",
9428 "TextPosition anchor_id=9 text_offset=0 "
9429 "affinity=downstream annotated_text=<L>ine 2"}},
9430 TextNavigationTestParam{
9432 return position->CreateNextLineStartPosition(
9437 {
"NullPosition"}}));
9440 CreateNextLineStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9441 AXPositionTextNavigationTestWithParam,
9443 TextNavigationTestParam{
9445 return position->CreateNextLineStartPosition(
9450 {
"TextPosition anchor_id=1 text_offset=7 "
9451 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9452 "TextPosition anchor_id=1 text_offset=13 "
9453 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9454 "TextPosition anchor_id=1 text_offset=13 "
9455 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9456 TextNavigationTestParam{
9458 return position->CreateNextLineStartPosition(
9463 {
"TextPosition anchor_id=4 text_offset=7 "
9464 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9465 "TextPosition anchor_id=4 text_offset=13 "
9466 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9467 "TextPosition anchor_id=4 text_offset=13 "
9468 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9469 TextNavigationTestParam{
9471 return position->CreateNextLineStartPosition(
9476 {
"TextPosition anchor_id=9 text_offset=0 "
9477 "affinity=downstream annotated_text=<L>ine 2",
9478 "TextPosition anchor_id=9 text_offset=6 "
9479 "affinity=downstream annotated_text=Line 2<>",
9480 "TextPosition anchor_id=9 text_offset=6 "
9481 "affinity=downstream annotated_text=Line 2<>"}},
9482 TextNavigationTestParam{
9484 return position->CreateNextLineStartPosition(
9489 {
"TextPosition anchor_id=9 text_offset=6 "
9490 "affinity=downstream annotated_text=Line 2<>",
9491 "TextPosition anchor_id=9 text_offset=6 "
9492 "affinity=downstream annotated_text=Line 2<>"}}));
9495 CreatePreviousLineStartPositionWithBoundaryBehaviorCrossBoundary,
9496 AXPositionTextNavigationTestWithParam,
9498 TextNavigationTestParam{
9500 return position->CreatePreviousLineStartPosition(
9505 {
"TextPosition anchor_id=1 text_offset=7 "
9506 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9507 "TextPosition anchor_id=1 text_offset=0 "
9508 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9510 TextNavigationTestParam{
9512 return position->CreatePreviousLineStartPosition(
9517 {
"TextPosition anchor_id=4 text_offset=7 "
9518 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9519 "TextPosition anchor_id=4 text_offset=0 "
9520 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9522 TextNavigationTestParam{
9524 return position->CreatePreviousLineStartPosition(
9529 {
"TextPosition anchor_id=5 text_offset=0 "
9530 "affinity=downstream annotated_text=<L>ine 1",
9532 TextNavigationTestParam{
9534 return position->CreatePreviousLineStartPosition(
9539 {
"TextPosition anchor_id=9 text_offset=0 "
9540 "affinity=downstream annotated_text=<L>ine 2",
9541 "TextPosition anchor_id=6 text_offset=0 "
9542 "affinity=downstream annotated_text=<L>ine 1",
9546 CreatePreviousLineStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9547 AXPositionTextNavigationTestWithParam,
9549 TextNavigationTestParam{
9551 return position->CreatePreviousLineStartPosition(
9556 {
"TextPosition anchor_id=1 text_offset=7 "
9557 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9558 "TextPosition anchor_id=1 text_offset=0 "
9559 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9560 "TextPosition anchor_id=1 text_offset=0 "
9561 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9562 TextNavigationTestParam{
9564 return position->CreatePreviousLineStartPosition(
9569 {
"TextPosition anchor_id=4 text_offset=7 "
9570 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9571 "TextPosition anchor_id=4 text_offset=0 "
9572 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9573 "TextPosition anchor_id=4 text_offset=0 "
9574 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9575 TextNavigationTestParam{
9577 return position->CreatePreviousLineStartPosition(
9582 {
"TextPosition anchor_id=5 text_offset=0 "
9583 "affinity=downstream annotated_text=<L>ine 1",
9584 "TextPosition anchor_id=5 text_offset=0 "
9585 "affinity=downstream annotated_text=<L>ine 1"}},
9586 TextNavigationTestParam{
9588 return position->CreatePreviousLineStartPosition(
9593 {
"TextPosition anchor_id=9 text_offset=0 "
9594 "affinity=downstream annotated_text=<L>ine 2",
9595 "TextPosition anchor_id=9 text_offset=0 "
9596 "affinity=downstream annotated_text=<L>ine 2"}}));
9599 CreatePreviousLineStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9600 AXPositionTextNavigationTestWithParam,
9602 TextNavigationTestParam{
9604 return position->CreatePreviousLineStartPosition(
9609 {
"TextPosition anchor_id=1 text_offset=7 "
9610 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9611 "TextPosition anchor_id=1 text_offset=7 "
9612 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
9613 TextNavigationTestParam{
9615 return position->CreatePreviousLineStartPosition(
9620 {
"TextPosition anchor_id=4 text_offset=7 "
9621 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9622 "TextPosition anchor_id=4 text_offset=7 "
9623 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
9624 TextNavigationTestParam{
9626 return position->CreatePreviousLineStartPosition(
9631 {
"TextPosition anchor_id=5 text_offset=0 "
9632 "affinity=downstream annotated_text=<L>ine 1",
9633 "TextPosition anchor_id=5 text_offset=0 "
9634 "affinity=downstream annotated_text=<L>ine 1"}},
9635 TextNavigationTestParam{
9637 return position->CreatePreviousLineStartPosition(
9642 {
"TextPosition anchor_id=9 text_offset=0 "
9643 "affinity=downstream annotated_text=<L>ine 2",
9644 "TextPosition anchor_id=9 text_offset=0 "
9645 "affinity=downstream annotated_text=<L>ine 2"}}));
9648 CreatePreviousLineStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9649 AXPositionTextNavigationTestWithParam,
9651 TextNavigationTestParam{
9653 return position->CreatePreviousLineStartPosition(
9658 {
"TextPosition anchor_id=1 text_offset=7 "
9659 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9660 "TextPosition anchor_id=1 text_offset=0 "
9661 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9662 "TextPosition anchor_id=1 text_offset=0 "
9663 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9664 TextNavigationTestParam{
9666 return position->CreatePreviousLineStartPosition(
9671 {
"TextPosition anchor_id=4 text_offset=7 "
9672 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9673 "TextPosition anchor_id=4 text_offset=0 "
9674 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9675 "TextPosition anchor_id=4 text_offset=0 "
9676 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9677 TextNavigationTestParam{
9679 return position->CreatePreviousLineStartPosition(
9684 {
"TextPosition anchor_id=5 text_offset=0 "
9685 "affinity=downstream annotated_text=<L>ine 1",
9686 "TextPosition anchor_id=5 text_offset=0 "
9687 "affinity=downstream annotated_text=<L>ine 1"}},
9688 TextNavigationTestParam{
9690 return position->CreatePreviousLineStartPosition(
9695 {
"TextPosition anchor_id=9 text_offset=0 "
9696 "affinity=downstream annotated_text=<L>ine 2",
9697 "TextPosition anchor_id=6 text_offset=0 "
9698 "affinity=downstream annotated_text=<L>ine 1",
9699 "TextPosition anchor_id=6 text_offset=0 "
9700 "affinity=downstream annotated_text=<L>ine 1"}}));
9703 CreateNextLineEndPositionWithBoundaryBehaviorCrossBoundary,
9704 AXPositionTextNavigationTestWithParam,
9706 TextNavigationTestParam{
9708 return position->CreateNextLineEndPosition(
9713 {
"TextPosition anchor_id=1 text_offset=6 "
9714 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9715 "TextPosition anchor_id=1 text_offset=13 "
9716 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9718 TextNavigationTestParam{
9720 return position->CreateNextLineEndPosition(
9725 {
"TextPosition anchor_id=4 text_offset=6 "
9726 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9727 "TextPosition anchor_id=4 text_offset=13 "
9728 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9731 return position->CreateNextLineEndPosition(
9736 {
"TextPosition anchor_id=5 text_offset=6 "
9737 "affinity=downstream annotated_text=Line 1<>",
9738 "TextPosition anchor_id=9 text_offset=6 "
9739 "affinity=downstream annotated_text=Line 2<>",
9742 return position->CreateNextLineEndPosition(
9747 {
"TextPosition anchor_id=9 text_offset=6 "
9748 "affinity=downstream annotated_text=Line 2<>",
9752 CreateNextLineEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9753 AXPositionTextNavigationTestWithParam,
9755 TextNavigationTestParam{
9757 return position->CreateNextLineEndPosition(
9762 {
"TextPosition anchor_id=1 text_offset=6 "
9763 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9764 "TextPosition anchor_id=1 text_offset=13 "
9765 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9766 "TextPosition anchor_id=1 text_offset=13 "
9767 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9768 TextNavigationTestParam{
9770 return position->CreateNextLineEndPosition(
9775 {
"TextPosition anchor_id=4 text_offset=6 "
9776 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9777 "TextPosition anchor_id=4 text_offset=13 "
9778 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9779 "TextPosition anchor_id=4 text_offset=13 "
9780 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9781 TextNavigationTestParam{
9783 return position->CreateNextLineEndPosition(
9788 {
"TextPosition anchor_id=5 text_offset=6 "
9789 "affinity=downstream annotated_text=Line 1<>",
9790 "TextPosition anchor_id=5 text_offset=6 "
9791 "affinity=downstream annotated_text=Line 1<>"}},
9792 TextNavigationTestParam{
9794 return position->CreateNextLineEndPosition(
9799 {
"TextPosition anchor_id=9 text_offset=6 "
9800 "affinity=downstream annotated_text=Line 2<>",
9801 "TextPosition anchor_id=9 text_offset=6 "
9802 "affinity=downstream annotated_text=Line 2<>"}}));
9805 CreateNextLineEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9806 AXPositionTextNavigationTestWithParam,
9808 TextNavigationTestParam{
9810 return position->CreateNextLineEndPosition(
9815 {
"TextPosition anchor_id=1 text_offset=6 "
9816 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9817 "TextPosition anchor_id=1 text_offset=6 "
9818 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
9819 TextNavigationTestParam{
9821 return position->CreateNextLineEndPosition(
9826 {
"TextPosition anchor_id=4 text_offset=6 "
9827 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9828 "TextPosition anchor_id=4 text_offset=6 "
9829 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
9830 TextNavigationTestParam{
9832 return position->CreateNextLineEndPosition(
9837 {
"TextPosition anchor_id=5 text_offset=6 "
9838 "affinity=downstream annotated_text=Line 1<>",
9839 "TextPosition anchor_id=5 text_offset=6 "
9840 "affinity=downstream annotated_text=Line 1<>"}},
9841 TextNavigationTestParam{
9843 return position->CreateNextLineEndPosition(
9848 {
"TextPosition anchor_id=9 text_offset=6 "
9849 "affinity=downstream annotated_text=Line 2<>",
9850 "TextPosition anchor_id=9 text_offset=6 "
9851 "affinity=downstream annotated_text=Line 2<>"}}));
9854 CreateNextLineEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9855 AXPositionTextNavigationTestWithParam,
9857 TextNavigationTestParam{
9859 return position->CreateNextLineEndPosition(
9864 {
"TextPosition anchor_id=1 text_offset=6 "
9865 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9866 "TextPosition anchor_id=1 text_offset=13 "
9867 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9868 "TextPosition anchor_id=1 text_offset=13 "
9869 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9870 TextNavigationTestParam{
9872 return position->CreateNextLineEndPosition(
9877 {
"TextPosition anchor_id=4 text_offset=6 "
9878 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9879 "TextPosition anchor_id=4 text_offset=13 "
9880 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9881 "TextPosition anchor_id=4 text_offset=13 "
9882 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9883 TextNavigationTestParam{
9885 return position->CreateNextLineEndPosition(
9890 {
"TextPosition anchor_id=5 text_offset=6 "
9891 "affinity=downstream annotated_text=Line 1<>",
9892 "TextPosition anchor_id=9 text_offset=6 "
9893 "affinity=downstream annotated_text=Line 2<>",
9894 "TextPosition anchor_id=9 text_offset=6 "
9895 "affinity=downstream annotated_text=Line 2<>"}},
9896 TextNavigationTestParam{
9898 return position->CreateNextLineEndPosition(
9903 {
"TextPosition anchor_id=9 text_offset=6 "
9904 "affinity=downstream annotated_text=Line 2<>",
9905 "TextPosition anchor_id=9 text_offset=6 "
9906 "affinity=downstream annotated_text=Line 2<>"}}));
9909 CreatePreviousLineEndPositionWithBoundaryBehaviorCrossBoundary,
9910 AXPositionTextNavigationTestWithParam,
9912 TextNavigationTestParam{
9914 return position->CreatePreviousLineEndPosition(
9919 {
"TextPosition anchor_id=1 text_offset=6 "
9920 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9922 TextNavigationTestParam{
9924 return position->CreatePreviousLineEndPosition(
9929 {
"TextPosition anchor_id=4 text_offset=6 "
9930 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9932 TextNavigationTestParam{
9934 return position->CreatePreviousLineEndPosition(
9940 TextNavigationTestParam{
9942 return position->CreatePreviousLineEndPosition(
9948 TextNavigationTestParam{
9950 return position->CreatePreviousLineEndPosition(
9955 {
"TextPosition anchor_id=6 text_offset=6 "
9956 "affinity=downstream annotated_text=Line 1<>",
9958 TextNavigationTestParam{
9960 return position->CreatePreviousLineEndPosition(
9965 {
"TextPosition anchor_id=7 text_offset=0 "
9966 "affinity=downstream annotated_text=<\n>",
9970 CreatePreviousLineEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9971 AXPositionTextNavigationTestWithParam,
9973 TextNavigationTestParam{
9975 return position->CreatePreviousLineEndPosition(
9980 {
"TextPosition anchor_id=1 text_offset=6 "
9981 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9982 "TextPosition anchor_id=1 text_offset=0 "
9983 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9984 TextNavigationTestParam{
9986 return position->CreatePreviousLineEndPosition(
9991 {
"TextPosition anchor_id=4 text_offset=6 "
9992 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9993 "TextPosition anchor_id=4 text_offset=0 "
9994 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9995 TextNavigationTestParam{
9997 return position->CreatePreviousLineEndPosition(
10002 {
"TextPosition anchor_id=1 text_offset=0 "
10003 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10004 "TextPosition anchor_id=1 text_offset=0 "
10005 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10006 TextNavigationTestParam{
10008 return position->CreatePreviousLineEndPosition(
10013 {
"TextPosition anchor_id=4 text_offset=0 "
10014 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10015 "TextPosition anchor_id=4 text_offset=0 "
10016 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10017 TextNavigationTestParam{
10019 return position->CreatePreviousLineEndPosition(
10024 {
"TextPosition anchor_id=9 text_offset=0 "
10025 "affinity=downstream annotated_text=<L>ine 2",
10026 "TextPosition anchor_id=9 text_offset=0 "
10027 "affinity=downstream annotated_text=<L>ine 2"}},
10028 TextNavigationTestParam{
10030 return position->CreatePreviousLineEndPosition(
10035 {
"TextPosition anchor_id=9 text_offset=0 "
10036 "affinity=downstream annotated_text=<L>ine 2",
10037 "TextPosition anchor_id=9 text_offset=0 "
10038 "affinity=downstream annotated_text=<L>ine 2"}}));
10041 CreatePreviousLineEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10042 AXPositionTextNavigationTestWithParam,
10044 TextNavigationTestParam{
10046 return position->CreatePreviousLineEndPosition(
10051 {
"TextPosition anchor_id=1 text_offset=6 "
10052 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10053 "TextPosition anchor_id=1 text_offset=6 "
10054 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
10055 TextNavigationTestParam{
10057 return position->CreatePreviousLineEndPosition(
10062 {
"TextPosition anchor_id=4 text_offset=6 "
10063 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10064 "TextPosition anchor_id=4 text_offset=6 "
10065 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
10066 TextNavigationTestParam{
10068 return position->CreatePreviousLineEndPosition(
10074 TextNavigationTestParam{
10076 return position->CreatePreviousLineEndPosition(
10081 {
"TextPosition anchor_id=6 text_offset=6 "
10082 "affinity=downstream annotated_text=Line 1<>",
10083 "TextPosition anchor_id=6 text_offset=6 "
10084 "affinity=downstream annotated_text=Line 1<>"}},
10085 TextNavigationTestParam{
10087 return position->CreatePreviousLineEndPosition(
10092 {
"TextPosition anchor_id=6 text_offset=6 "
10093 "affinity=downstream annotated_text=Line 1<>",
10094 "TextPosition anchor_id=6 text_offset=6 "
10095 "affinity=downstream annotated_text=Line 1<>"}}));
10098 CreatePreviousLineEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10099 AXPositionTextNavigationTestWithParam,
10101 TextNavigationTestParam{
10103 return position->CreatePreviousLineEndPosition(
10108 {
"TextPosition anchor_id=1 text_offset=6 "
10109 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10110 "TextPosition anchor_id=1 text_offset=0 "
10111 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10112 "TextPosition anchor_id=1 text_offset=0 "
10113 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10114 TextNavigationTestParam{
10116 return position->CreatePreviousLineEndPosition(
10121 {
"TextPosition anchor_id=4 text_offset=6 "
10122 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10123 "TextPosition anchor_id=2 text_offset=0 "
10124 "affinity=downstream annotated_text=<>",
10125 "TextPosition anchor_id=2 text_offset=0 "
10126 "affinity=downstream annotated_text=<>"}},
10127 TextNavigationTestParam{
10129 return position->CreatePreviousLineEndPosition(
10134 {
"TextPosition anchor_id=1 text_offset=0 "
10135 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10136 "TextPosition anchor_id=1 text_offset=0 "
10137 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10138 TextNavigationTestParam{
10140 return position->CreatePreviousLineEndPosition(
10145 {
"TextPosition anchor_id=2 text_offset=0 "
10146 "affinity=downstream annotated_text=<>",
10147 "TextPosition anchor_id=2 text_offset=0 "
10148 "affinity=downstream annotated_text=<>"}},
10149 TextNavigationTestParam{
10151 return position->CreatePreviousLineEndPosition(
10156 {
"TextPosition anchor_id=6 text_offset=6 "
10157 "affinity=downstream annotated_text=Line 1<>",
10158 "TextPosition anchor_id=2 text_offset=0 "
10159 "affinity=downstream annotated_text=<>",
10160 "TextPosition anchor_id=2 text_offset=0 "
10161 "affinity=downstream annotated_text=<>"}},
10162 TextNavigationTestParam{
10164 return position->CreatePreviousLineEndPosition(
10169 {
"TextPosition anchor_id=7 text_offset=0 "
10170 "affinity=downstream annotated_text=<\n>",
10171 "TextPosition anchor_id=2 text_offset=0 "
10172 "affinity=downstream annotated_text=<>",
10173 "TextPosition anchor_id=2 text_offset=0 "
10174 "affinity=downstream annotated_text=<>"}}));
10177 CreateNextParagraphStartPositionWithBoundaryBehaviorCrossBoundary,
10178 AXPositionTextNavigationTestWithParam,
10180 TextNavigationTestParam{
10182 return position->CreateNextParagraphStartPosition(
10187 {
"TextPosition anchor_id=1 text_offset=7 "
10188 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10189 TextNavigationTestParam{
10191 return position->CreateNextParagraphStartPosition(
10196 {
"TextPosition anchor_id=4 text_offset=7 "
10197 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10198 TextNavigationTestParam{
10200 return position->CreateNextParagraphStartPosition(
10205 {
"TextPosition anchor_id=9 text_offset=0 "
10206 "affinity=downstream annotated_text=<L>ine 2"}},
10207 TextNavigationTestParam{
10209 return position->CreateNextParagraphStartPosition(
10214 {
"NullPosition"}}));
10217 CreateNextParagraphStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10218 AXPositionTextNavigationTestWithParam,
10220 TextNavigationTestParam{
10222 return position->CreateNextParagraphStartPosition(
10227 {
"TextPosition anchor_id=1 text_offset=7 "
10228 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10229 "TextPosition anchor_id=1 text_offset=13 "
10230 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10231 TextNavigationTestParam{
10233 return position->CreateNextParagraphStartPosition(
10238 {
"TextPosition anchor_id=4 text_offset=7 "
10239 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10240 "TextPosition anchor_id=4 text_offset=13 "
10241 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10242 TextNavigationTestParam{
10244 return position->CreateNextParagraphStartPosition(
10249 {
"TextPosition anchor_id=5 text_offset=6 "
10250 "affinity=downstream annotated_text=Line 1<>"}},
10251 TextNavigationTestParam{
10253 return position->CreateNextParagraphStartPosition(
10258 {
"TextPosition anchor_id=9 text_offset=6 "
10259 "affinity=downstream annotated_text=Line 2<>"}}));
10262 CreateNextParagraphStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10263 AXPositionTextNavigationTestWithParam,
10265 TextNavigationTestParam{
10267 return position->CreateNextParagraphStartPosition(
10272 {
"TextPosition anchor_id=1 text_offset=0 "
10273 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10274 "TextPosition anchor_id=1 text_offset=0 "
10275 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10276 TextNavigationTestParam{
10278 return position->CreateNextParagraphStartPosition(
10283 {
"TextPosition anchor_id=4 text_offset=0 "
10284 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10285 "TextPosition anchor_id=4 text_offset=0 "
10286 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10287 TextNavigationTestParam{
10289 return position->CreateNextParagraphStartPosition(
10294 {
"TextPosition anchor_id=9 text_offset=0 "
10295 "affinity=downstream annotated_text=<L>ine 2",
10296 "TextPosition anchor_id=9 text_offset=0 "
10297 "affinity=downstream annotated_text=<L>ine 2"}},
10298 TextNavigationTestParam{
10300 return position->CreateNextParagraphStartPosition(
10305 {
"NullPosition"}}));
10308 CreateNextParagraphStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10309 AXPositionTextNavigationTestWithParam,
10311 TextNavigationTestParam{
10313 return position->CreateNextParagraphStartPosition(
10318 {
"TextPosition anchor_id=1 text_offset=7 "
10319 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10320 "TextPosition anchor_id=1 text_offset=13 "
10321 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10322 "TextPosition anchor_id=1 text_offset=13 "
10323 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10324 TextNavigationTestParam{
10326 return position->CreateNextParagraphStartPosition(
10331 {
"TextPosition anchor_id=4 text_offset=7 "
10332 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10333 "TextPosition anchor_id=4 text_offset=13 "
10334 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10335 "TextPosition anchor_id=4 text_offset=13 "
10336 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10337 TextNavigationTestParam{
10339 return position->CreateNextParagraphStartPosition(
10344 {
"TextPosition anchor_id=9 text_offset=0 "
10345 "affinity=downstream annotated_text=<L>ine 2",
10346 "TextPosition anchor_id=9 text_offset=6 "
10347 "affinity=downstream annotated_text=Line 2<>",
10348 "TextPosition anchor_id=9 text_offset=6 "
10349 "affinity=downstream annotated_text=Line 2<>"}},
10350 TextNavigationTestParam{
10352 return position->CreateNextParagraphStartPosition(
10357 {
"TextPosition anchor_id=9 text_offset=6 "
10358 "affinity=downstream annotated_text=Line 2<>",
10359 "TextPosition anchor_id=9 text_offset=6 "
10360 "affinity=downstream annotated_text=Line 2<>"}}));
10363 CreatePreviousParagraphStartPositionWithBoundaryBehaviorCrossBoundary,
10364 AXPositionTextNavigationTestWithParam,
10366 TextNavigationTestParam{
10368 return position->CreatePreviousParagraphStartPosition(
10373 {
"TextPosition anchor_id=1 text_offset=7 "
10374 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10375 "TextPosition anchor_id=1 text_offset=0 "
10376 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10378 TextNavigationTestParam{
10380 return position->CreatePreviousParagraphStartPosition(
10385 {
"TextPosition anchor_id=4 text_offset=7 "
10386 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10387 "TextPosition anchor_id=4 text_offset=0 "
10388 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10390 TextNavigationTestParam{
10392 return position->CreatePreviousParagraphStartPosition(
10397 {
"TextPosition anchor_id=5 text_offset=0 "
10398 "affinity=downstream annotated_text=<L>ine 1",
10400 TextNavigationTestParam{
10402 return position->CreatePreviousParagraphStartPosition(
10407 {
"TextPosition anchor_id=9 text_offset=0 "
10408 "affinity=downstream annotated_text=<L>ine 2",
10409 "TextPosition anchor_id=6 text_offset=0 "
10410 "affinity=downstream annotated_text=<L>ine 1",
10411 "NullPosition"}}));
10414 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10415 AXPositionTextNavigationTestWithParam,
10417 TextNavigationTestParam{
10419 return position->CreatePreviousParagraphStartPosition(
10424 {
"TextPosition anchor_id=1 text_offset=7 "
10425 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10426 "TextPosition anchor_id=1 text_offset=0 "
10427 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10428 "TextPosition anchor_id=1 text_offset=0 "
10429 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10430 TextNavigationTestParam{
10432 return position->CreatePreviousParagraphStartPosition(
10437 {
"TextPosition anchor_id=4 text_offset=7 "
10438 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10439 "TextPosition anchor_id=4 text_offset=0 "
10440 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10441 "TextPosition anchor_id=4 text_offset=0 "
10442 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10443 TextNavigationTestParam{
10445 return position->CreatePreviousParagraphStartPosition(
10450 {
"TextPosition anchor_id=5 text_offset=0 "
10451 "affinity=downstream annotated_text=<L>ine 1",
10452 "TextPosition anchor_id=5 text_offset=0 "
10453 "affinity=downstream annotated_text=<L>ine 1"}},
10454 TextNavigationTestParam{
10456 return position->CreatePreviousParagraphStartPosition(
10461 {
"TextPosition anchor_id=9 text_offset=0 "
10462 "affinity=downstream annotated_text=<L>ine 2",
10463 "TextPosition anchor_id=9 text_offset=0 "
10464 "affinity=downstream annotated_text=<L>ine 2"}}));
10467 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10468 AXPositionTextNavigationTestWithParam,
10470 TextNavigationTestParam{
10472 return position->CreatePreviousParagraphStartPosition(
10477 {
"TextPosition anchor_id=1 text_offset=7 "
10478 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10479 "TextPosition anchor_id=1 text_offset=7 "
10480 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10481 TextNavigationTestParam{
10483 return position->CreatePreviousParagraphStartPosition(
10488 {
"TextPosition anchor_id=4 text_offset=7 "
10489 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10490 "TextPosition anchor_id=4 text_offset=7 "
10491 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10492 TextNavigationTestParam{
10494 return position->CreatePreviousParagraphStartPosition(
10499 {
"TextPosition anchor_id=5 text_offset=0 "
10500 "affinity=downstream annotated_text=<L>ine 1",
10501 "TextPosition anchor_id=5 text_offset=0 "
10502 "affinity=downstream annotated_text=<L>ine 1"}},
10503 TextNavigationTestParam{
10505 return position->CreatePreviousParagraphStartPosition(
10510 {
"TextPosition anchor_id=9 text_offset=0 "
10511 "affinity=downstream annotated_text=<L>ine 2",
10512 "TextPosition anchor_id=9 text_offset=0 "
10513 "affinity=downstream annotated_text=<L>ine 2"}}));
10516 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10517 AXPositionTextNavigationTestWithParam,
10519 TextNavigationTestParam{
10521 return position->CreatePreviousParagraphStartPosition(
10526 {
"TextPosition anchor_id=1 text_offset=7 "
10527 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10528 "TextPosition anchor_id=1 text_offset=0 "
10529 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10530 "TextPosition anchor_id=1 text_offset=0 "
10531 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10532 "TextPosition anchor_id=1 text_offset=0 "
10533 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10534 TextNavigationTestParam{
10536 return position->CreatePreviousParagraphStartPosition(
10541 {
"TextPosition anchor_id=4 text_offset=7 "
10542 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10543 "TextPosition anchor_id=4 text_offset=0 "
10544 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10545 "TextPosition anchor_id=4 text_offset=0 "
10546 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10547 TextNavigationTestParam{
10549 return position->CreatePreviousParagraphStartPosition(
10554 {
"TextPosition anchor_id=5 text_offset=0 "
10555 "affinity=downstream annotated_text=<L>ine 1",
10556 "TextPosition anchor_id=5 text_offset=0 "
10557 "affinity=downstream annotated_text=<L>ine 1"}},
10558 TextNavigationTestParam{
10560 return position->CreatePreviousParagraphStartPosition(
10565 {
"TextPosition anchor_id=9 text_offset=0 "
10566 "affinity=downstream annotated_text=<L>ine 2",
10567 "TextPosition anchor_id=6 text_offset=0 "
10568 "affinity=downstream annotated_text=<L>ine 1",
10569 "TextPosition anchor_id=6 text_offset=0 "
10570 "affinity=downstream annotated_text=<L>ine 1"}}));
10573 CreateNextParagraphEndPositionWithBoundaryBehaviorCrossBoundary,
10574 AXPositionTextNavigationTestWithParam,
10576 TextNavigationTestParam{
10578 return position->CreateNextParagraphEndPosition(
10583 {
"TextPosition anchor_id=1 text_offset=7 "
10584 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10585 "TextPosition anchor_id=1 text_offset=13 "
10586 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10588 TextNavigationTestParam{
10590 return position->CreateNextParagraphEndPosition(
10595 {
"TextPosition anchor_id=4 text_offset=7 "
10596 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10597 "TextPosition anchor_id=4 text_offset=13 "
10598 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10600 TextNavigationTestParam{
10602 return position->CreateNextParagraphEndPosition(
10607 {
"TextPosition anchor_id=7 text_offset=1 "
10608 "affinity=downstream annotated_text=\n<>",
10609 "TextPosition anchor_id=9 text_offset=6 "
10610 "affinity=downstream annotated_text=Line 2<>",
10612 TextNavigationTestParam{
10614 return position->CreateNextParagraphEndPosition(
10619 {
"TextPosition anchor_id=9 text_offset=6 "
10620 "affinity=downstream annotated_text=Line 2<>",
10621 "NullPosition"}}));
10624 CreateNextParagraphEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10625 AXPositionTextNavigationTestWithParam,
10627 TextNavigationTestParam{
10629 return position->CreateNextParagraphEndPosition(
10634 {
"TextPosition anchor_id=1 text_offset=7 "
10635 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10636 "TextPosition anchor_id=1 text_offset=13 "
10637 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10638 "TextPosition anchor_id=1 text_offset=13 "
10639 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10640 "TextPosition anchor_id=1 text_offset=13 "
10641 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10642 TextNavigationTestParam{
10644 return position->CreateNextParagraphEndPosition(
10649 {
"TextPosition anchor_id=4 text_offset=7 "
10650 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10651 "TextPosition anchor_id=4 text_offset=13 "
10652 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10653 "TextPosition anchor_id=4 text_offset=13 "
10654 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10655 "TextPosition anchor_id=4 text_offset=13 "
10656 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10657 TextNavigationTestParam{
10659 return position->CreateNextParagraphEndPosition(
10664 {
"TextPosition anchor_id=5 text_offset=6 "
10665 "affinity=downstream annotated_text=Line 1<>",
10666 "TextPosition anchor_id=5 text_offset=6 "
10667 "affinity=downstream annotated_text=Line 1<>"}},
10668 TextNavigationTestParam{
10670 return position->CreateNextParagraphEndPosition(
10675 {
"TextPosition anchor_id=9 text_offset=6 "
10676 "affinity=downstream annotated_text=Line 2<>",
10677 "TextPosition anchor_id=9 text_offset=6 "
10678 "affinity=downstream annotated_text=Line 2<>"}}));
10681 CreateNextParagraphEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10682 AXPositionTextNavigationTestWithParam,
10684 TextNavigationTestParam{
10686 return position->CreateNextParagraphEndPosition(
10691 {
"TextPosition anchor_id=1 text_offset=0 "
10692 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10693 "TextPosition anchor_id=1 text_offset=0 "
10694 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10695 TextNavigationTestParam{
10697 return position->CreateNextParagraphEndPosition(
10702 {
"TextPosition anchor_id=4 text_offset=7 "
10703 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10704 "TextPosition anchor_id=4 text_offset=7 "
10705 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10706 TextNavigationTestParam{
10708 return position->CreateNextParagraphEndPosition(
10713 {
"TextPosition anchor_id=7 text_offset=1 "
10714 "affinity=downstream annotated_text=\n<>",
10715 "TextPosition anchor_id=7 text_offset=1 "
10716 "affinity=downstream annotated_text=\n<>"}},
10717 TextNavigationTestParam{
10719 return position->CreateNextParagraphEndPosition(
10724 {
"TextPosition anchor_id=9 text_offset=6 "
10725 "affinity=downstream annotated_text=Line 2<>",
10726 "TextPosition anchor_id=9 text_offset=6 "
10727 "affinity=downstream annotated_text=Line 2<>"}},
10728 TextNavigationTestParam{
10730 return position->CreateNextParagraphEndPosition(
10735 {
"TextPosition anchor_id=7 text_offset=1 "
10736 "affinity=downstream annotated_text=\n<>",
10737 "TextPosition anchor_id=7 text_offset=1 "
10738 "affinity=downstream annotated_text=\n<>"}},
10739 TextNavigationTestParam{
10741 return position->CreateNextParagraphEndPosition(
10746 {
"TextPosition anchor_id=7 text_offset=1 "
10747 "affinity=downstream annotated_text=\n<>",
10748 "TextPosition anchor_id=7 text_offset=1 "
10749 "affinity=downstream annotated_text=\n<>"}}));
10752 CreateNextParagraphEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10753 AXPositionTextNavigationTestWithParam,
10755 TextNavigationTestParam{
10757 return position->CreateNextParagraphEndPosition(
10762 {
"TextPosition anchor_id=1 text_offset=7 "
10763 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10764 "TextPosition anchor_id=1 text_offset=13 "
10765 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10766 "TextPosition anchor_id=1 text_offset=13 "
10767 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10768 TextNavigationTestParam{
10770 return position->CreateNextParagraphEndPosition(
10775 {
"TextPosition anchor_id=4 text_offset=7 "
10776 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10777 "TextPosition anchor_id=4 text_offset=13 "
10778 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10779 "TextPosition anchor_id=4 text_offset=13 "
10780 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10781 TextNavigationTestParam{
10783 return position->CreateNextParagraphEndPosition(
10788 {
"TextPosition anchor_id=7 text_offset=1 "
10789 "affinity=downstream annotated_text=\n<>",
10790 "TextPosition anchor_id=9 text_offset=6 "
10791 "affinity=downstream annotated_text=Line 2<>",
10792 "TextPosition anchor_id=9 text_offset=6 "
10793 "affinity=downstream annotated_text=Line 2<>"}},
10794 TextNavigationTestParam{
10796 return position->CreateNextParagraphEndPosition(
10801 {
"TextPosition anchor_id=9 text_offset=6 "
10802 "affinity=downstream annotated_text=Line 2<>",
10803 "TextPosition anchor_id=9 text_offset=6 "
10804 "affinity=downstream annotated_text=Line 2<>"}}));
10807 CreatePreviousParagraphEndPositionWithBoundaryBehaviorCrossBoundary,
10808 AXPositionTextNavigationTestWithParam,
10810 TextNavigationTestParam{
10812 return position->CreatePreviousParagraphEndPosition(
10817 {
"TextPosition anchor_id=1 text_offset=7 "
10818 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10819 "TextPosition anchor_id=1 text_offset=0 "
10820 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10822 TextNavigationTestParam{
10824 return position->CreatePreviousParagraphEndPosition(
10829 {
"TextPosition anchor_id=4 text_offset=7 "
10830 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10831 "TextPosition anchor_id=3 text_offset=0 "
10832 "affinity=downstream annotated_text=<>",
10834 TextNavigationTestParam{
10836 return position->CreatePreviousParagraphEndPosition(
10841 {
"TextPosition anchor_id=1 text_offset=0 "
10842 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10844 TextNavigationTestParam{
10846 return position->CreatePreviousParagraphEndPosition(
10851 {
"TextPosition anchor_id=3 text_offset=0 "
10852 "affinity=downstream annotated_text=<>",
10854 TextNavigationTestParam{
10856 return position->CreatePreviousParagraphEndPosition(
10861 {
"TextPosition anchor_id=7 text_offset=1 "
10862 "affinity=downstream annotated_text=\n<>",
10863 "TextPosition anchor_id=3 text_offset=0 "
10864 "affinity=downstream annotated_text=<>",
10866 TextNavigationTestParam{
10868 return position->CreatePreviousParagraphEndPosition(
10873 {
"TextPosition anchor_id=3 text_offset=0 "
10874 "affinity=downstream annotated_text=<>",
10875 "NullPosition"}}));
10878 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10879 AXPositionTextNavigationTestWithParam,
10881 TextNavigationTestParam{
10883 return position->CreatePreviousParagraphEndPosition(
10888 {
"TextPosition anchor_id=1 text_offset=7 "
10889 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10890 "TextPosition anchor_id=1 text_offset=0 "
10891 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10892 "TextPosition anchor_id=1 text_offset=0 "
10893 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10894 TextNavigationTestParam{
10896 return position->CreatePreviousParagraphEndPosition(
10901 {
"TextPosition anchor_id=4 text_offset=7 "
10902 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10903 "TextPosition anchor_id=4 text_offset=0 "
10904 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10905 "TextPosition anchor_id=4 text_offset=0 "
10906 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10907 TextNavigationTestParam{
10909 return position->CreatePreviousParagraphEndPosition(
10914 {
"TextPosition anchor_id=1 text_offset=0 "
10915 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10916 "TextPosition anchor_id=1 text_offset=0 "
10917 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10918 TextNavigationTestParam{
10920 return position->CreatePreviousParagraphEndPosition(
10925 {
"TextPosition anchor_id=4 text_offset=0 "
10926 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10927 "TextPosition anchor_id=4 text_offset=0 "
10928 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10929 TextNavigationTestParam{
10931 return position->CreatePreviousParagraphEndPosition(
10936 {
"TextPosition anchor_id=9 text_offset=0 "
10937 "affinity=downstream annotated_text=<L>ine 2",
10938 "TextPosition anchor_id=9 text_offset=0 "
10939 "affinity=downstream annotated_text=<L>ine 2"}},
10940 TextNavigationTestParam{
10942 return position->CreatePreviousParagraphEndPosition(
10947 {
"TextPosition anchor_id=9 text_offset=0 "
10948 "affinity=downstream annotated_text=<L>ine 2",
10949 "TextPosition anchor_id=9 text_offset=0 "
10950 "affinity=downstream annotated_text=<L>ine 2"}}));
10953 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10954 AXPositionTextNavigationTestWithParam,
10956 TextNavigationTestParam{
10958 return position->CreatePreviousParagraphEndPosition(
10963 {
"TextPosition anchor_id=1 text_offset=7 "
10964 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10965 "TextPosition anchor_id=1 text_offset=7 "
10966 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10967 TextNavigationTestParam{
10969 return position->CreatePreviousParagraphEndPosition(
10974 {
"TextPosition anchor_id=4 text_offset=7 "
10975 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10976 "TextPosition anchor_id=4 text_offset=7 "
10977 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10978 TextNavigationTestParam{
10980 return position->CreatePreviousParagraphEndPosition(
10985 {
"TextPosition anchor_id=3 text_offset=0 "
10986 "affinity=downstream annotated_text=<>",
10987 "TextPosition anchor_id=3 text_offset=0 "
10988 "affinity=downstream annotated_text=<>"}},
10989 TextNavigationTestParam{
10991 return position->CreatePreviousParagraphEndPosition(
10996 {
"TextPosition anchor_id=7 text_offset=1 "
10997 "affinity=downstream annotated_text=\n<>",
10998 "TextPosition anchor_id=7 text_offset=1 "
10999 "affinity=downstream annotated_text=\n<>"}},
11000 TextNavigationTestParam{
11002 return position->CreatePreviousParagraphEndPosition(
11007 {
"TextPosition anchor_id=7 text_offset=1 "
11008 "affinity=downstream annotated_text=\n<>",
11009 "TextPosition anchor_id=7 text_offset=1 "
11010 "affinity=downstream annotated_text=\n<>"}},
11011 TextNavigationTestParam{
11013 return position->CreatePreviousParagraphEndPosition(
11018 {
"TextPosition anchor_id=3 text_offset=0 "
11019 "affinity=downstream annotated_text=<>",
11020 "TextPosition anchor_id=3 text_offset=0 "
11021 "affinity=downstream annotated_text=<>"}},
11022 TextNavigationTestParam{
11024 return position->CreatePreviousParagraphEndPosition(
11029 {
"TextPosition anchor_id=7 text_offset=1 "
11030 "affinity=downstream annotated_text=\n<>",
11031 "TextPosition anchor_id=7 text_offset=1 "
11032 "affinity=downstream annotated_text=\n<>"}}));
11035 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
11036 AXPositionTextNavigationTestWithParam,
11038 TextNavigationTestParam{
11040 return position->CreatePreviousParagraphEndPosition(
11045 {
"TextPosition anchor_id=1 text_offset=7 "
11046 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
11047 "TextPosition anchor_id=1 text_offset=0 "
11048 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
11049 "TextPosition anchor_id=1 text_offset=0 "
11050 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
11051 TextNavigationTestParam{
11053 return position->CreatePreviousParagraphEndPosition(
11058 {
"TextPosition anchor_id=4 text_offset=7 "
11059 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
11060 "TextPosition anchor_id=3 text_offset=0 "
11061 "affinity=downstream annotated_text=<>",
11062 "TextPosition anchor_id=3 text_offset=0 "
11063 "affinity=downstream annotated_text=<>"}},
11064 TextNavigationTestParam{
11066 return position->CreatePreviousParagraphEndPosition(
11071 {
"TextPosition anchor_id=1 text_offset=0 "
11072 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
11073 "TextPosition anchor_id=1 text_offset=0 "
11074 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
11075 TextNavigationTestParam{
11077 return position->CreatePreviousParagraphEndPosition(
11082 {
"TextPosition anchor_id=3 text_offset=0 "
11083 "affinity=downstream annotated_text=<>",
11084 "TextPosition anchor_id=3 text_offset=0 "
11085 "affinity=downstream annotated_text=<>"}},
11086 TextNavigationTestParam{
11088 return position->CreatePreviousParagraphEndPosition(
11093 {
"TextPosition anchor_id=7 text_offset=1 "
11094 "affinity=downstream annotated_text=\n<>",
11095 "TextPosition anchor_id=3 text_offset=0 "
11096 "affinity=downstream annotated_text=<>",
11097 "TextPosition anchor_id=3 text_offset=0 "
11098 "affinity=downstream annotated_text=<>"}},
11099 TextNavigationTestParam{
11101 return position->CreatePreviousParagraphEndPosition(
11106 {
"TextPosition anchor_id=3 text_offset=0 "
11107 "affinity=downstream annotated_text=<>",
11108 "TextPosition anchor_id=3 text_offset=0 "
11109 "affinity=downstream annotated_text=<>"}}));
static AXPositionInstance Unserialize(const SerializedPosition &serialization)
static constexpr char16_t kEmbeddedCharacter
static const int INVALID_OFFSET
static AXPositionInstance CreateNullPosition()
static AXPositionInstance CreateTreePosition(AXTreeID tree_id, AXNode::AXID anchor_id, int child_index)
static const int BEFORE_TEXT
static const int INVALID_INDEX
static AXPositionInstance CreateTextPosition(AXTreeID tree_id, AXNode::AXID anchor_id, int text_offset, ax::mojom::TextAffinity affinity)
const AXTreeData & data() const
static AXTreeID CreateNewAXTreeID()
G_BEGIN_DECLS GBytes * message
TEST_P(AXPositionExpandToEnclosingTextBoundaryTestWithParam, TextPositionBeforeLine2)
const char * ToString(ax::mojom::Event event)
INSTANTIATE_TEST_SUITE_P(ExpandToEnclosingTextBoundary, AXPositionExpandToEnclosingTextBoundaryTestWithParam, testing::Values(ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kCharacter, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2", "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kCharacter, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=8 affinity=downstream " "annotated_text=Line 1\nL<i>ne 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kFormat, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kFormat, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineStart, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineStart, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineStartOrEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kLineStartOrEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kObject, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kObject, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=7 affinity=upstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=upstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphStart, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphStart, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphStartOrEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=4 text_offset=7 affinity=upstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kParagraphStartOrEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=13 affinity=downstream " "annotated_text=Line 1\nLine 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWebPage, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=1 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=9 text_offset=6 affinity=downstream " "annotated_text=Line 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWebPage, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=1 text_offset=0 affinity=downstream " "annotated_text=<L>ine 1\nLine 2", "TextPosition anchor_id=9 text_offset=6 affinity=downstream " "annotated_text=Line 2<>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2", "TextPosition anchor_id=4 text_offset=11 affinity=downstream " "annotated_text=Line 1\nLine< >2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2", "TextPosition anchor_id=4 text_offset=11 affinity=downstream " "annotated_text=Line 1\nLine< >2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordStart, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=5 affinity=downstream " "annotated_text=Line <1>\nLine 2", "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordStart, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=12 affinity=downstream " "annotated_text=Line 1\nLine <2>"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordStartOrEnd, AXRangeExpandBehavior::kLeftFirst, "TextPosition anchor_id=4 text_offset=5 affinity=downstream " "annotated_text=Line <1>\nLine 2", "TextPosition anchor_id=4 text_offset=6 affinity=downstream " "annotated_text=Line 1<\n>Line 2"}, ExpandToEnclosingTextBoundaryTestParam{ ax::mojom::TextBoundary::kWordStartOrEnd, AXRangeExpandBehavior::kRightFirst, "TextPosition anchor_id=4 text_offset=7 affinity=downstream " "annotated_text=Line 1\n<L>ine 2", "TextPosition anchor_id=4 text_offset=11 affinity=downstream " "annotated_text=Line 1\nLine< >2"}))
void swap(AXPosition< AXPositionType, AXNodeType > &first, AXPosition< AXPositionType, AXNodeType > &second)
AXEmbeddedObjectBehavior g_ax_embedded_object_behavior
std::unique_ptr< AXPosition< AXNodePosition, AXNode > > TestPositionType
@ StopIfAlreadyAtBoundary
@ StopAtLastAnchorBoundary
AXRange< AXPosition< AXNodePosition, AXNode > > TestPositionRange
TEST_F(AXPositionTest, Clone)
void AddIntListAttribute(ax::mojom::IntListAttribute attribute, const std::vector< int32_t > &value)
void AddState(ax::mojom::State state)
void AddIntAttribute(ax::mojom::IntAttribute attribute, int32_t value)
std::vector< int32_t > child_ids
void SetValue(const std::string &value)
void SetName(const std::string &name)
void RemoveState(ax::mojom::State state)
void AddBoolAttribute(ax::mojom::BoolAttribute attribute, bool value)
std::vector< AXNodeData > nodes
#define BASE_DISALLOW_COPY_AND_ASSIGN(TypeName)