Chromium Code Reviews| 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 "ui/gfx/render_text.h" | 5 #include "ui/gfx/render_text.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3991 // SUBPIXEL_RENDERING_RGB set above should now take effect. But, after | 3991 // SUBPIXEL_RENDERING_RGB set above should now take effect. But, after |
| 3992 // checking, apply the override anyway to be explicit that it is suppressed. | 3992 // checking, apply the override anyway to be explicit that it is suppressed. |
| 3993 EXPECT_FALSE(GetRendererPaint().isLCDRenderText()); | 3993 EXPECT_FALSE(GetRendererPaint().isLCDRenderText()); |
| 3994 GetHarfBuzzRunList()->runs()[0]->render_params.subpixel_rendering = | 3994 GetHarfBuzzRunList()->runs()[0]->render_params.subpixel_rendering = |
| 3995 FontRenderParams::SUBPIXEL_RENDERING_RGB; | 3995 FontRenderParams::SUBPIXEL_RENDERING_RGB; |
| 3996 DrawVisualText(); | 3996 DrawVisualText(); |
| 3997 #endif | 3997 #endif |
| 3998 EXPECT_FALSE(GetRendererPaint().isLCDRenderText()); | 3998 EXPECT_FALSE(GetRendererPaint().isLCDRenderText()); |
| 3999 } | 3999 } |
| 4000 | 4000 |
| 4001 // Verify GetDecoratedWordAtPoint returns the correct baseline point and | 4001 // Verify GetDecoratedWordAndBaselineAtPoint returns the correct baseline point |
|
msw
2017/01/26 20:59:16
Please add a basic test fixture for the new range-
spqchan
2017/02/01 00:32:38
Done.
| |
| 4002 // decorated word for an LTR string. | 4002 // and decorated word for an LTR string. |
| 4003 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_LTR) { | 4003 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_LTR) { |
| 4004 const base::string16 ltr = ASCIIToUTF16(" ab c "); | 4004 const base::string16 ltr = ASCIIToUTF16(" ab c "); |
| 4005 const int kWordOneStartIndex = 2; | 4005 const int kWordOneStartIndex = 2; |
| 4006 const int kWordTwoStartIndex = 6; | 4006 const int kWordTwoStartIndex = 6; |
| 4007 | 4007 |
| 4008 RenderText* render_text = GetRenderText(); | 4008 RenderText* render_text = GetRenderText(); |
| 4009 render_text->SetDisplayRect(Rect(100, 30)); | 4009 render_text->SetDisplayRect(Rect(100, 30)); |
| 4010 render_text->SetText(ltr); | 4010 render_text->SetText(ltr); |
| 4011 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(0, 3)); | 4011 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(0, 3)); |
| 4012 render_text->ApplyStyle(UNDERLINE, true, Range(1, 5)); | 4012 render_text->ApplyStyle(UNDERLINE, true, Range(1, 5)); |
| 4013 render_text->ApplyStyle(ITALIC, true, Range(3, 8)); | 4013 render_text->ApplyStyle(ITALIC, true, Range(3, 8)); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4039 font_spans, 0, kWordTwoStartIndex, Font::Weight::NORMAL, | 4039 font_spans, 0, kWordTwoStartIndex, Font::Weight::NORMAL, |
| 4040 ITALIC_MASK | DIAGONAL_STRIKE_MASK | STRIKE_MASK)); | 4040 ITALIC_MASK | DIAGONAL_STRIKE_MASK | STRIKE_MASK)); |
| 4041 const Rect left_glyph_word_2 = render_text->GetCursorBounds( | 4041 const Rect left_glyph_word_2 = render_text->GetCursorBounds( |
| 4042 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); | 4042 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); |
| 4043 | 4043 |
| 4044 DecoratedText decorated_word; | 4044 DecoratedText decorated_word; |
| 4045 Point baseline_point; | 4045 Point baseline_point; |
| 4046 | 4046 |
| 4047 { | 4047 { |
| 4048 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); | 4048 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); |
| 4049 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4049 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4050 Point(-5, cursor_y), &decorated_word, &baseline_point)); | 4050 Point(-5, cursor_y), &decorated_word, &baseline_point)); |
| 4051 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); | 4051 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); |
| 4052 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); | 4052 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); |
| 4053 } | 4053 } |
| 4054 { | 4054 { |
| 4055 SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds")); | 4055 SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds")); |
| 4056 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4056 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4057 Point(105, cursor_y), &decorated_word, &baseline_point)); | 4057 Point(105, cursor_y), &decorated_word, &baseline_point)); |
| 4058 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); | 4058 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); |
| 4059 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); | 4059 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); |
| 4060 } | 4060 } |
| 4061 | 4061 |
| 4062 for (size_t i = 0; i < render_text->text().length(); i++) { | 4062 for (size_t i = 0; i < render_text->text().length(); i++) { |
| 4063 SCOPED_TRACE(base::StringPrintf("Case[%" PRIuS "]", i)); | 4063 SCOPED_TRACE(base::StringPrintf("Case[%" PRIuS "]", i)); |
| 4064 // Query the decorated word using the origin of the i'th glyph's bounds. | 4064 // Query the decorated word using the origin of the i'th glyph's bounds. |
| 4065 const Point query = | 4065 const Point query = |
| 4066 render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false) | 4066 render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false) |
| 4067 .origin(); | 4067 .origin(); |
| 4068 | 4068 |
| 4069 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word, | 4069 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4070 &baseline_point)); | 4070 query, &decorated_word, &baseline_point)); |
| 4071 | 4071 |
| 4072 if (i < kWordTwoStartIndex) { | 4072 if (i < kWordTwoStartIndex) { |
| 4073 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); | 4073 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); |
| 4074 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); | 4074 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); |
| 4075 } else { | 4075 } else { |
| 4076 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); | 4076 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); |
| 4077 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); | 4077 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); |
| 4078 } | 4078 } |
| 4079 } | 4079 } |
| 4080 } | 4080 } |
| 4081 | 4081 |
| 4082 // Verify GetDecoratedWordAtPoint returns the correct baseline point and | 4082 // Verify GetDecoratedWordAndBaselineAtPoint returns the correct baseline point |
| 4083 // and | |
| 4083 // decorated word for an RTL string. | 4084 // decorated word for an RTL string. |
| 4084 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_RTL) { | 4085 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_RTL) { |
| 4085 const base::string16 rtl = WideToUTF16( | 4086 const base::string16 rtl = WideToUTF16( |
| 4086 L" " | 4087 L" " |
| 4087 L"\x0634\x0632" | 4088 L"\x0634\x0632" |
| 4088 L" " | 4089 L" " |
| 4089 L"\x0634"); | 4090 L"\x0634"); |
| 4090 const int kWordOneStartIndex = 1; | 4091 const int kWordOneStartIndex = 1; |
| 4091 const int kWordTwoStartIndex = 5; | 4092 const int kWordTwoStartIndex = 5; |
| 4092 | 4093 |
| 4093 RenderText* render_text = GetRenderText(); | 4094 RenderText* render_text = GetRenderText(); |
| 4094 render_text->SetDisplayRect(Rect(100, 30)); | 4095 render_text->SetDisplayRect(Rect(100, 30)); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 4123 expected_word_2.attributes.push_back(CreateRangedAttribute( | 4124 expected_word_2.attributes.push_back(CreateRangedAttribute( |
| 4124 font_spans, 0, kWordTwoStartIndex, Font::Weight::NORMAL, UNDERLINE_MASK)); | 4125 font_spans, 0, kWordTwoStartIndex, Font::Weight::NORMAL, UNDERLINE_MASK)); |
| 4125 const Rect left_glyph_word_2 = render_text->GetCursorBounds( | 4126 const Rect left_glyph_word_2 = render_text->GetCursorBounds( |
| 4126 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); | 4127 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); |
| 4127 | 4128 |
| 4128 DecoratedText decorated_word; | 4129 DecoratedText decorated_word; |
| 4129 Point baseline_point; | 4130 Point baseline_point; |
| 4130 | 4131 |
| 4131 { | 4132 { |
| 4132 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); | 4133 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); |
| 4133 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4134 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4134 Point(-5, cursor_y), &decorated_word, &baseline_point)); | 4135 Point(-5, cursor_y), &decorated_word, &baseline_point)); |
| 4135 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); | 4136 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); |
| 4136 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); | 4137 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); |
| 4137 } | 4138 } |
| 4138 { | 4139 { |
| 4139 SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds")); | 4140 SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds")); |
| 4140 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4141 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4141 Point(105, cursor_y), &decorated_word, &baseline_point)); | 4142 Point(105, cursor_y), &decorated_word, &baseline_point)); |
| 4142 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); | 4143 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); |
| 4143 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); | 4144 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); |
| 4144 } | 4145 } |
| 4145 | 4146 |
| 4146 for (size_t i = 0; i < render_text->text().length(); i++) { | 4147 for (size_t i = 0; i < render_text->text().length(); i++) { |
| 4147 SCOPED_TRACE(base::StringPrintf("Case[%" PRIuS "]", i)); | 4148 SCOPED_TRACE(base::StringPrintf("Case[%" PRIuS "]", i)); |
| 4148 | 4149 |
| 4149 // Query the decorated word using the top right point of the i'th glyph's | 4150 // Query the decorated word using the top right point of the i'th glyph's |
| 4150 // bounds. | 4151 // bounds. |
| 4151 const Point query = | 4152 const Point query = |
| 4152 render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false) | 4153 render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false) |
| 4153 .top_right(); | 4154 .top_right(); |
| 4154 | 4155 |
| 4155 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word, | 4156 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4156 &baseline_point)); | 4157 query, &decorated_word, &baseline_point)); |
| 4157 if (i < kWordTwoStartIndex) { | 4158 if (i < kWordTwoStartIndex) { |
| 4158 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); | 4159 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); |
| 4159 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); | 4160 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); |
| 4160 } else { | 4161 } else { |
| 4161 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); | 4162 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); |
| 4162 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); | 4163 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); |
| 4163 } | 4164 } |
| 4164 } | 4165 } |
| 4165 } | 4166 } |
| 4166 | 4167 |
| 4167 // Test that GetDecoratedWordAtPoint behaves correctly for multiline text. | 4168 // Test that GetDecoratedWordAndBaselineAtPoint behaves correctly for multiline |
| 4168 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_Multiline) { | 4169 // text. |
| 4170 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_Multiline) { | |
| 4169 const base::string16 text = ASCIIToUTF16("a b\n..\ncd."); | 4171 const base::string16 text = ASCIIToUTF16("a b\n..\ncd."); |
| 4170 const size_t kWordOneIndex = 0; // Index of character 'a'. | 4172 const size_t kWordOneIndex = 0; // Index of character 'a'. |
| 4171 const size_t kWordTwoIndex = 2; // Index of character 'b'. | 4173 const size_t kWordTwoIndex = 2; // Index of character 'b'. |
| 4172 const size_t kWordThreeIndex = 7; // Index of character 'c'. | 4174 const size_t kWordThreeIndex = 7; // Index of character 'c'. |
| 4173 | 4175 |
| 4174 // Set up render text. | 4176 // Set up render text. |
| 4175 RenderText* render_text = GetRenderText(); | 4177 RenderText* render_text = GetRenderText(); |
| 4176 render_text->SetMultiline(true); | 4178 render_text->SetMultiline(true); |
| 4177 render_text->SetDisplayRect(Rect(500, 500)); | 4179 render_text->SetDisplayRect(Rect(500, 500)); |
| 4178 render_text->SetText(text); | 4180 render_text->SetText(text); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 4208 expected_word_3.attributes.push_back(CreateRangedAttribute( | 4210 expected_word_3.attributes.push_back(CreateRangedAttribute( |
| 4209 font_spans, 1, kWordThreeIndex + 1, Font::Weight::NORMAL, ITALIC_MASK)); | 4211 font_spans, 1, kWordThreeIndex + 1, Font::Weight::NORMAL, ITALIC_MASK)); |
| 4210 | 4212 |
| 4211 const Rect left_glyph_word_3 = | 4213 const Rect left_glyph_word_3 = |
| 4212 GetSubstringBoundsUnion(Range(kWordThreeIndex, kWordThreeIndex + 1)); | 4214 GetSubstringBoundsUnion(Range(kWordThreeIndex, kWordThreeIndex + 1)); |
| 4213 | 4215 |
| 4214 DecoratedText decorated_word; | 4216 DecoratedText decorated_word; |
| 4215 Point baseline_point; | 4217 Point baseline_point; |
| 4216 { | 4218 { |
| 4217 // Query to the left of the first line. | 4219 // Query to the left of the first line. |
| 4218 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4220 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4219 Point(-5, GetCursorYForTesting(0)), &decorated_word, &baseline_point)); | 4221 Point(-5, GetCursorYForTesting(0)), &decorated_word, &baseline_point)); |
| 4220 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); | 4222 VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); |
| 4221 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); | 4223 EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point)); |
| 4222 } | 4224 } |
| 4223 { | 4225 { |
| 4224 // Query on the second line. | 4226 // Query on the second line. |
| 4225 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4227 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4226 Point(5, GetCursorYForTesting(1)), &decorated_word, &baseline_point)); | 4228 Point(5, GetCursorYForTesting(1)), &decorated_word, &baseline_point)); |
| 4227 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); | 4229 VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word); |
| 4228 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); | 4230 EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point)); |
| 4229 } | 4231 } |
| 4230 { | 4232 { |
| 4231 // Query at the center point of the character 'c'. | 4233 // Query at the center point of the character 'c'. |
| 4232 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4234 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4233 left_glyph_word_3.CenterPoint(), &decorated_word, &baseline_point)); | 4235 left_glyph_word_3.CenterPoint(), &decorated_word, &baseline_point)); |
| 4234 VerifyDecoratedWordsAreEqual(expected_word_3, decorated_word); | 4236 VerifyDecoratedWordsAreEqual(expected_word_3, decorated_word); |
| 4235 EXPECT_TRUE(left_glyph_word_3.Contains(baseline_point)); | 4237 EXPECT_TRUE(left_glyph_word_3.Contains(baseline_point)); |
| 4236 } | 4238 } |
| 4237 { | 4239 { |
| 4238 // Query to the right of the third line. | 4240 // Query to the right of the third line. |
| 4239 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4241 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4240 Point(505, GetCursorYForTesting(2)), &decorated_word, &baseline_point)); | 4242 Point(505, GetCursorYForTesting(2)), &decorated_word, &baseline_point)); |
| 4241 VerifyDecoratedWordsAreEqual(expected_word_3, decorated_word); | 4243 VerifyDecoratedWordsAreEqual(expected_word_3, decorated_word); |
| 4242 EXPECT_TRUE(left_glyph_word_3.Contains(baseline_point)); | 4244 EXPECT_TRUE(left_glyph_word_3.Contains(baseline_point)); |
| 4243 } | 4245 } |
| 4244 } | 4246 } |
| 4245 | 4247 |
| 4246 // Verify the boolean return value of GetDecoratedWordAtPoint. | 4248 // Verify the boolean return value of GetDecoratedWordAndBaselineAtPoint. |
| 4247 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_Return) { | 4249 TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_Return) { |
| 4248 RenderText* render_text = GetRenderText(); | 4250 RenderText* render_text = GetRenderText(); |
| 4249 render_text->SetText(ASCIIToUTF16("...")); | 4251 render_text->SetText(ASCIIToUTF16("...")); |
| 4250 | 4252 |
| 4251 DecoratedText decorated_word; | 4253 DecoratedText decorated_word; |
| 4252 Point baseline_point; | 4254 Point baseline_point; |
| 4253 | 4255 |
| 4254 // False should be returned, when the text does not contain any word. | 4256 // False should be returned, when the text does not contain any word. |
| 4255 Point query = | 4257 Point query = |
| 4256 render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) | 4258 render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) |
| 4257 .origin(); | 4259 .origin(); |
| 4258 EXPECT_FALSE(render_text->GetDecoratedWordAtPoint(query, &decorated_word, | 4260 EXPECT_FALSE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4259 &baseline_point)); | 4261 query, &decorated_word, &baseline_point)); |
| 4260 | 4262 |
| 4261 render_text->SetText(ASCIIToUTF16("abc")); | 4263 render_text->SetText(ASCIIToUTF16("abc")); |
| 4262 query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) | 4264 query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) |
| 4263 .origin(); | 4265 .origin(); |
| 4264 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word, | 4266 EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4265 &baseline_point)); | 4267 query, &decorated_word, &baseline_point)); |
| 4266 | 4268 |
| 4267 // False should be returned for obscured text. | 4269 // False should be returned for obscured text. |
| 4268 render_text->SetObscured(true); | 4270 render_text->SetObscured(true); |
| 4269 query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) | 4271 query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false) |
| 4270 .origin(); | 4272 .origin(); |
| 4271 EXPECT_FALSE(render_text->GetDecoratedWordAtPoint(query, &decorated_word, | 4273 EXPECT_FALSE(render_text->GetDecoratedWordAndBaselineAtPoint( |
| 4272 &baseline_point)); | 4274 query, &decorated_word, &baseline_point)); |
| 4273 } | 4275 } |
| 4274 | 4276 |
| 4275 // Tests text selection made at end points of individual lines of multiline | 4277 // Tests text selection made at end points of individual lines of multiline |
| 4276 // text. | 4278 // text. |
| 4277 TEST_P(RenderTextHarfBuzzTest, LineEndSelections) { | 4279 TEST_P(RenderTextHarfBuzzTest, LineEndSelections) { |
| 4278 const wchar_t* const ltr = L"abc\n\ndef"; | 4280 const wchar_t* const ltr = L"abc\n\ndef"; |
| 4279 const wchar_t* const rtl = L"\x5d0\x5d1\x5d2\n\n\x5d3\x5d4\x5d5"; | 4281 const wchar_t* const rtl = L"\x5d0\x5d1\x5d2\n\n\x5d3\x5d4\x5d5"; |
| 4280 const int left_x = -100; | 4282 const int left_x = -100; |
| 4281 const int right_x = 200; | 4283 const int right_x = 200; |
| 4282 struct { | 4284 struct { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4366 ::testing::Values(RENDER_TEXT_HARFBUZZ), | 4368 ::testing::Values(RENDER_TEXT_HARFBUZZ), |
| 4367 PrintRenderTextBackend()); | 4369 PrintRenderTextBackend()); |
| 4368 #endif | 4370 #endif |
| 4369 | 4371 |
| 4370 INSTANTIATE_TEST_CASE_P(, | 4372 INSTANTIATE_TEST_CASE_P(, |
| 4371 RenderTextHarfBuzzTest, | 4373 RenderTextHarfBuzzTest, |
| 4372 ::testing::Values(RENDER_TEXT_HARFBUZZ), | 4374 ::testing::Values(RENDER_TEXT_HARFBUZZ), |
| 4373 PrintRenderTextBackend()); | 4375 PrintRenderTextBackend()); |
| 4374 | 4376 |
| 4375 } // namespace gfx | 4377 } // namespace gfx |
| OLD | NEW |