| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 button_.id = BUTTON_ID; | 109 button_.id = BUTTON_ID; |
| 110 check_box_.id = CHECK_BOX_ID; | 110 check_box_.id = CHECK_BOX_ID; |
| 111 text_field_.id = TEXT_FIELD_ID; | 111 text_field_.id = TEXT_FIELD_ID; |
| 112 static_text1_.id = STATIC_TEXT1_ID; | 112 static_text1_.id = STATIC_TEXT1_ID; |
| 113 inline_box1_.id = INLINE_BOX1_ID; | 113 inline_box1_.id = INLINE_BOX1_ID; |
| 114 line_break_.id = LINE_BREAK_ID; | 114 line_break_.id = LINE_BREAK_ID; |
| 115 static_text2_.id = STATIC_TEXT2_ID; | 115 static_text2_.id = STATIC_TEXT2_ID; |
| 116 inline_box2_.id = INLINE_BOX2_ID; | 116 inline_box2_.id = INLINE_BOX2_ID; |
| 117 | 117 |
| 118 root_.role = AX_ROLE_DIALOG; | 118 root_.role = AX_ROLE_DIALOG; |
| 119 root_.state = 1 << AX_STATE_FOCUSABLE; | 119 root_.AddState(AX_STATE_FOCUSABLE); |
| 120 root_.SetName(std::string("ButtonCheck box") + TEXT_VALUE); | 120 root_.SetName(std::string("ButtonCheck box") + TEXT_VALUE); |
| 121 root_.location = gfx::RectF(0, 0, 800, 600); | 121 root_.location = gfx::RectF(0, 0, 800, 600); |
| 122 | 122 |
| 123 button_.role = AX_ROLE_BUTTON; | 123 button_.role = AX_ROLE_BUTTON; |
| 124 button_.state = 1 << AX_STATE_HASPOPUP; | 124 button_.AddState(AX_STATE_HASPOPUP); |
| 125 button_.SetName("Button"); | 125 button_.SetName("Button"); |
| 126 button_.location = gfx::RectF(20, 20, 200, 30); | 126 button_.location = gfx::RectF(20, 20, 200, 30); |
| 127 button_.AddIntListAttribute(AX_ATTR_WORD_STARTS, std::vector<int32_t>{0}); | 127 button_.AddIntListAttribute(AX_ATTR_WORD_STARTS, std::vector<int32_t>{0}); |
| 128 button_.AddIntListAttribute(AX_ATTR_WORD_ENDS, std::vector<int32_t>{6}); | 128 button_.AddIntListAttribute(AX_ATTR_WORD_ENDS, std::vector<int32_t>{6}); |
| 129 button_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, check_box_.id); | 129 button_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, check_box_.id); |
| 130 root_.child_ids.push_back(button_.id); | 130 root_.child_ids.push_back(button_.id); |
| 131 | 131 |
| 132 check_box_.role = AX_ROLE_CHECK_BOX; | 132 check_box_.role = AX_ROLE_CHECK_BOX; |
| 133 check_box_.AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, | 133 check_box_.AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, |
| 134 ui::AX_CHECKED_STATE_TRUE); | 134 ui::AX_CHECKED_STATE_TRUE); |
| 135 check_box_.SetName("Check box"); | 135 check_box_.SetName("Check box"); |
| 136 check_box_.location = gfx::RectF(20, 50, 200, 30); | 136 check_box_.location = gfx::RectF(20, 50, 200, 30); |
| 137 check_box_.AddIntListAttribute(AX_ATTR_WORD_STARTS, | 137 check_box_.AddIntListAttribute(AX_ATTR_WORD_STARTS, |
| 138 std::vector<int32_t>{0, 6}); | 138 std::vector<int32_t>{0, 6}); |
| 139 check_box_.AddIntListAttribute(AX_ATTR_WORD_ENDS, std::vector<int32_t>{5, 9}); | 139 check_box_.AddIntListAttribute(AX_ATTR_WORD_ENDS, std::vector<int32_t>{5, 9}); |
| 140 check_box_.AddIntAttribute(AX_ATTR_PREVIOUS_ON_LINE_ID, button_.id); | 140 check_box_.AddIntAttribute(AX_ATTR_PREVIOUS_ON_LINE_ID, button_.id); |
| 141 root_.child_ids.push_back(check_box_.id); | 141 root_.child_ids.push_back(check_box_.id); |
| 142 | 142 |
| 143 text_field_.role = AX_ROLE_TEXT_FIELD; | 143 text_field_.role = AX_ROLE_TEXT_FIELD; |
| 144 text_field_.state = 1 << AX_STATE_EDITABLE; | 144 text_field_.AddState(AX_STATE_EDITABLE); |
| 145 text_field_.SetValue(TEXT_VALUE); | 145 text_field_.SetValue(TEXT_VALUE); |
| 146 text_field_.AddIntListAttribute(AX_ATTR_CACHED_LINE_STARTS, | 146 text_field_.AddIntListAttribute(AX_ATTR_CACHED_LINE_STARTS, |
| 147 std::vector<int32_t>{0, 7}); | 147 std::vector<int32_t>{0, 7}); |
| 148 text_field_.child_ids.push_back(static_text1_.id); | 148 text_field_.child_ids.push_back(static_text1_.id); |
| 149 text_field_.child_ids.push_back(line_break_.id); | 149 text_field_.child_ids.push_back(line_break_.id); |
| 150 text_field_.child_ids.push_back(static_text2_.id); | 150 text_field_.child_ids.push_back(static_text2_.id); |
| 151 root_.child_ids.push_back(text_field_.id); | 151 root_.child_ids.push_back(text_field_.id); |
| 152 | 152 |
| 153 static_text1_.role = AX_ROLE_STATIC_TEXT; | 153 static_text1_.role = AX_ROLE_STATIC_TEXT; |
| 154 static_text1_.state = 1 << AX_STATE_EDITABLE; | 154 static_text1_.AddState(AX_STATE_EDITABLE); |
| 155 static_text1_.SetName("Line 1"); | 155 static_text1_.SetName("Line 1"); |
| 156 static_text1_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, line_break_.id); | 156 static_text1_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, line_break_.id); |
| 157 static_text1_.child_ids.push_back(inline_box1_.id); | 157 static_text1_.child_ids.push_back(inline_box1_.id); |
| 158 | 158 |
| 159 inline_box1_.role = AX_ROLE_INLINE_TEXT_BOX; | 159 inline_box1_.role = AX_ROLE_INLINE_TEXT_BOX; |
| 160 inline_box1_.state = 1 << AX_STATE_EDITABLE; | 160 inline_box1_.AddState(AX_STATE_EDITABLE); |
| 161 inline_box1_.SetName("Line 1"); | 161 inline_box1_.SetName("Line 1"); |
| 162 inline_box1_.AddIntListAttribute(AX_ATTR_WORD_STARTS, | 162 inline_box1_.AddIntListAttribute(AX_ATTR_WORD_STARTS, |
| 163 std::vector<int32_t>{0, 5}); | 163 std::vector<int32_t>{0, 5}); |
| 164 inline_box1_.AddIntListAttribute(AX_ATTR_WORD_ENDS, | 164 inline_box1_.AddIntListAttribute(AX_ATTR_WORD_ENDS, |
| 165 std::vector<int32_t>{4, 6}); | 165 std::vector<int32_t>{4, 6}); |
| 166 inline_box1_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, line_break_.id); | 166 inline_box1_.AddIntAttribute(AX_ATTR_NEXT_ON_LINE_ID, line_break_.id); |
| 167 | 167 |
| 168 line_break_.role = AX_ROLE_LINE_BREAK; | 168 line_break_.role = AX_ROLE_LINE_BREAK; |
| 169 line_break_.state = 1 << AX_STATE_EDITABLE; | 169 line_break_.AddState(AX_STATE_EDITABLE); |
| 170 line_break_.SetName("\n"); | 170 line_break_.SetName("\n"); |
| 171 line_break_.AddIntAttribute(AX_ATTR_PREVIOUS_ON_LINE_ID, inline_box1_.id); | 171 line_break_.AddIntAttribute(AX_ATTR_PREVIOUS_ON_LINE_ID, inline_box1_.id); |
| 172 | 172 |
| 173 static_text2_.role = AX_ROLE_STATIC_TEXT; | 173 static_text2_.role = AX_ROLE_STATIC_TEXT; |
| 174 static_text2_.state = 1 << AX_STATE_EDITABLE; | 174 static_text2_.AddState(AX_STATE_EDITABLE); |
| 175 static_text2_.SetName("Line 2"); | 175 static_text2_.SetName("Line 2"); |
| 176 static_text2_.child_ids.push_back(inline_box2_.id); | 176 static_text2_.child_ids.push_back(inline_box2_.id); |
| 177 | 177 |
| 178 inline_box2_.role = AX_ROLE_INLINE_TEXT_BOX; | 178 inline_box2_.role = AX_ROLE_INLINE_TEXT_BOX; |
| 179 inline_box2_.state = 1 << AX_STATE_EDITABLE; | 179 inline_box2_.AddState(AX_STATE_EDITABLE); |
| 180 inline_box2_.SetName("Line 2"); | 180 inline_box2_.SetName("Line 2"); |
| 181 inline_box2_.AddIntListAttribute(AX_ATTR_WORD_STARTS, | 181 inline_box2_.AddIntListAttribute(AX_ATTR_WORD_STARTS, |
| 182 std::vector<int32_t>{0, 5}); | 182 std::vector<int32_t>{0, 5}); |
| 183 inline_box2_.AddIntListAttribute(AX_ATTR_WORD_ENDS, | 183 inline_box2_.AddIntListAttribute(AX_ATTR_WORD_ENDS, |
| 184 std::vector<int32_t>{4, 6}); | 184 std::vector<int32_t>{4, 6}); |
| 185 | 185 |
| 186 AXTreeUpdate initial_state; | 186 AXTreeUpdate initial_state; |
| 187 initial_state.root_id = 1; | 187 initial_state.root_id = 1; |
| 188 initial_state.nodes.push_back(root_); | 188 initial_state.nodes.push_back(root_); |
| 189 initial_state.nodes.push_back(button_); | 189 initial_state.nodes.push_back(button_); |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 AX_TEXT_AFFINITY_DOWNSTREAM); | 1931 AX_TEXT_AFFINITY_DOWNSTREAM); |
| 1932 AXRange<AXPosition<AXNodePosition, AXNode>> forward_range(start->Clone(), | 1932 AXRange<AXPosition<AXNodePosition, AXNode>> forward_range(start->Clone(), |
| 1933 end->Clone()); | 1933 end->Clone()); |
| 1934 EXPECT_EQ(most_text, forward_range.GetText()); | 1934 EXPECT_EQ(most_text, forward_range.GetText()); |
| 1935 AXRange<AXPosition<AXNodePosition, AXNode>> backward_range(std::move(end), | 1935 AXRange<AXPosition<AXNodePosition, AXNode>> backward_range(std::move(end), |
| 1936 std::move(start)); | 1936 std::move(start)); |
| 1937 EXPECT_EQ(most_text, backward_range.GetText()); | 1937 EXPECT_EQ(most_text, backward_range.GetText()); |
| 1938 } | 1938 } |
| 1939 | 1939 |
| 1940 } // namespace ui | 1940 } // namespace ui |
| OLD | NEW |