OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 base::win::ScopedComPtr<IAccessibleText> paragraph_text; | 1694 base::win::ScopedComPtr<IAccessibleText> paragraph_text; |
1695 SetUpSampleParagraph(¶graph_text); | 1695 SetUpSampleParagraph(¶graph_text); |
1696 base::string16 embedded_character( | 1696 base::string16 embedded_character( |
1697 1, BrowserAccessibilityWin::kEmbeddedCharacter); | 1697 1, BrowserAccessibilityWin::kEmbeddedCharacter); |
1698 std::vector<std::wstring> words; | 1698 std::vector<std::wstring> words; |
1699 words.push_back(L"Game "); | 1699 words.push_back(L"Game "); |
1700 words.push_back(L"theory "); | 1700 words.push_back(L"theory "); |
1701 words.push_back(L"is \""); | 1701 words.push_back(L"is \""); |
1702 words.push_back(L"the "); | 1702 words.push_back(L"the "); |
1703 words.push_back(L"study "); | 1703 words.push_back(L"study "); |
1704 words.push_back(L"of " + embedded_character + L' '); | 1704 words.push_back(L"of "); |
| 1705 words.push_back(embedded_character); |
1705 words.push_back(L"of "); | 1706 words.push_back(L"of "); |
1706 words.push_back(L"conflict "); | 1707 words.push_back(L"conflict "); |
1707 words.push_back(L"and\n"); | 1708 words.push_back(L"and\n"); |
1708 words.push_back(L"cooperation "); | 1709 words.push_back(L"cooperation "); |
1709 words.push_back(L"between "); | 1710 words.push_back(L"between "); |
1710 words.push_back(L"intelligent "); | 1711 words.push_back(L"intelligent "); |
1711 words.push_back(L"rational "); | 1712 words.push_back(L"rational "); |
1712 words.push_back(L"decision-"); | 1713 words.push_back(L"decision-"); |
1713 words.push_back(L"makers.\""); | 1714 words.push_back(L"makers.\""); |
1714 | 1715 |
1715 // Try to retrieve one word after another. | 1716 // Try to retrieve one word after another. |
1716 LONG word_start_offset = 0; | 1717 LONG word_start_offset = 0; |
1717 for (auto& word : words) { | 1718 for (auto& word : words) { |
1718 LONG word_end_offset = word_start_offset + word.size(); | 1719 LONG word_end_offset = word_start_offset + word.size(); |
1719 CheckTextAtOffset(paragraph_text, word_start_offset, IA2_TEXT_BOUNDARY_WORD, | 1720 CheckTextAtOffset(paragraph_text, word_start_offset, IA2_TEXT_BOUNDARY_WORD, |
1720 word_start_offset, word_end_offset, word); | 1721 word_start_offset, word_end_offset, word); |
1721 word_start_offset = word_end_offset; | 1722 word_start_offset = word_end_offset; |
| 1723 // If the word boundary is inside an embedded object, |word_end_offset| |
| 1724 // should be one past the embedded object character. To get to the start of |
| 1725 // the next word, we have to skip the space between the embedded object |
| 1726 // character and the next word. |
| 1727 if (word == embedded_character) |
| 1728 ++word_start_offset; |
1722 } | 1729 } |
1723 } | 1730 } |
1724 | 1731 |
1725 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 1732 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
1726 TestTextAtOffsetWithBoundarySentence) { | 1733 TestTextAtOffsetWithBoundarySentence) { |
1727 base::win::ScopedComPtr<IAccessibleText> input_text; | 1734 base::win::ScopedComPtr<IAccessibleText> input_text; |
1728 SetUpInputField(&input_text); | 1735 SetUpInputField(&input_text); |
1729 | 1736 |
1730 // Sentence navigation is not currently implemented. | 1737 // Sentence navigation is not currently implemented. |
1731 LONG start_offset = 0; | 1738 LONG start_offset = 0; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_rowIndex(&row_index)); | 2041 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_rowIndex(&row_index)); |
2035 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_columnIndex(&column_index)); | 2042 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_columnIndex(&column_index)); |
2036 EXPECT_EQ(1, row_index); | 2043 EXPECT_EQ(1, row_index); |
2037 EXPECT_EQ(1, column_index); | 2044 EXPECT_EQ(1, column_index); |
2038 variant.Reset(); | 2045 variant.Reset(); |
2039 name.Reset(); | 2046 name.Reset(); |
2040 accessible_cell.Reset(); | 2047 accessible_cell.Reset(); |
2041 } | 2048 } |
2042 | 2049 |
2043 } // namespace content | 2050 } // namespace content |
OLD | NEW |