22#include "flutter/fml/platform/win/wstring_conversion.h"
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;
117 ExpandToEnclosingTextBoundaryTestParam(
118 const ExpandToEnclosingTextBoundaryTestParam& other) =
default;
119 ExpandToEnclosingTextBoundaryTestParam& operator=(
120 const ExpandToEnclosingTextBoundaryTestParam& other) =
default;
122 ~ExpandToEnclosingTextBoundaryTestParam() =
default;
132 std::string expected_anchor_position;
135 std::string expected_focus_position;
140class AXPositionExpandToEnclosingTextBoundaryTestWithParam
141 :
public AXPositionTest,
142 public testing::WithParamInterface<
143 ExpandToEnclosingTextBoundaryTestParam> {
145 AXPositionExpandToEnclosingTextBoundaryTestWithParam() =
default;
146 ~AXPositionExpandToEnclosingTextBoundaryTestWithParam()
override =
default;
149 AXPositionExpandToEnclosingTextBoundaryTestWithParam);
157struct CreatePositionAtTextBoundaryTestParam {
158 CreatePositionAtTextBoundaryTestParam() =
default;
161 CreatePositionAtTextBoundaryTestParam(
162 const CreatePositionAtTextBoundaryTestParam& other) =
default;
163 CreatePositionAtTextBoundaryTestParam& operator=(
164 const CreatePositionAtTextBoundaryTestParam& other) =
default;
166 ~CreatePositionAtTextBoundaryTestParam() =
default;
181 std::string expected_text_position;
186class AXPositionCreatePositionAtTextBoundaryTestWithParam
187 :
public AXPositionTest,
188 public testing::WithParamInterface<
189 CreatePositionAtTextBoundaryTestParam> {
191 AXPositionCreatePositionAtTextBoundaryTestWithParam() =
default;
192 ~AXPositionCreatePositionAtTextBoundaryTestWithParam()
override =
default;
195 AXPositionCreatePositionAtTextBoundaryTestWithParam);
203struct TextNavigationTestParam {
204 TextNavigationTestParam() =
default;
207 TextNavigationTestParam(
const TextNavigationTestParam& other) =
default;
208 TextNavigationTestParam& operator=(
const TextNavigationTestParam& other) =
211 ~TextNavigationTestParam() =
default;
225 std::vector<std::string> expectations;
235class AXPositionTextNavigationTestWithParam
236 :
public AXPositionTest,
237 public testing::WithParamInterface<TextNavigationTestParam> {
239 AXPositionTextNavigationTestWithParam() =
default;
240 ~AXPositionTextNavigationTestWithParam()
override =
default;
245const char* AXPositionTest::TEXT_VALUE =
"Line 1\nLine 2";
247void AXPositionTest::SetUp() {
264 button_.id = BUTTON_ID;
265 check_box_.id = CHECK_BOX_ID;
266 text_field_.id = TEXT_FIELD_ID;
267 static_text1_.id = STATIC_TEXT1_ID;
268 inline_box1_.id = INLINE_BOX1_ID;
269 line_break_.id = LINE_BREAK_ID;
270 static_text2_.id = STATIC_TEXT2_ID;
271 inline_box2_.id = INLINE_BOX2_ID;
280 button_.SetName(
"Button");
281 button_.relative_bounds.bounds =
gfx::RectF(20, 20, 200, 30);
282 root_.child_ids.push_back(button_.id);
288 check_box_.SetName(
"Check box");
289 check_box_.relative_bounds.bounds =
gfx::RectF(20, 50, 200, 30);
290 root_.child_ids.push_back(check_box_.id);
296 text_field_.SetValue(TEXT_VALUE);
297 text_field_.SetName(TEXT_VALUE);
298 text_field_.AddIntListAttribute(
300 std::vector<int32_t>{0, 7});
301 text_field_.child_ids.push_back(static_text1_.id);
302 text_field_.child_ids.push_back(line_break_.id);
303 text_field_.child_ids.push_back(static_text2_.id);
304 root_.child_ids.push_back(text_field_.id);
308 static_text1_.SetName(
"Line 1");
309 static_text1_.child_ids.push_back(inline_box1_.id);
310 static_text1_.AddIntAttribute(
316 inline_box1_.SetName(
"Line 1");
318 std::vector<int32_t>{0, 5});
320 std::vector<int32_t>{4, 6});
328 line_break_.SetName(
"\n");
334 static_text2_.SetName(
"Line 2");
335 static_text2_.child_ids.push_back(inline_box2_.id);
340 inline_box2_.SetName(
"Line 2");
342 std::vector<int32_t>{0, 5});
344 std::vector<int32_t>{4, 6});
348 initial_state.
nodes = {root_, button_, check_box_,
349 text_field_, static_text1_, inline_box1_,
350 line_break_, static_text2_, inline_box2_};
357 SetTree(std::make_unique<AXTree>(initial_state));
360std::unique_ptr<AXTree> AXPositionTest::CreateMultipageDocument(
376 page_1_text_data.
id = 3;
378 page_1_text_data.
SetName(
"some text on page 1");
388 page_2_text_data.
id = 5;
390 page_2_text_data.
SetName(
"some text on page 2");
401 page_3_text_data.
id = 7;
403 page_3_text_data.
SetName(
"some more text on page 3");
408 return CreateAXTree({root_data, page_1_data, page_1_text_data, page_2_data,
409 page_2_text_data, page_3_data, page_3_text_data});
412std::unique_ptr<AXTree> AXPositionTest::CreateMultilingualDocument(
413 std::vector<int>* text_offsets)
const {
414 EXPECT_NE(
nullptr, text_offsets);
415 text_offsets->push_back(0);
417 std::u16string english_text;
418 for (
int i = 0;
i < 3; ++
i) {
419 std::u16string grapheme = kGraphemeClusters[
i];
420 EXPECT_EQ(1u, grapheme.length())
421 <<
"All English characters should be one UTF16 code unit in length.";
422 text_offsets->push_back(text_offsets->back() +
423 static_cast<int>(grapheme.length()));
424 english_text.append(grapheme);
427 std::u16string hindi_text;
428 for (
int i = 3;
i < 5; ++
i) {
429 std::u16string grapheme = kGraphemeClusters[
i];
430 EXPECT_LE(2u, grapheme.length()) <<
"All Hindi characters should be two "
431 "or more UTF16 code units in length.";
432 text_offsets->push_back(text_offsets->back() +
433 static_cast<int>(grapheme.length()));
434 hindi_text.append(grapheme);
437 std::u16string thai_text;
438 for (
int i = 5;
i < 8; ++
i) {
439 std::u16string grapheme = kGraphemeClusters[
i];
440 EXPECT_LT(0u, grapheme.length())
441 <<
"One of the Thai characters should be one UTF16 code unit, "
442 "whilst others should be two or more.";
443 text_offsets->push_back(text_offsets->back() +
444 static_cast<int>(grapheme.length()));
445 thai_text.append(grapheme);
455 text_data1.
SetName(english_text);
460 text_data2.
SetName(hindi_text);
469 return CreateAXTree({root_data, text_data1, text_data2, text_data3});
472void AXPositionTest::AssertTextLengthEquals(
const AXTree* tree,
474 int expected_text_length)
const {
478 ASSERT_NE(
nullptr, text_position);
479 ASSERT_TRUE(text_position->IsTextPosition());
480 ASSERT_EQ(expected_text_length, text_position->MaxTextOffset());
481 ASSERT_EQ(expected_text_length,
482 static_cast<int>(text_position->GetText().length()));
485std::unique_ptr<AXTree> AXPositionTest::CreateAXTree(
486 const std::vector<AXNodeData>& nodes)
const {
487 EXPECT_FALSE(nodes.empty());
490 update.has_tree_data =
true;
491 update.root_id = nodes[0].id;
493 return std::make_unique<AXTree>(
update);
500 ASSERT_NE(
nullptr, null_position);
502 ASSERT_NE(
nullptr, copy_position);
506 GetTreeID(), root_.id, 1 );
507 ASSERT_NE(
nullptr, tree_position);
508 copy_position = tree_position->Clone();
509 ASSERT_NE(
nullptr, copy_position);
511 EXPECT_EQ(root_.id, copy_position->anchor_id());
512 EXPECT_EQ(1, copy_position->child_index());
517 ASSERT_NE(
nullptr, tree_position);
518 copy_position = tree_position->Clone();
519 ASSERT_NE(
nullptr, copy_position);
521 EXPECT_EQ(root_.id, copy_position->anchor_id());
526 GetTreeID(), text_field_.id, 0 ,
528 ASSERT_NE(
nullptr, text_position);
529 ASSERT_TRUE(text_position->IsTextPosition());
530 copy_position = text_position->Clone();
531 ASSERT_NE(
nullptr, copy_position);
533 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
534 EXPECT_EQ(0, copy_position->text_offset());
538 GetTreeID(), text_field_.id, 0 ,
540 ASSERT_NE(
nullptr, text_position);
541 ASSERT_TRUE(text_position->IsTextPosition());
542 copy_position = text_position->Clone();
543 ASSERT_NE(
nullptr, copy_position);
545 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
546 EXPECT_EQ(0, copy_position->text_offset());
553 ASSERT_NE(
nullptr, null_position);
556 ASSERT_NE(
nullptr, copy_position);
560 GetTreeID(), root_.id, 1 );
561 ASSERT_NE(
nullptr, tree_position);
563 ASSERT_NE(
nullptr, copy_position);
565 EXPECT_EQ(root_.id, copy_position->anchor_id());
566 EXPECT_EQ(1, copy_position->child_index());
571 ASSERT_NE(
nullptr, tree_position);
573 ASSERT_NE(
nullptr, copy_position);
575 EXPECT_EQ(root_.id, copy_position->anchor_id());
580 GetTreeID(), text_field_.id, 0 ,
582 ASSERT_NE(
nullptr, text_position);
583 ASSERT_TRUE(text_position->IsTextPosition());
585 ASSERT_NE(
nullptr, copy_position);
587 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
588 EXPECT_EQ(0, copy_position->text_offset());
592 GetTreeID(), text_field_.id, 0 ,
594 ASSERT_NE(
nullptr, text_position);
595 ASSERT_TRUE(text_position->IsTextPosition());
597 ASSERT_NE(
nullptr, copy_position);
599 EXPECT_EQ(text_field_.id, copy_position->anchor_id());
600 EXPECT_EQ(0, copy_position->text_offset());
611 static_text_data_1.
id = 2;
613 static_text_data_1.
SetName(
"some text");
616 static_text_data_2.
id = 3;
618 static_text_data_2.
SetName(u
"\xfffc");
621 static_text_data_3.
id = 4;
623 static_text_data_3.
SetName(
"more text");
625 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id,
626 static_text_data_3.
id};
628 SetTree(CreateAXTree(
629 {root_data, static_text_data_1, static_text_data_2, static_text_data_3}));
632 GetTreeID(), root_data.
id, 0 ,
634 ASSERT_TRUE(text_position_1->IsTextPosition());
636 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
637 "annotated_text=<s>ome text\xEF\xBF\xBCmore text",
638 text_position_1->ToString());
641 GetTreeID(), root_data.
id, 5 ,
643 ASSERT_TRUE(text_position_2->IsTextPosition());
645 "TextPosition anchor_id=1 text_offset=5 affinity=downstream "
646 "annotated_text=some <t>ext\xEF\xBF\xBCmore text",
647 text_position_2->ToString());
650 GetTreeID(), root_data.
id, 9 ,
652 ASSERT_TRUE(text_position_3->IsTextPosition());
654 "TextPosition anchor_id=1 text_offset=9 affinity=downstream "
655 "annotated_text=some text<\xEF\xBF\xBC>more text",
656 text_position_3->ToString());
659 GetTreeID(), root_data.
id, 10 ,
661 ASSERT_TRUE(text_position_4->IsTextPosition());
663 "TextPosition anchor_id=1 text_offset=10 affinity=downstream "
664 "annotated_text=some text\xEF\xBF\xBC<m>ore text",
665 text_position_4->ToString());
668 GetTreeID(), root_data.
id, 19 ,
670 ASSERT_TRUE(text_position_5->IsTextPosition());
672 "TextPosition anchor_id=1 text_offset=19 affinity=downstream "
673 "annotated_text=some text\xEF\xBF\xBCmore text<>",
674 text_position_5->ToString());
677 GetTreeID(), static_text_data_2.
id, 0 ,
679 ASSERT_TRUE(text_position_6->IsTextPosition());
681 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
682 "annotated_text=<\xEF\xBF\xBC>",
683 text_position_6->ToString());
686 GetTreeID(), static_text_data_2.
id, 1 ,
688 ASSERT_TRUE(text_position_7->IsTextPosition());
690 "TextPosition anchor_id=3 text_offset=1 affinity=downstream "
691 "annotated_text=\xEF\xBF\xBC<>",
692 text_position_7->ToString());
695 GetTreeID(), static_text_data_3.
id, 0 ,
697 ASSERT_TRUE(text_position_8->IsTextPosition());
699 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
700 "annotated_text=<m>ore text",
701 text_position_8->ToString());
704 GetTreeID(), static_text_data_3.
id, 5 ,
706 ASSERT_TRUE(text_position_9->IsTextPosition());
708 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
709 "annotated_text=more <t>ext",
710 text_position_9->ToString());
713 GetTreeID(), static_text_data_3.
id, 9 ,
715 ASSERT_TRUE(text_position_10->IsTextPosition());
717 "TextPosition anchor_id=4 text_offset=9 affinity=downstream "
718 "annotated_text=more text<>",
719 text_position_10->ToString());
732 static_text_data_1.
id = 2;
734 static_text_data_1.
SetName(
"One");
737 inline_box_data_1.
id = 3;
739 inline_box_data_1.
SetName(
"One");
743 container_data.
id = 4;
748 static_text_data_2.
id = 5;
750 static_text_data_2.
SetName(
"Two");
753 inline_box_data_2.
id = 6;
755 inline_box_data_2.
SetName(
"Two");
757 static_text_data_1.
child_ids = {inline_box_data_1.
id};
758 container_data.
child_ids = {static_text_data_2.
id};
759 static_text_data_2.
child_ids = {inline_box_data_2.
id};
760 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
763 CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
764 container_data, static_text_data_2, inline_box_data_2}));
771 GetTreeID(), root_data.
id, 0 ,
773 ASSERT_TRUE(text_position_1->IsTextPosition());
780 GetTreeID(), root_data.
id, 2 ,
782 ASSERT_TRUE(text_position_2->IsTextPosition());
788 GetTreeID(), root_data.
id, 3 ,
790 ASSERT_TRUE(text_position_3->IsTextPosition());
794 EXPECT_FALSE(text_position_3->IsIgnored());
798 GetTreeID(), root_data.
id, 4 ,
800 ASSERT_TRUE(text_position_4->IsTextPosition());
802 EXPECT_FALSE(text_position_4->IsIgnored());
807 GetTreeID(), container_data.
id, 0 ,
809 ASSERT_TRUE(text_position_5->IsTextPosition());
815 GetTreeID(), static_text_data_2.
id, 0 ,
817 ASSERT_TRUE(text_position_6->IsTextPosition());
818 EXPECT_FALSE(text_position_6->IsIgnored());
822 GetTreeID(), inline_box_data_1.
id, 1 ,
824 ASSERT_TRUE(text_position_7->IsTextPosition());
836 GetTreeID(), root_data.
id, 0 );
837 ASSERT_TRUE(tree_position_1->IsTreePosition());
838 EXPECT_FALSE(tree_position_1->IsIgnored());
842 GetTreeID(), root_data.
id, 1 );
843 ASSERT_TRUE(tree_position_2->IsTreePosition());
848 GetTreeID(), inline_box_data_1.
id, 0 );
849 ASSERT_TRUE(tree_position_3->IsTreePosition());
855 ASSERT_TRUE(tree_position_4->IsTreePosition());
861 GetTreeID(), root_data.
id, 2 );
862 ASSERT_TRUE(tree_position_5->IsTreePosition());
868 ASSERT_TRUE(tree_position_6->IsTreePosition());
869 EXPECT_FALSE(tree_position_6->IsIgnored());
872TEST_F(AXPositionTest, GetTextFromNullPosition) {
874 ASSERT_NE(
nullptr, text_position);
875 ASSERT_TRUE(text_position->IsNullPosition());
876 ASSERT_EQ(u
"", text_position->GetText());
881 GetTreeID(), root_.id, 0 ,
883 ASSERT_NE(
nullptr, text_position);
884 ASSERT_TRUE(text_position->IsTextPosition());
885 ASSERT_EQ(u
"Line 1\nLine 2", text_position->GetText());
888TEST_F(AXPositionTest, GetTextFromButton) {
890 GetTreeID(), button_.id, 0 ,
892 ASSERT_NE(
nullptr, text_position);
893 ASSERT_TRUE(text_position->IsTextPosition());
894 ASSERT_EQ(u
"", text_position->GetText());
897TEST_F(AXPositionTest, GetTextFromCheckbox) {
899 GetTreeID(), check_box_.id, 0 ,
901 ASSERT_NE(
nullptr, text_position);
902 ASSERT_TRUE(text_position->IsTextPosition());
903 ASSERT_EQ(u
"", text_position->GetText());
906TEST_F(AXPositionTest, GetTextFromTextField) {
908 GetTreeID(), text_field_.id, 0 ,
910 ASSERT_NE(
nullptr, text_position);
911 ASSERT_TRUE(text_position->IsTextPosition());
912 ASSERT_EQ(u
"Line 1\nLine 2", text_position->GetText());
915TEST_F(AXPositionTest, GetTextFromStaticText) {
917 GetTreeID(), static_text1_.id, 0 ,
919 ASSERT_NE(
nullptr, text_position);
920 ASSERT_TRUE(text_position->IsTextPosition());
921 ASSERT_EQ(u
"Line 1", text_position->GetText());
924TEST_F(AXPositionTest, GetTextFromInlineTextBox) {
926 GetTreeID(), inline_box1_.id, 0 ,
928 ASSERT_NE(
nullptr, text_position);
929 ASSERT_TRUE(text_position->IsTextPosition());
930 ASSERT_EQ(u
"Line 1", text_position->GetText());
933TEST_F(AXPositionTest, GetTextFromLineBreak) {
935 GetTreeID(), line_break_.id, 0 ,
937 ASSERT_NE(
nullptr, text_position);
938 ASSERT_TRUE(text_position->IsTextPosition());
939 ASSERT_EQ(u
"\n", text_position->GetText());
942TEST_F(AXPositionTest, GetMaxTextOffsetFromNullPosition) {
944 ASSERT_NE(
nullptr, text_position);
945 ASSERT_TRUE(text_position->IsNullPosition());
949TEST_F(AXPositionTest, GetMaxTextOffsetFromRoot) {
951 GetTreeID(), root_.id, 0 ,
953 ASSERT_NE(
nullptr, text_position);
954 ASSERT_TRUE(text_position->IsTextPosition());
955 ASSERT_EQ(13, text_position->MaxTextOffset());
958TEST_F(AXPositionTest, GetMaxTextOffsetFromButton) {
960 GetTreeID(), button_.id, 0 ,
962 ASSERT_NE(
nullptr, text_position);
963 ASSERT_TRUE(text_position->IsTextPosition());
964 ASSERT_EQ(0, text_position->MaxTextOffset());
967TEST_F(AXPositionTest, GetMaxTextOffsetFromCheckbox) {
969 GetTreeID(), check_box_.id, 0 ,
971 ASSERT_NE(
nullptr, text_position);
972 ASSERT_TRUE(text_position->IsTextPosition());
973 ASSERT_EQ(0, text_position->MaxTextOffset());
976TEST_F(AXPositionTest, GetMaxTextOffsetFromTextfield) {
978 GetTreeID(), text_field_.id, 0 ,
980 ASSERT_NE(
nullptr, text_position);
981 ASSERT_TRUE(text_position->IsTextPosition());
982 ASSERT_EQ(13, text_position->MaxTextOffset());
985TEST_F(AXPositionTest, GetMaxTextOffsetFromStaticText) {
987 GetTreeID(), static_text1_.id, 0 ,
989 ASSERT_NE(
nullptr, text_position);
990 ASSERT_TRUE(text_position->IsTextPosition());
991 ASSERT_EQ(6, text_position->MaxTextOffset());
994TEST_F(AXPositionTest, GetMaxTextOffsetFromInlineTextBox) {
996 GetTreeID(), inline_box1_.id, 0 ,
998 ASSERT_NE(
nullptr, text_position);
999 ASSERT_TRUE(text_position->IsTextPosition());
1000 ASSERT_EQ(6, text_position->MaxTextOffset());
1003TEST_F(AXPositionTest, GetMaxTextOffsetFromLineBreak) {
1005 GetTreeID(), line_break_.id, 0 ,
1007 ASSERT_NE(
nullptr, text_position);
1008 ASSERT_TRUE(text_position->IsTextPosition());
1009 ASSERT_EQ(1, text_position->MaxTextOffset());
1012TEST_F(AXPositionTest, GetMaxTextOffsetUpdate) {
1020 text_data.
SetName(
"some text");
1023 more_text_data.
id = 3;
1025 more_text_data.
SetName(
"more text");
1029 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1031 AssertTextLengthEquals(GetTree(), text_data.
id, 9);
1032 AssertTextLengthEquals(GetTree(), root_data.
id, 18);
1034 text_data.
SetName(
"Adjusted line 1");
1035 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1037 AssertTextLengthEquals(GetTree(), text_data.
id, 15);
1038 AssertTextLengthEquals(GetTree(), root_data.
id, 24);
1041 text_data.
SetValue(
"Value should override name");
1042 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1044 AssertTextLengthEquals(GetTree(), text_data.
id, 26);
1045 AssertTextLengthEquals(GetTree(), root_data.
id, 35);
1049 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
1051 AssertTextLengthEquals(GetTree(), text_data.
id, 15);
1052 AssertTextLengthEquals(GetTree(), root_data.
id, 24);
1055TEST_F(AXPositionTest, GetMaxTextOffsetAndGetTextWithGeneratedContent) {
1070 text_field_2.
id = 2;
1071 static_text_3.
id = 3;
1072 inline_box_4.
id = 4;
1073 static_text_5.
id = 5;
1074 inline_box_6.
id = 6;
1081 text_field_2.
child_ids = {static_text_3.
id, static_text_5.
id};
1084 static_text_3.
SetName(
"Placeholder from generated content");
1088 inline_box_4.
SetName(
"Placeholder from generated content");
1091 static_text_5.
SetName(
"3.14");
1097 SetTree(CreateAXTree({root_1, text_field_2, static_text_3, inline_box_4,
1098 static_text_5, inline_box_6}));
1101 GetTreeID(), text_field_2.
id, 0 ,
1103 ASSERT_NE(
nullptr, text_position);
1105 EXPECT_EQ(38, text_position->MaxTextOffset());
1106 EXPECT_EQ(u
"Placeholder from generated content3.14",
1107 text_position->GetText());
1110TEST_F(AXPositionTest, AtStartOfAnchorWithNullPosition) {
1112 ASSERT_NE(
nullptr, null_position);
1113 EXPECT_FALSE(null_position->AtStartOfAnchor());
1116TEST_F(AXPositionTest, AtStartOfAnchorWithTreePosition) {
1118 GetTreeID(), root_.id, 0 );
1119 ASSERT_NE(
nullptr, tree_position);
1124 ASSERT_NE(
nullptr, tree_position);
1125 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1129 ASSERT_NE(
nullptr, tree_position);
1130 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1135 ASSERT_NE(
nullptr, tree_position);
1140 GetTreeID(), inline_box1_.id, 0 );
1141 ASSERT_NE(
nullptr, tree_position);
1142 EXPECT_FALSE(tree_position->AtStartOfAnchor());
1145TEST_F(AXPositionTest, AtStartOfAnchorWithTextPosition) {
1147 GetTreeID(), inline_box1_.id, 0 ,
1149 ASSERT_NE(
nullptr, text_position);
1150 ASSERT_TRUE(text_position->IsTextPosition());
1154 GetTreeID(), inline_box1_.id, 1 ,
1156 ASSERT_NE(
nullptr, text_position);
1157 ASSERT_TRUE(text_position->IsTextPosition());
1158 EXPECT_FALSE(text_position->AtStartOfAnchor());
1161 GetTreeID(), inline_box1_.id, 6 ,
1163 ASSERT_NE(
nullptr, text_position);
1164 ASSERT_TRUE(text_position->IsTextPosition());
1165 EXPECT_FALSE(text_position->AtStartOfAnchor());
1168TEST_F(AXPositionTest, AtEndOfAnchorWithNullPosition) {
1170 ASSERT_NE(
nullptr, null_position);
1171 EXPECT_FALSE(null_position->AtEndOfAnchor());
1174TEST_F(AXPositionTest, AtEndOfAnchorWithTreePosition) {
1176 GetTreeID(), root_.id, 3 );
1177 ASSERT_NE(
nullptr, tree_position);
1182 ASSERT_NE(
nullptr, tree_position);
1183 EXPECT_FALSE(tree_position->AtEndOfAnchor());
1187 ASSERT_NE(
nullptr, tree_position);
1188 EXPECT_FALSE(tree_position->AtEndOfAnchor());
1191TEST_F(AXPositionTest, AtEndOfAnchorWithTextPosition) {
1193 GetTreeID(), inline_box1_.id, 6 ,
1195 ASSERT_NE(
nullptr, text_position);
1196 ASSERT_TRUE(text_position->IsTextPosition());
1200 GetTreeID(), inline_box1_.id, 5 ,
1202 ASSERT_NE(
nullptr, text_position);
1203 ASSERT_TRUE(text_position->IsTextPosition());
1204 EXPECT_FALSE(text_position->AtEndOfAnchor());
1207 GetTreeID(), inline_box1_.id, 0 ,
1209 ASSERT_NE(
nullptr, text_position);
1210 ASSERT_TRUE(text_position->IsTextPosition());
1211 EXPECT_FALSE(text_position->AtEndOfAnchor());
1214TEST_F(AXPositionTest, AtStartOfLineWithTextPosition) {
1218 GetTreeID(), inline_box1_.id, 0 ,
1220 ASSERT_NE(
nullptr, text_position);
1221 ASSERT_TRUE(text_position->IsTextPosition());
1225 GetTreeID(), inline_box1_.id, 1 ,
1227 ASSERT_NE(
nullptr, text_position);
1228 ASSERT_TRUE(text_position->IsTextPosition());
1229 EXPECT_FALSE(text_position->AtStartOfLine());
1232 GetTreeID(), line_break_.id, 0 ,
1234 ASSERT_NE(
nullptr, text_position);
1235 ASSERT_TRUE(text_position->IsTextPosition());
1236 EXPECT_FALSE(text_position->AtStartOfLine());
1241 GetTreeID(), line_break_.id, 1 ,
1243 ASSERT_NE(
nullptr, text_position);
1244 ASSERT_TRUE(text_position->IsTextPosition());
1250 GetTreeID(), inline_box2_.id, 0 ,
1252 ASSERT_NE(
nullptr, text_position);
1253 ASSERT_TRUE(text_position->IsTextPosition());
1257 GetTreeID(), inline_box2_.id, 1 ,
1259 ASSERT_NE(
nullptr, text_position);
1260 ASSERT_TRUE(text_position->IsTextPosition());
1261 EXPECT_FALSE(text_position->AtStartOfLine());
1264TEST_F(AXPositionTest, AtStartOfLineStaticTextExtraPrecedingSpace) {
1294 static_text1.
id = 3;
1299 inline_text1.
id = 4;
1304 root.child_ids = {static_text1.
id};
1306 SetTree(CreateAXTree({
root, static_text1, inline_text1}));
1312 GetTreeID(), static_text1.
id, 1 ,
1314 ASSERT_FALSE(text_position->AtStartOfLine());
1317TEST_F(AXPositionTest, AtEndOfLineWithTextPosition) {
1319 GetTreeID(), inline_box1_.id, 5 ,
1321 ASSERT_NE(
nullptr, text_position);
1322 ASSERT_TRUE(text_position->IsTextPosition());
1323 EXPECT_FALSE(text_position->AtEndOfLine());
1326 GetTreeID(), inline_box1_.id, 6 ,
1328 ASSERT_NE(
nullptr, text_position);
1329 ASSERT_TRUE(text_position->IsTextPosition());
1335 GetTreeID(), line_break_.id, 0 ,
1337 ASSERT_NE(
nullptr, text_position);
1338 ASSERT_TRUE(text_position->IsTextPosition());
1344 GetTreeID(), line_break_.id, 1 ,
1346 ASSERT_NE(
nullptr, text_position);
1347 ASSERT_TRUE(text_position->IsTextPosition());
1348 EXPECT_FALSE(text_position->AtEndOfLine());
1351 GetTreeID(), inline_box2_.id, 5 ,
1353 ASSERT_NE(
nullptr, text_position);
1354 ASSERT_TRUE(text_position->IsTextPosition());
1355 EXPECT_FALSE(text_position->AtEndOfLine());
1358 GetTreeID(), inline_box2_.id, 6 ,
1360 ASSERT_NE(
nullptr, text_position);
1361 ASSERT_TRUE(text_position->IsTextPosition());
1371 update.nodes = {inline_box1_, line_break_};
1372 ASSERT_TRUE(GetTree()->Unserialize(
update));
1375 GetTreeID(), text_field_.id, 1 );
1376 ASSERT_NE(
nullptr, tree_position);
1377 ASSERT_TRUE(tree_position->IsTreePosition());
1381 GetTreeID(), line_break_.id, 0 ,
1383 ASSERT_NE(
nullptr, text_position);
1384 ASSERT_TRUE(text_position->IsTextPosition());
1390 GetTreeID(), line_break_.id, 1 ,
1392 ASSERT_NE(
nullptr, text_position);
1393 ASSERT_TRUE(text_position->IsTextPosition());
1403 update.nodes = {inline_box1_, line_break_};
1404 ASSERT_TRUE(GetTree()->Unserialize(
update));
1407 GetTreeID(), text_field_.id, 1 );
1408 ASSERT_NE(
nullptr, tree_position);
1409 ASSERT_TRUE(tree_position->IsTreePosition());
1410 EXPECT_FALSE(tree_position->AtEndOfLine());
1413 GetTreeID(), line_break_.id, 0 ,
1415 ASSERT_NE(
nullptr, text_position);
1416 ASSERT_TRUE(text_position->IsTextPosition());
1417 EXPECT_FALSE(text_position->AtEndOfLine());
1420 GetTreeID(), line_break_.id, 1 ,
1422 ASSERT_NE(
nullptr, text_position);
1423 ASSERT_TRUE(text_position->IsTextPosition());
1427TEST_F(AXPositionTest, AtStartAndEndOfLineWhenAtEndOfTextSpan) {
1469 static_text_data_1.
id = 2;
1471 static_text_data_1.
SetName(
"Hello testing ");
1474 inline_box_data_1.
id = 3;
1476 inline_box_data_1.
SetName(
"hello");
1479 inline_box_data_2.
id = 4;
1482 inline_box_data_2.
id);
1484 inline_box_data_1.
id);
1487 inline_box_data_2.
SetName(
" ");
1490 inline_box_data_3.
id = 5;
1492 inline_box_data_3.
SetName(
"testing");
1495 inline_box_data_4.
id = 6;
1498 inline_box_data_4.
id);
1500 inline_box_data_3.
id);
1501 inline_box_data_4.
SetName(
" ");
1504 static_text_data_2.
id = 7;
1506 static_text_data_2.
SetName(
"here.");
1509 inline_box_data_5.
id = 8;
1511 inline_box_data_5.
SetName(
"here.");
1513 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id,
1514 inline_box_data_3.
id, inline_box_data_4.
id};
1515 static_text_data_2.
child_ids = {inline_box_data_5.
id};
1516 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id};
1518 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
1519 inline_box_data_2, inline_box_data_3, inline_box_data_4,
1520 static_text_data_2, inline_box_data_5}));
1524 GetTreeID(), inline_box_data_2.
id, 0 );
1525 ASSERT_NE(
nullptr, tree_position);
1526 ASSERT_TRUE(tree_position->IsTreePosition());
1528 EXPECT_FALSE(tree_position->AtEndOfLine());
1533 GetTreeID(), inline_box_data_4.
id, 0 );
1534 ASSERT_NE(
nullptr, tree_position);
1535 ASSERT_TRUE(tree_position->IsTreePosition());
1536 EXPECT_FALSE(tree_position->AtStartOfLine());
1540 GetTreeID(), inline_box_data_2.
id, 1 ,
1542 ASSERT_NE(
nullptr, text_position);
1543 ASSERT_TRUE(text_position->IsTextPosition());
1545 EXPECT_FALSE(text_position->AtEndOfLine());
1548 GetTreeID(), inline_box_data_4.
id, 1 ,
1550 ASSERT_NE(
nullptr, text_position);
1551 ASSERT_TRUE(text_position->IsTextPosition());
1552 EXPECT_FALSE(text_position->AtStartOfLine());
1556TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {
1573 text_field_data_1.
id = 2;
1582 text_field_data_1.
SetValue(
" Text field one ");
1585 static_text_data_1.
id = 3;
1587 static_text_data_1.
SetName(
" Text field one ");
1590 inline_box_data_1.
id = 4;
1592 inline_box_data_1.
SetName(
" ");
1595 inline_box_data_2.
id = 5;
1598 inline_box_data_2.
id);
1600 inline_box_data_1.
id);
1601 inline_box_data_2.
SetName(
"Text field one");
1604 inline_box_data_3.
id = 6;
1607 inline_box_data_3.
id);
1609 inline_box_data_2.
id);
1610 inline_box_data_3.
SetName(
" ");
1613 text_field_data_2.
id = 7;
1622 text_field_data_2.
SetValue(
" Text field two ");
1625 static_text_data_2.
id = 8;
1627 static_text_data_2.
SetName(
" Text field two ");
1630 inline_box_data_4.
id = 9;
1632 inline_box_data_4.
SetName(
" ");
1635 inline_box_data_5.
id = 10;
1637 inline_box_data_5.
SetName(
"Text field two");
1640 inline_box_data_6.
id = 11;
1642 inline_box_data_6.
SetName(
" ");
1644 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id,
1645 inline_box_data_3.
id};
1646 static_text_data_2.
child_ids = {inline_box_data_4.
id, inline_box_data_5.
id,
1647 inline_box_data_6.
id};
1648 text_field_data_1.
child_ids = {static_text_data_1.
id};
1649 text_field_data_2.
child_ids = {static_text_data_2.
id};
1650 root_data.
child_ids = {text_field_data_1.
id, text_field_data_2.
id};
1653 CreateAXTree({root_data, text_field_data_1, static_text_data_1,
1654 inline_box_data_1, inline_box_data_2, inline_box_data_3,
1655 text_field_data_2, static_text_data_2, inline_box_data_4,
1656 inline_box_data_5, inline_box_data_6}));
1659 GetTreeID(), text_field_data_1.
id, 0 );
1660 ASSERT_NE(
nullptr, tree_position);
1661 ASSERT_TRUE(tree_position->IsTreePosition());
1663 EXPECT_FALSE(tree_position->AtEndOfLine());
1666 GetTreeID(), text_field_data_1.
id, 1 );
1667 ASSERT_NE(
nullptr, tree_position);
1668 ASSERT_TRUE(tree_position->IsTreePosition());
1669 EXPECT_FALSE(tree_position->AtStartOfLine());
1673 GetTreeID(), text_field_data_2.
id, 0 );
1674 ASSERT_NE(
nullptr, tree_position);
1675 ASSERT_TRUE(tree_position->IsTreePosition());
1677 EXPECT_FALSE(tree_position->AtEndOfLine());
1680 GetTreeID(), text_field_data_2.
id, 1 );
1681 ASSERT_NE(
nullptr, tree_position);
1682 ASSERT_TRUE(tree_position->IsTreePosition());
1683 EXPECT_FALSE(tree_position->AtStartOfLine());
1687 GetTreeID(), text_field_data_1.
id, 0 ,
1689 ASSERT_NE(
nullptr, text_position);
1690 ASSERT_TRUE(text_position->IsTextPosition());
1692 EXPECT_FALSE(text_position->AtEndOfLine());
1695 GetTreeID(), text_field_data_1.
id, 16 ,
1697 ASSERT_NE(
nullptr, text_position);
1698 ASSERT_TRUE(text_position->IsTextPosition());
1699 EXPECT_FALSE(text_position->AtStartOfLine());
1703 GetTreeID(), text_field_data_2.
id, 0 ,
1705 ASSERT_NE(
nullptr, text_position);
1706 ASSERT_TRUE(text_position->IsTextPosition());
1708 EXPECT_FALSE(text_position->AtEndOfLine());
1711 GetTreeID(), text_field_data_2.
id, 16 ,
1713 ASSERT_NE(
nullptr, text_position);
1714 ASSERT_TRUE(text_position->IsTextPosition());
1715 EXPECT_FALSE(text_position->AtStartOfLine());
1719TEST_F(AXPositionTest, AtStartOfParagraphWithTextPosition) {
1723 GetTreeID(), inline_box1_.id, 0 ,
1725 ASSERT_NE(
nullptr, text_position);
1726 ASSERT_TRUE(text_position->IsTextPosition());
1730 GetTreeID(), inline_box1_.id, 1 ,
1732 ASSERT_NE(
nullptr, text_position);
1733 ASSERT_TRUE(text_position->IsTextPosition());
1734 EXPECT_FALSE(text_position->AtStartOfParagraph());
1737 GetTreeID(), line_break_.id, 0 ,
1739 ASSERT_NE(
nullptr, text_position);
1740 ASSERT_TRUE(text_position->IsTextPosition());
1741 EXPECT_FALSE(text_position->AtStartOfParagraph());
1748 GetTreeID(), line_break_.id, 1 ,
1750 ASSERT_NE(
nullptr, text_position);
1751 ASSERT_TRUE(text_position->IsTextPosition());
1752 EXPECT_FALSE(text_position->AtStartOfParagraph());
1757 GetTreeID(), inline_box2_.id, 0 ,
1759 ASSERT_NE(
nullptr, text_position);
1760 ASSERT_TRUE(text_position->IsTextPosition());
1764 GetTreeID(), inline_box2_.id, 1 ,
1766 ASSERT_NE(
nullptr, text_position);
1767 ASSERT_TRUE(text_position->IsTextPosition());
1768 EXPECT_FALSE(text_position->AtStartOfParagraph());
1771TEST_F(AXPositionTest, AtEndOfParagraphWithTextPosition) {
1775 GetTreeID(), inline_box1_.id, 6 ,
1777 ASSERT_NE(
nullptr, text_position);
1778 ASSERT_TRUE(text_position->IsTextPosition());
1779 EXPECT_FALSE(text_position->AtEndOfParagraph());
1784 GetTreeID(), line_break_.id, 0 ,
1786 ASSERT_NE(
nullptr, text_position);
1787 ASSERT_TRUE(text_position->IsTextPosition());
1788 EXPECT_FALSE(text_position->AtEndOfParagraph());
1793 GetTreeID(), line_break_.id, 1 ,
1795 ASSERT_NE(
nullptr, text_position);
1796 ASSERT_TRUE(text_position->IsTextPosition());
1800 GetTreeID(), inline_box2_.id, 5 ,
1802 ASSERT_NE(
nullptr, text_position);
1803 ASSERT_TRUE(text_position->IsTextPosition());
1804 EXPECT_FALSE(text_position->AtEndOfParagraph());
1809 GetTreeID(), inline_box2_.id, 6 ,
1811 ASSERT_NE(
nullptr, text_position);
1812 ASSERT_TRUE(text_position->IsTextPosition());
1816TEST_F(AXPositionTest, ParagraphEdgesWithPreservedNewLine) {
1838 static_text_data_1.
id = 2;
1840 static_text_data_1.
SetName(
"some text");
1843 some_text_data.
id = 3;
1845 some_text_data.
SetName(
"some text");
1848 container_data.
id = 4;
1854 static_text_data_2.
id = 5;
1856 static_text_data_2.
SetName(
"\nmore text");
1859 preserved_newline_data.
id = 6;
1861 preserved_newline_data.
SetName(
"\n");
1866 more_text_data.
id = 7;
1868 more_text_data.
SetName(
"more text");
1870 static_text_data_1.
child_ids = {some_text_data.
id};
1871 container_data.
child_ids = {static_text_data_2.
id};
1872 static_text_data_2.
child_ids = {preserved_newline_data.
id, more_text_data.
id};
1873 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
1875 SetTree(CreateAXTree({root_data, static_text_data_1, some_text_data,
1876 container_data, static_text_data_2,
1877 preserved_newline_data, more_text_data}));
1881 GetTreeID(), root_data.
id, 8 ,
1883 EXPECT_FALSE(text_position1->AtEndOfParagraph());
1884 EXPECT_FALSE(text_position1->AtStartOfParagraph());
1888 GetTreeID(), root_data.
id, 9 ,
1890 EXPECT_FALSE(text_position2->AtEndOfParagraph());
1891 EXPECT_FALSE(text_position2->AtStartOfParagraph());
1895 GetTreeID(), root_data.
id, 9 ,
1897 EXPECT_FALSE(text_position3->AtEndOfParagraph());
1898 EXPECT_FALSE(text_position3->AtStartOfParagraph());
1902 GetTreeID(), root_data.
id, 10 ,
1904 EXPECT_FALSE(text_position4->AtEndOfParagraph());
1905 EXPECT_TRUE(text_position4->AtStartOfParagraph());
1909 GetTreeID(), root_data.
id, 10 ,
1912 EXPECT_FALSE(text_position5->AtStartOfParagraph());
1916 GetTreeID(), container_data.
id, 0 ,
1918 EXPECT_FALSE(text_position6->AtEndOfParagraph());
1919 EXPECT_FALSE(text_position6->AtStartOfParagraph());
1923 GetTreeID(), container_data.
id, 1 ,
1925 EXPECT_FALSE(text_position7->AtEndOfParagraph());
1926 EXPECT_TRUE(text_position7->AtStartOfParagraph());
1930 GetTreeID(), container_data.
id, 1 ,
1933 EXPECT_FALSE(text_position8->AtStartOfParagraph());
1937 GetTreeID(), static_text_data_2.
id, 1 ,
1939 EXPECT_FALSE(text_position9->AtEndOfParagraph());
1940 EXPECT_TRUE(text_position9->AtStartOfParagraph());
1944 GetTreeID(), static_text_data_2.
id, 1 ,
1947 EXPECT_FALSE(text_position10->AtStartOfParagraph());
1950 GetTreeID(), preserved_newline_data.
id, 0 ,
1952 EXPECT_FALSE(text_position11->AtEndOfParagraph());
1953 EXPECT_FALSE(text_position11->AtStartOfParagraph());
1956 GetTreeID(), preserved_newline_data.
id, 1 ,
1959 EXPECT_FALSE(text_position12->AtStartOfParagraph());
1962 GetTreeID(), more_text_data.
id, 0 ,
1964 EXPECT_FALSE(text_position13->AtEndOfParagraph());
1965 EXPECT_TRUE(text_position13->AtStartOfParagraph());
1968 GetTreeID(), more_text_data.
id, 1 ,
1970 EXPECT_FALSE(text_position14->AtEndOfParagraph());
1971 EXPECT_FALSE(text_position14->AtStartOfParagraph());
1976 PreviousParagraphEndStopAtAnchorBoundaryWithConsecutiveParentChildLineBreakingObjects) {
1990 static_text_data_a.
id = 2;
1992 static_text_data_a.
SetName(
"first");
1995 container_data_a.
id = 3;
2001 container_data_b.
id = 4;
2007 static_text_data_b.
id = 5;
2009 static_text_data_b.
SetName(
"second");
2011 root_data.
child_ids = {static_text_data_a.
id, container_data_a.
id};
2012 container_data_a.
child_ids = {container_data_b.
id, static_text_data_b.
id};
2014 SetTree(CreateAXTree({root_data, static_text_data_a, container_data_a,
2015 container_data_b, static_text_data_b}));
2018 GetTreeID(), root_data.
id, 11 ,
2021 test_position = test_position->CreatePreviousParagraphEndPosition(
2024 EXPECT_EQ(root_data.
id, test_position->anchor_id());
2025 EXPECT_EQ(5, test_position->text_offset());
2028TEST_F(AXPositionTest, AtStartOrEndOfParagraphOnAListMarker) {
2071 static_text1.
id = 2;
2075 list_marker_legacy.
id = 6;
2076 static_text2.
id = 7;
2078 static_text3.
id = 9;
2079 inline_box3.
id = 10;
2081 list_marker_ng.
id = 12;
2082 static_text4.
id = 13;
2083 inline_box4.
id = 14;
2084 static_text5.
id = 15;
2085 inline_box5.
id = 16;
2088 root.child_ids = {static_text1.
id, list.
id, static_text5.
id};
2093 static_text1.
SetName(
"Before list.");
2096 inline_box1.
SetName(
"Before list.");
2102 list_item1.
child_ids = {list_marker_legacy.
id, static_text3.
id};
2120 static_text3.
SetName(
"First item.");
2123 inline_box3.
SetName(
"First item.");
2128 list_item2.
child_ids = {list_marker_ng.
id, static_text4.
id};
2133 list_marker_ng.
SetName(
"2. ");
2139 static_text4.
SetName(
"Second item.");
2142 inline_box4.
SetName(
"Second item.");
2148 static_text5.
SetName(
"After list.");
2151 inline_box5.
SetName(
"After list.");
2153 SetTree(CreateAXTree({
root, static_text1, inline_box1, list, list_item1,
2154 list_marker_legacy, static_text2, inline_box2,
2155 static_text3, inline_box3, list_item2, list_marker_ng,
2156 static_text4, inline_box4, static_text5, inline_box5}));
2162 GetTreeID(), static_text1.
id, 12 ,
2164 ASSERT_NE(
nullptr, text_position);
2165 EXPECT_FALSE(text_position->AtStartOfParagraph());
2172 GetTreeID(), inline_box1.
id, 12 ,
2174 ASSERT_NE(
nullptr, text_position);
2175 EXPECT_FALSE(text_position->AtStartOfParagraph());
2180 GetTreeID(), list.
id, 0 ,
2182 ASSERT_NE(
nullptr, text_position);
2184 EXPECT_FALSE(text_position->AtEndOfParagraph());
2190 GetTreeID(), list.
id, 14 ,
2192 ASSERT_NE(
nullptr, text_position);
2194 EXPECT_FALSE(text_position->AtEndOfParagraph());
2198 GetTreeID(), list.
id, 14 ,
2200 ASSERT_NE(
nullptr, text_position);
2201 EXPECT_FALSE(text_position->AtStartOfParagraph());
2206 GetTreeID(), list_marker_legacy.
id, 0 ,
2208 ASSERT_NE(
nullptr, text_position);
2210 EXPECT_FALSE(text_position->AtEndOfParagraph());
2213 GetTreeID(), list_marker_legacy.
id, 1 ,
2215 ASSERT_NE(
nullptr, text_position);
2216 EXPECT_FALSE(text_position->AtStartOfParagraph());
2217 EXPECT_FALSE(text_position->AtEndOfParagraph());
2221 GetTreeID(), static_text2.
id, 0 ,
2223 ASSERT_NE(
nullptr, text_position);
2225 EXPECT_FALSE(text_position->AtEndOfParagraph());
2228 GetTreeID(), static_text2.
id, 2 ,
2230 ASSERT_NE(
nullptr, text_position);
2231 EXPECT_FALSE(text_position->AtStartOfParagraph());
2232 EXPECT_FALSE(text_position->AtEndOfParagraph());
2236 GetTreeID(), inline_box2.
id, 0 ,
2238 ASSERT_NE(
nullptr, text_position);
2240 EXPECT_FALSE(text_position->AtEndOfParagraph());
2243 GetTreeID(), inline_box2.
id, 3 ,
2245 ASSERT_NE(
nullptr, text_position);
2246 EXPECT_FALSE(text_position->AtStartOfParagraph());
2247 EXPECT_FALSE(text_position->AtEndOfParagraph());
2251 GetTreeID(), list_marker_ng.
id, 0 ,
2253 ASSERT_NE(
nullptr, text_position);
2255 EXPECT_FALSE(text_position->AtEndOfParagraph());
2258 GetTreeID(), list_marker_ng.
id, 3 ,
2260 ASSERT_NE(
nullptr, text_position);
2261 EXPECT_FALSE(text_position->AtStartOfParagraph());
2262 EXPECT_FALSE(text_position->AtEndOfParagraph());
2267 GetTreeID(), static_text3.
id, 0 ,
2269 ASSERT_NE(
nullptr, text_position);
2270 EXPECT_FALSE(text_position->AtStartOfParagraph());
2271 EXPECT_FALSE(text_position->AtEndOfParagraph());
2276 GetTreeID(), inline_box3.
id, 0 ,
2278 ASSERT_NE(
nullptr, text_position);
2279 EXPECT_FALSE(text_position->AtStartOfParagraph());
2280 EXPECT_FALSE(text_position->AtEndOfParagraph());
2284 GetTreeID(), static_text3.
id, 11 ,
2286 ASSERT_NE(
nullptr, text_position);
2287 EXPECT_FALSE(text_position->AtStartOfParagraph());
2292 GetTreeID(), inline_box3.
id, 11 ,
2294 ASSERT_NE(
nullptr, text_position);
2295 EXPECT_FALSE(text_position->AtStartOfParagraph());
2301 GetTreeID(), static_text4.
id, 0 ,
2303 ASSERT_NE(
nullptr, text_position);
2304 EXPECT_FALSE(text_position->AtStartOfParagraph());
2305 EXPECT_FALSE(text_position->AtEndOfParagraph());
2310 GetTreeID(), inline_box4.
id, 0 ,
2312 ASSERT_NE(
nullptr, text_position);
2313 EXPECT_FALSE(text_position->AtStartOfParagraph());
2314 EXPECT_FALSE(text_position->AtEndOfParagraph());
2318 GetTreeID(), static_text4.
id, 12 ,
2320 ASSERT_NE(
nullptr, text_position);
2321 EXPECT_FALSE(text_position->AtStartOfParagraph());
2326 GetTreeID(), inline_box4.
id, 12 ,
2328 ASSERT_NE(
nullptr, text_position);
2329 EXPECT_FALSE(text_position->AtStartOfParagraph());
2334 GetTreeID(), inline_box5.
id, 0 ,
2336 ASSERT_NE(
nullptr, text_position);
2338 EXPECT_FALSE(text_position->AtEndOfParagraph());
2342 AtStartOrEndOfParagraphWithLeadingAndTrailingDocumentWhitespace) {
2369 container_data_a.
id = 2;
2375 static_text_data_a.
id = 3;
2377 static_text_data_a.
SetName(
"\n");
2380 inline_text_data_a.
id = 4;
2382 inline_text_data_a.
SetName(
"\n");
2387 container_data_b.
id = 5;
2393 static_text_data_b.
id = 6;
2395 static_text_data_b.
SetName(
"some text");
2398 inline_text_data_b_1.
id = 7;
2400 inline_text_data_b_1.
SetName(
"some");
2403 inline_text_data_b_2.
id = 8;
2405 inline_text_data_b_2.
SetName(
" ");
2408 inline_text_data_b_3.
id = 9;
2410 inline_text_data_b_3.
SetName(
"text");
2413 container_data_c.
id = 10;
2419 static_text_data_c.
id = 11;
2421 static_text_data_c.
SetName(
"\n");
2424 inline_text_data_c.
id = 12;
2426 inline_text_data_c.
SetName(
"\n");
2430 root_data.
child_ids = {container_data_a.
id, container_data_b.
id,
2431 container_data_c.
id};
2432 container_data_a.
child_ids = {static_text_data_a.
id};
2433 static_text_data_a.
child_ids = {inline_text_data_a.
id};
2434 container_data_b.
child_ids = {static_text_data_b.
id};
2435 static_text_data_b.
child_ids = {inline_text_data_b_1.
id,
2436 inline_text_data_b_2.
id,
2437 inline_text_data_b_3.
id};
2438 container_data_c.
child_ids = {static_text_data_c.
id};
2439 static_text_data_c.
child_ids = {inline_text_data_c.
id};
2441 SetTree(CreateAXTree(
2442 {root_data, container_data_a, container_data_b, container_data_c,
2443 static_text_data_a, static_text_data_b, static_text_data_c,
2444 inline_text_data_a, inline_text_data_b_1, inline_text_data_b_2,
2445 inline_text_data_b_3, inline_text_data_c}));
2449 GetTreeID(), inline_text_data_a.
id, 0 ,
2451 EXPECT_FALSE(text_position1->AtEndOfParagraph());
2452 EXPECT_TRUE(text_position1->AtStartOfParagraph());
2460 GetTreeID(), inline_text_data_a.
id, 1 ,
2463 EXPECT_FALSE(text_position2->AtStartOfParagraph());
2467 GetTreeID(), inline_text_data_b_1.
id, 0 ,
2469 EXPECT_FALSE(text_position3->AtEndOfParagraph());
2470 EXPECT_TRUE(text_position3->AtStartOfParagraph());
2474 GetTreeID(), inline_text_data_b_1.
id, 4 ,
2476 EXPECT_FALSE(text_position4->AtEndOfParagraph());
2477 EXPECT_FALSE(text_position4->AtStartOfParagraph());
2481 GetTreeID(), inline_text_data_b_2.
id, 0 ,
2483 EXPECT_FALSE(text_position5->AtEndOfParagraph());
2484 EXPECT_FALSE(text_position5->AtStartOfParagraph());
2488 GetTreeID(), inline_text_data_b_2.
id, 1 ,
2490 EXPECT_FALSE(text_position6->AtEndOfParagraph());
2491 EXPECT_FALSE(text_position6->AtStartOfParagraph());
2495 GetTreeID(), inline_text_data_b_3.
id, 0 ,
2497 EXPECT_FALSE(text_position7->AtEndOfParagraph());
2498 EXPECT_FALSE(text_position7->AtStartOfParagraph());
2502 GetTreeID(), inline_text_data_b_3.
id, 4 ,
2504 EXPECT_FALSE(text_position8->AtEndOfParagraph());
2505 EXPECT_FALSE(text_position8->AtStartOfParagraph());
2509 GetTreeID(), inline_text_data_c.
id, 0 ,
2511 EXPECT_FALSE(text_position9->AtEndOfParagraph());
2512 EXPECT_FALSE(text_position9->AtStartOfParagraph());
2516 GetTreeID(), inline_text_data_c.
id, 1 ,
2519 EXPECT_FALSE(text_position10->AtStartOfParagraph());
2522TEST_F(AXPositionTest, AtStartOrEndOfParagraphWithIgnoredNodes) {
2549 container_data_a.
id = 2;
2556 static_text_data_a.
id = 3;
2558 static_text_data_a.
SetName(
"ignored text");
2562 inline_text_data_a.
id = 4;
2564 inline_text_data_a.
SetName(
"ignored text");
2568 container_data_b.
id = 5;
2574 static_text_data_b.
id = 6;
2576 static_text_data_b.
SetName(
"some text");
2579 inline_text_data_b_1.
id = 7;
2581 inline_text_data_b_1.
SetName(
"some");
2584 inline_text_data_b_2.
id = 8;
2586 inline_text_data_b_2.
SetName(
" ");
2589 inline_text_data_b_3.
id = 9;
2591 inline_text_data_b_3.
SetName(
"text");
2594 container_data_c.
id = 10;
2601 static_text_data_c.
id = 11;
2603 static_text_data_c.
SetName(
"ignored text");
2607 inline_text_data_c.
id = 12;
2609 inline_text_data_c.
SetName(
"ignored text");
2612 root_data.
child_ids = {container_data_a.
id, container_data_b.
id,
2613 container_data_c.
id};
2614 container_data_a.
child_ids = {static_text_data_a.
id};
2615 static_text_data_a.
child_ids = {inline_text_data_a.
id};
2616 container_data_b.
child_ids = {static_text_data_b.
id};
2617 static_text_data_b.
child_ids = {inline_text_data_b_1.
id,
2618 inline_text_data_b_2.
id,
2619 inline_text_data_b_3.
id};
2620 container_data_c.
child_ids = {static_text_data_c.
id};
2621 static_text_data_c.
child_ids = {inline_text_data_c.
id};
2623 SetTree(CreateAXTree(
2624 {root_data, container_data_a, container_data_b, container_data_c,
2625 static_text_data_a, static_text_data_b, static_text_data_c,
2626 inline_text_data_a, inline_text_data_b_1, inline_text_data_b_2,
2627 inline_text_data_b_3, inline_text_data_c}));
2631 GetTreeID(), inline_text_data_a.
id, 0 ,
2633 EXPECT_FALSE(text_position1->AtEndOfParagraph());
2634 EXPECT_FALSE(text_position1->AtStartOfParagraph());
2643 GetTreeID(), inline_text_data_a.
id, 12 ,
2645 EXPECT_FALSE(text_position2->AtEndOfParagraph());
2646 EXPECT_FALSE(text_position2->AtStartOfParagraph());
2650 GetTreeID(), inline_text_data_b_1.
id, 0 ,
2652 EXPECT_FALSE(text_position3->AtEndOfParagraph());
2653 EXPECT_TRUE(text_position3->AtStartOfParagraph());
2657 GetTreeID(), inline_text_data_b_1.
id, 4 ,
2659 EXPECT_FALSE(text_position4->AtEndOfParagraph());
2660 EXPECT_FALSE(text_position4->AtStartOfParagraph());
2664 GetTreeID(), inline_text_data_b_2.
id, 0 ,
2666 EXPECT_FALSE(text_position5->AtEndOfParagraph());
2667 EXPECT_FALSE(text_position5->AtStartOfParagraph());
2671 GetTreeID(), inline_text_data_b_2.
id, 1 ,
2673 EXPECT_FALSE(text_position6->AtEndOfParagraph());
2674 EXPECT_FALSE(text_position6->AtStartOfParagraph());
2678 GetTreeID(), inline_text_data_b_3.
id, 0 ,
2680 EXPECT_FALSE(text_position7->AtEndOfParagraph());
2681 EXPECT_FALSE(text_position7->AtStartOfParagraph());
2685 GetTreeID(), inline_text_data_b_3.
id, 4 ,
2688 EXPECT_FALSE(text_position8->AtStartOfParagraph());
2692 GetTreeID(), inline_text_data_c.
id, 0 ,
2694 EXPECT_FALSE(text_position9->AtEndOfParagraph());
2695 EXPECT_FALSE(text_position9->AtStartOfParagraph());
2699 GetTreeID(), inline_text_data_c.
id, 12 ,
2701 EXPECT_FALSE(text_position10->AtEndOfParagraph());
2702 EXPECT_FALSE(text_position10->AtStartOfParagraph());
2705TEST_F(AXPositionTest, AtStartOrEndOfParagraphWithEmbeddedObjectCharacter) {
2732 static_text_3.
id = 3;
2733 inline_box_4.
id = 4;
2735 static_text_6.
id = 6;
2736 inline_box_7.
id = 7;
2748 static_text_3.
SetName(
"Hello");
2751 inline_box_4.
SetName(
"Hello");
2758 static_text_6.
SetName(
"world");
2761 inline_box_7.
SetName(
"world");
2763 SetTree(CreateAXTree({root_1, link_2, static_text_3, inline_box_4, image_5,
2764 static_text_6, inline_box_7}));
2768 GetTreeID(), inline_box_4.
id, 0 ,
2770 EXPECT_FALSE(text_position->AtEndOfParagraph());
2780 GetTreeID(), inline_box_4.
id, 5 ,
2783 EXPECT_FALSE(text_position->AtStartOfParagraph());
2787 GetTreeID(), image_5.
id, 0 ,
2789 EXPECT_FALSE(text_position->AtEndOfParagraph());
2794 GetTreeID(), image_5.
id, 1 ,
2797 EXPECT_FALSE(text_position->AtStartOfParagraph());
2801 GetTreeID(), inline_box_7.
id, 0 ,
2803 EXPECT_FALSE(text_position->AtEndOfParagraph());
2808 GetTreeID(), inline_box_7.
id, 5 ,
2811 EXPECT_FALSE(text_position->AtStartOfParagraph());
2814TEST_F(AXPositionTest, LowestCommonAncestor) {
2816 ASSERT_NE(
nullptr, null_position);
2819 GetTreeID(), root_.id, 3 );
2820 ASSERT_NE(
nullptr, root_position);
2824 ASSERT_NE(
nullptr, button_position);
2826 GetTreeID(), text_field_.id, 2 );
2827 ASSERT_NE(
nullptr, text_field_position);
2829 GetTreeID(), static_text1_.id, 0 );
2830 ASSERT_NE(
nullptr, static_text1_position);
2832 GetTreeID(), static_text2_.id, 0 );
2833 ASSERT_NE(
nullptr, static_text2_position);
2835 GetTreeID(), inline_box1_.id, 0 ,
2837 ASSERT_NE(
nullptr, inline_box1_position);
2838 ASSERT_TRUE(inline_box1_position->IsTextPosition());
2840 GetTreeID(), inline_box2_.id, 0 ,
2842 ASSERT_NE(
nullptr, inline_box2_position);
2843 ASSERT_TRUE(inline_box2_position->IsTextPosition());
2846 root_position->LowestCommonAncestor(*null_position.get());
2847 EXPECT_NE(
nullptr, test_position);
2850 test_position = root_position->LowestCommonAncestor(*root_position.get());
2851 EXPECT_NE(
nullptr, test_position);
2853 EXPECT_EQ(root_.id, test_position->anchor_id());
2856 EXPECT_EQ(3, test_position->child_index());
2859 button_position->LowestCommonAncestor(*text_field_position.get());
2860 EXPECT_NE(
nullptr, test_position);
2862 EXPECT_EQ(root_.id, test_position->anchor_id());
2864 EXPECT_EQ(0, test_position->child_index());
2867 static_text2_position->LowestCommonAncestor(*static_text1_position.get());
2868 EXPECT_NE(
nullptr, test_position);
2870 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2872 EXPECT_EQ(2, test_position->child_index());
2875 static_text1_position->LowestCommonAncestor(*text_field_position.get());
2876 EXPECT_NE(
nullptr, test_position);
2878 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2880 EXPECT_EQ(0, test_position->child_index());
2883 inline_box1_position->LowestCommonAncestor(*inline_box2_position.get());
2884 EXPECT_NE(
nullptr, test_position);
2886 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2887 EXPECT_EQ(0, test_position->text_offset());
2890 inline_box2_position->LowestCommonAncestor(*inline_box1_position.get());
2891 EXPECT_NE(
nullptr, test_position);
2893 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2895 EXPECT_EQ(7, test_position->text_offset());
2898TEST_F(AXPositionTest, AsTreePositionWithNullPosition) {
2900 ASSERT_NE(
nullptr, null_position);
2902 ASSERT_NE(
nullptr, test_position);
2906TEST_F(AXPositionTest, AsTreePositionWithTreePosition) {
2908 GetTreeID(), root_.id, 1 );
2909 ASSERT_NE(
nullptr, tree_position);
2911 ASSERT_NE(
nullptr, test_position);
2913 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2914 EXPECT_EQ(root_.id, test_position->anchor_id());
2915 EXPECT_EQ(1, test_position->child_index());
2919TEST_F(AXPositionTest, AsTreePositionWithTextPosition) {
2922 GetTreeID(), text_field_.id, 12 ,
2924 ASSERT_NE(
nullptr, text_position);
2925 ASSERT_TRUE(text_position->IsTextPosition());
2927 ASSERT_NE(
nullptr, test_position);
2929 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2930 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2933 EXPECT_EQ(2, test_position->child_index());
2935 EXPECT_EQ(12, test_position->text_offset());
2939 GetTreeID(), inline_box2_.id, 0 ,
2941 ASSERT_NE(
nullptr, text_position);
2942 ASSERT_TRUE(text_position->IsTextPosition());
2943 test_position = text_position->AsTreePosition();
2944 ASSERT_NE(
nullptr, test_position);
2946 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2947 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
2949 EXPECT_EQ(0, test_position->text_offset());
2953 GetTreeID(), inline_box2_.id, 6 ,
2955 ASSERT_NE(
nullptr, text_position);
2956 ASSERT_TRUE(text_position->IsTextPosition());
2957 test_position = text_position->AsTreePosition();
2958 ASSERT_NE(
nullptr, test_position);
2960 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2961 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
2962 EXPECT_EQ(0, test_position->child_index());
2963 EXPECT_EQ(6, test_position->text_offset());
2966TEST_F(AXPositionTest, AsTextPositionWithNullPosition) {
2968 ASSERT_NE(
nullptr, null_position);
2970 ASSERT_NE(
nullptr, test_position);
2974TEST_F(AXPositionTest, AsTextPositionWithTreePosition) {
2978 GetTreeID(), text_field_.id, 1 );
2979 ASSERT_NE(
nullptr, tree_position);
2981 ASSERT_NE(
nullptr, test_position);
2983 EXPECT_EQ(GetTreeID(), test_position->tree_id());
2984 EXPECT_EQ(text_field_.id, test_position->anchor_id());
2987 EXPECT_EQ(6, test_position->text_offset());
2989 EXPECT_EQ(1, test_position->child_index());
2998 ASSERT_NE(
nullptr, tree_position);
2999 test_position = tree_position->AsTextPosition();
3000 ASSERT_NE(
nullptr, test_position);
3002 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3003 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3004 EXPECT_EQ(0, test_position->text_offset());
3010 GetTreeID(), inline_box1_.id, 0 );
3011 ASSERT_NE(
nullptr, tree_position);
3012 test_position = tree_position->AsTextPosition();
3013 ASSERT_NE(
nullptr, test_position);
3015 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3016 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3017 EXPECT_EQ(6, test_position->text_offset());
3018 EXPECT_EQ(0, test_position->child_index());
3022TEST_F(AXPositionTest, AsTextPositionWithTextPosition) {
3024 GetTreeID(), text_field_.id, 0 ,
3026 ASSERT_NE(
nullptr, text_position);
3027 ASSERT_TRUE(text_position->IsTextPosition());
3029 ASSERT_NE(
nullptr, test_position);
3031 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3032 EXPECT_EQ(text_field_.id, test_position->anchor_id());
3033 EXPECT_EQ(0, test_position->text_offset());
3038TEST_F(AXPositionTest, AsLeafTreePositionWithNullPosition) {
3040 ASSERT_NE(
nullptr, null_position);
3042 ASSERT_NE(
nullptr, test_position);
3046TEST_F(AXPositionTest, AsLeafTreePositionWithTreePosition) {
3050 GetTreeID(), text_field_.id, 0 );
3051 ASSERT_NE(
nullptr, tree_position);
3053 ASSERT_NE(
nullptr, test_position);
3055 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3056 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3062 GetTreeID(), text_field_.id, 1 );
3063 ASSERT_NE(
nullptr, tree_position);
3064 test_position = tree_position->AsLeafTreePosition();
3065 ASSERT_NE(
nullptr, test_position);
3067 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3068 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3074 GetTreeID(), text_field_.id, 2 );
3075 ASSERT_NE(
nullptr, tree_position);
3076 test_position = tree_position->AsLeafTreePosition();
3077 ASSERT_NE(
nullptr, test_position);
3079 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3080 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3084TEST_F(AXPositionTest, AsLeafTreePositionWithTextPosition) {
3088 GetTreeID(), root_.id, 13 ,
3090 ASSERT_NE(
nullptr, text_position);
3091 ASSERT_TRUE(text_position->IsTextPosition());
3093 ASSERT_NE(
nullptr, test_position);
3095 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3096 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3097 EXPECT_EQ(0, test_position->child_index());
3100 GetTreeID(), root_.id, 0 ,
3102 ASSERT_NE(
nullptr, text_position);
3103 ASSERT_TRUE(text_position->IsTextPosition());
3104 test_position = text_position->AsLeafTreePosition();
3105 ASSERT_NE(
nullptr, test_position);
3107 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3108 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3112 GetTreeID(), text_field_.id, 0 ,
3114 ASSERT_NE(
nullptr, text_position);
3115 ASSERT_TRUE(text_position->IsTextPosition());
3116 test_position = text_position->AsLeafTreePosition();
3117 ASSERT_NE(
nullptr, test_position);
3119 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3120 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3124 GetTreeID(), text_field_.id, 0 ,
3126 ASSERT_NE(
nullptr, text_position);
3127 ASSERT_TRUE(text_position->IsTextPosition());
3128 test_position = text_position->AsLeafTreePosition();
3129 ASSERT_NE(
nullptr, test_position);
3131 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3132 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3140 GetTreeID(), root_.id, 6 ,
3142 ASSERT_NE(
nullptr, text_position);
3143 ASSERT_TRUE(text_position->IsTextPosition());
3144 test_position = text_position->AsLeafTreePosition();
3145 ASSERT_NE(
nullptr, test_position);
3147 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3148 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3149 EXPECT_EQ(0, test_position->child_index());
3155 GetTreeID(), text_field_.id, 6 ,
3157 ASSERT_NE(
nullptr, text_position);
3158 test_position = text_position->AsLeafTreePosition();
3159 ASSERT_NE(
nullptr, test_position);
3161 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3162 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3163 EXPECT_EQ(0, test_position->child_index());
3168 GetTreeID(), root_.id, 6 ,
3170 ASSERT_NE(
nullptr, text_position);
3171 test_position = text_position->AsLeafTreePosition();
3172 ASSERT_NE(
nullptr, test_position);
3174 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3175 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3181 GetTreeID(), text_field_.id, 6 ,
3183 ASSERT_NE(
nullptr, text_position);
3184 test_position = text_position->AsLeafTreePosition();
3185 ASSERT_NE(
nullptr, test_position);
3187 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3188 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3194 GetTreeID(), text_field_.id, 13 ,
3196 ASSERT_NE(
nullptr, text_position);
3197 test_position = text_position->AsLeafTreePosition();
3198 ASSERT_NE(
nullptr, test_position);
3200 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3201 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3202 EXPECT_EQ(0, test_position->child_index());
3207 GetTreeID(), root_.id, 10 ,
3209 ASSERT_NE(
nullptr, text_position);
3210 test_position = text_position->AsLeafTreePosition();
3211 ASSERT_NE(
nullptr, test_position);
3213 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3214 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3218TEST_F(AXPositionTest, AsLeafTextPositionWithNullPosition) {
3220 ASSERT_NE(
nullptr, null_position);
3222 ASSERT_NE(
nullptr, test_position);
3226TEST_F(AXPositionTest, AsLeafTextPositionWithTreePosition) {
3230 GetTreeID(), text_field_.id, 0 );
3231 ASSERT_NE(
nullptr, tree_position);
3233 ASSERT_NE(
nullptr, test_position);
3235 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3236 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3237 EXPECT_EQ(0, test_position->text_offset());
3243 GetTreeID(), text_field_.id, 1 );
3244 ASSERT_NE(
nullptr, tree_position);
3245 test_position = tree_position->AsLeafTextPosition();
3246 ASSERT_NE(
nullptr, test_position);
3248 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3249 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3250 EXPECT_EQ(0, test_position->text_offset());
3256 GetTreeID(), text_field_.id, 2 );
3257 ASSERT_NE(
nullptr, tree_position);
3258 test_position = tree_position->AsLeafTextPosition();
3259 ASSERT_NE(
nullptr, test_position);
3261 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3262 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3263 EXPECT_EQ(0, test_position->text_offset());
3267TEST_F(AXPositionTest, AsLeafTextPositionWithTextPosition) {
3271 GetTreeID(), root_.id, 13 ,
3273 ASSERT_NE(
nullptr, text_position);
3274 ASSERT_TRUE(text_position->IsTextPosition());
3275 ASSERT_FALSE(text_position->IsLeafTextPosition());
3277 ASSERT_NE(
nullptr, test_position);
3279 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3280 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3281 EXPECT_EQ(6, test_position->text_offset());
3285 GetTreeID(), root_.id, 0 ,
3287 ASSERT_NE(
nullptr, text_position);
3288 test_position = text_position->AsLeafTextPosition();
3289 ASSERT_NE(
nullptr, test_position);
3291 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3292 EXPECT_EQ(button_.id, test_position->anchor_id());
3293 EXPECT_EQ(0, test_position->text_offset());
3297 GetTreeID(), text_field_.id, 0 ,
3299 ASSERT_NE(
nullptr, text_position);
3300 test_position = text_position->AsLeafTextPosition();
3301 ASSERT_NE(
nullptr, test_position);
3303 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3304 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3305 EXPECT_EQ(0, test_position->text_offset());
3309 GetTreeID(), text_field_.id, 0 ,
3311 ASSERT_NE(
nullptr, text_position);
3312 test_position = text_position->AsLeafTextPosition();
3313 ASSERT_NE(
nullptr, test_position);
3315 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3316 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3317 EXPECT_EQ(0, test_position->text_offset());
3325 GetTreeID(), root_.id, 6 ,
3327 ASSERT_NE(
nullptr, text_position);
3328 test_position = text_position->AsLeafTextPosition();
3329 ASSERT_NE(
nullptr, test_position);
3331 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3332 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3333 EXPECT_EQ(6, test_position->text_offset());
3340 GetTreeID(), text_field_.id, 6 ,
3342 ASSERT_NE(
nullptr, text_position);
3343 test_position = text_position->AsLeafTextPosition();
3344 ASSERT_NE(
nullptr, test_position);
3346 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3347 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3348 EXPECT_EQ(6, 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);
3360 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3361 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3362 EXPECT_EQ(0, test_position->text_offset());
3368 GetTreeID(), text_field_.id, 6 ,
3370 ASSERT_NE(
nullptr, text_position);
3371 test_position = text_position->AsLeafTextPosition();
3372 ASSERT_NE(
nullptr, test_position);
3374 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3375 EXPECT_EQ(line_break_.id, test_position->anchor_id());
3376 EXPECT_EQ(0, test_position->text_offset());
3382 GetTreeID(), text_field_.id, 13 ,
3384 ASSERT_NE(
nullptr, text_position);
3385 test_position = text_position->AsLeafTextPosition();
3386 ASSERT_NE(
nullptr, test_position);
3388 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3389 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3390 EXPECT_EQ(6, test_position->text_offset());
3396 GetTreeID(), root_.id, 10 ,
3398 ASSERT_NE(
nullptr, text_position);
3399 test_position = text_position->AsLeafTextPosition();
3400 ASSERT_NE(
nullptr, test_position);
3402 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3403 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3404 EXPECT_EQ(3, test_position->text_offset());
3410 GetTreeID(), root_.id, 10 ,
3412 ASSERT_NE(
nullptr, text_position);
3413 test_position = text_position->AsLeafTextPosition();
3414 ASSERT_NE(
nullptr, test_position);
3416 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3417 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
3418 EXPECT_EQ(3, test_position->text_offset());
3422TEST_F(AXPositionTest, AsLeafTextPositionWithTextPositionAndEmptyTextSandwich) {
3433 text_data.
SetName(
"some text");
3441 more_text_data.
id = 4;
3443 more_text_data.
SetName(
"more text");
3445 root_data.
child_ids = {text_data.
id, button_data.
id, more_text_data.
id};
3447 SetTree(CreateAXTree({root_data, text_data, button_data, more_text_data}));
3452 GetTreeID(), root_data.
id, 9 ,
3454 ASSERT_NE(
nullptr, text_position);
3455 ASSERT_TRUE(text_position->IsTextPosition());
3456 ASSERT_FALSE(text_position->IsLeafTextPosition());
3458 ASSERT_NE(
nullptr, test_position);
3460 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3461 EXPECT_EQ(button_data.
id, test_position->anchor_id());
3462 EXPECT_EQ(0, test_position->text_offset());
3466 GetTreeID(), root_data.
id, 9 ,
3468 ASSERT_NE(
nullptr, text_position);
3469 test_position = text_position->AsLeafTextPosition();
3470 ASSERT_NE(
nullptr, test_position);
3472 EXPECT_EQ(GetTreeID(), test_position->tree_id());
3473 EXPECT_EQ(text_data.
id, test_position->anchor_id());
3474 EXPECT_EQ(9, test_position->text_offset());
3484 static_text_data_1.
id = 2;
3486 static_text_data_1.
SetName(
"12");
3489 inline_box_data_1.
id = 3;
3491 inline_box_data_1.
SetName(
"1");
3494 inline_box_data_2.
id = 4;
3496 inline_box_data_2.
SetName(
"2");
3500 container_data.
id = 5;
3505 static_text_data_2.
id = 6;
3507 static_text_data_2.
SetName(
"3");
3510 inline_box_data_3.
id = 7;
3512 inline_box_data_3.
SetName(
"3");
3514 static_text_data_1.
child_ids = {inline_box_data_1.
id, inline_box_data_2.
id};
3515 container_data.
child_ids = {static_text_data_2.
id};
3516 static_text_data_2.
child_ids = {inline_box_data_3.
id};
3517 root_data.
child_ids = {static_text_data_1.
id, container_data.
id};
3519 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
3520 inline_box_data_2, container_data, static_text_data_2,
3521 inline_box_data_3}));
3533 GetTreeID(), container_data.
id, 0 ,
3535 ASSERT_TRUE(text_position->IsIgnored());
3538 ASSERT_NE(
nullptr, test_position);
3540 EXPECT_EQ(root_data.
id, test_position->anchor_id());
3541 EXPECT_EQ(2, test_position->text_offset());
3546 GetTreeID(), container_data.
id, 1 ,
3548 ASSERT_TRUE(text_position->IsIgnored());
3550 test_position = text_position->AsUnignoredPosition(
3552 ASSERT_NE(
nullptr, test_position);
3554 EXPECT_EQ(root_data.
id, test_position->anchor_id());
3555 EXPECT_EQ(3, test_position->text_offset());
3560 GetTreeID(), container_data.
id, 0 );
3561 ASSERT_TRUE(tree_position->IsIgnored());
3562 test_position = tree_position->AsUnignoredPosition(
3564 ASSERT_NE(
nullptr, test_position);
3566 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3571 GetTreeID(), container_data.
id, 1 );
3572 ASSERT_TRUE(tree_position->IsIgnored());
3574 test_position = tree_position->AsUnignoredPosition(
3576 ASSERT_NE(
nullptr, test_position);
3578 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3579 EXPECT_EQ(0, test_position->child_index());
3584 GetTreeID(), static_text_data_1.
id, 2 );
3585 ASSERT_TRUE(tree_position->IsIgnored());
3586 test_position = tree_position->AsUnignoredPosition(
3588 ASSERT_NE(
nullptr, test_position);
3590 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3591 EXPECT_EQ(0, test_position->child_index());
3599 SetTree(CreateAXTree({root_data, static_text_data_1, inline_box_data_1,
3600 inline_box_data_2, container_data, static_text_data_2,
3601 inline_box_data_3}));
3604 GetTreeID(), root_data.
id, 0 ,
3606 ASSERT_TRUE(text_position->IsIgnored());
3607 test_position = text_position->AsUnignoredPosition(
3609 ASSERT_NE(
nullptr, test_position);
3611 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3612 EXPECT_EQ(0, test_position->text_offset());
3616 GetTreeID(), root_data.
id, 0 ,
3618 ASSERT_TRUE(text_position->IsIgnored());
3620 test_position = text_position->AsUnignoredPosition(
3622 ASSERT_NE(
nullptr, test_position);
3624 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3625 EXPECT_EQ(0, test_position->text_offset());
3630 ASSERT_TRUE(tree_position->IsIgnored());
3631 test_position = tree_position->AsUnignoredPosition(
3633 ASSERT_NE(
nullptr, test_position);
3635 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3639 test_position = tree_position->AsUnignoredPosition(
3641 ASSERT_NE(
nullptr, test_position);
3643 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3649 ASSERT_TRUE(tree_position->IsIgnored());
3650 test_position = tree_position->AsUnignoredPosition(
3652 ASSERT_NE(
nullptr, test_position);
3654 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3655 EXPECT_EQ(0, test_position->child_index());
3658 test_position = tree_position->AsUnignoredPosition(
3660 ASSERT_NE(
nullptr, test_position);
3662 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3663 EXPECT_EQ(0, test_position->child_index());
3667 GetTreeID(), container_data.
id, 0 );
3668 ASSERT_TRUE(tree_position->IsIgnored());
3669 test_position = tree_position->AsUnignoredPosition(
3671 ASSERT_NE(
nullptr, test_position);
3673 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3678 GetTreeID(), container_data.
id, 1 );
3679 ASSERT_TRUE(tree_position->IsIgnored());
3681 test_position = tree_position->AsUnignoredPosition(
3683 ASSERT_NE(
nullptr, test_position);
3685 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3686 EXPECT_EQ(0, test_position->child_index());
3692 GetTreeID(), root_data.
id, 1 ,
3694 ASSERT_TRUE(text_position->IsIgnored());
3695 test_position = text_position->AsUnignoredPosition(
3697 ASSERT_NE(
nullptr, test_position);
3699 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3700 EXPECT_EQ(0, test_position->text_offset());
3704 GetTreeID(), inline_box_data_2.
id, 0 ,
3706 ASSERT_TRUE(text_position->IsIgnored());
3707 test_position = text_position->AsUnignoredPosition(
3709 ASSERT_NE(
nullptr, test_position);
3711 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3712 EXPECT_EQ(0, test_position->text_offset());
3716 GetTreeID(), inline_box_data_2.
id, 0 ,
3718 ASSERT_TRUE(text_position->IsIgnored());
3719 test_position = text_position->AsUnignoredPosition(
3721 ASSERT_NE(
nullptr, test_position);
3723 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3725 EXPECT_EQ(1, test_position->text_offset());
3730 ASSERT_TRUE(tree_position->IsIgnored());
3731 test_position = tree_position->AsUnignoredPosition(
3733 ASSERT_NE(
nullptr, test_position);
3735 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3737 ASSERT_TRUE(tree_position->IsIgnored());
3739 test_position = tree_position->AsUnignoredPosition(
3741 ASSERT_NE(
nullptr, test_position);
3743 EXPECT_EQ(inline_box_data_1.
id, test_position->anchor_id());
3744 EXPECT_EQ(0, test_position->child_index());
3747TEST_F(AXPositionTest, CreatePositionAtTextBoundaryDocumentStartEndIsIgnored) {
3768 root_data.
id = ROOT_ID;
3772 static_text_data_1.
id = STATIC_TEXT1_ID;
3774 static_text_data_1.
SetName(
"One");
3777 inline_box_data_1.
id = INLINE_BOX1_ID;
3779 inline_box_data_1.
SetName(
"One");
3784 std::vector<int32_t>{3});
3789 static_text_data_2.
id = STATIC_TEXT2_ID;
3791 static_text_data_2.
SetName(
"Two");
3794 inline_box_data_2.
id = INLINE_BOX2_ID;
3796 inline_box_data_2.
SetName(
"Two");
3800 std::vector<int32_t>{3});
3807 static_text_data_3.
id = STATIC_TEXT3_ID;
3809 static_text_data_3.
SetName(
"Three");
3812 inline_box_data_3.
id = INLINE_BOX3_ID;
3814 inline_box_data_3.
SetName(
"Three");
3818 std::vector<int32_t>{5});
3825 static_text_data_4.
id = STATIC_TEXT4_ID;
3827 static_text_data_4.
SetName(
"Four");
3830 inline_box_data_4.
id = INLINE_BOX4_ID;
3832 inline_box_data_4.
SetName(
"Four");
3837 std::vector<int32_t>{4});
3841 root_data.
child_ids = {static_text_data_1.
id, static_text_data_2.
id,
3842 static_text_data_3.
id, static_text_data_4.
id};
3843 static_text_data_1.
child_ids = {inline_box_data_1.
id};
3844 static_text_data_2.
child_ids = {inline_box_data_2.
id};
3845 static_text_data_3.
child_ids = {inline_box_data_3.
id};
3846 static_text_data_4.
child_ids = {inline_box_data_4.
id};
3849 CreateAXTree({root_data, static_text_data_1, static_text_data_2,
3850 static_text_data_3, static_text_data_4, inline_box_data_1,
3851 inline_box_data_2, inline_box_data_3, inline_box_data_4}));
3854 GetTreeID(), inline_box_data_2.
id, 0 ,
3856 ASSERT_FALSE(text_position->IsIgnored());
3857 TestPositionType test_position = text_position->CreatePositionAtTextBoundary(
3860 ASSERT_NE(
nullptr, test_position);
3862 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3863 EXPECT_EQ(0, test_position->text_offset());
3865 test_position = text_position->CreatePositionAtTextBoundary(
3868 ASSERT_NE(
nullptr, test_position);
3870 EXPECT_EQ(inline_box_data_2.
id, test_position->anchor_id());
3871 EXPECT_EQ(0, test_position->text_offset());
3875 GetTreeID(), inline_box_data_3.
id, 0 ,
3877 ASSERT_FALSE(text_position->IsIgnored());
3878 test_position = text_position->CreatePositionAtTextBoundary(
3881 ASSERT_NE(
nullptr, test_position);
3883 EXPECT_EQ(inline_box_data_3.
id, test_position->anchor_id());
3884 EXPECT_EQ(5, test_position->text_offset());
3886 test_position = text_position->CreatePositionAtTextBoundary(
3889 ASSERT_NE(
nullptr, test_position);
3891 EXPECT_EQ(inline_box_data_2.
id, test_position->anchor_id());
3892 EXPECT_EQ(0, test_position->text_offset());
3896TEST_F(AXPositionTest, CreatePositionAtInvalidGraphemeBoundary) {
3897 std::vector<int> text_offsets;
3898 SetTree(CreateMultilingualDocument(&text_offsets));
3901 GetTreeID(), GetTree()->
root()->
id(), 4 ,
3903 ASSERT_NE(
nullptr, test_position);
3905 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
3906 EXPECT_EQ(4, test_position->text_offset());
3910 GetTreeID(), GetTree()->
root()->
id(), 10 ,
3912 ASSERT_NE(
nullptr, test_position);
3914 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
3915 EXPECT_EQ(10, test_position->text_offset());
3919TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithNullPosition) {
3921 ASSERT_NE(
nullptr, null_position);
3923 null_position->CreatePositionAtStartOfAnchor();
3924 EXPECT_NE(
nullptr, test_position);
3928TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithTreePosition) {
3930 GetTreeID(), root_.id, 0 );
3931 ASSERT_NE(
nullptr, tree_position);
3933 tree_position->CreatePositionAtStartOfAnchor();
3934 EXPECT_NE(
nullptr, test_position);
3936 EXPECT_EQ(root_.id, test_position->anchor_id());
3937 EXPECT_EQ(0, test_position->child_index());
3941 ASSERT_NE(
nullptr, tree_position);
3942 test_position = tree_position->CreatePositionAtStartOfAnchor();
3943 EXPECT_NE(
nullptr, test_position);
3945 EXPECT_EQ(root_.id, test_position->anchor_id());
3946 EXPECT_EQ(0, test_position->child_index());
3950 GetTreeID(), inline_box1_.id, 0 );
3951 ASSERT_NE(
nullptr, tree_position);
3952 test_position = tree_position->CreatePositionAtStartOfAnchor();
3953 EXPECT_NE(
nullptr, test_position);
3955 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3959TEST_F(AXPositionTest, CreatePositionAtStartOfAnchorWithTextPosition) {
3961 GetTreeID(), inline_box1_.id, 0 ,
3963 ASSERT_NE(
nullptr, text_position);
3964 ASSERT_TRUE(text_position->IsTextPosition());
3966 text_position->CreatePositionAtStartOfAnchor();
3967 ASSERT_NE(
nullptr, test_position);
3969 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3970 EXPECT_EQ(0, test_position->text_offset());
3974 GetTreeID(), inline_box1_.id, 1 ,
3976 ASSERT_NE(
nullptr, text_position);
3977 ASSERT_TRUE(text_position->IsTextPosition());
3978 test_position = text_position->CreatePositionAtStartOfAnchor();
3979 EXPECT_NE(
nullptr, test_position);
3981 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
3982 EXPECT_EQ(0, test_position->text_offset());
3987TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithNullPosition) {
3989 ASSERT_NE(
nullptr, null_position);
3990 TestPositionType test_position = null_position->CreatePositionAtEndOfAnchor();
3991 EXPECT_NE(
nullptr, test_position);
3995TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithTreePosition) {
3997 GetTreeID(), root_.id, 3 );
3998 ASSERT_NE(
nullptr, tree_position);
3999 TestPositionType test_position = tree_position->CreatePositionAtEndOfAnchor();
4000 EXPECT_NE(
nullptr, test_position);
4002 EXPECT_EQ(root_.id, test_position->anchor_id());
4003 EXPECT_EQ(3, test_position->child_index());
4007 ASSERT_NE(
nullptr, tree_position);
4008 test_position = tree_position->CreatePositionAtEndOfAnchor();
4009 EXPECT_NE(
nullptr, test_position);
4011 EXPECT_EQ(root_.id, test_position->anchor_id());
4012 EXPECT_EQ(3, test_position->child_index());
4015TEST_F(AXPositionTest, CreatePositionAtEndOfAnchorWithTextPosition) {
4017 GetTreeID(), inline_box1_.id, 6 ,
4019 ASSERT_NE(
nullptr, text_position);
4020 ASSERT_TRUE(text_position->IsTextPosition());
4021 TestPositionType test_position = text_position->CreatePositionAtEndOfAnchor();
4022 EXPECT_NE(
nullptr, test_position);
4024 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4025 EXPECT_EQ(6, test_position->text_offset());
4029 GetTreeID(), inline_box1_.id, 5 ,
4031 ASSERT_NE(
nullptr, text_position);
4032 ASSERT_TRUE(text_position->IsTextPosition());
4033 test_position = text_position->CreatePositionAtEndOfAnchor();
4034 EXPECT_NE(
nullptr, test_position);
4036 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4037 EXPECT_EQ(6, test_position->text_offset());
4042TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithNullPosition) {
4044 ASSERT_NE(
nullptr, null_position);
4046 null_position->CreatePreviousFormatStartPosition(
4048 EXPECT_NE(
nullptr, test_position);
4050 test_position = null_position->CreatePreviousFormatStartPosition(
4052 EXPECT_NE(
nullptr, test_position);
4054 test_position = null_position->CreatePreviousFormatStartPosition(
4056 EXPECT_NE(
nullptr, test_position);
4060TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithTreePosition) {
4062 GetTreeID(), static_text1_.id, 1 );
4063 ASSERT_NE(
nullptr, tree_position);
4064 ASSERT_TRUE(tree_position->IsTreePosition());
4067 tree_position->CreatePreviousFormatStartPosition(
4069 EXPECT_NE(
nullptr, test_position);
4071 EXPECT_EQ(static_text1_.id, test_position->anchor_id());
4072 EXPECT_EQ(0, test_position->child_index());
4074 test_position = test_position->CreatePreviousFormatStartPosition(
4076 EXPECT_NE(
nullptr, test_position);
4078 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4081 test_position = test_position->CreatePreviousFormatStartPosition(
4083 EXPECT_NE(
nullptr, test_position);
4085 EXPECT_EQ(button_.id, test_position->anchor_id());
4089 test_position = test_position->CreatePreviousFormatStartPosition(
4091 EXPECT_NE(
nullptr, test_position);
4093 EXPECT_EQ(button_.id, test_position->anchor_id());
4098 test_position = test_position->CreatePreviousFormatStartPosition(
4100 EXPECT_NE(
nullptr, test_position);
4102 EXPECT_EQ(button_.id, test_position->anchor_id());
4105 test_position = test_position->CreatePreviousFormatStartPosition(
4107 EXPECT_NE(
nullptr, test_position);
4111TEST_F(AXPositionTest, CreatePositionAtPreviousFormatStartWithTextPosition) {
4113 GetTreeID(), inline_box1_.id, 2 ,
4115 ASSERT_NE(
nullptr, text_position);
4116 ASSERT_TRUE(text_position->IsTextPosition());
4119 text_position->CreatePreviousFormatStartPosition(
4121 EXPECT_NE(
nullptr, test_position);
4123 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4124 EXPECT_EQ(0, test_position->text_offset());
4127 test_position = test_position->CreatePreviousFormatStartPosition(
4129 EXPECT_NE(
nullptr, test_position);
4131 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4132 EXPECT_EQ(0, test_position->text_offset());
4134 test_position = test_position->CreatePreviousFormatStartPosition(
4136 EXPECT_NE(
nullptr, test_position);
4138 EXPECT_EQ(button_.id, test_position->anchor_id());
4139 EXPECT_EQ(0, test_position->text_offset());
4142 test_position = test_position->CreatePreviousFormatStartPosition(
4144 EXPECT_NE(
nullptr, test_position);
4146 EXPECT_EQ(button_.id, test_position->anchor_id());
4147 EXPECT_EQ(0, test_position->text_offset());
4151 test_position = test_position->CreatePreviousFormatStartPosition(
4153 EXPECT_NE(
nullptr, test_position);
4155 EXPECT_EQ(button_.id, test_position->anchor_id());
4156 EXPECT_EQ(0, test_position->text_offset());
4158 test_position = test_position->CreatePreviousFormatStartPosition(
4160 EXPECT_NE(
nullptr, test_position);
4164TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithNullPosition) {
4166 ASSERT_NE(
nullptr, null_position);
4167 TestPositionType test_position = null_position->CreateNextFormatEndPosition(
4169 EXPECT_NE(
nullptr, test_position);
4171 test_position = null_position->CreateNextFormatEndPosition(
4173 EXPECT_NE(
nullptr, test_position);
4177TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithTreePosition) {
4179 GetTreeID(), button_.id, 0 );
4180 ASSERT_NE(
nullptr, tree_position);
4181 ASSERT_TRUE(tree_position->IsTreePosition());
4183 TestPositionType test_position = tree_position->CreateNextFormatEndPosition(
4185 EXPECT_NE(
nullptr, test_position);
4187 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4188 EXPECT_EQ(0, test_position->child_index());
4190 test_position = test_position->CreateNextFormatEndPosition(
4192 EXPECT_NE(
nullptr, test_position);
4194 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4195 EXPECT_EQ(0, test_position->child_index());
4197 test_position = test_position->CreateNextFormatEndPosition(
4199 EXPECT_NE(
nullptr, test_position);
4201 EXPECT_EQ(line_break_.id, test_position->anchor_id());
4202 EXPECT_EQ(0, test_position->child_index());
4204 test_position = test_position->CreateNextFormatEndPosition(
4206 EXPECT_NE(
nullptr, test_position);
4208 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4209 EXPECT_EQ(0, test_position->child_index());
4212 test_position = test_position->CreateNextFormatEndPosition(
4214 EXPECT_NE(
nullptr, test_position);
4216 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4217 EXPECT_EQ(0, test_position->child_index());
4221 test_position = test_position->CreateNextFormatEndPosition(
4223 EXPECT_NE(
nullptr, test_position);
4225 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4226 EXPECT_EQ(0, test_position->child_index());
4228 test_position = test_position->CreateNextFormatEndPosition(
4230 EXPECT_NE(
nullptr, test_position);
4234TEST_F(AXPositionTest, CreatePositionAtNextFormatEndWithTextPosition) {
4236 GetTreeID(), button_.id, 0 ,
4238 ASSERT_NE(
nullptr, text_position);
4239 ASSERT_TRUE(text_position->IsTextPosition());
4241 TestPositionType test_position = text_position->CreateNextFormatEndPosition(
4243 EXPECT_NE(
nullptr, test_position);
4245 EXPECT_EQ(check_box_.id, test_position->anchor_id());
4246 EXPECT_EQ(0, test_position->text_offset());
4248 test_position = test_position->CreateNextFormatEndPosition(
4250 EXPECT_NE(
nullptr, test_position);
4252 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
4253 EXPECT_EQ(6, test_position->text_offset());
4255 test_position = test_position->CreateNextFormatEndPosition(
4257 EXPECT_NE(
nullptr, test_position);
4259 EXPECT_EQ(line_break_.id, test_position->anchor_id());
4260 EXPECT_EQ(1, test_position->text_offset());
4262 test_position = test_position->CreateNextFormatEndPosition(
4264 EXPECT_NE(
nullptr, test_position);
4266 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4267 EXPECT_EQ(6, test_position->text_offset());
4270 test_position = test_position->CreateNextFormatEndPosition(
4272 EXPECT_NE(
nullptr, test_position);
4274 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4275 EXPECT_EQ(6, test_position->text_offset());
4279 test_position = test_position->CreateNextFormatEndPosition(
4281 EXPECT_NE(
nullptr, test_position);
4283 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4284 EXPECT_EQ(6, test_position->text_offset());
4286 test_position = test_position->CreateNextFormatEndPosition(
4288 EXPECT_NE(
nullptr, test_position);
4292TEST_F(AXPositionTest, CreatePositionAtFormatBoundaryWithTextPosition) {
4303 text_data.
SetName(
"some text");
4306 more_text_data.
id = 3;
4308 more_text_data.
SetName(
"more text");
4312 SetTree(CreateAXTree({root_data, text_data, more_text_data}));
4316 GetTreeID(), text_data.
id, 8 ,
4318 ASSERT_NE(
nullptr, text_position);
4320 text_position->CreatePreviousFormatStartPosition(
4322 EXPECT_NE(
nullptr, test_position);
4324 EXPECT_EQ(text_data.
id, test_position->anchor_id());
4325 EXPECT_EQ(0, test_position->text_offset());
4329 GetTreeID(), more_text_data.
id, 0 ,
4331 ASSERT_NE(
nullptr, text_position);
4332 test_position = text_position->CreateNextFormatEndPosition(
4334 EXPECT_NE(
nullptr, test_position);
4336 EXPECT_EQ(more_text_data.
id, test_position->anchor_id());
4337 EXPECT_EQ(9, test_position->text_offset());
4340TEST_F(AXPositionTest, MoveByFormatWithIgnoredNodes) {
4393 generic_container_2.
id = 2;
4395 static_text_4.
id = 4;
4396 inline_box_5.
id = 5;
4398 generic_container_7.
id = 7;
4399 generic_container_8.
id = 8;
4401 static_text_10.
id = 10;
4402 inline_box_11.
id = 11;
4403 static_text_12.
id = 12;
4404 inline_box_13.
id = 13;
4405 generic_container_14.
id = 14;
4406 generic_container_15.
id = 15;
4408 static_text_17.
id = 17;
4409 inline_box_18.
id = 18;
4410 generic_container_19.
id = 19;
4411 generic_container_20.
id = 20;
4412 static_text_21.
id = 21;
4413 inline_box_22.
id = 22;
4415 static_text_24.
id = 24;
4416 inline_box_25.
id = 25;
4419 root_1.
child_ids = {generic_container_2.
id, generic_container_8.
id,
4420 generic_container_15.
id, generic_container_19.
id};
4430 static_text_4.
SetName(
"Button");
4433 inline_box_5.
SetName(
"Button");
4443 generic_container_8.
child_ids = {heading_9.
id, static_text_12.
id,
4444 generic_container_14.
id};
4451 static_text_10.
SetName(
"Heading");
4454 inline_box_11.
SetName(
"Heading");
4458 static_text_12.
SetName(
"3.14");
4461 inline_box_13.
SetName(
"3.14");
4474 static_text_17.
SetName(
"Heading");
4477 inline_box_18.
SetName(
"Heading");
4480 generic_container_19.
child_ids = {generic_container_20.
id, static_text_21.
id,
4488 static_text_21.
SetName(
"3.14");
4491 inline_box_22.
SetName(
"3.14");
4498 static_text_24.
SetName(
"Heading");
4501 inline_box_25.
SetName(
"Heading");
4503 SetTree(CreateAXTree({root_1,
4504 generic_container_2,
4509 generic_container_7,
4510 generic_container_8,
4516 generic_container_14,
4517 generic_container_15,
4521 generic_container_19,
4522 generic_container_20,
4540 GetTreeID(), inline_box_5.
id, 6 ,
4542 ASSERT_NE(
nullptr, text_position);
4544 EXPECT_EQ(inline_box_5.
id, text_position->anchor_id());
4545 EXPECT_EQ(6, text_position->text_offset());
4547 text_position = text_position->CreateNextFormatEndPosition(
4549 ASSERT_NE(
nullptr, text_position);
4551 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4552 EXPECT_EQ(7, text_position->text_offset());
4556 GetTreeID(), inline_box_11.
id, 0 ,
4558 ASSERT_NE(
nullptr, text_position);
4560 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4561 EXPECT_EQ(0, text_position->text_offset());
4563 text_position = text_position->CreatePreviousFormatStartPosition(
4565 ASSERT_NE(
nullptr, text_position);
4567 EXPECT_EQ(inline_box_5.
id, text_position->anchor_id());
4568 EXPECT_EQ(0, text_position->text_offset());
4576 GetTreeID(), inline_box_11.
id, 7 ,
4578 ASSERT_NE(
nullptr, text_position);
4580 EXPECT_EQ(inline_box_11.
id, text_position->anchor_id());
4581 EXPECT_EQ(7, text_position->text_offset());
4583 text_position = text_position->CreateNextFormatEndPosition(
4585 ASSERT_NE(
nullptr, text_position);
4587 EXPECT_EQ(inline_box_13.
id, text_position->anchor_id());
4588 EXPECT_EQ(4, text_position->text_offset());
4592 GetTreeID(), inline_box_25.
id, 0 ,
4594 ASSERT_NE(
nullptr, text_position);
4596 EXPECT_EQ(inline_box_25.
id, text_position->anchor_id());
4597 EXPECT_EQ(0, text_position->text_offset());
4599 text_position = text_position->CreatePreviousFormatStartPosition(
4601 ASSERT_NE(
nullptr, text_position);
4603 EXPECT_EQ(inline_box_22.
id, text_position->anchor_id());
4604 EXPECT_EQ(0, text_position->text_offset());
4608TEST_F(AXPositionTest, CreatePositionAtPageBoundaryWithTextPosition) {
4609 AXNodeData root_data, page_1_data, page_1_text_data, page_2_data,
4610 page_2_text_data, page_3_data, page_3_text_data;
4611 SetTree(CreateMultipageDocument(root_data, page_1_data, page_1_text_data,
4612 page_2_data, page_2_text_data, page_3_data,
4617 GetTreeID(), page_1_text_data.
id, 0 ,
4619 ASSERT_NE(
nullptr, text_position);
4620 ASSERT_TRUE(text_position->IsTextPosition());
4623 TestPositionType test_position = text_position->CreateNextPageStartPosition(
4625 EXPECT_NE(
nullptr, test_position);
4627 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4628 EXPECT_EQ(0, test_position->text_offset());
4630 test_position = text_position->CreateNextPageStartPosition(
4632 EXPECT_NE(
nullptr, test_position);
4634 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4635 EXPECT_EQ(0, test_position->text_offset());
4637 test_position = text_position->CreateNextPageStartPosition(
4639 EXPECT_NE(
nullptr, test_position);
4641 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4642 EXPECT_EQ(0, test_position->text_offset());
4645 test_position = test_position->CreateNextPageEndPosition(
4647 EXPECT_NE(
nullptr, test_position);
4649 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4650 EXPECT_EQ(19, test_position->text_offset());
4652 test_position = test_position->CreateNextPageEndPosition(
4654 EXPECT_NE(
nullptr, test_position);
4656 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4657 EXPECT_EQ(24, test_position->text_offset());
4659 test_position = test_position->CreateNextPageEndPosition(
4661 EXPECT_NE(
nullptr, test_position);
4663 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4664 EXPECT_EQ(24, test_position->text_offset());
4667 test_position = test_position->CreateNextPageStartPosition(
4669 EXPECT_NE(
nullptr, test_position);
4671 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4672 EXPECT_EQ(24, test_position->text_offset());
4674 test_position = test_position->CreateNextPageEndPosition(
4676 EXPECT_NE(
nullptr, test_position);
4678 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4679 EXPECT_EQ(24, test_position->text_offset());
4682 TestPositionType null_position = test_position->CreateNextPageStartPosition(
4684 EXPECT_NE(
nullptr, null_position);
4687 null_position = test_position->CreateNextPageEndPosition(
4689 EXPECT_NE(
nullptr, null_position);
4693 text_position = test_position->CreatePreviousPageEndPosition(
4695 EXPECT_NE(
nullptr, text_position);
4697 EXPECT_EQ(page_3_text_data.
id, text_position->anchor_id());
4698 EXPECT_EQ(24, text_position->text_offset());
4700 test_position = text_position->CreatePreviousPageEndPosition(
4702 EXPECT_NE(
nullptr, test_position);
4704 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4705 EXPECT_EQ(19, test_position->text_offset());
4707 test_position = text_position->CreatePreviousPageEndPosition(
4709 EXPECT_NE(
nullptr, test_position);
4711 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4712 EXPECT_EQ(19, test_position->text_offset());
4714 test_position = test_position->CreatePreviousPageStartPosition(
4716 EXPECT_NE(
nullptr, test_position);
4718 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4719 EXPECT_EQ(0, test_position->text_offset());
4721 test_position = test_position->CreatePreviousPageStartPosition(
4723 EXPECT_NE(
nullptr, test_position);
4725 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4726 EXPECT_EQ(0, test_position->text_offset());
4728 test_position = test_position->CreatePreviousPageStartPosition(
4730 EXPECT_NE(
nullptr, test_position);
4732 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4733 EXPECT_EQ(0, test_position->text_offset());
4736 test_position = test_position->CreatePreviousPageStartPosition(
4738 EXPECT_NE(
nullptr, test_position);
4740 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4741 EXPECT_EQ(0, test_position->text_offset());
4743 test_position = test_position->CreatePreviousPageEndPosition(
4745 EXPECT_NE(
nullptr, test_position);
4747 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4748 EXPECT_EQ(0, test_position->text_offset());
4751 null_position = test_position->CreatePreviousPageStartPosition(
4753 EXPECT_NE(
nullptr, null_position);
4756 null_position = test_position->CreatePreviousPageEndPosition(
4758 EXPECT_NE(
nullptr, null_position);
4762TEST_F(AXPositionTest, CreatePositionAtPageBoundaryWithTreePosition) {
4763 AXNodeData root_data, page_1_data, page_1_text_data, page_2_data,
4764 page_2_text_data, page_3_data, page_3_text_data;
4765 SetTree(CreateMultipageDocument(root_data, page_1_data, page_1_text_data,
4766 page_2_data, page_2_text_data, page_3_data,
4771 GetTreeID(), page_1_data.
id, 0 );
4772 ASSERT_NE(
nullptr, tree_position);
4773 ASSERT_TRUE(tree_position->IsTreePosition());
4776 TestPositionType test_position = tree_position->CreateNextPageStartPosition(
4778 EXPECT_NE(
nullptr, test_position);
4780 EXPECT_EQ(page_1_data.
id, test_position->anchor_id());
4781 EXPECT_EQ(0, test_position->child_index());
4783 test_position = tree_position->CreateNextPageStartPosition(
4785 EXPECT_NE(
nullptr, test_position);
4787 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4790 test_position = tree_position->CreateNextPageStartPosition(
4792 EXPECT_NE(
nullptr, test_position);
4794 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4798 test_position = tree_position->CreateNextPageEndPosition(
4800 EXPECT_NE(
nullptr, test_position);
4802 EXPECT_EQ(page_1_data.
id, test_position->anchor_id());
4803 EXPECT_EQ(1, test_position->child_index());
4805 test_position = test_position->CreateNextPageEndPosition(
4807 EXPECT_NE(
nullptr, test_position);
4809 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4810 EXPECT_EQ(0, test_position->child_index());
4812 test_position = test_position->CreateNextPageEndPosition(
4814 EXPECT_NE(
nullptr, test_position);
4816 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4817 EXPECT_EQ(0, test_position->child_index());
4820 test_position = test_position->CreateNextPageStartPosition(
4822 EXPECT_NE(
nullptr, test_position);
4824 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4825 EXPECT_EQ(0, test_position->child_index());
4827 test_position = test_position->CreateNextPageEndPosition(
4829 EXPECT_NE(
nullptr, test_position);
4831 EXPECT_EQ(page_3_text_data.
id, test_position->anchor_id());
4832 EXPECT_EQ(0, test_position->child_index());
4835 TestPositionType null_position = test_position->CreateNextPageStartPosition(
4837 EXPECT_NE(
nullptr, null_position);
4840 null_position = test_position->CreateNextPageEndPosition(
4842 EXPECT_NE(
nullptr, null_position);
4846 tree_position = test_position->CreatePreviousPageEndPosition(
4848 EXPECT_NE(
nullptr, tree_position);
4850 EXPECT_EQ(page_3_text_data.
id, tree_position->anchor_id());
4851 EXPECT_EQ(0, tree_position->child_index());
4853 test_position = tree_position->CreatePreviousPageEndPosition(
4855 EXPECT_NE(
nullptr, test_position);
4857 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4858 EXPECT_EQ(0, test_position->child_index());
4860 test_position = tree_position->CreatePreviousPageEndPosition(
4862 EXPECT_NE(
nullptr, test_position);
4864 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4865 EXPECT_EQ(0, test_position->child_index());
4867 test_position = test_position->CreatePreviousPageStartPosition(
4869 EXPECT_NE(
nullptr, test_position);
4871 EXPECT_EQ(page_2_text_data.
id, test_position->anchor_id());
4874 test_position = test_position->CreatePreviousPageStartPosition(
4876 EXPECT_NE(
nullptr, test_position);
4878 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4881 test_position = test_position->CreatePreviousPageStartPosition(
4883 EXPECT_NE(
nullptr, test_position);
4885 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4889 test_position = test_position->CreatePreviousPageStartPosition(
4891 EXPECT_NE(
nullptr, test_position);
4893 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4896 test_position = test_position->CreatePreviousPageEndPosition(
4898 EXPECT_NE(
nullptr, test_position);
4900 EXPECT_EQ(page_1_text_data.
id, test_position->anchor_id());
4904 null_position = test_position->CreatePreviousPageStartPosition(
4906 EXPECT_NE(
nullptr, null_position);
4909 null_position = test_position->CreatePreviousPageEndPosition(
4911 EXPECT_NE(
nullptr, null_position);
4915TEST_F(AXPositionTest, CreatePagePositionWithNullPosition) {
4917 ASSERT_NE(
nullptr, null_position);
4919 null_position->CreatePreviousPageStartPosition(
4921 EXPECT_NE(
nullptr, test_position);
4924 test_position = null_position->CreateNextPageStartPosition(
4926 EXPECT_NE(
nullptr, test_position);
4929 test_position = null_position->CreatePreviousPageEndPosition(
4931 EXPECT_NE(
nullptr, test_position);
4934 test_position = null_position->CreatePreviousPageStartPosition(
4936 EXPECT_NE(
nullptr, test_position);
4940TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithNullPosition) {
4942 ASSERT_NE(
nullptr, null_position);
4944 null_position->CreatePositionAtStartOfDocument();
4945 EXPECT_NE(
nullptr, test_position);
4949TEST_F(AXPositionTest, CreatePagePositionWithNonPaginatedDocument) {
4951 GetTreeID(), static_text1_.id, 0 ,
4953 ASSERT_NE(
nullptr, text_position);
4959 text_position->CreatePreviousPageStartPosition(
4961 EXPECT_NE(
nullptr, test_position);
4963 EXPECT_EQ(button_.id, test_position->anchor_id());
4964 EXPECT_EQ(0, test_position->text_offset());
4968 test_position = text_position->CreateNextPageStartPosition(
4970 EXPECT_NE(
nullptr, test_position);
4975 test_position = text_position->CreatePreviousPageEndPosition(
4977 EXPECT_NE(
nullptr, test_position);
4982 test_position = text_position->CreateNextPageEndPosition(
4984 EXPECT_NE(
nullptr, test_position);
4986 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
4987 EXPECT_EQ(6, test_position->text_offset());
4991 test_position = test_position->CreatePreviousPageStartPosition(
4993 EXPECT_NE(
nullptr, test_position);
4995 EXPECT_EQ(button_.id, test_position->anchor_id());
4996 EXPECT_EQ(0, test_position->text_offset());
5000 test_position = test_position->CreateNextPageStartPosition(
5002 EXPECT_NE(
nullptr, test_position);
5007 test_position = text_position->CreatePreviousPageEndPosition(
5009 EXPECT_NE(
nullptr, test_position);
5014 test_position = text_position->CreatePreviousPageStartPosition(
5016 EXPECT_NE(
nullptr, test_position);
5020TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithTreePosition) {
5022 GetTreeID(), root_.id, 0 );
5023 ASSERT_NE(
nullptr, tree_position);
5025 tree_position->CreatePositionAtStartOfDocument();
5026 EXPECT_NE(
nullptr, test_position);
5027 EXPECT_EQ(root_.id, test_position->anchor_id());
5031 ASSERT_NE(
nullptr, tree_position);
5032 test_position = tree_position->CreatePositionAtStartOfDocument();
5033 EXPECT_NE(
nullptr, test_position);
5034 EXPECT_EQ(root_.id, test_position->anchor_id());
5037 GetTreeID(), inline_box1_.id, 0 );
5038 ASSERT_NE(
nullptr, tree_position);
5039 test_position = tree_position->CreatePositionAtStartOfDocument();
5040 EXPECT_NE(
nullptr, test_position);
5041 EXPECT_EQ(root_.id, test_position->anchor_id());
5044TEST_F(AXPositionTest, CreatePositionAtStartOfDocumentWithTextPosition) {
5046 GetTreeID(), inline_box1_.id, 0 ,
5048 ASSERT_NE(
nullptr, text_position);
5050 text_position->CreatePositionAtStartOfDocument();
5051 EXPECT_NE(
nullptr, test_position);
5052 EXPECT_EQ(root_.id, test_position->anchor_id());
5055 GetTreeID(), inline_box1_.id, 1 ,
5057 ASSERT_NE(
nullptr, text_position);
5058 test_position = text_position->CreatePositionAtStartOfDocument();
5059 EXPECT_NE(
nullptr, test_position);
5060 EXPECT_EQ(root_.id, test_position->anchor_id());
5065TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithNullPosition) {
5067 ASSERT_NE(
nullptr, null_position);
5069 null_position->CreatePositionAtEndOfDocument();
5070 EXPECT_NE(
nullptr, test_position);
5074TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithTreePosition) {
5076 GetTreeID(), root_.id, 3 );
5077 ASSERT_NE(
nullptr, tree_position);
5079 tree_position->CreatePositionAtEndOfDocument();
5080 EXPECT_NE(
nullptr, test_position);
5081 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5085 ASSERT_NE(
nullptr, tree_position);
5086 test_position = tree_position->CreatePositionAtEndOfDocument();
5087 EXPECT_NE(
nullptr, test_position);
5088 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5091 GetTreeID(), inline_box1_.id, 0 );
5092 ASSERT_NE(
nullptr, tree_position);
5093 test_position = tree_position->CreatePositionAtEndOfDocument();
5094 EXPECT_NE(
nullptr, test_position);
5095 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5098TEST_F(AXPositionTest, CreatePositionAtEndOfDocumentWithTextPosition) {
5100 GetTreeID(), inline_box1_.id, 6 ,
5102 ASSERT_NE(
nullptr, text_position);
5104 text_position->CreatePositionAtEndOfDocument();
5105 EXPECT_NE(
nullptr, test_position);
5106 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5109 GetTreeID(), inline_box1_.id, 5 ,
5111 ASSERT_NE(
nullptr, text_position);
5112 test_position = text_position->CreatePositionAtEndOfDocument();
5113 EXPECT_NE(
nullptr, test_position);
5114 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5121 GetTreeID(), inline_box1_.id, 6 ,
5123 ASSERT_NE(
nullptr, text_position);
5124 EXPECT_FALSE(text_position->AtLastNodeInTree());
5125 EXPECT_FALSE(text_position->AsTreePosition()->AtLastNodeInTree());
5128 text_position->CreatePositionAtEndOfDocument();
5129 ASSERT_NE(
nullptr, test_position);
5131 EXPECT_TRUE(test_position->AsTreePosition()->AtLastNodeInTree());
5132 EXPECT_FALSE(text_position->CreateNullPosition()->AtLastNodeInTree());
5138 ASSERT_NE(
nullptr, on_last_node_but_not_at_maxtextoffset);
5139 EXPECT_TRUE(on_last_node_but_not_at_maxtextoffset->AtLastNodeInTree());
5140 EXPECT_TRUE(on_last_node_but_not_at_maxtextoffset->AsTreePosition()
5141 ->AtLastNodeInTree());
5144TEST_F(AXPositionTest, CreateChildPositionAtWithNullPosition) {
5146 ASSERT_NE(
nullptr, null_position);
5148 EXPECT_NE(
nullptr, test_position);
5152TEST_F(AXPositionTest, CreateChildPositionAtWithTreePosition) {
5154 GetTreeID(), root_.id, 2 );
5155 ASSERT_NE(
nullptr, tree_position);
5157 EXPECT_NE(
nullptr, test_position);
5159 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5166 ASSERT_NE(
nullptr, tree_position);
5167 test_position = tree_position->CreateChildPositionAt(0);
5168 EXPECT_NE(
nullptr, test_position);
5172TEST_F(AXPositionTest, CreateChildPositionAtWithTextPosition) {
5174 GetTreeID(), static_text1_.id, 5 ,
5176 ASSERT_NE(
nullptr, text_position);
5177 ASSERT_TRUE(text_position->IsTextPosition());
5179 EXPECT_NE(
nullptr, test_position);
5181 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5182 EXPECT_EQ(0, test_position->text_offset());
5185 GetTreeID(), static_text2_.id, 4 ,
5187 ASSERT_NE(
nullptr, text_position);
5188 ASSERT_TRUE(text_position->IsTextPosition());
5189 test_position = text_position->CreateChildPositionAt(1);
5190 EXPECT_NE(
nullptr, test_position);
5194TEST_F(AXPositionTest, CreateParentPositionWithNullPosition) {
5196 ASSERT_NE(
nullptr, null_position);
5198 EXPECT_NE(
nullptr, test_position);
5202TEST_F(AXPositionTest, CreateParentPositionWithTreePosition) {
5204 GetTreeID(), check_box_.id, 0 );
5205 ASSERT_NE(
nullptr, tree_position);
5207 EXPECT_NE(
nullptr, test_position);
5209 EXPECT_EQ(root_.id, test_position->anchor_id());
5211 EXPECT_EQ(1, test_position->child_index());
5216 ASSERT_NE(
nullptr, tree_position);
5217 test_position = tree_position->CreateParentPosition();
5218 EXPECT_NE(
nullptr, test_position);
5222TEST_F(AXPositionTest, CreateParentPositionWithTextPosition) {
5226 GetTreeID(), check_box_.id, 0 ,
5228 ASSERT_NE(
nullptr, text_position);
5229 ASSERT_TRUE(text_position->IsTextPosition());
5231 EXPECT_NE(
nullptr, test_position);
5233 EXPECT_EQ(root_.id, test_position->anchor_id());
5234 EXPECT_EQ(0, test_position->text_offset());
5241 GetTreeID(), inline_box2_.id, 5 ,
5243 ASSERT_NE(
nullptr, text_position);
5244 ASSERT_TRUE(text_position->IsTextPosition());
5245 test_position = text_position->CreateParentPosition();
5246 EXPECT_NE(
nullptr, test_position);
5248 EXPECT_EQ(static_text2_.id, test_position->anchor_id());
5249 EXPECT_EQ(5, test_position->text_offset());
5252 test_position = test_position->CreateParentPosition();
5253 EXPECT_NE(
nullptr, test_position);
5255 EXPECT_EQ(text_field_.id, test_position->anchor_id());
5258 EXPECT_EQ(12, test_position->text_offset());
5262TEST_F(AXPositionTest, CreateNextAndPreviousLeafTextPositionWithNullPosition) {
5264 ASSERT_NE(
nullptr, null_position);
5265 TestPositionType test_position = null_position->CreateNextLeafTextPosition();
5266 EXPECT_NE(
nullptr, test_position);
5268 test_position = null_position->CreatePreviousLeafTextPosition();
5269 EXPECT_NE(
nullptr, test_position);
5273TEST_F(AXPositionTest, CreateNextLeafTextPosition) {
5275 GetTreeID(), root_.id, 1 );
5276 ASSERT_NE(
nullptr, check_box_position);
5278 check_box_position->CreateNextLeafTextPosition();
5279 EXPECT_NE(
nullptr, test_position);
5281 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5282 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5283 EXPECT_EQ(0, test_position->text_offset());
5288 GetTreeID(), root_.id, 0 ,
5290 ASSERT_NE(
nullptr, root_position);
5291 ASSERT_TRUE(root_position->IsTextPosition());
5292 test_position = root_position->CreateNextLeafTextPosition();
5293 EXPECT_NE(
nullptr, test_position);
5295 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5296 EXPECT_EQ(button_.id, test_position->anchor_id());
5297 EXPECT_EQ(0, test_position->text_offset());
5300 GetTreeID(), button_.id, 0 ,
5302 ASSERT_NE(
nullptr, button_position);
5303 ASSERT_TRUE(button_position->IsTextPosition());
5304 test_position = button_position->CreateNextLeafTextPosition();
5305 EXPECT_NE(
nullptr, test_position);
5307 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5308 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5309 EXPECT_EQ(0, test_position->text_offset());
5311 test_position = test_position->CreateNextLeafTextPosition();
5312 EXPECT_NE(
nullptr, test_position);
5314 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5315 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5316 EXPECT_EQ(0, test_position->text_offset());
5318 test_position = test_position->CreateNextLeafTextPosition();
5319 EXPECT_NE(
nullptr, test_position);
5321 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5322 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5323 EXPECT_EQ(0, test_position->text_offset());
5325 test_position = test_position->CreateNextLeafTextPosition();
5326 EXPECT_NE(
nullptr, test_position);
5328 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5329 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5330 EXPECT_EQ(0, test_position->text_offset());
5332 test_position = test_position->CreateNextLeafTextPosition();
5333 EXPECT_NE(
nullptr, test_position);
5337 GetTreeID(), root_.id, 2 );
5338 ASSERT_NE(
nullptr, text_field_position);
5339 test_position = text_field_position->CreateNextLeafTextPosition();
5340 EXPECT_NE(
nullptr, test_position);
5342 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5343 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5344 EXPECT_EQ(0, test_position->text_offset());
5349 GetTreeID(), root_.id, 10 ,
5351 ASSERT_NE(
nullptr, root_position2);
5352 ASSERT_TRUE(root_position2->IsTextPosition());
5353 test_position = root_position2->CreateNextLeafTextPosition();
5354 EXPECT_NE(
nullptr, test_position);
5356 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5357 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5358 EXPECT_EQ(3, test_position->text_offset());
5361TEST_F(AXPositionTest, CreatePreviousLeafTextPosition) {
5363 GetTreeID(), inline_box2_.id, 5 ,
5365 ASSERT_NE(
nullptr, text_position);
5366 ASSERT_TRUE(text_position->IsTextPosition());
5368 text_position->CreatePreviousLeafTextPosition();
5369 EXPECT_NE(
nullptr, test_position);
5371 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5372 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5373 EXPECT_EQ(0, test_position->text_offset());
5378 ASSERT_NE(
nullptr, before_text_position);
5379 test_position = before_text_position->CreatePreviousLeafTextPosition();
5380 EXPECT_NE(
nullptr, test_position);
5382 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5383 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5384 EXPECT_EQ(0, test_position->text_offset());
5386 test_position = test_position->CreatePreviousLeafTextPosition();
5387 EXPECT_NE(
nullptr, test_position);
5389 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5390 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5391 EXPECT_EQ(0, test_position->text_offset());
5393 test_position = test_position->CreatePreviousLeafTextPosition();
5394 EXPECT_NE(
nullptr, test_position);
5396 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5397 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5398 EXPECT_EQ(0, test_position->text_offset());
5400 test_position = test_position->CreatePreviousLeafTextPosition();
5401 EXPECT_NE(
nullptr, test_position);
5403 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5404 EXPECT_EQ(button_.id, test_position->anchor_id());
5405 EXPECT_EQ(0, test_position->text_offset());
5407 test_position = test_position->CreatePreviousLeafTextPosition();
5408 EXPECT_NE(
nullptr, test_position);
5412 GetTreeID(), text_field_.id, 2 );
5413 ASSERT_NE(
nullptr, text_field_position);
5414 test_position = text_field_position->CreatePreviousLeafTextPosition();
5415 EXPECT_NE(
nullptr, test_position);
5417 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5418 EXPECT_EQ(check_box_.id, test_position->anchor_id());
5419 EXPECT_EQ(0, test_position->text_offset());
5424 GetTreeID(), check_box_.id, 0 ,
5426 ASSERT_NE(
nullptr, check_box_position);
5427 ASSERT_TRUE(check_box_position->IsTextPosition());
5428 test_position = check_box_position->CreatePreviousLeafTextPosition();
5429 EXPECT_NE(
nullptr, test_position);
5431 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5432 EXPECT_EQ(button_.id, test_position->anchor_id());
5433 EXPECT_EQ(0, test_position->text_offset());
5438 GetTreeID(), root_.id, 10 ,
5440 ASSERT_NE(
nullptr, root_position2);
5441 ASSERT_TRUE(root_position2->IsTextPosition());
5442 test_position = root_position2->CreatePreviousLeafTextPosition();
5443 EXPECT_NE(
nullptr, test_position);
5445 EXPECT_EQ(GetTreeID(), test_position->tree_id());
5446 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5447 EXPECT_EQ(3, test_position->text_offset());
5450TEST_F(AXPositionTest, CreateNextLeafTreePosition) {
5452 GetTreeID(), root_.id, 0 );
5453 ASSERT_TRUE(root_position->IsTreePosition());
5466 TestPositionType test_position = root_position->CreateNextLeafTreePosition();
5468 EXPECT_EQ(*test_position, *button_position);
5470 test_position = test_position->CreateNextLeafTreePosition();
5472 EXPECT_EQ(*test_position, *checkbox_position);
5474 test_position = test_position->CreateNextLeafTreePosition();
5476 EXPECT_EQ(*test_position, *inline_box1_position);
5478 test_position = test_position->CreateNextLeafTreePosition();
5480 EXPECT_EQ(*test_position, *line_break_position);
5482 test_position = test_position->CreateNextLeafTreePosition();
5484 EXPECT_EQ(*test_position, *inline_box2_position);
5486 test_position = test_position->CreateNextLeafTreePosition();
5490 GetTreeID(), root_.id, 2 ,
5492 EXPECT_TRUE(root_text_position->IsTextPosition());
5494 test_position = root_text_position->CreateNextLeafTreePosition();
5496 EXPECT_EQ(*test_position, *inline_box1_position);
5502 EXPECT_TRUE(inline_box1_text_position->IsTextPosition());
5504 test_position = inline_box1_text_position->CreateNextLeafTreePosition();
5506 EXPECT_EQ(*test_position, *line_break_position);
5509TEST_F(AXPositionTest, CreatePreviousLeafTreePosition) {
5512 ASSERT_TRUE(inline_box2_position->IsTreePosition());
5524 inline_box2_position->CreatePreviousLeafTreePosition();
5526 EXPECT_EQ(*test_position, *line_break_position);
5528 test_position = test_position->CreatePreviousLeafTreePosition();
5530 EXPECT_EQ(*test_position, *inline_box1_position);
5532 test_position = test_position->CreatePreviousLeafTreePosition();
5534 EXPECT_EQ(*test_position, *checkbox_position);
5536 test_position = test_position->CreatePreviousLeafTreePosition();
5538 EXPECT_EQ(*test_position, *button_position);
5540 test_position = test_position->CreatePreviousLeafTreePosition();
5547 EXPECT_TRUE(inline_box2_text_position->IsTextPosition());
5549 test_position = inline_box2_text_position->CreatePreviousLeafTreePosition();
5551 EXPECT_EQ(*test_position, *line_break_position);
5555 AsLeafTextPositionBeforeAndAfterCharacterWithNullPosition) {
5557 ASSERT_NE(
nullptr, null_position);
5558 ASSERT_TRUE(null_position->IsNullPosition());
5560 null_position->AsLeafTextPositionBeforeCharacter();
5561 EXPECT_NE(
nullptr, test_position);
5563 test_position = null_position->AsLeafTextPositionAfterCharacter();
5564 EXPECT_NE(
nullptr, test_position);
5569 AsLeafTextPositionBeforeAndAfterCharacterAtInvalidGraphemeBoundary) {
5572 <<
"Skipping, current accessibility library cannot handle grapheme";
5574 std::vector<int> text_offsets;
5575 SetTree(CreateMultilingualDocument(&text_offsets));
5578 GetTreeID(), GetTree()->
root()->
id(), 4 ,
5580 test_position = test_position->AsLeafTextPositionAfterCharacter();
5581 ASSERT_NE(
nullptr, test_position);
5583 EXPECT_EQ(GetTree()->
root()->children()[1]->
id(), test_position->anchor_id());
5585 EXPECT_EQ(2, test_position->text_offset());
5589 GetTreeID(), GetTree()->
root()->
id(), 10 ,
5591 test_position = test_position->AsLeafTextPositionBeforeCharacter();
5592 ASSERT_NE(
nullptr, test_position);
5594 EXPECT_EQ(GetTree()->
root()->children()[2]->
id(), test_position->anchor_id());
5596 EXPECT_EQ(0, test_position->text_offset());
5600 GetTreeID(), GetTree()->
root()->
id(), 10 ,
5602 test_position = test_position->AsLeafTextPositionBeforeCharacter();
5603 ASSERT_NE(
nullptr, test_position);
5605 EXPECT_EQ(GetTree()->
root()->children()[2]->
id(), test_position->anchor_id());
5608 EXPECT_EQ(0, test_position->text_offset());
5616TEST_F(AXPositionTest, AsLeafTextPositionBeforeCharacterNoAdjustment) {
5619 GetTreeID(), root_.id, 6 ,
5621 ASSERT_NE(
nullptr, text_position);
5622 ASSERT_TRUE(text_position->IsTextPosition());
5624 text_position->AsLeafTextPositionBeforeCharacter();
5625 EXPECT_NE(
nullptr, test_position);
5627 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5628 EXPECT_EQ(0, test_position->text_offset());
5632 GetTreeID(), text_field_.id, 6 ,
5634 ASSERT_NE(
nullptr, text_position);
5635 ASSERT_TRUE(text_position->IsTextPosition());
5636 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5637 EXPECT_NE(
nullptr, test_position);
5639 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5640 EXPECT_EQ(0, test_position->text_offset());
5644 GetTreeID(), text_field_.id, 13 ,
5646 ASSERT_NE(
nullptr, text_position);
5647 ASSERT_TRUE(text_position->IsTextPosition());
5648 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5649 EXPECT_NE(
nullptr, test_position);
5653 GetTreeID(), static_text1_.id, 6 ,
5655 ASSERT_NE(
nullptr, text_position);
5656 ASSERT_TRUE(text_position->IsTextPosition());
5657 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5658 EXPECT_NE(
nullptr, test_position);
5660 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5661 EXPECT_EQ(0, test_position->text_offset());
5664 GetTreeID(), inline_box1_.id, 6 ,
5666 ASSERT_NE(
nullptr, text_position);
5667 ASSERT_TRUE(text_position->IsTextPosition());
5668 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5669 EXPECT_NE(
nullptr, test_position);
5671 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5672 EXPECT_EQ(0, test_position->text_offset());
5675 GetTreeID(), line_break_.id, 1 ,
5677 ASSERT_NE(
nullptr, text_position);
5678 ASSERT_TRUE(text_position->IsTextPosition());
5679 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5680 EXPECT_NE(
nullptr, test_position);
5682 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5683 EXPECT_EQ(0, test_position->text_offset());
5686TEST_F(AXPositionTest, AsLeafTextPositionAfterCharacterNoAdjustment) {
5689 GetTreeID(), root_.id, 13 ,
5691 ASSERT_NE(
nullptr, text_position);
5692 ASSERT_TRUE(text_position->IsTextPosition());
5694 text_position->AsLeafTextPositionAfterCharacter();
5695 EXPECT_NE(
nullptr, test_position);
5697 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5698 EXPECT_EQ(6, test_position->text_offset());
5702 GetTreeID(), root_.id, 7 ,
5704 ASSERT_NE(
nullptr, text_position);
5705 ASSERT_TRUE(text_position->IsTextPosition());
5706 test_position = text_position->AsLeafTextPositionAfterCharacter();
5707 EXPECT_NE(
nullptr, test_position);
5709 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5710 EXPECT_EQ(1, test_position->text_offset());
5714 GetTreeID(), text_field_.id, 6 ,
5716 ASSERT_NE(
nullptr, text_position);
5717 ASSERT_TRUE(text_position->IsTextPosition());
5718 test_position = text_position->AsLeafTextPositionAfterCharacter();
5719 EXPECT_NE(
nullptr, test_position);
5721 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5722 EXPECT_EQ(6, test_position->text_offset());
5726 GetTreeID(), text_field_.id, 13 ,
5728 ASSERT_NE(
nullptr, text_position);
5729 ASSERT_TRUE(text_position->IsTextPosition());
5730 test_position = text_position->AsLeafTextPositionAfterCharacter();
5731 EXPECT_NE(
nullptr, test_position);
5733 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5734 EXPECT_EQ(6, test_position->text_offset());
5737 GetTreeID(), line_break_.id, 0 ,
5739 ASSERT_NE(
nullptr, text_position);
5740 ASSERT_TRUE(text_position->IsTextPosition());
5741 test_position = text_position->AsLeafTextPositionAfterCharacter();
5742 EXPECT_NE(
nullptr, test_position);
5744 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5745 EXPECT_EQ(6, test_position->text_offset());
5748 GetTreeID(), line_break_.id, 1 ,
5750 ASSERT_NE(
nullptr, text_position);
5751 ASSERT_TRUE(text_position->IsTextPosition());
5752 test_position = text_position->AsLeafTextPositionAfterCharacter();
5753 EXPECT_NE(
nullptr, test_position);
5755 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5756 EXPECT_EQ(1, test_position->text_offset());
5759 GetTreeID(), inline_box2_.id, 6 ,
5761 ASSERT_NE(
nullptr, text_position);
5762 ASSERT_TRUE(text_position->IsTextPosition());
5763 test_position = text_position->AsLeafTextPositionAfterCharacter();
5764 EXPECT_NE(
nullptr, test_position);
5766 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5767 EXPECT_EQ(6, test_position->text_offset());
5770TEST_F(AXPositionTest, AsLeafTextPositionBeforeCharacter) {
5772 GetTreeID(), inline_box1_.id, 3 ,
5774 ASSERT_NE(
nullptr, text_position);
5775 ASSERT_TRUE(text_position->IsTextPosition());
5777 text_position->AsLeafTextPositionBeforeCharacter();
5778 EXPECT_NE(
nullptr, test_position);
5780 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5781 EXPECT_EQ(3, test_position->text_offset());
5784 GetTreeID(), line_break_.id, 1 ,
5786 ASSERT_NE(
nullptr, text_position);
5787 ASSERT_TRUE(text_position->IsTextPosition());
5788 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5789 EXPECT_NE(
nullptr, test_position);
5791 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5792 EXPECT_EQ(0, test_position->text_offset());
5795 GetTreeID(), inline_box2_.id, 0 ,
5797 ASSERT_NE(
nullptr, text_position);
5798 ASSERT_TRUE(text_position->IsTextPosition());
5799 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5800 EXPECT_NE(
nullptr, test_position);
5802 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
5803 EXPECT_EQ(0, test_position->text_offset());
5806 GetTreeID(), inline_box2_.id, 6 ,
5808 ASSERT_NE(
nullptr, text_position);
5809 ASSERT_TRUE(text_position->IsTextPosition());
5810 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5811 EXPECT_NE(
nullptr, test_position);
5815 GetTreeID(), root_.id, 13 ,
5817 ASSERT_NE(
nullptr, text_position);
5818 ASSERT_TRUE(text_position->IsTextPosition());
5819 test_position = text_position->AsLeafTextPositionBeforeCharacter();
5820 EXPECT_NE(
nullptr, test_position);
5824TEST_F(AXPositionTest, AsLeafTextPositionAfterCharacter) {
5826 GetTreeID(), inline_box1_.id, 0 ,
5828 ASSERT_NE(
nullptr, text_position);
5829 ASSERT_TRUE(text_position->IsTextPosition());
5831 text_position->AsLeafTextPositionAfterCharacter();
5832 EXPECT_NE(
nullptr, test_position);
5836 GetTreeID(), inline_box1_.id, 5 ,
5838 ASSERT_NE(
nullptr, text_position);
5839 ASSERT_TRUE(text_position->IsTextPosition());
5840 test_position = text_position->AsLeafTextPositionAfterCharacter();
5841 EXPECT_NE(
nullptr, test_position);
5843 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
5844 EXPECT_EQ(5, test_position->text_offset());
5847 GetTreeID(), line_break_.id, 1 ,
5849 ASSERT_NE(
nullptr, text_position);
5850 ASSERT_TRUE(text_position->IsTextPosition());
5851 test_position = text_position->AsLeafTextPositionAfterCharacter();
5852 EXPECT_NE(
nullptr, test_position);
5854 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5855 EXPECT_EQ(1, test_position->text_offset());
5858 GetTreeID(), inline_box2_.id, 0 ,
5860 ASSERT_NE(
nullptr, text_position);
5861 ASSERT_TRUE(text_position->IsTextPosition());
5862 test_position = text_position->AsLeafTextPositionAfterCharacter();
5863 EXPECT_NE(
nullptr, test_position);
5865 EXPECT_EQ(line_break_.id, test_position->anchor_id());
5866 EXPECT_EQ(1, test_position->text_offset());
5869 GetTreeID(), root_.id, 0 ,
5871 ASSERT_NE(
nullptr, text_position);
5872 ASSERT_TRUE(text_position->IsTextPosition());
5873 test_position = text_position->AsLeafTextPositionAfterCharacter();
5874 EXPECT_NE(
nullptr, test_position);
5878TEST_F(AXPositionTest, CreateNextAndPreviousCharacterPositionWithNullPosition) {
5880 ASSERT_NE(
nullptr, null_position);
5881 TestPositionType test_position = null_position->CreateNextCharacterPosition(
5883 EXPECT_NE(
nullptr, test_position);
5885 test_position = null_position->CreatePreviousCharacterPosition(
5887 EXPECT_NE(
nullptr, test_position);
5899 text_data.
SetName(
"some text");
5903 SetTree(CreateAXTree({root_data, text_data}));
5907 GetTreeID(), text_data.
id, 9 ,
5909 ASSERT_NE(
nullptr, text_position);
5912 EXPECT_EQ(9, text_position->text_offset());
5915 TestPositionType test_position = text_position->CreateNextCharacterPosition(
5918 ASSERT_NE(
nullptr, test_position);
5920 EXPECT_EQ(text_data.
id, test_position->anchor_id());
5921 EXPECT_EQ(9, test_position->text_offset());
5922 test_position = text_position->CreateNextCharacterPosition(
5924 ASSERT_NE(
nullptr, test_position);
5929 test_position = text_position->AsValidPosition();
5931 EXPECT_EQ(*test_position, *text_position);
5935 text_data.
SetName(
"some tex");
5937 shorten_text_update.
nodes = {text_data};
5938 ASSERT_TRUE(GetTree()->Unserialize(shorten_text_update));
5940 EXPECT_FALSE(text_position->IsValid());
5941 text_position = text_position->AsValidPosition();
5943 EXPECT_EQ(8, text_position->text_offset());
5947 test_position = text_position->CreateNextCharacterPosition(
5950 ASSERT_NE(
nullptr, test_position);
5952 EXPECT_EQ(text_data.
id, test_position->anchor_id());
5953 EXPECT_EQ(8, test_position->text_offset());
5954 test_position = text_position->CreateNextCharacterPosition(
5956 ASSERT_NE(
nullptr, test_position);
5963 ASSERT_NE(
nullptr, tree_position);
5966 EXPECT_EQ(0, tree_position->child_index());
5970 remove_node_update.
nodes = {root_data};
5971 ASSERT_TRUE(GetTree()->Unserialize(remove_node_update));
5972 EXPECT_FALSE(text_position->IsValid());
5973 EXPECT_FALSE(tree_position->IsValid());
5975 text_position = text_position->AsValidPosition();
5977 tree_position = tree_position->AsValidPosition();
5984TEST_F(AXPositionTest, AsValidPositionInDescendantOfEmptyObject) {
5998 static_text_3.
id = 3;
5999 inline_box_4.
id = 4;
6008 static_text_3.
SetName(
"3.14");
6014 SetTree(CreateAXTree({root_1, button_2, static_text_3, inline_box_4}));
6018 ASSERT_NE(
nullptr, text_position);
6021 EXPECT_EQ(*text_position, *text_position->AsValidPosition());
6025 ASSERT_NE(
nullptr, tree_position);
6028 EXPECT_EQ(*tree_position, *tree_position->AsValidPosition());
6033 update.nodes = {static_text_3, inline_box_4};
6034 ASSERT_TRUE(GetTree()->Unserialize(
update));
6036 EXPECT_FALSE(text_position->IsValid());
6037 text_position = text_position->AsValidPosition();
6039 EXPECT_EQ(1, text_position->text_offset());
6041 EXPECT_FALSE(tree_position->IsValid());
6042 tree_position = tree_position->AsValidPosition();
6044 EXPECT_EQ(0, tree_position->child_index());
6047TEST_F(AXPositionTest, CreateNextCharacterPosition) {
6049 GetTreeID(), inline_box1_.id, 4 ,
6051 ASSERT_NE(
nullptr, text_position);
6052 ASSERT_TRUE(text_position->IsTextPosition());
6054 TestPositionType test_position = text_position->CreateNextCharacterPosition(
6056 EXPECT_NE(
nullptr, test_position);
6058 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6059 EXPECT_EQ(4, test_position->text_offset());
6060 test_position = text_position->CreateNextCharacterPosition(
6062 EXPECT_NE(
nullptr, test_position);
6064 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6065 EXPECT_EQ(5, test_position->text_offset());
6066 test_position = text_position->CreateNextCharacterPosition(
6068 EXPECT_NE(
nullptr, test_position);
6070 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6071 EXPECT_EQ(5, test_position->text_offset());
6072 test_position = text_position->CreateNextCharacterPosition(
6074 EXPECT_NE(
nullptr, test_position);
6076 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6077 EXPECT_EQ(5, test_position->text_offset());
6080 GetTreeID(), inline_box1_.id, 5 ,
6082 ASSERT_NE(
nullptr, text_position);
6083 ASSERT_TRUE(text_position->IsTextPosition());
6085 test_position = text_position->CreateNextCharacterPosition(
6087 EXPECT_NE(
nullptr, test_position);
6089 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6090 EXPECT_EQ(5, test_position->text_offset());
6091 test_position = text_position->CreateNextCharacterPosition(
6093 EXPECT_NE(
nullptr, test_position);
6095 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6096 EXPECT_EQ(6, test_position->text_offset());
6097 test_position = text_position->CreateNextCharacterPosition(
6099 EXPECT_NE(
nullptr, test_position);
6101 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6102 EXPECT_EQ(6, test_position->text_offset());
6103 test_position = text_position->CreateNextCharacterPosition(
6105 EXPECT_NE(
nullptr, test_position);
6107 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6108 EXPECT_EQ(6, test_position->text_offset());
6111 GetTreeID(), inline_box1_.id, 6 ,
6113 ASSERT_NE(
nullptr, text_position);
6114 ASSERT_TRUE(text_position->IsTextPosition());
6116 test_position = text_position->CreateNextCharacterPosition(
6118 EXPECT_NE(
nullptr, test_position);
6120 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6121 EXPECT_EQ(6, test_position->text_offset());
6122 test_position = text_position->CreateNextCharacterPosition(
6124 EXPECT_NE(
nullptr, test_position);
6126 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6127 EXPECT_EQ(1, test_position->text_offset());
6128 test_position = text_position->CreateNextCharacterPosition(
6130 EXPECT_NE(
nullptr, test_position);
6132 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6133 EXPECT_EQ(6, test_position->text_offset());
6134 test_position = text_position->CreateNextCharacterPosition(
6136 EXPECT_NE(
nullptr, test_position);
6138 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6139 EXPECT_EQ(1, test_position->text_offset());
6142 GetTreeID(), inline_box2_.id, 6 ,
6144 ASSERT_NE(
nullptr, text_position);
6145 ASSERT_TRUE(text_position->IsTextPosition());
6147 test_position = text_position->CreateNextCharacterPosition(
6149 EXPECT_NE(
nullptr, test_position);
6151 test_position = text_position->CreateNextCharacterPosition(
6153 EXPECT_NE(
nullptr, test_position);
6155 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6156 EXPECT_EQ(6, test_position->text_offset());
6157 test_position = text_position->CreateNextCharacterPosition(
6159 EXPECT_NE(
nullptr, test_position);
6161 EXPECT_EQ(inline_box2_.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);
6167 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6168 EXPECT_EQ(6, test_position->text_offset());
6171 GetTreeID(), check_box_.id, 0 ,
6173 ASSERT_NE(
nullptr, text_position);
6174 ASSERT_TRUE(text_position->IsTextPosition());
6176 test_position = text_position->CreateNextCharacterPosition(
6178 EXPECT_NE(
nullptr, test_position);
6180 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6181 EXPECT_EQ(1, test_position->text_offset());
6182 test_position = text_position->CreateNextCharacterPosition(
6184 EXPECT_NE(
nullptr, test_position);
6186 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6187 EXPECT_EQ(0, test_position->text_offset());
6188 test_position = text_position->CreateNextCharacterPosition(
6190 EXPECT_NE(
nullptr, test_position);
6192 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6193 EXPECT_EQ(0, test_position->text_offset());
6194 test_position = text_position->CreateNextCharacterPosition(
6196 EXPECT_NE(
nullptr, test_position);
6198 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6199 EXPECT_EQ(1, test_position->text_offset());
6202 GetTreeID(), text_field_.id, 0 ,
6204 ASSERT_NE(
nullptr, text_position);
6205 ASSERT_TRUE(text_position->IsTextPosition());
6207 test_position = text_position->CreateNextCharacterPosition(
6209 EXPECT_NE(
nullptr, test_position);
6211 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6212 EXPECT_EQ(1, test_position->text_offset());
6217 GetTreeID(), text_field_.id, 12 ,
6219 ASSERT_NE(
nullptr, text_position);
6220 ASSERT_TRUE(text_position->IsTextPosition());
6222 test_position = text_position->CreateNextCharacterPosition(
6224 EXPECT_NE(
nullptr, test_position);
6226 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6227 EXPECT_EQ(13, test_position->text_offset());
6232TEST_F(AXPositionTest, CreatePreviousCharacterPosition) {
6234 GetTreeID(), inline_box2_.id, 5 ,
6236 ASSERT_NE(
nullptr, text_position);
6237 ASSERT_TRUE(text_position->IsTextPosition());
6240 text_position->CreatePreviousCharacterPosition(
6242 EXPECT_NE(
nullptr, test_position);
6244 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6245 EXPECT_EQ(5, test_position->text_offset());
6246 test_position = text_position->CreatePreviousCharacterPosition(
6248 EXPECT_NE(
nullptr, test_position);
6250 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6251 EXPECT_EQ(4, test_position->text_offset());
6252 test_position = text_position->CreatePreviousCharacterPosition(
6254 EXPECT_NE(
nullptr, test_position);
6256 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6257 EXPECT_EQ(4, test_position->text_offset());
6258 test_position = text_position->CreatePreviousCharacterPosition(
6260 EXPECT_NE(
nullptr, test_position);
6262 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6263 EXPECT_EQ(4, test_position->text_offset());
6266 GetTreeID(), inline_box2_.id, 1 ,
6268 ASSERT_NE(
nullptr, text_position);
6269 ASSERT_TRUE(text_position->IsTextPosition());
6271 test_position = text_position->CreatePreviousCharacterPosition(
6273 EXPECT_NE(
nullptr, test_position);
6275 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6276 EXPECT_EQ(1, test_position->text_offset());
6277 test_position = text_position->CreatePreviousCharacterPosition(
6279 EXPECT_NE(
nullptr, test_position);
6281 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6282 EXPECT_EQ(0, test_position->text_offset());
6283 test_position = text_position->CreatePreviousCharacterPosition(
6285 EXPECT_NE(
nullptr, test_position);
6287 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6288 EXPECT_EQ(0, test_position->text_offset());
6289 test_position = text_position->CreatePreviousCharacterPosition(
6291 EXPECT_NE(
nullptr, test_position);
6293 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6294 EXPECT_EQ(0, test_position->text_offset());
6297 GetTreeID(), inline_box2_.id, 0 ,
6299 ASSERT_NE(
nullptr, text_position);
6300 ASSERT_TRUE(text_position->IsTextPosition());
6302 test_position = text_position->CreatePreviousCharacterPosition(
6304 EXPECT_NE(
nullptr, test_position);
6306 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6307 EXPECT_EQ(0, test_position->text_offset());
6308 test_position = text_position->CreatePreviousCharacterPosition(
6310 EXPECT_NE(
nullptr, test_position);
6312 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6313 EXPECT_EQ(0, test_position->text_offset());
6314 test_position = text_position->CreatePreviousCharacterPosition(
6316 EXPECT_NE(
nullptr, test_position);
6318 EXPECT_EQ(inline_box2_.id, test_position->anchor_id());
6319 EXPECT_EQ(0, test_position->text_offset());
6320 test_position = text_position->CreatePreviousCharacterPosition(
6322 EXPECT_NE(
nullptr, test_position);
6324 EXPECT_EQ(line_break_.id, test_position->anchor_id());
6325 EXPECT_EQ(0, test_position->text_offset());
6328 GetTreeID(), inline_box1_.id, 0 ,
6330 ASSERT_NE(
nullptr, text_position);
6331 ASSERT_TRUE(text_position->IsTextPosition());
6333 test_position = text_position->CreatePreviousCharacterPosition(
6335 EXPECT_NE(
nullptr, test_position);
6337 test_position = text_position->CreatePreviousCharacterPosition(
6339 EXPECT_NE(
nullptr, test_position);
6341 EXPECT_EQ(inline_box1_.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);
6347 EXPECT_EQ(inline_box1_.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);
6353 EXPECT_EQ(inline_box1_.id, test_position->anchor_id());
6354 EXPECT_EQ(0, test_position->text_offset());
6357 GetTreeID(), check_box_.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);
6366 test_position = text_position->CreatePreviousCharacterPosition(
6368 EXPECT_NE(
nullptr, test_position);
6370 EXPECT_EQ(check_box_.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);
6376 EXPECT_EQ(check_box_.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);
6382 EXPECT_EQ(check_box_.id, test_position->anchor_id());
6383 EXPECT_EQ(0, test_position->text_offset());
6386 GetTreeID(), text_field_.id, 1 ,
6388 ASSERT_NE(
nullptr, text_position);
6389 ASSERT_TRUE(text_position->IsTextPosition());
6391 test_position = text_position->CreatePreviousCharacterPosition(
6393 EXPECT_NE(
nullptr, test_position);
6395 EXPECT_EQ(text_field_.id, test_position->anchor_id());
6396 EXPECT_EQ(0, test_position->text_offset());
6401TEST_F(AXPositionTest, CreateNextCharacterPositionAtGraphemeBoundary) {
6404 <<
"Skipping, current accessibility library cannot handle grapheme";
6406 std::vector<int> text_offsets;
6407 SetTree(CreateMultilingualDocument(&text_offsets));
6410 GetTreeID(), GetTree()->
root()->
id(), 0 ,
6412 ASSERT_NE(
nullptr, test_position);
6413 ASSERT_TRUE(test_position->IsTextPosition());
6415 for (
auto iter = (text_offsets.begin() + 1); iter != text_offsets.end();
6417 const int text_offset = *iter;
6418 test_position = test_position->CreateNextCharacterPosition(
6420 ASSERT_NE(
nullptr, test_position);
6424 message <<
"Expecting character boundary at " << text_offset <<
" in\n"
6428 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6429 EXPECT_EQ(text_offset, test_position->text_offset());
6434 GetTreeID(), GetTree()->
root()->
id(), 3 ,
6436 test_position = test_position->CreateNextCharacterPosition(
6438 ASSERT_NE(
nullptr, test_position);
6440 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6441 EXPECT_EQ(3, test_position->text_offset());
6445 GetTreeID(), GetTree()->
root()->
id(), 4 ,
6447 test_position = test_position->CreateNextCharacterPosition(
6449 ASSERT_NE(
nullptr, test_position);
6451 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6452 EXPECT_EQ(5, test_position->text_offset());
6456 GetTreeID(), GetTree()->
root()->
id(), 9 ,
6458 test_position = test_position->CreateNextCharacterPosition(
6460 ASSERT_NE(
nullptr, test_position);
6462 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6463 EXPECT_EQ(9, test_position->text_offset());
6467 GetTreeID(), GetTree()->
root()->
id(), 10 ,
6469 test_position = test_position->CreateNextCharacterPosition(
6471 ASSERT_NE(
nullptr, test_position);
6473 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6474 EXPECT_EQ(12, test_position->text_offset());
6480TEST_F(AXPositionTest, CreatePreviousCharacterPositionAtGraphemeBoundary) {
6483 <<
"Skipping, current accessibility library cannot handle grapheme";
6485 std::vector<int> text_offsets;
6486 SetTree(CreateMultilingualDocument(&text_offsets));
6490 text_offsets.back() ,
6492 ASSERT_NE(
nullptr, test_position);
6493 ASSERT_TRUE(test_position->IsTextPosition());
6495 for (
auto iter = (text_offsets.rbegin() + 1); iter != text_offsets.rend();
6497 const int text_offset = *iter;
6498 test_position = test_position->CreatePreviousCharacterPosition(
6500 ASSERT_NE(
nullptr, test_position);
6504 message <<
"Expecting character boundary at " << text_offset <<
" in\n"
6508 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6509 EXPECT_EQ(text_offset, test_position->text_offset());
6514 GetTreeID(), GetTree()->
root()->
id(), 3 ,
6516 test_position = test_position->CreatePreviousCharacterPosition(
6518 ASSERT_NE(
nullptr, test_position);
6520 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6521 EXPECT_EQ(3, test_position->text_offset());
6525 GetTreeID(), GetTree()->
root()->
id(), 4 ,
6527 test_position = test_position->CreatePreviousCharacterPosition(
6529 ASSERT_NE(
nullptr, test_position);
6531 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6532 EXPECT_EQ(3, test_position->text_offset());
6536 GetTreeID(), GetTree()->
root()->
id(), 9 ,
6538 test_position = test_position->CreatePreviousCharacterPosition(
6540 ASSERT_NE(
nullptr, test_position);
6542 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6543 EXPECT_EQ(9, test_position->text_offset());
6547 GetTreeID(), GetTree()->
root()->
id(), 10 ,
6549 test_position = test_position->CreatePreviousCharacterPosition(
6551 ASSERT_NE(
nullptr, test_position);
6553 EXPECT_EQ(GetTree()->
root()->
id(), test_position->anchor_id());
6554 EXPECT_EQ(9, test_position->text_offset());
6560TEST_F(AXPositionTest, ReciprocalCreateNextAndPreviousCharacterPosition) {
6562 GetTreeID(), root_.id, 0 );
6564 ASSERT_NE(
nullptr, text_position);
6565 ASSERT_TRUE(text_position->IsTextPosition());
6567 size_t next_character_moves = 0;
6568 while (!text_position->IsNullPosition()) {
6570 text_position->CreateNextCharacterPosition(
6572 ASSERT_NE(
nullptr, moved_position);
6574 text_position = std::move(moved_position);
6575 ++next_character_moves;
6579 GetTreeID(), root_.id, root_.child_ids.size() );
6580 text_position = tree_position->AsTextPosition();
6581 ASSERT_NE(
nullptr, text_position);
6582 ASSERT_TRUE(text_position->IsTextPosition());
6584 size_t previous_character_moves = 0;
6585 while (!text_position->IsNullPosition()) {
6587 text_position->CreatePreviousCharacterPosition(
6589 ASSERT_NE(
nullptr, moved_position);
6591 text_position = std::move(moved_position);
6592 ++previous_character_moves;
6595 EXPECT_EQ(next_character_moves, previous_character_moves);
6596 EXPECT_EQ(strlen(TEXT_VALUE), next_character_moves - 1);
6599TEST_F(AXPositionTest, CreateNextAndPreviousWordStartPositionWithNullPosition) {
6601 ASSERT_NE(
nullptr, null_position);
6602 TestPositionType test_position = null_position->CreateNextWordStartPosition(
6604 EXPECT_NE(
nullptr, test_position);
6606 test_position = null_position->CreatePreviousWordStartPosition(
6608 EXPECT_NE(
nullptr, test_position);
6612TEST_F(AXPositionTest, CreateNextAndPreviousWordEndPositionWithNullPosition) {
6614 ASSERT_NE(
nullptr, null_position);
6617 EXPECT_NE(
nullptr, test_position);
6619 test_position = null_position->CreatePreviousWordEndPosition(
6621 EXPECT_NE(
nullptr, test_position);
6627 ASSERT_NE(
nullptr, null_position1);
6629 ASSERT_NE(
nullptr, null_position2);
6630 EXPECT_EQ(*null_position1, *null_position2);
6634 GetTreeID(), root_.id, 0 );
6635 ASSERT_NE(
nullptr, button_position1);
6637 GetTreeID(), root_.id, 0 );
6638 ASSERT_NE(
nullptr, button_position2);
6639 EXPECT_EQ(*button_position1, *button_position2);
6644 GetTreeID(), root_.id, 4 );
6645 ASSERT_NE(
nullptr, tree_position1);
6648 ASSERT_NE(
nullptr, tree_position2);
6649 EXPECT_EQ(*tree_position1, *tree_position2);
6655 ASSERT_NE(
nullptr, tree_position1);
6658 ASSERT_NE(
nullptr, tree_position2);
6659 EXPECT_NE(*tree_position1, *tree_position2);
6663 GetTreeID(), text_field_.id, 3 );
6664 ASSERT_NE(
nullptr, tree_position1);
6666 GetTreeID(), text_field_.id, 3 );
6667 ASSERT_NE(
nullptr, tree_position2);
6668 EXPECT_EQ(*tree_position1, *tree_position2);
6673 ASSERT_NE(
nullptr, tree_position1);
6676 ASSERT_NE(
nullptr, tree_position2);
6677 EXPECT_EQ(*tree_position1, *tree_position2);
6682 GetTreeID(), inline_box1_.id, 15 ,
6684 ASSERT_NE(
nullptr, text_position1);
6685 ASSERT_TRUE(text_position1->IsNullPosition());
6687 GetTreeID(), text_field_.id, -1 ,
6689 ASSERT_NE(
nullptr, text_position2);
6690 ASSERT_TRUE(text_position2->IsNullPosition());
6691 EXPECT_EQ(*text_position1, *text_position2);
6694 GetTreeID(), inline_box1_.id, 0 ,
6696 ASSERT_NE(
nullptr, text_position1);
6697 ASSERT_TRUE(text_position1->IsTextPosition());
6699 GetTreeID(), inline_box1_.id, 0 ,
6701 ASSERT_NE(
nullptr, text_position2);
6702 ASSERT_TRUE(text_position2->IsTextPosition());
6703 EXPECT_EQ(*text_position1, *text_position2);
6707 GetTreeID(), inline_box1_.id, 0 ,
6709 ASSERT_NE(
nullptr, text_position2);
6710 ASSERT_TRUE(text_position2->IsTextPosition());
6711 EXPECT_EQ(*text_position1, *text_position2);
6715 GetTreeID(), inline_box1_.id, 5 ,
6717 ASSERT_NE(
nullptr, text_position1);
6718 ASSERT_TRUE(text_position1->IsTextPosition());
6719 EXPECT_NE(*text_position1, *text_position2);
6723 GetTreeID(), line_break_.id, 1 ,
6725 ASSERT_NE(
nullptr, text_position1);
6726 ASSERT_TRUE(text_position1->IsTextPosition());
6728 GetTreeID(), line_break_.id, 1 ,
6730 ASSERT_NE(
nullptr, text_position2);
6731 ASSERT_TRUE(text_position2->IsTextPosition());
6732 EXPECT_EQ(*text_position1, *text_position2);
6737 GetTreeID(), inline_box2_.id, 0 ,
6739 ASSERT_NE(
nullptr, text_position1);
6740 ASSERT_TRUE(text_position1->IsTextPosition());
6742 GetTreeID(), line_break_.id, 1 ,
6744 ASSERT_NE(
nullptr, text_position2);
6745 ASSERT_TRUE(text_position2->IsTextPosition());
6746 EXPECT_EQ(*text_position1, *text_position2);
6751 GetTreeID(), static_text1_.id, 6 ,
6753 ASSERT_NE(
nullptr, text_position1);
6754 ASSERT_TRUE(text_position1->IsTextPosition());
6756 GetTreeID(), inline_box1_.id, 6 ,
6758 ASSERT_NE(
nullptr, text_position2);
6759 ASSERT_TRUE(text_position2->IsTextPosition());
6760 EXPECT_EQ(*text_position1, *text_position2);
6764 GetTreeID(), static_text2_.id, 6 ,
6766 ASSERT_NE(
nullptr, text_position1);
6767 ASSERT_TRUE(text_position1->IsTextPosition());
6769 GetTreeID(), inline_box2_.id, 6 ,
6771 ASSERT_NE(
nullptr, text_position2);
6772 ASSERT_TRUE(text_position2->IsTextPosition());
6776 text_position1->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6778 text_position2->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6780 EXPECT_EQ(*text_position1, *text_position2);
6783TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetSameAnchorId) {
6785 GetTreeID(), root_.id, 0 ,
6787 ASSERT_NE(
nullptr, text_position_one);
6788 ASSERT_TRUE(text_position_one->IsTextPosition());
6791 GetTreeID(), root_.id, 0 ,
6793 ASSERT_NE(
nullptr, text_position_two);
6794 ASSERT_TRUE(text_position_two->IsTextPosition());
6796 ASSERT_TRUE(*text_position_one == *text_position_two);
6797 ASSERT_TRUE(*text_position_two == *text_position_one);
6800TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetDifferentAnchorIdRoot) {
6802 GetTreeID(), root_.id, 0 ,
6804 ASSERT_NE(
nullptr, text_position_one);
6805 ASSERT_TRUE(text_position_one->IsTextPosition());
6808 GetTreeID(), check_box_.id, 0 ,
6810 ASSERT_NE(
nullptr, text_position_two);
6811 ASSERT_TRUE(text_position_two->IsTextPosition());
6813 ASSERT_TRUE(*text_position_one == *text_position_two);
6814 ASSERT_TRUE(*text_position_two == *text_position_one);
6817TEST_F(AXPositionTest, OperatorEqualsSameTextOffsetDifferentAnchorIdLeaf) {
6819 GetTreeID(), button_.id, 0 ,
6821 ASSERT_NE(
nullptr, text_position_one);
6822 ASSERT_TRUE(text_position_one->IsTextPosition());
6825 GetTreeID(), check_box_.id, 0 ,
6827 ASSERT_NE(
nullptr, text_position_two);
6828 ASSERT_TRUE(text_position_two->IsTextPosition());
6830 ASSERT_TRUE(*text_position_one == *text_position_two);
6831 ASSERT_TRUE(*text_position_two == *text_position_one);
6834TEST_F(AXPositionTest, OperatorsLessThanAndGreaterThan) {
6836 ASSERT_NE(
nullptr, null_position1);
6838 ASSERT_NE(
nullptr, null_position2);
6839 EXPECT_FALSE(*null_position1 < *null_position2);
6840 EXPECT_FALSE(*null_position1 > *null_position2);
6843 GetTreeID(), root_.id, 0 );
6844 ASSERT_NE(
nullptr, button_position1);
6846 GetTreeID(), root_.id, 1 );
6847 ASSERT_NE(
nullptr, button_position2);
6848 EXPECT_LT(*button_position1, *button_position2);
6849 EXPECT_GT(*button_position2, *button_position1);
6852 GetTreeID(), text_field_.id, 2 );
6853 ASSERT_NE(
nullptr, tree_position1);
6856 GetTreeID(), text_field_.id, 3 );
6857 ASSERT_NE(
nullptr, tree_position2);
6858 EXPECT_LT(*tree_position1, *tree_position2);
6859 EXPECT_GT(*tree_position2, *tree_position1);
6864 ASSERT_NE(
nullptr, tree_position1);
6867 GetTreeID(), inline_box1_.id, 0 );
6868 ASSERT_NE(
nullptr, tree_position2);
6869 EXPECT_LT(*tree_position1, *tree_position2);
6870 EXPECT_GT(*tree_position2, *tree_position1);
6874 GetTreeID(), inline_box1_.id, 2 ,
6876 ASSERT_NE(
nullptr, text_position1);
6877 ASSERT_TRUE(text_position1->IsTextPosition());
6879 GetTreeID(), inline_box1_.id, 0 ,
6881 ASSERT_NE(
nullptr, text_position2);
6882 ASSERT_TRUE(text_position2->IsTextPosition());
6883 EXPECT_GT(*text_position1, *text_position2);
6884 EXPECT_LT(*text_position2, *text_position1);
6888 GetTreeID(), inline_box1_.id, 0 ,
6890 ASSERT_NE(
nullptr, text_position2);
6891 ASSERT_TRUE(text_position2->IsTextPosition());
6892 EXPECT_GT(*text_position1, *text_position2);
6893 EXPECT_LT(*text_position2, *text_position1);
6897 GetTreeID(), line_break_.id, 1 ,
6899 ASSERT_NE(
nullptr, text_position1);
6900 ASSERT_TRUE(text_position1->IsTextPosition());
6903 GetTreeID(), line_break_.id, 0 ,
6905 ASSERT_NE(
nullptr, text_position2);
6906 ASSERT_TRUE(text_position2->IsTextPosition());
6907 EXPECT_GT(*text_position1, *text_position2);
6908 EXPECT_LT(*text_position2, *text_position1);
6912 GetTreeID(), text_field_.id, 6 ,
6914 ASSERT_NE(
nullptr, text_position1);
6915 ASSERT_TRUE(text_position1->IsTextPosition());
6917 GetTreeID(), inline_box1_.id, 5 ,
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(), inline_box2_.id, 0 ,
6928 ASSERT_NE(
nullptr, text_position1);
6929 ASSERT_TRUE(text_position1->IsTextPosition());
6931 GetTreeID(), line_break_.id, 0 ,
6933 ASSERT_NE(
nullptr, text_position2);
6934 ASSERT_TRUE(text_position2->IsTextPosition());
6935 EXPECT_GT(*text_position1, *text_position2);
6936 EXPECT_LT(*text_position2, *text_position1);
6940 GetTreeID(), line_break_.id, 1 ,
6942 ASSERT_NE(
nullptr, text_position2);
6943 ASSERT_TRUE(text_position2->IsTextPosition());
6944 EXPECT_EQ(*text_position1, *text_position2);
6948 GetTreeID(), inline_box2_.id, 6 ,
6950 ASSERT_NE(
nullptr, text_position1);
6951 ASSERT_TRUE(text_position1->IsTextPosition());
6955 text_position1->AsLeafTextPositionBeforeCharacter()->IsNullPosition());
6958 GetTreeID(), static_text2_.id, 0 ,
6960 ASSERT_NE(
nullptr, text_position2);
6961 ASSERT_TRUE(text_position2->IsTextPosition());
6962 EXPECT_GT(*text_position1, *text_position2);
6963 EXPECT_LT(*text_position2, *text_position1);
6968 ASSERT_NE(
nullptr, null_position1);
6970 ASSERT_NE(
nullptr, null_position2);
6972 swap(*null_position1, *null_position2);
6977 GetTreeID(), root_.id, 2 );
6978 ASSERT_NE(
nullptr, tree_position1);
6980 GetTreeID(), text_field_.id, 3 );
6981 ASSERT_NE(
nullptr, tree_position2);
6983 swap(*tree_position1, *tree_position2);
6985 EXPECT_EQ(GetTreeID(), tree_position1->tree_id());
6986 EXPECT_EQ(text_field_.id, tree_position1->anchor_id());
6987 EXPECT_EQ(3, tree_position1->child_index());
6989 EXPECT_EQ(GetTreeID(), tree_position2->tree_id());
6990 EXPECT_EQ(root_.id, tree_position2->anchor_id());
6991 EXPECT_EQ(2, tree_position2->child_index());
6993 swap(*tree_position1, *null_position1);
6996 EXPECT_EQ(GetTreeID(), null_position1->tree_id());
6997 EXPECT_EQ(text_field_.id, null_position1->anchor_id());
6998 EXPECT_EQ(3, null_position1->child_index());
7001 GetTreeID(), line_break_.id, 1 ,
7003 ASSERT_NE(
nullptr, text_position);
7005 swap(*text_position, *null_position1);
7007 EXPECT_EQ(GetTreeID(), text_position->tree_id());
7008 EXPECT_EQ(line_break_.id, null_position1->anchor_id());
7009 EXPECT_EQ(1, null_position1->text_offset());
7012 EXPECT_EQ(GetTreeID(), text_position->tree_id());
7013 EXPECT_EQ(text_field_.id, text_position->anchor_id());
7014 EXPECT_EQ(3, text_position->child_index());
7017TEST_F(AXPositionTest, CreateNextAnchorPosition) {
7027 text_data.
SetName(
"some text");
7030 text_field_data.
id = 3;
7034 empty_text_data.
id = 4;
7039 more_text_data.
id = 5;
7041 more_text_data.
SetName(
"more text");
7043 root_data.
child_ids = {text_data.
id, text_field_data.
id, more_text_data.
id};
7046 SetTree(CreateAXTree({root_data, text_data, text_field_data, empty_text_data,
7052 GetTreeID(), text_data.
id, 8 ,
7054 ASSERT_NE(
nullptr, text_position1);
7055 ASSERT_FALSE(text_position1->CreateNextAnchorPosition()
7056 ->CreateNextAnchorPosition()
7057 ->IsNullPosition());
7060TEST_F(AXPositionTest, CreateLinePositionsMultipleAnchorsInSingleLine) {
7083 static_text1.
id = 2;
7085 inline_block.
id = 4;
7086 static_text2.
id = 5;
7088 static_text3.
id = 7;
7092 root.child_ids = {static_text1.
id, inline_block.
id, static_text3.
id};
7095 static_text1.
SetName(
"before");
7099 inline_box1.
SetName(
"before");
7107 static_text2.
SetName(
"inside");
7111 inline_box2.
SetName(
"inside");
7118 static_text3.
SetName(
"after");
7126 SetTree(CreateAXTree({
root, static_text1, inline_box1, inline_block,
7127 static_text2, inline_box2, static_text3, inline_box3}));
7130 GetTreeID(), inline_block.
id, 3 ,
7132 ASSERT_NE(
nullptr, text_position);
7133 ASSERT_TRUE(text_position->IsTextPosition());
7136 text_position->CreateNextLineStartPosition(
7138 ASSERT_NE(
nullptr, next_line_start_position);
7139 EXPECT_TRUE(next_line_start_position->IsTextPosition());
7140 EXPECT_EQ(inline_box3.
id, next_line_start_position->anchor_id());
7141 EXPECT_EQ(5, next_line_start_position->text_offset());
7144 text_position->CreatePreviousLineStartPosition(
7146 ASSERT_NE(
nullptr, previous_line_start_position);
7147 EXPECT_TRUE(previous_line_start_position->IsTextPosition());
7148 EXPECT_EQ(inline_box1.
id, previous_line_start_position->anchor_id());
7149 EXPECT_EQ(0, previous_line_start_position->text_offset());
7152 text_position->CreateNextLineEndPosition(
7154 ASSERT_NE(
nullptr, next_line_end_position);
7155 EXPECT_TRUE(next_line_end_position->IsTextPosition());
7156 EXPECT_EQ(inline_box3.
id, next_line_end_position->anchor_id());
7157 EXPECT_EQ(5, next_line_end_position->text_offset());
7160 text_position->CreatePreviousLineEndPosition(
7162 ASSERT_NE(
nullptr, previous_line_end_position);
7163 EXPECT_TRUE(previous_line_end_position->IsTextPosition());
7164 EXPECT_EQ(inline_box1.
id, previous_line_end_position->anchor_id());
7165 EXPECT_EQ(0, previous_line_end_position->text_offset());
7168TEST_F(AXPositionTest, CreateNextWordPositionInList) {
7203 list_marker1.
id = 4;
7204 static_text1.
id = 5;
7206 static_text2.
id = 7;
7209 list_marker2.
id = 10;
7210 static_text3.
id = 11;
7211 inline_box3.
id = 12;
7212 static_text4.
id = 13;
7213 inline_box4.
id = 14;
7216 root.child_ids = {list.
id};
7236 std::vector<int32_t>{0});
7238 std::vector<int32_t>{3});
7241 static_text2.
SetName(
"first item");
7245 inline_box2.
SetName(
"first item");
7247 std::vector<int32_t>{0, 6});
7249 std::vector<int32_t>{5});
7266 std::vector<int32_t>{0});
7268 std::vector<int32_t>{3});
7271 static_text4.
SetName(
"second item");
7275 inline_box4.
SetName(
"second item");
7277 std::vector<int32_t>{0, 7});
7279 std::vector<int32_t>{6});
7281 SetTree(CreateAXTree({
root, list, list_item1, list_marker1, static_text1,
7282 inline_box1, static_text2, inline_box2, list_item2,
7283 list_marker2, static_text3, inline_box3, static_text4,
7287 GetTreeID(), inline_box1.
id, 0 ,
7289 ASSERT_NE(
nullptr, text_position);
7290 ASSERT_TRUE(text_position->IsTextPosition());
7291 ASSERT_EQ(inline_box1.
id, text_position->anchor_id());
7292 ASSERT_EQ(0, text_position->text_offset());
7295 text_position = text_position->CreateNextWordStartPosition(
7297 ASSERT_NE(
nullptr, text_position);
7298 ASSERT_TRUE(text_position->IsTextPosition());
7299 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7300 ASSERT_EQ(0, text_position->text_offset());
7303 text_position = text_position->CreateNextWordStartPosition(
7305 ASSERT_NE(
nullptr, text_position);
7306 ASSERT_TRUE(text_position->IsTextPosition());
7307 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7308 ASSERT_EQ(6, text_position->text_offset());
7311 text_position = text_position->CreateNextWordStartPosition(
7313 ASSERT_NE(
nullptr, text_position);
7314 ASSERT_TRUE(text_position->IsTextPosition());
7315 ASSERT_EQ(inline_box3.
id, text_position->anchor_id());
7316 ASSERT_EQ(0, text_position->text_offset());
7319 text_position = text_position->CreateNextWordStartPosition(
7321 ASSERT_NE(
nullptr, text_position);
7322 ASSERT_TRUE(text_position->IsTextPosition());
7323 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7324 ASSERT_EQ(0, text_position->text_offset());
7327 text_position = text_position->CreateNextWordStartPosition(
7329 ASSERT_NE(
nullptr, text_position);
7330 ASSERT_TRUE(text_position->IsTextPosition());
7331 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7332 ASSERT_EQ(7, text_position->text_offset());
7335TEST_F(AXPositionTest, CreatePreviousWordPositionInList) {
7370 list_marker1.
id = 4;
7371 static_text1.
id = 5;
7373 static_text2.
id = 7;
7376 list_marker2.
id = 10;
7377 static_text3.
id = 11;
7378 inline_box3.
id = 12;
7379 static_text4.
id = 13;
7380 inline_box4.
id = 14;
7383 root.child_ids = {list.
id};
7403 std::vector<int32_t>{0});
7405 std::vector<int32_t>{3});
7408 static_text2.
SetName(
"first item");
7412 inline_box2.
SetName(
"first item");
7414 std::vector<int32_t>{0, 6});
7416 std::vector<int32_t>{5});
7433 std::vector<int32_t>{0});
7435 std::vector<int32_t>{3});
7438 static_text4.
SetName(
"second item");
7442 inline_box4.
SetName(
"second item");
7444 std::vector<int32_t>{0, 7});
7446 std::vector<int32_t>{6});
7448 SetTree(CreateAXTree({
root, list, list_item1, list_marker1, static_text1,
7449 inline_box1, static_text2, inline_box2, list_item2,
7450 list_marker2, static_text3, inline_box3, static_text4,
7454 GetTreeID(), inline_box4.
id, 11 ,
7456 ASSERT_NE(
nullptr, text_position);
7457 ASSERT_TRUE(text_position->IsTextPosition());
7458 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7459 ASSERT_EQ(11, text_position->text_offset());
7462 text_position = text_position->CreatePreviousWordStartPosition(
7464 ASSERT_NE(
nullptr, text_position);
7465 ASSERT_TRUE(text_position->IsTextPosition());
7466 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7467 ASSERT_EQ(7, text_position->text_offset());
7470 text_position = text_position->CreatePreviousWordStartPosition(
7472 ASSERT_NE(
nullptr, text_position);
7473 ASSERT_TRUE(text_position->IsTextPosition());
7474 ASSERT_EQ(inline_box4.
id, text_position->anchor_id());
7475 ASSERT_EQ(0, text_position->text_offset());
7478 text_position = text_position->CreatePreviousWordStartPosition(
7480 ASSERT_NE(
nullptr, text_position);
7481 ASSERT_TRUE(text_position->IsTextPosition());
7482 ASSERT_EQ(inline_box3.
id, text_position->anchor_id());
7483 ASSERT_EQ(0, text_position->text_offset());
7486 text_position = text_position->CreatePreviousWordStartPosition(
7488 ASSERT_NE(
nullptr, text_position);
7489 ASSERT_TRUE(text_position->IsTextPosition());
7490 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7491 ASSERT_EQ(6, text_position->text_offset());
7494 text_position = text_position->CreatePreviousWordStartPosition(
7496 ASSERT_NE(
nullptr, text_position);
7497 ASSERT_TRUE(text_position->IsTextPosition());
7498 ASSERT_EQ(inline_box2.
id, text_position->anchor_id());
7499 ASSERT_EQ(0, text_position->text_offset());
7502 text_position = text_position->CreatePreviousWordStartPosition(
7504 ASSERT_NE(
nullptr, text_position);
7505 ASSERT_TRUE(text_position->IsTextPosition());
7506 ASSERT_EQ(inline_box1.
id, text_position->anchor_id());
7507 ASSERT_EQ(0, text_position->text_offset());
7510TEST_F(AXPositionTest, EmptyObjectReplacedByCharacterTextNavigation) {
7545 static_text_2.
id = 2;
7546 inline_box_3.
id = 3;
7547 text_field_4.
id = 4;
7548 generic_container_5.
id = 5;
7549 static_text_6.
id = 6;
7550 inline_box_7.
id = 7;
7552 static_text_9.
id = 9;
7553 inline_box_10.
id = 10;
7554 generic_container_11.
id = 11;
7555 generic_container_12.
id = 12;
7556 static_text_13.
id = 13;
7558 generic_container_15.
id = 15;
7562 static_text_6.
id, heading_8.
id,
7563 generic_container_11.
id, generic_container_12.
id,
7564 static_text_13.
id, button_14.
id};
7567 static_text_2.
SetName(
"Hello ");
7571 inline_box_3.
SetName(
"Hello ");
7573 std::vector<int32_t>{0});
7575 std::vector<int32_t>{6});
7578 text_field_4.
child_ids = {generic_container_5.
id};
7583 static_text_6.
SetName(
" world");
7587 inline_box_7.
SetName(
" world");
7589 std::vector<int32_t>{1});
7591 std::vector<int32_t>{6});
7598 static_text_9.
SetName(
"3.14");
7601 inline_box_10.
SetName(
"3.14");
7613 static_text_13.
SetName(
"hey");
7621 SetTree(CreateAXTree({root_1, static_text_2, inline_box_3, text_field_4,
7622 generic_container_5, static_text_6, inline_box_7,
7623 heading_8, static_text_9, inline_box_10,
7624 generic_container_11, generic_container_12,
7625 static_text_13, button_14, generic_container_15}));
7629 GetTreeID(), inline_box_3.
id, 0 ,
7634 std::string expectations =
7635 "TextPosition anchor_id=5 text_offset=0 affinity=downstream "
7636 "annotated_text=<\xEF\xBF\xBC>";
7637 ASSERT_EQ(result_position->ToString(), expectations);
7639 position = std::move(result_position);
7643 "TextPosition anchor_id=7 text_offset=1 affinity=downstream "
7644 "annotated_text= <w>orld";
7645 ASSERT_EQ(result_position->ToString(), expectations);
7648 position = std::move(result_position);
7649 result_position = position->CreatePreviousWordStartPosition(
7652 "TextPosition anchor_id=5 text_offset=0 affinity=downstream "
7653 "annotated_text=<\xEF\xBF\xBC>";
7654 ASSERT_EQ(result_position->ToString(), expectations);
7656 position = std::move(result_position);
7657 result_position = position->CreatePreviousWordStartPosition(
7660 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
7661 "annotated_text=<H>ello ";
7662 ASSERT_EQ(result_position->ToString(), expectations);
7665 position = std::move(result_position);
7669 "TextPosition anchor_id=3 text_offset=6 affinity=downstream "
7670 "annotated_text=Hello <>";
7671 ASSERT_EQ(result_position->ToString(), expectations);
7673 position = std::move(result_position);
7677 "TextPosition anchor_id=5 text_offset=1 affinity=downstream "
7678 "annotated_text=\xEF\xBF\xBC<>";
7679 ASSERT_EQ(result_position->ToString(), expectations);
7681 position = std::move(result_position);
7685 "TextPosition anchor_id=7 text_offset=6 affinity=downstream "
7686 "annotated_text= world<>";
7687 ASSERT_EQ(result_position->ToString(), expectations);
7690 position = std::move(result_position);
7691 result_position = position->CreatePreviousWordEndPosition(
7694 "TextPosition anchor_id=5 text_offset=1 affinity=downstream "
7695 "annotated_text=\xEF\xBF\xBC<>";
7696 ASSERT_EQ(result_position->ToString(), expectations);
7698 position = std::move(result_position);
7699 result_position = position->CreatePreviousWordEndPosition(
7702 "TextPosition anchor_id=3 text_offset=6 affinity=downstream "
7703 "annotated_text=Hello <>";
7704 ASSERT_EQ(result_position->ToString(), expectations);
7708 GetTreeID(), generic_container_5.
id, 0 ,
7711 std::u16string expected_text;
7713 ASSERT_EQ(expected_text, position->GetText());
7718 GetTreeID(), root_1.
id, 0 ,
7725 ASSERT_EQ(expected_text, position->GetText());
7729 GetTreeID(), generic_container_5.
id, 0 ,
7732 ASSERT_EQ(1, position->MaxTextOffset());
7736 position = position->CreateParentPosition();
7738 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
7739 "annotated_text=<\xEF\xBF\xBC>";
7740 ASSERT_EQ(position->ToString(), expectations);
7741 ASSERT_EQ(1, position->MaxTextOffset());
7743 position = position->CreateParentPosition();
7745 "TextPosition anchor_id=1 text_offset=6 affinity=downstream "
7746 "annotated_text=Hello <\xEF\xBF\xBC> "
7747 "world3.14\xEF\xBF\xBChey\xEF\xBF\xBC";
7748 ASSERT_EQ(position->ToString(), expectations);
7749 ASSERT_EQ(22, position->MaxTextOffset());
7754 GetTreeID(), root_1.
id, 0 ,
7756 ASSERT_EQ(22, position->MaxTextOffset());
7766 GetTreeID(), generic_container_12.
id, 0 ,
7768 ASSERT_NE(
nullptr, text_position);
7770 text_position = text_position->CreatePreviousFormatStartPosition(
7772 EXPECT_NE(
nullptr, text_position);
7774 EXPECT_EQ(generic_container_12.
id, text_position->anchor_id());
7775 EXPECT_EQ(0, text_position->text_offset());
7786 GetTreeID(), static_text_13.
id, 3 ,
7788 ASSERT_NE(
nullptr, text_position);
7790 text_position = text_position->CreateNextParagraphEndPosition(
7792 EXPECT_NE(
nullptr, text_position);
7795 EXPECT_EQ(button_14.
id, text_position->anchor_id());
7796 EXPECT_EQ(1, text_position->text_offset());
7799TEST_F(AXPositionTest, TextNavigationWithCollapsedCombobox) {
7825 static_text_2.
id = 2;
7826 inline_box_3.
id = 3;
7827 popup_button_4.
id = 4;
7828 menu_list_popup_5.
id = 5;
7829 menu_list_option_6.
id = 6;
7830 static_text_7.
id = 7;
7831 inline_box_8.
id = 8;
7834 root_1.
child_ids = {static_text_2.
id, popup_button_4.
id, static_text_7.
id};
7847 popup_button_4.
child_ids = {menu_list_popup_5.
id};
7851 menu_list_popup_5.
child_ids = {menu_list_option_6.
id};
7854 menu_list_option_6.
SetName(
"Option");
7857 static_text_7.
SetName(
"3.14");
7866 SetTree(CreateAXTree({root_1, static_text_2, inline_box_3, popup_button_4,
7867 menu_list_popup_5, menu_list_option_6, static_text_7,
7873 ASSERT_NE(
nullptr, position);
7875 position = position->CreateNextParagraphStartPosition(
7877 ASSERT_NE(
nullptr, position);
7878 EXPECT_EQ(popup_button_4.
id, position->anchor_id());
7879 EXPECT_EQ(0, position->text_offset());
7881 position = position->CreateNextParagraphStartPosition(
7883 ASSERT_NE(
nullptr, position);
7884 EXPECT_EQ(inline_box_8.
id, position->anchor_id());
7885 EXPECT_EQ(0, position->text_offset());
7890 ASSERT_NE(
nullptr, position);
7892 position = position->CreatePreviousParagraphEndPosition(
7894 ASSERT_NE(
nullptr, position);
7895 EXPECT_EQ(popup_button_4.
id, position->anchor_id());
7898 EXPECT_EQ(1, position->text_offset());
7900 position = position->CreatePreviousParagraphEndPosition(
7902 ASSERT_NE(
nullptr, position);
7903 EXPECT_EQ(inline_box_3.
id, position->anchor_id());
7904 EXPECT_EQ(2, position->text_offset());
7910 update.nodes = {popup_button_4};
7911 ASSERT_TRUE(GetTree()->Unserialize(
update));
7916 ASSERT_NE(
nullptr, position);
7918 position = position->CreateNextParagraphStartPosition(
7920 ASSERT_NE(
nullptr, position);
7921 EXPECT_EQ(menu_list_option_6.
id, position->anchor_id());
7922 EXPECT_EQ(0, position->text_offset());
7924 position = position->CreateNextParagraphStartPosition(
7926 ASSERT_NE(
nullptr, position);
7927 EXPECT_EQ(inline_box_8.
id, position->anchor_id());
7928 EXPECT_EQ(0, position->text_offset());
7933 ASSERT_NE(
nullptr, position);
7935 position = position->CreatePreviousParagraphEndPosition(
7937 ASSERT_NE(
nullptr, position);
7938 EXPECT_EQ(menu_list_option_6.
id, position->anchor_id());
7939 EXPECT_EQ(1, position->text_offset());
7941 position = position->CreatePreviousParagraphEndPosition(
7943 ASSERT_NE(
nullptr, position);
7944 EXPECT_EQ(inline_box_3.
id, position->anchor_id());
7945 EXPECT_EQ(2, position->text_offset());
7952TEST_P(AXPositionExpandToEnclosingTextBoundaryTestWithParam,
7953 TextPositionBeforeLine2) {
7957 GetTreeID(), text_field_.id, 7 ,
7959 ASSERT_TRUE(text_position->IsTextPosition());
7961 GetParam().boundary, GetParam().expand_behavior);
7962 EXPECT_EQ(GetParam().expected_anchor_position, range.
anchor()->ToString());
7963 EXPECT_EQ(GetParam().expected_focus_position, range.
focus()->ToString());
7966TEST_P(AXPositionCreatePositionAtTextBoundaryTestWithParam,
7967 TextPositionBeforeStaticText) {
7969 GetTreeID(), static_text2_.id, 0 ,
7971 ASSERT_TRUE(text_position->IsTextPosition());
7972 text_position = text_position->CreatePositionAtTextBoundary(
7973 GetParam().boundary, GetParam().direction, GetParam().boundary_behavior);
7974 EXPECT_NE(
nullptr, text_position);
7975 EXPECT_EQ(GetParam().expected_text_position, text_position->ToString());
7979 TraverseTreeStartingWithAffinityDownstream) {
7981 GetTreeID(), GetParam().start_node_id, GetParam().start_offset,
7983 ASSERT_TRUE(text_position->IsTextPosition());
7984 for (
const std::string&
expectation : GetParam().expectations) {
7985 text_position = GetParam().TestMethod(text_position);
7986 EXPECT_NE(
nullptr, text_position);
7987 EXPECT_EQ(
expectation, text_position->ToString());
7992 TraverseTreeStartingWithAffinityUpstream) {
7994 GetTreeID(), GetParam().start_node_id, GetParam().start_offset,
7996 ASSERT_TRUE(text_position->IsTextPosition());
7997 for (
const std::string&
expectation : GetParam().expectations) {
7998 text_position = GetParam().TestMethod(text_position);
7999 EXPECT_NE(
nullptr, text_position);
8000 EXPECT_EQ(
expectation, text_position->ToString());
8009 ExpandToEnclosingTextBoundary,
8010 AXPositionExpandToEnclosingTextBoundaryTestWithParam,
8012 ExpandToEnclosingTextBoundaryTestParam{
8015 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8016 "annotated_text=Line 1<\n>Line 2",
8017 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8018 "annotated_text=Line 1\n<L>ine 2"},
8019 ExpandToEnclosingTextBoundaryTestParam{
8022 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8023 "annotated_text=Line 1\n<L>ine 2",
8024 "TextPosition anchor_id=4 text_offset=8 affinity=downstream "
8025 "annotated_text=Line 1\nL<i>ne 2"},
8026 ExpandToEnclosingTextBoundaryTestParam{
8028 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8029 "annotated_text=<L>ine 1\nLine 2",
8030 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8031 "annotated_text=Line 1\nLine 2<>"},
8032 ExpandToEnclosingTextBoundaryTestParam{
8035 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8036 "annotated_text=<L>ine 1\nLine 2",
8037 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8038 "annotated_text=Line 1\nLine 2<>"},
8039 ExpandToEnclosingTextBoundaryTestParam{
8042 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8043 "annotated_text=Line 1<\n>Line 2",
8044 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8045 "annotated_text=Line 1\nLine 2<>"},
8046 ExpandToEnclosingTextBoundaryTestParam{
8049 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8050 "annotated_text=Line 1<\n>Line 2",
8051 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8052 "annotated_text=Line 1\nLine 2<>"},
8053 ExpandToEnclosingTextBoundaryTestParam{
8056 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8057 "annotated_text=<L>ine 1\nLine 2",
8058 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8059 "annotated_text=Line 1\n<L>ine 2"},
8060 ExpandToEnclosingTextBoundaryTestParam{
8063 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8064 "annotated_text=Line 1\n<L>ine 2",
8065 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8066 "annotated_text=Line 1\nLine 2<>"},
8067 ExpandToEnclosingTextBoundaryTestParam{
8070 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8071 "annotated_text=<L>ine 1\nLine 2",
8072 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8073 "annotated_text=Line 1<\n>Line 2"},
8074 ExpandToEnclosingTextBoundaryTestParam{
8077 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8078 "annotated_text=Line 1\n<L>ine 2",
8079 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8080 "annotated_text=Line 1\nLine 2<>"},
8081 ExpandToEnclosingTextBoundaryTestParam{
8083 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8084 "annotated_text=<L>ine 1\nLine 2",
8085 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8086 "annotated_text=Line 1\nLine 2<>"},
8087 ExpandToEnclosingTextBoundaryTestParam{
8090 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8091 "annotated_text=<L>ine 1\nLine 2",
8092 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8093 "annotated_text=Line 1\nLine 2<>"},
8094 ExpandToEnclosingTextBoundaryTestParam{
8097 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8098 "annotated_text=<L>ine 1\nLine 2",
8099 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8100 "annotated_text=Line 1\n<L>ine 2"},
8101 ExpandToEnclosingTextBoundaryTestParam{
8104 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8105 "annotated_text=Line 1\n<L>ine 2",
8106 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8107 "annotated_text=Line 1\nLine 2<>"},
8108 ExpandToEnclosingTextBoundaryTestParam{
8111 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8112 "annotated_text=<L>ine 1\nLine 2",
8113 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8114 "annotated_text=Line 1\n<L>ine 2"},
8115 ExpandToEnclosingTextBoundaryTestParam{
8118 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8119 "annotated_text=Line 1\n<L>ine 2",
8120 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8121 "annotated_text=Line 1\nLine 2<>"},
8122 ExpandToEnclosingTextBoundaryTestParam{
8125 "TextPosition anchor_id=4 text_offset=0 affinity=downstream "
8126 "annotated_text=<L>ine 1\nLine 2",
8127 "TextPosition anchor_id=4 text_offset=7 affinity=upstream "
8128 "annotated_text=Line 1\n<L>ine 2"},
8129 ExpandToEnclosingTextBoundaryTestParam{
8132 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8133 "annotated_text=Line 1\n<L>ine 2",
8134 "TextPosition anchor_id=4 text_offset=13 affinity=downstream "
8135 "annotated_text=Line 1\nLine 2<>"},
8137 ExpandToEnclosingTextBoundaryTestParam{
8140 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8141 "annotated_text=<L>ine 1\nLine 2",
8142 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8143 "annotated_text=Line 2<>"},
8144 ExpandToEnclosingTextBoundaryTestParam{
8147 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8148 "annotated_text=<L>ine 1\nLine 2",
8149 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8150 "annotated_text=Line 2<>"},
8151 ExpandToEnclosingTextBoundaryTestParam{
8154 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8155 "annotated_text=Line 1<\n>Line 2",
8156 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8157 "annotated_text=Line 1\nLine< >2"},
8158 ExpandToEnclosingTextBoundaryTestParam{
8161 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8162 "annotated_text=Line 1<\n>Line 2",
8163 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8164 "annotated_text=Line 1\nLine< >2"},
8165 ExpandToEnclosingTextBoundaryTestParam{
8168 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
8169 "annotated_text=Line <1>\nLine 2",
8170 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8171 "annotated_text=Line 1\n<L>ine 2"},
8172 ExpandToEnclosingTextBoundaryTestParam{
8175 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8176 "annotated_text=Line 1\n<L>ine 2",
8177 "TextPosition anchor_id=4 text_offset=12 affinity=downstream "
8178 "annotated_text=Line 1\nLine <2>"},
8179 ExpandToEnclosingTextBoundaryTestParam{
8182 "TextPosition anchor_id=4 text_offset=5 affinity=downstream "
8183 "annotated_text=Line <1>\nLine 2",
8184 "TextPosition anchor_id=4 text_offset=6 affinity=downstream "
8185 "annotated_text=Line 1<\n>Line 2"},
8186 ExpandToEnclosingTextBoundaryTestParam{
8189 "TextPosition anchor_id=4 text_offset=7 affinity=downstream "
8190 "annotated_text=Line 1\n<L>ine 2",
8191 "TextPosition anchor_id=4 text_offset=11 affinity=downstream "
8192 "annotated_text=Line 1\nLine< >2"}));
8197 CreatePositionAtTextBoundary,
8198 AXPositionCreatePositionAtTextBoundaryTestWithParam,
8200 CreatePositionAtTextBoundaryTestParam{
8204 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8205 "annotated_text=<\n>"},
8206 CreatePositionAtTextBoundaryTestParam{
8210 "TextPosition anchor_id=8 text_offset=1 affinity=downstream "
8211 "annotated_text=L<i>ne 2"},
8212 CreatePositionAtTextBoundaryTestParam{
8216 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8217 "annotated_text=<\n>"},
8218 CreatePositionAtTextBoundaryTestParam{
8222 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8223 "annotated_text=Line 2<>"},
8224 CreatePositionAtTextBoundaryTestParam{
8228 "TextPosition anchor_id=7 text_offset=0 affinity=downstream "
8229 "annotated_text=<\n>"},
8230 CreatePositionAtTextBoundaryTestParam{
8234 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8235 "annotated_text=Line 2<>"},
8236 CreatePositionAtTextBoundaryTestParam{
8240 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8241 "annotated_text=<L>ine 1"},
8242 CreatePositionAtTextBoundaryTestParam{
8246 CreatePositionAtTextBoundaryTestParam{
8250 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8251 "annotated_text=<L>ine 1"},
8252 CreatePositionAtTextBoundaryTestParam{
8256 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8257 "annotated_text=Line 2<>"},
8258 CreatePositionAtTextBoundaryTestParam{
8262 "TextPosition anchor_id=8 text_offset=0 affinity=downstream "
8263 "annotated_text=<L>ine 2"},
8264 CreatePositionAtTextBoundaryTestParam{
8268 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8269 "annotated_text=Line 2<>"},
8270 CreatePositionAtTextBoundaryTestParam{
8274 "TextPosition anchor_id=3 text_offset=0 affinity=downstream "
8275 "annotated_text=<>"},
8276 CreatePositionAtTextBoundaryTestParam{
8280 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8281 "annotated_text=Line 2<>"},
8282 CreatePositionAtTextBoundaryTestParam{
8286 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8287 "annotated_text=<L>ine 1"},
8288 CreatePositionAtTextBoundaryTestParam{
8292 CreatePositionAtTextBoundaryTestParam{
8296 "TextPosition anchor_id=6 text_offset=0 affinity=downstream "
8297 "annotated_text=<L>ine 1"},
8298 CreatePositionAtTextBoundaryTestParam{
8302 "TextPosition anchor_id=8 text_offset=6 affinity=downstream "
8303 "annotated_text=Line 2<>"},
8305 CreatePositionAtTextBoundaryTestParam{
8309 "TextPosition anchor_id=1 text_offset=0 affinity=downstream "
8310 "annotated_text=<L>ine 1\nLine 2"},
8311 CreatePositionAtTextBoundaryTestParam{
8315 "TextPosition anchor_id=9 text_offset=6 affinity=downstream "
8316 "annotated_text=Line 2<>"},
8317 CreatePositionAtTextBoundaryTestParam{
8321 "TextPosition anchor_id=6 text_offset=6 affinity=downstream "
8322 "annotated_text=Line 1<>"},
8323 CreatePositionAtTextBoundaryTestParam{
8327 "TextPosition anchor_id=8 text_offset=4 affinity=downstream "
8328 "annotated_text=Line< >2"},
8329 CreatePositionAtTextBoundaryTestParam{
8333 "TextPosition anchor_id=6 text_offset=5 affinity=downstream "
8334 "annotated_text=Line <1>"},
8335 CreatePositionAtTextBoundaryTestParam{
8339 "TextPosition anchor_id=8 text_offset=5 affinity=downstream "
8340 "annotated_text=Line <2>"},
8341 CreatePositionAtTextBoundaryTestParam{
8345 "TextPosition anchor_id=6 text_offset=5 affinity=downstream "
8346 "annotated_text=Line <1>"},
8347 CreatePositionAtTextBoundaryTestParam{
8351 "TextPosition anchor_id=8 text_offset=4 affinity=downstream "
8352 "annotated_text=Line< >2"}));
8355 CreateNextWordStartPositionWithBoundaryBehaviorCrossBoundary,
8356 AXPositionTextNavigationTestWithParam,
8358 TextNavigationTestParam{
8360 return position->CreateNextWordStartPosition(
8365 {
"TextPosition anchor_id=1 text_offset=5 "
8366 "affinity=downstream annotated_text=Line <1>\nLine 2",
8367 "TextPosition anchor_id=1 text_offset=7 "
8368 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8369 "TextPosition anchor_id=1 text_offset=12 "
8370 "affinity=downstream annotated_text=Line 1\nLine <2>",
8372 TextNavigationTestParam{
8374 return position->CreateNextWordStartPosition(
8379 {
"TextPosition anchor_id=4 text_offset=5 "
8380 "affinity=downstream annotated_text=Line <1>\nLine 2",
8381 "TextPosition anchor_id=4 text_offset=7 "
8382 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8383 "TextPosition anchor_id=4 text_offset=12 "
8384 "affinity=downstream annotated_text=Line 1\nLine <2>",
8387 return position->CreateNextWordStartPosition(
8392 {
"TextPosition anchor_id=5 text_offset=5 "
8393 "affinity=downstream annotated_text=Line <1>",
8394 "TextPosition anchor_id=9 text_offset=0 "
8395 "affinity=downstream annotated_text=<L>ine 2",
8396 "TextPosition anchor_id=9 text_offset=5 "
8397 "affinity=downstream annotated_text=Line <2>",
8400 return position->CreateNextWordStartPosition(
8405 {
"TextPosition anchor_id=9 text_offset=5 "
8406 "affinity=downstream annotated_text=Line <2>",
8410 CreateNextWordStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8411 AXPositionTextNavigationTestWithParam,
8413 TextNavigationTestParam{
8415 return position->CreateNextWordStartPosition(
8420 {
"TextPosition anchor_id=1 text_offset=5 "
8421 "affinity=downstream annotated_text=Line <1>\nLine 2",
8422 "TextPosition anchor_id=1 text_offset=7 "
8423 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8424 "TextPosition anchor_id=1 text_offset=12 "
8425 "affinity=downstream annotated_text=Line 1\nLine <2>",
8426 "TextPosition anchor_id=1 text_offset=13 "
8427 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8428 TextNavigationTestParam{
8430 return position->CreateNextWordStartPosition(
8435 {
"TextPosition anchor_id=4 text_offset=5 "
8436 "affinity=downstream annotated_text=Line <1>\nLine 2",
8437 "TextPosition anchor_id=4 text_offset=7 "
8438 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8439 "TextPosition anchor_id=4 text_offset=12 "
8440 "affinity=downstream annotated_text=Line 1\nLine <2>",
8441 "TextPosition anchor_id=4 text_offset=13 "
8442 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8443 TextNavigationTestParam{
8445 return position->CreateNextWordStartPosition(
8450 {
"TextPosition anchor_id=5 text_offset=5 "
8451 "affinity=downstream annotated_text=Line <1>",
8452 "TextPosition anchor_id=5 text_offset=6 "
8453 "affinity=downstream annotated_text=Line 1<>"}},
8454 TextNavigationTestParam{
8456 return position->CreateNextWordStartPosition(
8461 {
"TextPosition anchor_id=9 text_offset=5 "
8462 "affinity=downstream annotated_text=Line <2>",
8463 "TextPosition anchor_id=9 text_offset=6 "
8464 "affinity=downstream annotated_text=Line 2<>"}}));
8467 CreateNextWordStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8468 AXPositionTextNavigationTestWithParam,
8470 TextNavigationTestParam{
8472 return position->CreateNextWordStartPosition(
8477 {
"TextPosition anchor_id=1 text_offset=0 "
8478 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8479 "TextPosition anchor_id=1 text_offset=0 "
8480 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8481 TextNavigationTestParam{
8483 return position->CreateNextWordStartPosition(
8488 {
"TextPosition anchor_id=4 text_offset=0 "
8489 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8490 "TextPosition anchor_id=4 text_offset=0 "
8491 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8492 TextNavigationTestParam{
8494 return position->CreateNextWordStartPosition(
8499 {
"TextPosition anchor_id=5 text_offset=5 "
8500 "affinity=downstream annotated_text=Line <1>",
8501 "TextPosition anchor_id=5 text_offset=5 "
8502 "affinity=downstream annotated_text=Line <1>"}},
8503 TextNavigationTestParam{
8505 return position->CreateNextWordStartPosition(
8510 {
"TextPosition anchor_id=9 text_offset=5 "
8511 "affinity=downstream annotated_text=Line <2>",
8512 "TextPosition anchor_id=9 text_offset=5 "
8513 "affinity=downstream annotated_text=Line <2>"}}));
8516 CreateNextWordStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
8517 AXPositionTextNavigationTestWithParam,
8519 TextNavigationTestParam{
8521 return position->CreateNextWordStartPosition(
8526 {
"TextPosition anchor_id=1 text_offset=5 "
8527 "affinity=downstream annotated_text=Line <1>\nLine 2",
8528 "TextPosition anchor_id=1 text_offset=7 "
8529 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8530 "TextPosition anchor_id=1 text_offset=12 "
8531 "affinity=downstream annotated_text=Line 1\nLine <2>",
8532 "TextPosition anchor_id=1 text_offset=13 "
8533 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8534 "TextPosition anchor_id=1 text_offset=13 "
8535 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8536 TextNavigationTestParam{
8538 return position->CreateNextWordStartPosition(
8543 {
"TextPosition anchor_id=4 text_offset=5 "
8544 "affinity=downstream annotated_text=Line <1>\nLine 2",
8545 "TextPosition anchor_id=4 text_offset=7 "
8546 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8547 "TextPosition anchor_id=4 text_offset=12 "
8548 "affinity=downstream annotated_text=Line 1\nLine <2>",
8549 "TextPosition anchor_id=4 text_offset=13 "
8550 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8551 "TextPosition anchor_id=4 text_offset=13 "
8552 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8553 TextNavigationTestParam{
8555 return position->CreateNextWordStartPosition(
8560 {
"TextPosition anchor_id=5 text_offset=5 "
8561 "affinity=downstream annotated_text=Line <1>",
8562 "TextPosition anchor_id=9 text_offset=0 "
8563 "affinity=downstream annotated_text=<L>ine 2",
8564 "TextPosition anchor_id=9 text_offset=5 "
8565 "affinity=downstream annotated_text=Line <2>",
8566 "TextPosition anchor_id=9 text_offset=6 "
8567 "affinity=downstream annotated_text=Line 2<>",
8568 "TextPosition anchor_id=9 text_offset=6 "
8569 "affinity=downstream annotated_text=Line 2<>"}},
8570 TextNavigationTestParam{
8572 return position->CreateNextWordStartPosition(
8577 {
"TextPosition anchor_id=9 text_offset=5 "
8578 "affinity=downstream annotated_text=Line <2>",
8579 "TextPosition anchor_id=9 text_offset=6 "
8580 "affinity=downstream annotated_text=Line 2<>",
8581 "TextPosition anchor_id=9 text_offset=6 "
8582 "affinity=downstream annotated_text=Line 2<>"}}));
8585 CreatePreviousWordStartPositionWithBoundaryBehaviorCrossBoundary,
8586 AXPositionTextNavigationTestWithParam,
8588 TextNavigationTestParam{
8590 return position->CreatePreviousWordStartPosition(
8595 {
"TextPosition anchor_id=1 text_offset=12 "
8596 "affinity=downstream annotated_text=Line 1\nLine <2>",
8597 "TextPosition anchor_id=1 text_offset=7 "
8598 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8599 "TextPosition anchor_id=1 text_offset=5 "
8600 "affinity=downstream annotated_text=Line <1>\nLine 2",
8601 "TextPosition anchor_id=1 text_offset=0 "
8602 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8604 TextNavigationTestParam{
8606 return position->CreatePreviousWordStartPosition(
8611 {
"TextPosition anchor_id=4 text_offset=12 "
8612 "affinity=downstream annotated_text=Line 1\nLine <2>",
8613 "TextPosition anchor_id=4 text_offset=7 "
8614 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8615 "TextPosition anchor_id=4 text_offset=5 "
8616 "affinity=downstream annotated_text=Line <1>\nLine 2",
8617 "TextPosition anchor_id=4 text_offset=0 "
8618 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8620 TextNavigationTestParam{
8622 return position->CreatePreviousWordStartPosition(
8627 {
"TextPosition anchor_id=5 text_offset=0 "
8628 "affinity=downstream annotated_text=<L>ine 1",
8630 TextNavigationTestParam{
8632 return position->CreatePreviousWordStartPosition(
8637 {
"TextPosition anchor_id=9 text_offset=0 "
8638 "affinity=downstream annotated_text=<L>ine 2",
8639 "TextPosition anchor_id=6 text_offset=5 "
8640 "affinity=downstream annotated_text=Line <1>",
8641 "TextPosition anchor_id=6 text_offset=0 "
8642 "affinity=downstream annotated_text=<L>ine 1",
8646 CreatePreviousWordStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8647 AXPositionTextNavigationTestWithParam,
8649 TextNavigationTestParam{
8651 return position->CreatePreviousWordStartPosition(
8656 {
"TextPosition anchor_id=1 text_offset=12 "
8657 "affinity=downstream annotated_text=Line 1\nLine <2>",
8658 "TextPosition anchor_id=1 text_offset=7 "
8659 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8660 "TextPosition anchor_id=1 text_offset=5 "
8661 "affinity=downstream annotated_text=Line <1>\nLine 2",
8662 "TextPosition anchor_id=1 text_offset=0 "
8663 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8664 "TextPosition anchor_id=1 text_offset=0 "
8665 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8666 TextNavigationTestParam{
8668 return position->CreatePreviousWordStartPosition(
8673 {
"TextPosition anchor_id=4 text_offset=12 "
8674 "affinity=downstream annotated_text=Line 1\nLine <2>",
8675 "TextPosition anchor_id=4 text_offset=7 "
8676 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8677 "TextPosition anchor_id=4 text_offset=5 "
8678 "affinity=downstream annotated_text=Line <1>\nLine 2",
8679 "TextPosition anchor_id=4 text_offset=0 "
8680 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8681 "TextPosition anchor_id=4 text_offset=0 "
8682 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8683 TextNavigationTestParam{
8685 return position->CreatePreviousWordStartPosition(
8690 {
"TextPosition anchor_id=5 text_offset=0 "
8691 "affinity=downstream annotated_text=<L>ine 1",
8692 "TextPosition anchor_id=5 text_offset=0 "
8693 "affinity=downstream annotated_text=<L>ine 1"}},
8694 TextNavigationTestParam{
8696 return position->CreatePreviousWordStartPosition(
8701 {
"TextPosition anchor_id=9 text_offset=0 "
8702 "affinity=downstream annotated_text=<L>ine 2",
8703 "TextPosition anchor_id=9 text_offset=0 "
8704 "affinity=downstream annotated_text=<L>ine 2"}}));
8707 CreatePreviousWordStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8708 AXPositionTextNavigationTestWithParam,
8710 TextNavigationTestParam{
8712 return position->CreatePreviousWordStartPosition(
8717 {
"TextPosition anchor_id=1 text_offset=12 "
8718 "affinity=downstream annotated_text=Line 1\nLine <2>",
8719 "TextPosition anchor_id=1 text_offset=12 "
8720 "affinity=downstream annotated_text=Line 1\nLine <2>"}},
8721 TextNavigationTestParam{
8723 return position->CreatePreviousWordStartPosition(
8728 {
"TextPosition anchor_id=4 text_offset=12 "
8729 "affinity=downstream annotated_text=Line 1\nLine <2>",
8730 "TextPosition anchor_id=4 text_offset=12 "
8731 "affinity=downstream annotated_text=Line 1\nLine <2>"}},
8732 TextNavigationTestParam{
8734 return position->CreatePreviousWordStartPosition(
8739 {
"TextPosition anchor_id=5 text_offset=5 "
8740 "affinity=downstream annotated_text=Line <1>"}},
8741 TextNavigationTestParam{
8743 return position->CreatePreviousWordStartPosition(
8748 {
"TextPosition anchor_id=9 text_offset=0 "
8749 "affinity=downstream annotated_text=<L>ine 2",
8750 "TextPosition anchor_id=9 text_offset=0 "
8751 "affinity=downstream annotated_text=<L>ine 2"}}));
8754 CreatePreviousWordStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
8755 AXPositionTextNavigationTestWithParam,
8757 TextNavigationTestParam{
8759 return position->CreatePreviousWordStartPosition(
8764 {
"TextPosition anchor_id=1 text_offset=12 "
8765 "affinity=downstream annotated_text=Line 1\nLine <2>",
8766 "TextPosition anchor_id=1 text_offset=7 "
8767 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8768 "TextPosition anchor_id=1 text_offset=5 "
8769 "affinity=downstream annotated_text=Line <1>\nLine 2",
8770 "TextPosition anchor_id=1 text_offset=0 "
8771 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8772 "TextPosition anchor_id=1 text_offset=0 "
8773 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8774 TextNavigationTestParam{
8776 return position->CreatePreviousWordStartPosition(
8781 {
"TextPosition anchor_id=4 text_offset=12 "
8782 "affinity=downstream annotated_text=Line 1\nLine <2>",
8783 "TextPosition anchor_id=4 text_offset=7 "
8784 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
8785 "TextPosition anchor_id=4 text_offset=5 "
8786 "affinity=downstream annotated_text=Line <1>\nLine 2",
8787 "TextPosition anchor_id=4 text_offset=0 "
8788 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
8789 "TextPosition anchor_id=4 text_offset=0 "
8790 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
8791 TextNavigationTestParam{
8793 return position->CreatePreviousWordStartPosition(
8798 {
"TextPosition anchor_id=5 text_offset=0 "
8799 "affinity=downstream annotated_text=<L>ine 1",
8800 "TextPosition anchor_id=5 text_offset=0 "
8801 "affinity=downstream annotated_text=<L>ine 1"}},
8802 TextNavigationTestParam{
8804 return position->CreatePreviousWordStartPosition(
8809 {
"TextPosition anchor_id=9 text_offset=0 "
8810 "affinity=downstream annotated_text=<L>ine 2",
8811 "TextPosition anchor_id=6 text_offset=5 "
8812 "affinity=downstream annotated_text=Line <1>",
8813 "TextPosition anchor_id=6 text_offset=0 "
8814 "affinity=downstream annotated_text=<L>ine 1",
8815 "TextPosition anchor_id=6 text_offset=0 "
8816 "affinity=downstream annotated_text=<L>ine 1"}}));
8819 CreateNextWordEndPositionWithBoundaryBehaviorCrossBoundary,
8820 AXPositionTextNavigationTestWithParam,
8822 TextNavigationTestParam{
8824 return position->CreateNextWordEndPosition(
8829 {
"TextPosition anchor_id=1 text_offset=4 "
8830 "affinity=downstream annotated_text=Line< >1\nLine 2",
8831 "TextPosition anchor_id=1 text_offset=6 "
8832 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8833 "TextPosition anchor_id=1 text_offset=11 "
8834 "affinity=downstream annotated_text=Line 1\nLine< >2",
8835 "TextPosition anchor_id=1 text_offset=13 "
8836 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8838 TextNavigationTestParam{
8840 return position->CreateNextWordEndPosition(
8845 {
"TextPosition anchor_id=4 text_offset=4 "
8846 "affinity=downstream annotated_text=Line< >1\nLine 2",
8847 "TextPosition anchor_id=4 text_offset=6 "
8848 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8849 "TextPosition anchor_id=4 text_offset=11 "
8850 "affinity=downstream annotated_text=Line 1\nLine< >2",
8851 "TextPosition anchor_id=4 text_offset=13 "
8852 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8855 return position->CreateNextWordEndPosition(
8860 {
"TextPosition anchor_id=5 text_offset=4 "
8861 "affinity=downstream annotated_text=Line< >1",
8862 "TextPosition anchor_id=5 text_offset=6 "
8863 "affinity=downstream annotated_text=Line 1<>",
8864 "TextPosition anchor_id=9 text_offset=4 "
8865 "affinity=downstream annotated_text=Line< >2",
8866 "TextPosition anchor_id=9 text_offset=6 "
8867 "affinity=downstream annotated_text=Line 2<>",
8870 return position->CreateNextWordEndPosition(
8875 {
"TextPosition anchor_id=9 text_offset=6 "
8876 "affinity=downstream annotated_text=Line 2<>",
8880 CreateNextWordEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
8881 AXPositionTextNavigationTestWithParam,
8883 TextNavigationTestParam{
8885 return position->CreateNextWordEndPosition(
8890 {
"TextPosition anchor_id=1 text_offset=4 "
8891 "affinity=downstream annotated_text=Line< >1\nLine 2",
8892 "TextPosition anchor_id=1 text_offset=6 "
8893 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8894 "TextPosition anchor_id=1 text_offset=11 "
8895 "affinity=downstream annotated_text=Line 1\nLine< >2",
8896 "TextPosition anchor_id=1 text_offset=13 "
8897 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8898 "TextPosition anchor_id=1 text_offset=13 "
8899 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8900 TextNavigationTestParam{
8902 return position->CreateNextWordEndPosition(
8907 {
"TextPosition anchor_id=4 text_offset=4 "
8908 "affinity=downstream annotated_text=Line< >1\nLine 2",
8909 "TextPosition anchor_id=4 text_offset=6 "
8910 "affinity=downstream annotated_text=Line 1<\n>Line 2",
8911 "TextPosition anchor_id=4 text_offset=11 "
8912 "affinity=downstream annotated_text=Line 1\nLine< >2",
8913 "TextPosition anchor_id=4 text_offset=13 "
8914 "affinity=downstream annotated_text=Line 1\nLine 2<>",
8915 "TextPosition anchor_id=4 text_offset=13 "
8916 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
8917 TextNavigationTestParam{
8919 return position->CreateNextWordEndPosition(
8924 {
"TextPosition anchor_id=5 text_offset=4 "
8925 "affinity=downstream annotated_text=Line< >1",
8926 "TextPosition anchor_id=5 text_offset=6 "
8927 "affinity=downstream annotated_text=Line 1<>",
8928 "TextPosition anchor_id=5 text_offset=6 "
8929 "affinity=downstream annotated_text=Line 1<>"}},
8930 TextNavigationTestParam{
8932 return position->CreateNextWordEndPosition(
8937 {
"TextPosition anchor_id=9 text_offset=6 "
8938 "affinity=downstream annotated_text=Line 2<>",
8939 "TextPosition anchor_id=9 text_offset=6 "
8940 "affinity=downstream annotated_text=Line 2<>"}}));
8943 CreateNextWordEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
8944 AXPositionTextNavigationTestWithParam,
8946 TextNavigationTestParam{
8948 return position->CreateNextWordEndPosition(
8953 {
"TextPosition anchor_id=1 text_offset=4 "
8954 "affinity=downstream annotated_text=Line< >1\nLine 2",
8955 "TextPosition anchor_id=1 text_offset=4 "
8956 "affinity=downstream annotated_text=Line< >1\nLine 2"}},
8957 TextNavigationTestParam{
8959 return position->CreateNextWordEndPosition(
8964 {
"TextPosition anchor_id=4 text_offset=4 "
8965 "affinity=downstream annotated_text=Line< >1\nLine 2",
8966 "TextPosition anchor_id=4 text_offset=4 "
8967 "affinity=downstream annotated_text=Line< >1\nLine 2"}},
8968 TextNavigationTestParam{
8970 return position->CreateNextWordEndPosition(
8975 {
"TextPosition anchor_id=5 text_offset=4 "
8976 "affinity=downstream annotated_text=Line< >1",
8977 "TextPosition anchor_id=5 text_offset=4 "
8978 "affinity=downstream annotated_text=Line< >1"}},
8979 TextNavigationTestParam{
8981 return position->CreateNextWordEndPosition(
8986 {
"TextPosition anchor_id=9 text_offset=4 "
8987 "affinity=downstream annotated_text=Line< >2"}}));
8990 CreateNextWordEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
8991 AXPositionTextNavigationTestWithParam,
8993 TextNavigationTestParam{
8995 return position->CreateNextWordEndPosition(
9000 {
"TextPosition anchor_id=1 text_offset=4 "
9001 "affinity=downstream annotated_text=Line< >1\nLine 2",
9002 "TextPosition anchor_id=1 text_offset=6 "
9003 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9004 "TextPosition anchor_id=1 text_offset=11 "
9005 "affinity=downstream annotated_text=Line 1\nLine< >2",
9006 "TextPosition anchor_id=1 text_offset=13 "
9007 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9008 "TextPosition anchor_id=1 text_offset=13 "
9009 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9010 TextNavigationTestParam{
9012 return position->CreateNextWordEndPosition(
9017 {
"TextPosition anchor_id=4 text_offset=4 "
9018 "affinity=downstream annotated_text=Line< >1\nLine 2",
9019 "TextPosition anchor_id=4 text_offset=6 "
9020 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9021 "TextPosition anchor_id=4 text_offset=11 "
9022 "affinity=downstream annotated_text=Line 1\nLine< >2",
9023 "TextPosition anchor_id=4 text_offset=13 "
9024 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9025 "TextPosition anchor_id=4 text_offset=13 "
9026 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9027 TextNavigationTestParam{
9029 return position->CreateNextWordEndPosition(
9034 {
"TextPosition anchor_id=5 text_offset=4 "
9035 "affinity=downstream annotated_text=Line< >1",
9036 "TextPosition anchor_id=5 text_offset=6 "
9037 "affinity=downstream annotated_text=Line 1<>",
9038 "TextPosition anchor_id=9 text_offset=4 "
9039 "affinity=downstream annotated_text=Line< >2",
9040 "TextPosition anchor_id=9 text_offset=6 "
9041 "affinity=downstream annotated_text=Line 2<>",
9042 "TextPosition anchor_id=9 text_offset=6 "
9043 "affinity=downstream annotated_text=Line 2<>"}},
9044 TextNavigationTestParam{
9046 return position->CreateNextWordEndPosition(
9051 {
"TextPosition anchor_id=9 text_offset=6 "
9052 "affinity=downstream annotated_text=Line 2<>",
9053 "TextPosition anchor_id=9 text_offset=6 "
9054 "affinity=downstream annotated_text=Line 2<>"}}));
9057 CreatePreviousWordEndPositionWithBoundaryBehaviorCrossBoundary,
9058 AXPositionTextNavigationTestWithParam,
9060 TextNavigationTestParam{
9062 return position->CreatePreviousWordEndPosition(
9067 {
"TextPosition anchor_id=1 text_offset=11 "
9068 "affinity=downstream annotated_text=Line 1\nLine< >2",
9069 "TextPosition anchor_id=1 text_offset=6 "
9070 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9071 "TextPosition anchor_id=1 text_offset=4 "
9072 "affinity=downstream annotated_text=Line< >1\nLine 2",
9074 TextNavigationTestParam{
9076 return position->CreatePreviousWordEndPosition(
9081 {
"TextPosition anchor_id=4 text_offset=11 "
9082 "affinity=downstream annotated_text=Line 1\nLine< >2",
9083 "TextPosition anchor_id=4 text_offset=6 "
9084 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9085 "TextPosition anchor_id=4 text_offset=4 "
9086 "affinity=downstream annotated_text=Line< >1\nLine 2",
9088 TextNavigationTestParam{
9090 return position->CreatePreviousWordEndPosition(
9095 {
"TextPosition anchor_id=5 text_offset=4 "
9096 "affinity=downstream annotated_text=Line< >1",
9098 TextNavigationTestParam{
9100 return position->CreatePreviousWordEndPosition(
9105 {
"TextPosition anchor_id=6 text_offset=6 "
9106 "affinity=downstream annotated_text=Line 1<>",
9107 "TextPosition anchor_id=6 text_offset=4 "
9108 "affinity=downstream annotated_text=Line< >1",
9112 CreatePreviousWordEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9113 AXPositionTextNavigationTestWithParam,
9115 TextNavigationTestParam{
9117 return position->CreatePreviousWordEndPosition(
9123 "TextPosition anchor_id=1 text_offset=11 "
9124 "affinity=downstream annotated_text=Line 1\nLine< >2",
9125 "TextPosition anchor_id=1 text_offset=6 "
9126 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9127 "TextPosition anchor_id=1 text_offset=4 "
9128 "affinity=downstream annotated_text=Line< >1\nLine 2",
9129 "TextPosition anchor_id=1 text_offset=0 "
9130 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9132 TextNavigationTestParam{
9134 return position->CreatePreviousWordEndPosition(
9139 {
"TextPosition anchor_id=4 text_offset=11 "
9140 "affinity=downstream annotated_text=Line 1\nLine< >2",
9141 "TextPosition anchor_id=4 text_offset=6 "
9142 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9143 "TextPosition anchor_id=4 text_offset=4 "
9144 "affinity=downstream annotated_text=Line< >1\nLine 2",
9145 "TextPosition anchor_id=4 text_offset=0 "
9146 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9147 TextNavigationTestParam{
9149 return position->CreatePreviousWordEndPosition(
9154 {
"TextPosition anchor_id=5 text_offset=4 "
9155 "affinity=downstream annotated_text=Line< >1",
9156 "TextPosition anchor_id=5 text_offset=0 "
9157 "affinity=downstream annotated_text=<L>ine 1"}},
9158 TextNavigationTestParam{
9160 return position->CreatePreviousWordEndPosition(
9165 {
"TextPosition anchor_id=9 text_offset=0 "
9166 "affinity=downstream annotated_text=<L>ine 2"}}));
9169 CreatePreviousWordEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9170 AXPositionTextNavigationTestWithParam,
9172 TextNavigationTestParam{
9174 return position->CreatePreviousWordEndPosition(
9179 {
"TextPosition anchor_id=1 text_offset=13 "
9180 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9181 TextNavigationTestParam{
9183 return position->CreatePreviousWordEndPosition(
9188 {
"TextPosition anchor_id=4 text_offset=13 "
9189 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9190 TextNavigationTestParam{
9192 return position->CreatePreviousWordEndPosition(
9197 {
"TextPosition anchor_id=5 text_offset=4 "
9198 "affinity=downstream annotated_text=Line< >1",
9199 "TextPosition anchor_id=5 text_offset=4 "
9200 "affinity=downstream annotated_text=Line< >1"}},
9201 TextNavigationTestParam{
9203 return position->CreatePreviousWordEndPosition(
9208 {
"TextPosition anchor_id=9 text_offset=4 "
9209 "affinity=downstream annotated_text=Line< >2"}}));
9212 CreatePreviousWordEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9213 AXPositionTextNavigationTestWithParam,
9215 TextNavigationTestParam{
9217 return position->CreatePreviousWordEndPosition(
9222 {
"TextPosition anchor_id=1 text_offset=11 "
9223 "affinity=downstream annotated_text=Line 1\nLine< >2",
9224 "TextPosition anchor_id=1 text_offset=6 "
9225 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9226 "TextPosition anchor_id=1 text_offset=4 "
9227 "affinity=downstream annotated_text=Line< >1\nLine 2",
9228 "TextPosition anchor_id=1 text_offset=0 "
9229 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9230 "TextPosition anchor_id=1 text_offset=0 "
9231 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9232 TextNavigationTestParam{
9234 return position->CreatePreviousWordEndPosition(
9239 {
"TextPosition anchor_id=4 text_offset=11 "
9240 "affinity=downstream annotated_text=Line 1\nLine< >2",
9241 "TextPosition anchor_id=4 text_offset=6 "
9242 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9243 "TextPosition anchor_id=4 text_offset=4 "
9244 "affinity=downstream annotated_text=Line< >1\nLine 2",
9245 "TextPosition anchor_id=2 text_offset=0 "
9246 "affinity=downstream annotated_text=<>",
9247 "TextPosition anchor_id=2 text_offset=0 "
9248 "affinity=downstream annotated_text=<>"}},
9249 TextNavigationTestParam{
9251 return position->CreatePreviousWordEndPosition(
9256 {
"TextPosition anchor_id=5 text_offset=4 "
9257 "affinity=downstream annotated_text=Line< >1",
9258 "TextPosition anchor_id=2 text_offset=0 "
9259 "affinity=downstream annotated_text=<>",
9260 "TextPosition anchor_id=2 text_offset=0 "
9261 "affinity=downstream annotated_text=<>"}},
9262 TextNavigationTestParam{
9264 return position->CreatePreviousWordEndPosition(
9269 {
"TextPosition anchor_id=6 text_offset=6 "
9270 "affinity=downstream annotated_text=Line 1<>",
9271 "TextPosition anchor_id=6 text_offset=4 "
9272 "affinity=downstream annotated_text=Line< >1",
9273 "TextPosition anchor_id=2 text_offset=0 "
9274 "affinity=downstream annotated_text=<>",
9275 "TextPosition anchor_id=2 text_offset=0 "
9276 "affinity=downstream annotated_text=<>"}}));
9279 CreateNextLineStartPositionWithBoundaryBehaviorCrossBoundary,
9280 AXPositionTextNavigationTestWithParam,
9282 TextNavigationTestParam{
9284 return position->CreateNextLineStartPosition(
9289 {
"TextPosition anchor_id=1 text_offset=7 "
9290 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9292 TextNavigationTestParam{
9294 return position->CreateNextLineStartPosition(
9299 {
"TextPosition anchor_id=4 text_offset=7 "
9300 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9303 return position->CreateNextLineStartPosition(
9308 {
"TextPosition anchor_id=9 text_offset=0 "
9309 "affinity=downstream annotated_text=<L>ine 2",
9312 return position->CreateNextLineStartPosition(
9317 {
"NullPosition"}}));
9320 CreateNextLineStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9321 AXPositionTextNavigationTestWithParam,
9323 TextNavigationTestParam{
9325 return position->CreateNextLineStartPosition(
9330 {
"TextPosition anchor_id=1 text_offset=7 "
9331 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9332 "TextPosition anchor_id=1 text_offset=13 "
9333 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9334 TextNavigationTestParam{
9336 return position->CreateNextLineStartPosition(
9341 {
"TextPosition anchor_id=4 text_offset=7 "
9342 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9343 "TextPosition anchor_id=4 text_offset=13 "
9344 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9345 TextNavigationTestParam{
9347 return position->CreateNextLineStartPosition(
9352 {
"TextPosition anchor_id=5 text_offset=6 "
9353 "affinity=downstream annotated_text=Line 1<>"}},
9354 TextNavigationTestParam{
9356 return position->CreateNextLineStartPosition(
9361 {
"TextPosition anchor_id=9 text_offset=6 "
9362 "affinity=downstream annotated_text=Line 2<>"}}));
9365 CreateNextLineStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9366 AXPositionTextNavigationTestWithParam,
9368 TextNavigationTestParam{
9370 return position->CreateNextLineStartPosition(
9375 {
"TextPosition anchor_id=1 text_offset=0 "
9376 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9377 "TextPosition anchor_id=1 text_offset=0 "
9378 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9379 TextNavigationTestParam{
9381 return position->CreateNextLineStartPosition(
9386 {
"TextPosition anchor_id=4 text_offset=0 "
9387 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9388 "TextPosition anchor_id=4 text_offset=0 "
9389 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9390 TextNavigationTestParam{
9392 return position->CreateNextLineStartPosition(
9397 {
"TextPosition anchor_id=9 text_offset=0 "
9398 "affinity=downstream annotated_text=<L>ine 2",
9399 "TextPosition anchor_id=9 text_offset=0 "
9400 "affinity=downstream annotated_text=<L>ine 2"}},
9401 TextNavigationTestParam{
9403 return position->CreateNextLineStartPosition(
9408 {
"NullPosition"}}));
9411 CreateNextLineStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9412 AXPositionTextNavigationTestWithParam,
9414 TextNavigationTestParam{
9416 return position->CreateNextLineStartPosition(
9421 {
"TextPosition anchor_id=1 text_offset=7 "
9422 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9423 "TextPosition anchor_id=1 text_offset=13 "
9424 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9425 "TextPosition anchor_id=1 text_offset=13 "
9426 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9427 TextNavigationTestParam{
9429 return position->CreateNextLineStartPosition(
9434 {
"TextPosition anchor_id=4 text_offset=7 "
9435 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9436 "TextPosition anchor_id=4 text_offset=13 "
9437 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9438 "TextPosition anchor_id=4 text_offset=13 "
9439 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9440 TextNavigationTestParam{
9442 return position->CreateNextLineStartPosition(
9447 {
"TextPosition anchor_id=9 text_offset=0 "
9448 "affinity=downstream annotated_text=<L>ine 2",
9449 "TextPosition anchor_id=9 text_offset=6 "
9450 "affinity=downstream annotated_text=Line 2<>",
9451 "TextPosition anchor_id=9 text_offset=6 "
9452 "affinity=downstream annotated_text=Line 2<>"}},
9453 TextNavigationTestParam{
9455 return position->CreateNextLineStartPosition(
9460 {
"TextPosition anchor_id=9 text_offset=6 "
9461 "affinity=downstream annotated_text=Line 2<>",
9462 "TextPosition anchor_id=9 text_offset=6 "
9463 "affinity=downstream annotated_text=Line 2<>"}}));
9466 CreatePreviousLineStartPositionWithBoundaryBehaviorCrossBoundary,
9467 AXPositionTextNavigationTestWithParam,
9469 TextNavigationTestParam{
9471 return position->CreatePreviousLineStartPosition(
9476 {
"TextPosition anchor_id=1 text_offset=7 "
9477 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9478 "TextPosition anchor_id=1 text_offset=0 "
9479 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9481 TextNavigationTestParam{
9483 return position->CreatePreviousLineStartPosition(
9488 {
"TextPosition anchor_id=4 text_offset=7 "
9489 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9490 "TextPosition anchor_id=4 text_offset=0 "
9491 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9493 TextNavigationTestParam{
9495 return position->CreatePreviousLineStartPosition(
9500 {
"TextPosition anchor_id=5 text_offset=0 "
9501 "affinity=downstream annotated_text=<L>ine 1",
9503 TextNavigationTestParam{
9505 return position->CreatePreviousLineStartPosition(
9510 {
"TextPosition anchor_id=9 text_offset=0 "
9511 "affinity=downstream annotated_text=<L>ine 2",
9512 "TextPosition anchor_id=6 text_offset=0 "
9513 "affinity=downstream annotated_text=<L>ine 1",
9517 CreatePreviousLineStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9518 AXPositionTextNavigationTestWithParam,
9520 TextNavigationTestParam{
9522 return position->CreatePreviousLineStartPosition(
9527 {
"TextPosition anchor_id=1 text_offset=7 "
9528 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9529 "TextPosition anchor_id=1 text_offset=0 "
9530 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9531 "TextPosition anchor_id=1 text_offset=0 "
9532 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9533 TextNavigationTestParam{
9535 return position->CreatePreviousLineStartPosition(
9540 {
"TextPosition anchor_id=4 text_offset=7 "
9541 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9542 "TextPosition anchor_id=4 text_offset=0 "
9543 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9544 "TextPosition anchor_id=4 text_offset=0 "
9545 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9546 TextNavigationTestParam{
9548 return position->CreatePreviousLineStartPosition(
9553 {
"TextPosition anchor_id=5 text_offset=0 "
9554 "affinity=downstream annotated_text=<L>ine 1",
9555 "TextPosition anchor_id=5 text_offset=0 "
9556 "affinity=downstream annotated_text=<L>ine 1"}},
9557 TextNavigationTestParam{
9559 return position->CreatePreviousLineStartPosition(
9564 {
"TextPosition anchor_id=9 text_offset=0 "
9565 "affinity=downstream annotated_text=<L>ine 2",
9566 "TextPosition anchor_id=9 text_offset=0 "
9567 "affinity=downstream annotated_text=<L>ine 2"}}));
9570 CreatePreviousLineStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9571 AXPositionTextNavigationTestWithParam,
9573 TextNavigationTestParam{
9575 return position->CreatePreviousLineStartPosition(
9580 {
"TextPosition anchor_id=1 text_offset=7 "
9581 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9582 "TextPosition anchor_id=1 text_offset=7 "
9583 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
9584 TextNavigationTestParam{
9586 return position->CreatePreviousLineStartPosition(
9591 {
"TextPosition anchor_id=4 text_offset=7 "
9592 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9593 "TextPosition anchor_id=4 text_offset=7 "
9594 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
9595 TextNavigationTestParam{
9597 return position->CreatePreviousLineStartPosition(
9602 {
"TextPosition anchor_id=5 text_offset=0 "
9603 "affinity=downstream annotated_text=<L>ine 1",
9604 "TextPosition anchor_id=5 text_offset=0 "
9605 "affinity=downstream annotated_text=<L>ine 1"}},
9606 TextNavigationTestParam{
9608 return position->CreatePreviousLineStartPosition(
9613 {
"TextPosition anchor_id=9 text_offset=0 "
9614 "affinity=downstream annotated_text=<L>ine 2",
9615 "TextPosition anchor_id=9 text_offset=0 "
9616 "affinity=downstream annotated_text=<L>ine 2"}}));
9619 CreatePreviousLineStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9620 AXPositionTextNavigationTestWithParam,
9622 TextNavigationTestParam{
9624 return position->CreatePreviousLineStartPosition(
9629 {
"TextPosition anchor_id=1 text_offset=7 "
9630 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9631 "TextPosition anchor_id=1 text_offset=0 "
9632 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9633 "TextPosition anchor_id=1 text_offset=0 "
9634 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9635 TextNavigationTestParam{
9637 return position->CreatePreviousLineStartPosition(
9642 {
"TextPosition anchor_id=4 text_offset=7 "
9643 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
9644 "TextPosition anchor_id=4 text_offset=0 "
9645 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9646 "TextPosition anchor_id=4 text_offset=0 "
9647 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9648 TextNavigationTestParam{
9650 return position->CreatePreviousLineStartPosition(
9655 {
"TextPosition anchor_id=5 text_offset=0 "
9656 "affinity=downstream annotated_text=<L>ine 1",
9657 "TextPosition anchor_id=5 text_offset=0 "
9658 "affinity=downstream annotated_text=<L>ine 1"}},
9659 TextNavigationTestParam{
9661 return position->CreatePreviousLineStartPosition(
9666 {
"TextPosition anchor_id=9 text_offset=0 "
9667 "affinity=downstream annotated_text=<L>ine 2",
9668 "TextPosition anchor_id=6 text_offset=0 "
9669 "affinity=downstream annotated_text=<L>ine 1",
9670 "TextPosition anchor_id=6 text_offset=0 "
9671 "affinity=downstream annotated_text=<L>ine 1"}}));
9674 CreateNextLineEndPositionWithBoundaryBehaviorCrossBoundary,
9675 AXPositionTextNavigationTestWithParam,
9677 TextNavigationTestParam{
9679 return position->CreateNextLineEndPosition(
9684 {
"TextPosition anchor_id=1 text_offset=6 "
9685 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9686 "TextPosition anchor_id=1 text_offset=13 "
9687 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9689 TextNavigationTestParam{
9691 return position->CreateNextLineEndPosition(
9696 {
"TextPosition anchor_id=4 text_offset=6 "
9697 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9698 "TextPosition anchor_id=4 text_offset=13 "
9699 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9702 return position->CreateNextLineEndPosition(
9707 {
"TextPosition anchor_id=5 text_offset=6 "
9708 "affinity=downstream annotated_text=Line 1<>",
9709 "TextPosition anchor_id=9 text_offset=6 "
9710 "affinity=downstream annotated_text=Line 2<>",
9713 return position->CreateNextLineEndPosition(
9718 {
"TextPosition anchor_id=9 text_offset=6 "
9719 "affinity=downstream annotated_text=Line 2<>",
9723 CreateNextLineEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9724 AXPositionTextNavigationTestWithParam,
9726 TextNavigationTestParam{
9728 return position->CreateNextLineEndPosition(
9733 {
"TextPosition anchor_id=1 text_offset=6 "
9734 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9735 "TextPosition anchor_id=1 text_offset=13 "
9736 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9737 "TextPosition anchor_id=1 text_offset=13 "
9738 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9739 TextNavigationTestParam{
9741 return position->CreateNextLineEndPosition(
9746 {
"TextPosition anchor_id=4 text_offset=6 "
9747 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9748 "TextPosition anchor_id=4 text_offset=13 "
9749 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9750 "TextPosition anchor_id=4 text_offset=13 "
9751 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9752 TextNavigationTestParam{
9754 return position->CreateNextLineEndPosition(
9759 {
"TextPosition anchor_id=5 text_offset=6 "
9760 "affinity=downstream annotated_text=Line 1<>",
9761 "TextPosition anchor_id=5 text_offset=6 "
9762 "affinity=downstream annotated_text=Line 1<>"}},
9763 TextNavigationTestParam{
9765 return position->CreateNextLineEndPosition(
9770 {
"TextPosition anchor_id=9 text_offset=6 "
9771 "affinity=downstream annotated_text=Line 2<>",
9772 "TextPosition anchor_id=9 text_offset=6 "
9773 "affinity=downstream annotated_text=Line 2<>"}}));
9776 CreateNextLineEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
9777 AXPositionTextNavigationTestWithParam,
9779 TextNavigationTestParam{
9781 return position->CreateNextLineEndPosition(
9786 {
"TextPosition anchor_id=1 text_offset=6 "
9787 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9788 "TextPosition anchor_id=1 text_offset=6 "
9789 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
9790 TextNavigationTestParam{
9792 return position->CreateNextLineEndPosition(
9797 {
"TextPosition anchor_id=4 text_offset=6 "
9798 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9799 "TextPosition anchor_id=4 text_offset=6 "
9800 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
9801 TextNavigationTestParam{
9803 return position->CreateNextLineEndPosition(
9808 {
"TextPosition anchor_id=5 text_offset=6 "
9809 "affinity=downstream annotated_text=Line 1<>",
9810 "TextPosition anchor_id=5 text_offset=6 "
9811 "affinity=downstream annotated_text=Line 1<>"}},
9812 TextNavigationTestParam{
9814 return position->CreateNextLineEndPosition(
9819 {
"TextPosition anchor_id=9 text_offset=6 "
9820 "affinity=downstream annotated_text=Line 2<>",
9821 "TextPosition anchor_id=9 text_offset=6 "
9822 "affinity=downstream annotated_text=Line 2<>"}}));
9825 CreateNextLineEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
9826 AXPositionTextNavigationTestWithParam,
9828 TextNavigationTestParam{
9830 return position->CreateNextLineEndPosition(
9835 {
"TextPosition anchor_id=1 text_offset=6 "
9836 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9837 "TextPosition anchor_id=1 text_offset=13 "
9838 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9839 "TextPosition anchor_id=1 text_offset=13 "
9840 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9841 TextNavigationTestParam{
9843 return position->CreateNextLineEndPosition(
9848 {
"TextPosition anchor_id=4 text_offset=6 "
9849 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9850 "TextPosition anchor_id=4 text_offset=13 "
9851 "affinity=downstream annotated_text=Line 1\nLine 2<>",
9852 "TextPosition anchor_id=4 text_offset=13 "
9853 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
9854 TextNavigationTestParam{
9856 return position->CreateNextLineEndPosition(
9861 {
"TextPosition anchor_id=5 text_offset=6 "
9862 "affinity=downstream annotated_text=Line 1<>",
9863 "TextPosition anchor_id=9 text_offset=6 "
9864 "affinity=downstream annotated_text=Line 2<>",
9865 "TextPosition anchor_id=9 text_offset=6 "
9866 "affinity=downstream annotated_text=Line 2<>"}},
9867 TextNavigationTestParam{
9869 return position->CreateNextLineEndPosition(
9874 {
"TextPosition anchor_id=9 text_offset=6 "
9875 "affinity=downstream annotated_text=Line 2<>",
9876 "TextPosition anchor_id=9 text_offset=6 "
9877 "affinity=downstream annotated_text=Line 2<>"}}));
9880 CreatePreviousLineEndPositionWithBoundaryBehaviorCrossBoundary,
9881 AXPositionTextNavigationTestWithParam,
9883 TextNavigationTestParam{
9885 return position->CreatePreviousLineEndPosition(
9890 {
"TextPosition anchor_id=1 text_offset=6 "
9891 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9893 TextNavigationTestParam{
9895 return position->CreatePreviousLineEndPosition(
9900 {
"TextPosition anchor_id=4 text_offset=6 "
9901 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9903 TextNavigationTestParam{
9905 return position->CreatePreviousLineEndPosition(
9911 TextNavigationTestParam{
9913 return position->CreatePreviousLineEndPosition(
9919 TextNavigationTestParam{
9921 return position->CreatePreviousLineEndPosition(
9926 {
"TextPosition anchor_id=6 text_offset=6 "
9927 "affinity=downstream annotated_text=Line 1<>",
9929 TextNavigationTestParam{
9931 return position->CreatePreviousLineEndPosition(
9936 {
"TextPosition anchor_id=7 text_offset=0 "
9937 "affinity=downstream annotated_text=<\n>",
9941 CreatePreviousLineEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
9942 AXPositionTextNavigationTestWithParam,
9944 TextNavigationTestParam{
9946 return position->CreatePreviousLineEndPosition(
9951 {
"TextPosition anchor_id=1 text_offset=6 "
9952 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9953 "TextPosition anchor_id=1 text_offset=0 "
9954 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9955 TextNavigationTestParam{
9957 return position->CreatePreviousLineEndPosition(
9962 {
"TextPosition anchor_id=4 text_offset=6 "
9963 "affinity=downstream annotated_text=Line 1<\n>Line 2",
9964 "TextPosition anchor_id=4 text_offset=0 "
9965 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9966 TextNavigationTestParam{
9968 return position->CreatePreviousLineEndPosition(
9973 {
"TextPosition anchor_id=1 text_offset=0 "
9974 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9975 "TextPosition anchor_id=1 text_offset=0 "
9976 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9977 TextNavigationTestParam{
9979 return position->CreatePreviousLineEndPosition(
9984 {
"TextPosition anchor_id=4 text_offset=0 "
9985 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
9986 "TextPosition anchor_id=4 text_offset=0 "
9987 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
9988 TextNavigationTestParam{
9990 return position->CreatePreviousLineEndPosition(
9995 {
"TextPosition anchor_id=9 text_offset=0 "
9996 "affinity=downstream annotated_text=<L>ine 2",
9997 "TextPosition anchor_id=9 text_offset=0 "
9998 "affinity=downstream annotated_text=<L>ine 2"}},
9999 TextNavigationTestParam{
10001 return position->CreatePreviousLineEndPosition(
10006 {
"TextPosition anchor_id=9 text_offset=0 "
10007 "affinity=downstream annotated_text=<L>ine 2",
10008 "TextPosition anchor_id=9 text_offset=0 "
10009 "affinity=downstream annotated_text=<L>ine 2"}}));
10012 CreatePreviousLineEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10013 AXPositionTextNavigationTestWithParam,
10015 TextNavigationTestParam{
10017 return position->CreatePreviousLineEndPosition(
10022 {
"TextPosition anchor_id=1 text_offset=6 "
10023 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10024 "TextPosition anchor_id=1 text_offset=6 "
10025 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
10026 TextNavigationTestParam{
10028 return position->CreatePreviousLineEndPosition(
10033 {
"TextPosition anchor_id=4 text_offset=6 "
10034 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10035 "TextPosition anchor_id=4 text_offset=6 "
10036 "affinity=downstream annotated_text=Line 1<\n>Line 2"}},
10037 TextNavigationTestParam{
10039 return position->CreatePreviousLineEndPosition(
10045 TextNavigationTestParam{
10047 return position->CreatePreviousLineEndPosition(
10052 {
"TextPosition anchor_id=6 text_offset=6 "
10053 "affinity=downstream annotated_text=Line 1<>",
10054 "TextPosition anchor_id=6 text_offset=6 "
10055 "affinity=downstream annotated_text=Line 1<>"}},
10056 TextNavigationTestParam{
10058 return position->CreatePreviousLineEndPosition(
10063 {
"TextPosition anchor_id=6 text_offset=6 "
10064 "affinity=downstream annotated_text=Line 1<>",
10065 "TextPosition anchor_id=6 text_offset=6 "
10066 "affinity=downstream annotated_text=Line 1<>"}}));
10069 CreatePreviousLineEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10070 AXPositionTextNavigationTestWithParam,
10072 TextNavigationTestParam{
10074 return position->CreatePreviousLineEndPosition(
10079 {
"TextPosition anchor_id=1 text_offset=6 "
10080 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10081 "TextPosition anchor_id=1 text_offset=0 "
10082 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10083 "TextPosition anchor_id=1 text_offset=0 "
10084 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10085 TextNavigationTestParam{
10087 return position->CreatePreviousLineEndPosition(
10092 {
"TextPosition anchor_id=4 text_offset=6 "
10093 "affinity=downstream annotated_text=Line 1<\n>Line 2",
10094 "TextPosition anchor_id=2 text_offset=0 "
10095 "affinity=downstream annotated_text=<>",
10096 "TextPosition anchor_id=2 text_offset=0 "
10097 "affinity=downstream annotated_text=<>"}},
10098 TextNavigationTestParam{
10100 return position->CreatePreviousLineEndPosition(
10105 {
"TextPosition anchor_id=1 text_offset=0 "
10106 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10107 "TextPosition anchor_id=1 text_offset=0 "
10108 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10109 TextNavigationTestParam{
10111 return position->CreatePreviousLineEndPosition(
10116 {
"TextPosition anchor_id=2 text_offset=0 "
10117 "affinity=downstream annotated_text=<>",
10118 "TextPosition anchor_id=2 text_offset=0 "
10119 "affinity=downstream annotated_text=<>"}},
10120 TextNavigationTestParam{
10122 return position->CreatePreviousLineEndPosition(
10127 {
"TextPosition anchor_id=6 text_offset=6 "
10128 "affinity=downstream annotated_text=Line 1<>",
10129 "TextPosition anchor_id=2 text_offset=0 "
10130 "affinity=downstream annotated_text=<>",
10131 "TextPosition anchor_id=2 text_offset=0 "
10132 "affinity=downstream annotated_text=<>"}},
10133 TextNavigationTestParam{
10135 return position->CreatePreviousLineEndPosition(
10140 {
"TextPosition anchor_id=7 text_offset=0 "
10141 "affinity=downstream annotated_text=<\n>",
10142 "TextPosition anchor_id=2 text_offset=0 "
10143 "affinity=downstream annotated_text=<>",
10144 "TextPosition anchor_id=2 text_offset=0 "
10145 "affinity=downstream annotated_text=<>"}}));
10148 CreateNextParagraphStartPositionWithBoundaryBehaviorCrossBoundary,
10149 AXPositionTextNavigationTestWithParam,
10151 TextNavigationTestParam{
10153 return position->CreateNextParagraphStartPosition(
10158 {
"TextPosition anchor_id=1 text_offset=7 "
10159 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10160 TextNavigationTestParam{
10162 return position->CreateNextParagraphStartPosition(
10167 {
"TextPosition anchor_id=4 text_offset=7 "
10168 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10169 TextNavigationTestParam{
10171 return position->CreateNextParagraphStartPosition(
10176 {
"TextPosition anchor_id=9 text_offset=0 "
10177 "affinity=downstream annotated_text=<L>ine 2"}},
10178 TextNavigationTestParam{
10180 return position->CreateNextParagraphStartPosition(
10185 {
"NullPosition"}}));
10188 CreateNextParagraphStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10189 AXPositionTextNavigationTestWithParam,
10191 TextNavigationTestParam{
10193 return position->CreateNextParagraphStartPosition(
10198 {
"TextPosition anchor_id=1 text_offset=7 "
10199 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10200 "TextPosition anchor_id=1 text_offset=13 "
10201 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10202 TextNavigationTestParam{
10204 return position->CreateNextParagraphStartPosition(
10209 {
"TextPosition anchor_id=4 text_offset=7 "
10210 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10211 "TextPosition anchor_id=4 text_offset=13 "
10212 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10213 TextNavigationTestParam{
10215 return position->CreateNextParagraphStartPosition(
10220 {
"TextPosition anchor_id=5 text_offset=6 "
10221 "affinity=downstream annotated_text=Line 1<>"}},
10222 TextNavigationTestParam{
10224 return position->CreateNextParagraphStartPosition(
10229 {
"TextPosition anchor_id=9 text_offset=6 "
10230 "affinity=downstream annotated_text=Line 2<>"}}));
10233 CreateNextParagraphStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10234 AXPositionTextNavigationTestWithParam,
10236 TextNavigationTestParam{
10238 return position->CreateNextParagraphStartPosition(
10243 {
"TextPosition anchor_id=1 text_offset=0 "
10244 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10245 "TextPosition anchor_id=1 text_offset=0 "
10246 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10247 TextNavigationTestParam{
10249 return position->CreateNextParagraphStartPosition(
10254 {
"TextPosition anchor_id=4 text_offset=0 "
10255 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10256 "TextPosition anchor_id=4 text_offset=0 "
10257 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10258 TextNavigationTestParam{
10260 return position->CreateNextParagraphStartPosition(
10265 {
"TextPosition anchor_id=9 text_offset=0 "
10266 "affinity=downstream annotated_text=<L>ine 2",
10267 "TextPosition anchor_id=9 text_offset=0 "
10268 "affinity=downstream annotated_text=<L>ine 2"}},
10269 TextNavigationTestParam{
10271 return position->CreateNextParagraphStartPosition(
10276 {
"NullPosition"}}));
10279 CreateNextParagraphStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10280 AXPositionTextNavigationTestWithParam,
10282 TextNavigationTestParam{
10284 return position->CreateNextParagraphStartPosition(
10289 {
"TextPosition anchor_id=1 text_offset=7 "
10290 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10291 "TextPosition anchor_id=1 text_offset=13 "
10292 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10293 "TextPosition anchor_id=1 text_offset=13 "
10294 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10295 TextNavigationTestParam{
10297 return position->CreateNextParagraphStartPosition(
10302 {
"TextPosition anchor_id=4 text_offset=7 "
10303 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10304 "TextPosition anchor_id=4 text_offset=13 "
10305 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10306 "TextPosition anchor_id=4 text_offset=13 "
10307 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10308 TextNavigationTestParam{
10310 return position->CreateNextParagraphStartPosition(
10315 {
"TextPosition anchor_id=9 text_offset=0 "
10316 "affinity=downstream annotated_text=<L>ine 2",
10317 "TextPosition anchor_id=9 text_offset=6 "
10318 "affinity=downstream annotated_text=Line 2<>",
10319 "TextPosition anchor_id=9 text_offset=6 "
10320 "affinity=downstream annotated_text=Line 2<>"}},
10321 TextNavigationTestParam{
10323 return position->CreateNextParagraphStartPosition(
10328 {
"TextPosition anchor_id=9 text_offset=6 "
10329 "affinity=downstream annotated_text=Line 2<>",
10330 "TextPosition anchor_id=9 text_offset=6 "
10331 "affinity=downstream annotated_text=Line 2<>"}}));
10334 CreatePreviousParagraphStartPositionWithBoundaryBehaviorCrossBoundary,
10335 AXPositionTextNavigationTestWithParam,
10337 TextNavigationTestParam{
10339 return position->CreatePreviousParagraphStartPosition(
10344 {
"TextPosition anchor_id=1 text_offset=7 "
10345 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10346 "TextPosition anchor_id=1 text_offset=0 "
10347 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10349 TextNavigationTestParam{
10351 return position->CreatePreviousParagraphStartPosition(
10356 {
"TextPosition anchor_id=4 text_offset=7 "
10357 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10358 "TextPosition anchor_id=4 text_offset=0 "
10359 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10361 TextNavigationTestParam{
10363 return position->CreatePreviousParagraphStartPosition(
10368 {
"TextPosition anchor_id=5 text_offset=0 "
10369 "affinity=downstream annotated_text=<L>ine 1",
10371 TextNavigationTestParam{
10373 return position->CreatePreviousParagraphStartPosition(
10378 {
"TextPosition anchor_id=9 text_offset=0 "
10379 "affinity=downstream annotated_text=<L>ine 2",
10380 "TextPosition anchor_id=6 text_offset=0 "
10381 "affinity=downstream annotated_text=<L>ine 1",
10382 "NullPosition"}}));
10385 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10386 AXPositionTextNavigationTestWithParam,
10388 TextNavigationTestParam{
10390 return position->CreatePreviousParagraphStartPosition(
10395 {
"TextPosition anchor_id=1 text_offset=7 "
10396 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10397 "TextPosition anchor_id=1 text_offset=0 "
10398 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10399 "TextPosition anchor_id=1 text_offset=0 "
10400 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10401 TextNavigationTestParam{
10403 return position->CreatePreviousParagraphStartPosition(
10408 {
"TextPosition anchor_id=4 text_offset=7 "
10409 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10410 "TextPosition anchor_id=4 text_offset=0 "
10411 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10412 "TextPosition anchor_id=4 text_offset=0 "
10413 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10414 TextNavigationTestParam{
10416 return position->CreatePreviousParagraphStartPosition(
10421 {
"TextPosition anchor_id=5 text_offset=0 "
10422 "affinity=downstream annotated_text=<L>ine 1",
10423 "TextPosition anchor_id=5 text_offset=0 "
10424 "affinity=downstream annotated_text=<L>ine 1"}},
10425 TextNavigationTestParam{
10427 return position->CreatePreviousParagraphStartPosition(
10432 {
"TextPosition anchor_id=9 text_offset=0 "
10433 "affinity=downstream annotated_text=<L>ine 2",
10434 "TextPosition anchor_id=9 text_offset=0 "
10435 "affinity=downstream annotated_text=<L>ine 2"}}));
10438 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10439 AXPositionTextNavigationTestWithParam,
10441 TextNavigationTestParam{
10443 return position->CreatePreviousParagraphStartPosition(
10448 {
"TextPosition anchor_id=1 text_offset=7 "
10449 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10450 "TextPosition anchor_id=1 text_offset=7 "
10451 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10452 TextNavigationTestParam{
10454 return position->CreatePreviousParagraphStartPosition(
10459 {
"TextPosition anchor_id=4 text_offset=7 "
10460 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10461 "TextPosition anchor_id=4 text_offset=7 "
10462 "affinity=downstream annotated_text=Line 1\n<L>ine 2"}},
10463 TextNavigationTestParam{
10465 return position->CreatePreviousParagraphStartPosition(
10470 {
"TextPosition anchor_id=5 text_offset=0 "
10471 "affinity=downstream annotated_text=<L>ine 1",
10472 "TextPosition anchor_id=5 text_offset=0 "
10473 "affinity=downstream annotated_text=<L>ine 1"}},
10474 TextNavigationTestParam{
10476 return position->CreatePreviousParagraphStartPosition(
10481 {
"TextPosition anchor_id=9 text_offset=0 "
10482 "affinity=downstream annotated_text=<L>ine 2",
10483 "TextPosition anchor_id=9 text_offset=0 "
10484 "affinity=downstream annotated_text=<L>ine 2"}}));
10487 CreatePreviousParagraphStartPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10488 AXPositionTextNavigationTestWithParam,
10490 TextNavigationTestParam{
10492 return position->CreatePreviousParagraphStartPosition(
10497 {
"TextPosition anchor_id=1 text_offset=7 "
10498 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10499 "TextPosition anchor_id=1 text_offset=0 "
10500 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10501 "TextPosition anchor_id=1 text_offset=0 "
10502 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10503 "TextPosition anchor_id=1 text_offset=0 "
10504 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10505 TextNavigationTestParam{
10507 return position->CreatePreviousParagraphStartPosition(
10512 {
"TextPosition anchor_id=4 text_offset=7 "
10513 "affinity=downstream annotated_text=Line 1\n<L>ine 2",
10514 "TextPosition anchor_id=4 text_offset=0 "
10515 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10516 "TextPosition anchor_id=4 text_offset=0 "
10517 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10518 TextNavigationTestParam{
10520 return position->CreatePreviousParagraphStartPosition(
10525 {
"TextPosition anchor_id=5 text_offset=0 "
10526 "affinity=downstream annotated_text=<L>ine 1",
10527 "TextPosition anchor_id=5 text_offset=0 "
10528 "affinity=downstream annotated_text=<L>ine 1"}},
10529 TextNavigationTestParam{
10531 return position->CreatePreviousParagraphStartPosition(
10536 {
"TextPosition anchor_id=9 text_offset=0 "
10537 "affinity=downstream annotated_text=<L>ine 2",
10538 "TextPosition anchor_id=6 text_offset=0 "
10539 "affinity=downstream annotated_text=<L>ine 1",
10540 "TextPosition anchor_id=6 text_offset=0 "
10541 "affinity=downstream annotated_text=<L>ine 1"}}));
10544 CreateNextParagraphEndPositionWithBoundaryBehaviorCrossBoundary,
10545 AXPositionTextNavigationTestWithParam,
10547 TextNavigationTestParam{
10549 return position->CreateNextParagraphEndPosition(
10554 {
"TextPosition anchor_id=1 text_offset=7 "
10555 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10556 "TextPosition anchor_id=1 text_offset=13 "
10557 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10559 TextNavigationTestParam{
10561 return position->CreateNextParagraphEndPosition(
10566 {
"TextPosition anchor_id=4 text_offset=7 "
10567 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10568 "TextPosition anchor_id=4 text_offset=13 "
10569 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10571 TextNavigationTestParam{
10573 return position->CreateNextParagraphEndPosition(
10578 {
"TextPosition anchor_id=7 text_offset=1 "
10579 "affinity=downstream annotated_text=\n<>",
10580 "TextPosition anchor_id=9 text_offset=6 "
10581 "affinity=downstream annotated_text=Line 2<>",
10583 TextNavigationTestParam{
10585 return position->CreateNextParagraphEndPosition(
10590 {
"TextPosition anchor_id=9 text_offset=6 "
10591 "affinity=downstream annotated_text=Line 2<>",
10592 "NullPosition"}}));
10595 CreateNextParagraphEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10596 AXPositionTextNavigationTestWithParam,
10598 TextNavigationTestParam{
10600 return position->CreateNextParagraphEndPosition(
10605 {
"TextPosition anchor_id=1 text_offset=7 "
10606 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10607 "TextPosition anchor_id=1 text_offset=13 "
10608 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10609 "TextPosition anchor_id=1 text_offset=13 "
10610 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10611 "TextPosition anchor_id=1 text_offset=13 "
10612 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10613 TextNavigationTestParam{
10615 return position->CreateNextParagraphEndPosition(
10620 {
"TextPosition anchor_id=4 text_offset=7 "
10621 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10622 "TextPosition anchor_id=4 text_offset=13 "
10623 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10624 "TextPosition anchor_id=4 text_offset=13 "
10625 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10626 "TextPosition anchor_id=4 text_offset=13 "
10627 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10628 TextNavigationTestParam{
10630 return position->CreateNextParagraphEndPosition(
10635 {
"TextPosition anchor_id=5 text_offset=6 "
10636 "affinity=downstream annotated_text=Line 1<>",
10637 "TextPosition anchor_id=5 text_offset=6 "
10638 "affinity=downstream annotated_text=Line 1<>"}},
10639 TextNavigationTestParam{
10641 return position->CreateNextParagraphEndPosition(
10646 {
"TextPosition anchor_id=9 text_offset=6 "
10647 "affinity=downstream annotated_text=Line 2<>",
10648 "TextPosition anchor_id=9 text_offset=6 "
10649 "affinity=downstream annotated_text=Line 2<>"}}));
10652 CreateNextParagraphEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10653 AXPositionTextNavigationTestWithParam,
10655 TextNavigationTestParam{
10657 return position->CreateNextParagraphEndPosition(
10662 {
"TextPosition anchor_id=1 text_offset=0 "
10663 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10664 "TextPosition anchor_id=1 text_offset=0 "
10665 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10666 TextNavigationTestParam{
10668 return position->CreateNextParagraphEndPosition(
10673 {
"TextPosition anchor_id=4 text_offset=7 "
10674 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10675 "TextPosition anchor_id=4 text_offset=7 "
10676 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10677 TextNavigationTestParam{
10679 return position->CreateNextParagraphEndPosition(
10684 {
"TextPosition anchor_id=7 text_offset=1 "
10685 "affinity=downstream annotated_text=\n<>",
10686 "TextPosition anchor_id=7 text_offset=1 "
10687 "affinity=downstream annotated_text=\n<>"}},
10688 TextNavigationTestParam{
10690 return position->CreateNextParagraphEndPosition(
10695 {
"TextPosition anchor_id=9 text_offset=6 "
10696 "affinity=downstream annotated_text=Line 2<>",
10697 "TextPosition anchor_id=9 text_offset=6 "
10698 "affinity=downstream annotated_text=Line 2<>"}},
10699 TextNavigationTestParam{
10701 return position->CreateNextParagraphEndPosition(
10706 {
"TextPosition anchor_id=7 text_offset=1 "
10707 "affinity=downstream annotated_text=\n<>",
10708 "TextPosition anchor_id=7 text_offset=1 "
10709 "affinity=downstream annotated_text=\n<>"}},
10710 TextNavigationTestParam{
10712 return position->CreateNextParagraphEndPosition(
10717 {
"TextPosition anchor_id=7 text_offset=1 "
10718 "affinity=downstream annotated_text=\n<>",
10719 "TextPosition anchor_id=7 text_offset=1 "
10720 "affinity=downstream annotated_text=\n<>"}}));
10723 CreateNextParagraphEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
10724 AXPositionTextNavigationTestWithParam,
10726 TextNavigationTestParam{
10728 return position->CreateNextParagraphEndPosition(
10733 {
"TextPosition anchor_id=1 text_offset=7 "
10734 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10735 "TextPosition anchor_id=1 text_offset=13 "
10736 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10737 "TextPosition anchor_id=1 text_offset=13 "
10738 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10739 TextNavigationTestParam{
10741 return position->CreateNextParagraphEndPosition(
10746 {
"TextPosition anchor_id=4 text_offset=7 "
10747 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10748 "TextPosition anchor_id=4 text_offset=13 "
10749 "affinity=downstream annotated_text=Line 1\nLine 2<>",
10750 "TextPosition anchor_id=4 text_offset=13 "
10751 "affinity=downstream annotated_text=Line 1\nLine 2<>"}},
10752 TextNavigationTestParam{
10754 return position->CreateNextParagraphEndPosition(
10759 {
"TextPosition anchor_id=7 text_offset=1 "
10760 "affinity=downstream annotated_text=\n<>",
10761 "TextPosition anchor_id=9 text_offset=6 "
10762 "affinity=downstream annotated_text=Line 2<>",
10763 "TextPosition anchor_id=9 text_offset=6 "
10764 "affinity=downstream annotated_text=Line 2<>"}},
10765 TextNavigationTestParam{
10767 return position->CreateNextParagraphEndPosition(
10772 {
"TextPosition anchor_id=9 text_offset=6 "
10773 "affinity=downstream annotated_text=Line 2<>",
10774 "TextPosition anchor_id=9 text_offset=6 "
10775 "affinity=downstream annotated_text=Line 2<>"}}));
10778 CreatePreviousParagraphEndPositionWithBoundaryBehaviorCrossBoundary,
10779 AXPositionTextNavigationTestWithParam,
10781 TextNavigationTestParam{
10783 return position->CreatePreviousParagraphEndPosition(
10788 {
"TextPosition anchor_id=1 text_offset=7 "
10789 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10790 "TextPosition anchor_id=1 text_offset=0 "
10791 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10793 TextNavigationTestParam{
10795 return position->CreatePreviousParagraphEndPosition(
10800 {
"TextPosition anchor_id=4 text_offset=7 "
10801 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10802 "TextPosition anchor_id=3 text_offset=0 "
10803 "affinity=downstream annotated_text=<>",
10805 TextNavigationTestParam{
10807 return position->CreatePreviousParagraphEndPosition(
10812 {
"TextPosition anchor_id=1 text_offset=0 "
10813 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10815 TextNavigationTestParam{
10817 return position->CreatePreviousParagraphEndPosition(
10822 {
"TextPosition anchor_id=3 text_offset=0 "
10823 "affinity=downstream annotated_text=<>",
10825 TextNavigationTestParam{
10827 return position->CreatePreviousParagraphEndPosition(
10832 {
"TextPosition anchor_id=7 text_offset=1 "
10833 "affinity=downstream annotated_text=\n<>",
10834 "TextPosition anchor_id=3 text_offset=0 "
10835 "affinity=downstream annotated_text=<>",
10837 TextNavigationTestParam{
10839 return position->CreatePreviousParagraphEndPosition(
10844 {
"TextPosition anchor_id=3 text_offset=0 "
10845 "affinity=downstream annotated_text=<>",
10846 "NullPosition"}}));
10849 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopAtAnchorBoundary,
10850 AXPositionTextNavigationTestWithParam,
10852 TextNavigationTestParam{
10854 return position->CreatePreviousParagraphEndPosition(
10859 {
"TextPosition anchor_id=1 text_offset=7 "
10860 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10861 "TextPosition anchor_id=1 text_offset=0 "
10862 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10863 "TextPosition anchor_id=1 text_offset=0 "
10864 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10865 TextNavigationTestParam{
10867 return position->CreatePreviousParagraphEndPosition(
10872 {
"TextPosition anchor_id=4 text_offset=7 "
10873 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10874 "TextPosition anchor_id=4 text_offset=0 "
10875 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10876 "TextPosition anchor_id=4 text_offset=0 "
10877 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10878 TextNavigationTestParam{
10880 return position->CreatePreviousParagraphEndPosition(
10885 {
"TextPosition anchor_id=1 text_offset=0 "
10886 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10887 "TextPosition anchor_id=1 text_offset=0 "
10888 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10889 TextNavigationTestParam{
10891 return position->CreatePreviousParagraphEndPosition(
10896 {
"TextPosition anchor_id=4 text_offset=0 "
10897 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
10898 "TextPosition anchor_id=4 text_offset=0 "
10899 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
10900 TextNavigationTestParam{
10902 return position->CreatePreviousParagraphEndPosition(
10907 {
"TextPosition anchor_id=9 text_offset=0 "
10908 "affinity=downstream annotated_text=<L>ine 2",
10909 "TextPosition anchor_id=9 text_offset=0 "
10910 "affinity=downstream annotated_text=<L>ine 2"}},
10911 TextNavigationTestParam{
10913 return position->CreatePreviousParagraphEndPosition(
10918 {
"TextPosition anchor_id=9 text_offset=0 "
10919 "affinity=downstream annotated_text=<L>ine 2",
10920 "TextPosition anchor_id=9 text_offset=0 "
10921 "affinity=downstream annotated_text=<L>ine 2"}}));
10924 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopIfAlreadyAtBoundary,
10925 AXPositionTextNavigationTestWithParam,
10927 TextNavigationTestParam{
10929 return position->CreatePreviousParagraphEndPosition(
10934 {
"TextPosition anchor_id=1 text_offset=7 "
10935 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10936 "TextPosition anchor_id=1 text_offset=7 "
10937 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10938 TextNavigationTestParam{
10940 return position->CreatePreviousParagraphEndPosition(
10945 {
"TextPosition anchor_id=4 text_offset=7 "
10946 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
10947 "TextPosition anchor_id=4 text_offset=7 "
10948 "affinity=upstream annotated_text=Line 1\n<L>ine 2"}},
10949 TextNavigationTestParam{
10951 return position->CreatePreviousParagraphEndPosition(
10956 {
"TextPosition anchor_id=3 text_offset=0 "
10957 "affinity=downstream annotated_text=<>",
10958 "TextPosition anchor_id=3 text_offset=0 "
10959 "affinity=downstream annotated_text=<>"}},
10960 TextNavigationTestParam{
10962 return position->CreatePreviousParagraphEndPosition(
10967 {
"TextPosition anchor_id=7 text_offset=1 "
10968 "affinity=downstream annotated_text=\n<>",
10969 "TextPosition anchor_id=7 text_offset=1 "
10970 "affinity=downstream annotated_text=\n<>"}},
10971 TextNavigationTestParam{
10973 return position->CreatePreviousParagraphEndPosition(
10978 {
"TextPosition anchor_id=7 text_offset=1 "
10979 "affinity=downstream annotated_text=\n<>",
10980 "TextPosition anchor_id=7 text_offset=1 "
10981 "affinity=downstream annotated_text=\n<>"}},
10982 TextNavigationTestParam{
10984 return position->CreatePreviousParagraphEndPosition(
10989 {
"TextPosition anchor_id=3 text_offset=0 "
10990 "affinity=downstream annotated_text=<>",
10991 "TextPosition anchor_id=3 text_offset=0 "
10992 "affinity=downstream annotated_text=<>"}},
10993 TextNavigationTestParam{
10995 return position->CreatePreviousParagraphEndPosition(
11000 {
"TextPosition anchor_id=7 text_offset=1 "
11001 "affinity=downstream annotated_text=\n<>",
11002 "TextPosition anchor_id=7 text_offset=1 "
11003 "affinity=downstream annotated_text=\n<>"}}));
11006 CreatePreviousParagraphEndPositionWithBoundaryBehaviorStopAtLastAnchorBoundary,
11007 AXPositionTextNavigationTestWithParam,
11009 TextNavigationTestParam{
11011 return position->CreatePreviousParagraphEndPosition(
11016 {
"TextPosition anchor_id=1 text_offset=7 "
11017 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
11018 "TextPosition anchor_id=1 text_offset=0 "
11019 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
11020 "TextPosition anchor_id=1 text_offset=0 "
11021 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
11022 TextNavigationTestParam{
11024 return position->CreatePreviousParagraphEndPosition(
11029 {
"TextPosition anchor_id=4 text_offset=7 "
11030 "affinity=upstream annotated_text=Line 1\n<L>ine 2",
11031 "TextPosition anchor_id=3 text_offset=0 "
11032 "affinity=downstream annotated_text=<>",
11033 "TextPosition anchor_id=3 text_offset=0 "
11034 "affinity=downstream annotated_text=<>"}},
11035 TextNavigationTestParam{
11037 return position->CreatePreviousParagraphEndPosition(
11042 {
"TextPosition anchor_id=1 text_offset=0 "
11043 "affinity=downstream annotated_text=<L>ine 1\nLine 2",
11044 "TextPosition anchor_id=1 text_offset=0 "
11045 "affinity=downstream annotated_text=<L>ine 1\nLine 2"}},
11046 TextNavigationTestParam{
11048 return position->CreatePreviousParagraphEndPosition(
11053 {
"TextPosition anchor_id=3 text_offset=0 "
11054 "affinity=downstream annotated_text=<>",
11055 "TextPosition anchor_id=3 text_offset=0 "
11056 "affinity=downstream annotated_text=<>"}},
11057 TextNavigationTestParam{
11059 return position->CreatePreviousParagraphEndPosition(
11064 {
"TextPosition anchor_id=7 text_offset=1 "
11065 "affinity=downstream annotated_text=\n<>",
11066 "TextPosition anchor_id=3 text_offset=0 "
11067 "affinity=downstream annotated_text=<>",
11068 "TextPosition anchor_id=3 text_offset=0 "
11069 "affinity=downstream annotated_text=<>"}},
11070 TextNavigationTestParam{
11072 return position->CreatePreviousParagraphEndPosition(
11077 {
"TextPosition anchor_id=3 text_offset=0 "
11078 "affinity=downstream annotated_text=<>",
11079 "TextPosition anchor_id=3 text_offset=0 "
11080 "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)
AXPositionType * anchor() const
AXPositionType * focus() const
static AXTreeID CreateNewAXTreeID()
const AXTreeData & data() const
Dart_NativeFunction function
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
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)
#define EXPECT_TRUE(handle)