Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: content/browser/accessibility/accessibility_win_browsertest.cc

Issue 1905263002: Correctly finds line boundaries in objects with rich text on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); 1598 32, CONTENTS_LENGTH, L"\"KHTML, like\".");
1599 1599
1600 // Test special offsets. 1600 // Test special offsets.
1601 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_LENGTH, 1601 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_LENGTH,
1602 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); 1602 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\".");
1603 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_CARET, 1603 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_CARET,
1604 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); 1604 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\".");
1605 } 1605 }
1606 1606
1607 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, 1607 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
1608 TestParagraphTextAtOffsetWithBoundaryLine) {
1609 base::win::ScopedComPtr<IAccessibleText> paragraph_text;
1610 SetUpSampleParagraph(&paragraph_text);
1611
1612 // There should be two lines in this paragraph.
1613 const LONG newline_offset = 46;
1614 LONG n_characters;
1615 ASSERT_HRESULT_SUCCEEDED(paragraph_text->get_nCharacters(&n_characters));
1616 ASSERT_LT(0, n_characters);
1617 ASSERT_LT(newline_offset, n_characters);
1618
1619 for (LONG i = 0; i <= newline_offset; ++i) {
1620 CheckTextAtOffset(paragraph_text, i, IA2_TEXT_BOUNDARY_LINE, 0,
1621 newline_offset, L"Moz/5.0 (ST 6.x; WWW33)\n");
1622 }
1623
1624 for (LONG i = newline_offset + 1; i < n_characters; ++i) {
1625 CheckTextAtOffset(paragraph_text, i, IA2_TEXT_BOUNDARY_LINE,
1626 newline_offset + 1, n_characters,
1627 L"Moz/5.0 (ST 6.x; WWW33)\n");
1628 }
1629 }
1630
1631 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
1608 TestTextAtOffsetWithBoundaryAll) { 1632 TestTextAtOffsetWithBoundaryAll) {
1609 base::win::ScopedComPtr<IAccessibleText> input_text; 1633 base::win::ScopedComPtr<IAccessibleText> input_text;
1610 SetUpInputField(&input_text); 1634 SetUpInputField(&input_text);
1611 1635
1612 CheckTextAtOffset(input_text, 0, IA2_TEXT_BOUNDARY_ALL, 1636 CheckTextAtOffset(input_text, 0, IA2_TEXT_BOUNDARY_ALL,
1613 0, CONTENTS_LENGTH, base::SysUTF8ToWide(INPUT_CONTENTS)); 1637 0, CONTENTS_LENGTH, base::SysUTF8ToWide(INPUT_CONTENTS));
1614 } 1638 }
1615 1639
1616 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, 1640 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
1617 TestMultiLineTextAtOffsetWithBoundaryAll) { 1641 TestMultiLineTextAtOffsetWithBoundaryAll) {
1618 base::win::ScopedComPtr<IAccessibleText> textarea_text; 1642 base::win::ScopedComPtr<IAccessibleText> textarea_text;
1619 SetUpTextareaField(&textarea_text); 1643 SetUpTextareaField(&textarea_text);
1620 1644
1621 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL, 1645 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL,
1622 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS)); 1646 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS));
1623 } 1647 }
1624 1648
1625 } // namespace content 1649 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698