Commit 57f5b834 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Make CharacterIndexAtPointWithPinchZoom load Ahem

This test uses the Ahem font but on machines/bots without this font
it will fallback. The expectations were set for the fallback without
realizing it. This causes the test to fail on a system with Ahem
installed.

This patch calls LoadAhem in the test and resets the expectations.

Bug: 749836
Change-Id: I7c0854f8d45bbadf1b88c27ab4964b2dac312058
Reviewed-on: https://chromium-review.googlesource.com/627378Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496585}
parent 156f8f09
...@@ -4128,22 +4128,25 @@ TEST_P(ParameterizedWebFrameTest, CharacterIndexAtPointWithPinchZoom) { ...@@ -4128,22 +4128,25 @@ TEST_P(ParameterizedWebFrameTest, CharacterIndexAtPointWithPinchZoom) {
FrameTestHelpers::WebViewHelper web_view_helper; FrameTestHelpers::WebViewHelper web_view_helper;
web_view_helper.InitializeAndLoad(base_url_ + "sometext.html"); web_view_helper.InitializeAndLoad(base_url_ + "sometext.html");
// TODO(kojii): This is needed to test consistently on machines without Ahem web_view_helper.LoadAhem();
// installed, but test expectations also need to be adjusted.
// web_view_helper.LoadAhem();
web_view_helper.Resize(WebSize(640, 480)); web_view_helper.Resize(WebSize(640, 480));
// Move the visual viewport to the start of the target div containing the
// text.
web_view_helper.WebView()->SetPageScaleFactor(2); web_view_helper.WebView()->SetPageScaleFactor(2);
web_view_helper.WebView()->SetVisualViewportOffset(WebFloatPoint(50, 60)); web_view_helper.WebView()->SetVisualViewportOffset(WebFloatPoint(100, 50));
WebRect base_rect; WebRect base_rect;
WebRect extent_rect; WebRect extent_rect;
WebLocalFrame* main_frame = WebLocalFrame* main_frame =
web_view_helper.WebView()->MainFrame()->ToWebLocalFrame(); web_view_helper.WebView()->MainFrame()->ToWebLocalFrame();
size_t ix = main_frame->CharacterIndexForPoint(WebPoint(320, 388));
EXPECT_EQ(2ul, ix); // Since we're zoomed in to 2X, each char of Ahem is 20px wide/tall in
// viewport space. We expect to hit the fifth char on the first line.
size_t ix = main_frame->CharacterIndexForPoint(WebPoint(100, 15));
EXPECT_EQ(5ul, ix);
} }
TEST_P(ParameterizedWebFrameTest, FirstRectForCharacterRangeWithPinchZoom) { TEST_P(ParameterizedWebFrameTest, FirstRectForCharacterRangeWithPinchZoom) {
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
-webkit-font-smoothing: none; -webkit-font-smoothing: none;
margin: 0px; margin: 0px;
position: absolute; position: absolute;
left: 200px; left: 100px;
top: 250px; top: 50px;
} }
</style> </style>
......
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