Commit 9b60f86c authored by Adam Ettenberger's avatar Adam Ettenberger Committed by Commit Bot

Update AXPlatformNodeTextProviderWinBrowserTest.GetVisibleBounds

I wasn't able to reproduce the failure, but according to the error
logs they suggested that for some reason, word-wrapping was likely
different from public Chromium and closed Chrome.

This could be something subtle like differences in fonts,
scroll bars, or potentially DPI differences in the test environment.

Updating the test to avoid these types of differences.
Adjusted the text so that line breaks will be more predictable,
leaving ample room for and scrollbar differences.

The error was :
---
error: Expected equality of these values:
  L"G H I J K L "
  provider_content
    Which is: L"G H I J K L M "
---

Bug: 966344
Change-Id: If978ce1fe03984c64151241e6241cdfc29d900c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627927Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Adam Ettenberger <adettenb@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#663961}
parent dfe58844
...@@ -152,26 +152,18 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeTextProviderWinBrowserTest, ...@@ -152,26 +152,18 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeTextProviderWinBrowserTest,
LoadInitialAccessibilityTreeFromHtml(std::string(R"HTML( LoadInitialAccessibilityTreeFromHtml(std::string(R"HTML(
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<style>
.overflow_y {
overflow-x: hidden;
overflow-y: visible;
}
</style>
</head>
<body> <body>
<div class='overflow_y' style='width: 110px; height: 40px;'> <div style='overflow: hidden visible; width: 10em; height: 2.4em;'>
<span> <span style='white-space: pre-line;'>AAA BBB
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z CCCCCC
</span> DDDDDD</span>
</div> </div>
</body> </body>
</html> </html>
)HTML")); )HTML"));
auto* node = FindNode(ax::mojom::Role::kStaticText, auto* node =
"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); FindNode(ax::mojom::Role::kStaticText, "AAA BBB\nCCCCCC\nDDDDDD");
ASSERT_NE(nullptr, node); ASSERT_NE(nullptr, node);
EXPECT_TRUE(node->PlatformIsLeaf()); EXPECT_TRUE(node->PlatformIsLeaf());
EXPECT_EQ(0u, node->PlatformChildCount()); EXPECT_EQ(0u, node->PlatformChildCount());
...@@ -188,8 +180,8 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeTextProviderWinBrowserTest, ...@@ -188,8 +180,8 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeTextProviderWinBrowserTest,
ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData( ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData(
text_provider_ranges.Get(), reinterpret_cast<void**>(&array_data))); text_provider_ranges.Get(), reinterpret_cast<void**>(&array_data)));
EXPECT_UIA_TEXTRANGE_EQ(array_data[0], L"A B C D E F "); EXPECT_UIA_TEXTRANGE_EQ(array_data[0], L"AAA BBB");
EXPECT_UIA_TEXTRANGE_EQ(array_data[1], L"G H I J K L "); EXPECT_UIA_TEXTRANGE_EQ(array_data[1], L"CCCCCC");
ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(text_provider_ranges.Get())); ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(text_provider_ranges.Get()));
text_provider_ranges.Reset(); text_provider_ranges.Reset();
......
...@@ -662,8 +662,10 @@ gfx::Rect BrowserAccessibility::GetInnerTextRangeBoundsRectInSubtree( ...@@ -662,8 +662,10 @@ gfx::Rect BrowserAccessibility::GetInnerTextRangeBoundsRectInSubtree(
// The text bounds queried are not in this subtree; skip it and continue. // The text bounds queried are not in this subtree; skip it and continue.
const int child_start_offset = const int child_start_offset =
std::max(start_offset - child_offset_in_parent, 0); std::max(start_offset - child_offset_in_parent, 0);
if (child_start_offset > child_inner_text_length) if (child_start_offset > child_inner_text_length) {
child_offset_in_parent += child_inner_text_length;
continue; continue;
}
// The text bounds queried have already been gathered; short circuit. // The text bounds queried have already been gathered; short circuit.
const int child_end_offset = const int child_end_offset =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment