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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 2164483006: [MacViews] Implemented text context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tapted's comments and fixed tests Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/render_text_unittest.cc
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index 3657ef0353f9d09393b13f488032fa535cefc30a..83432a530ba7e07ac154660587f725abe20b77a9 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -3994,9 +3994,9 @@ TEST_P(RenderTextTest, SubpixelRenderingSuppressed) {
EXPECT_FALSE(GetRendererPaint().isLCDRenderText());
}
-// Verify GetDecoratedWordAtPoint returns the correct baseline point and
-// decorated word for an LTR string.
-TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_LTR) {
+// Verify GetDecoratedWordAndBaselineAtPoint returns the correct baseline point
+// and decorated word for an LTR string.
+TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_LTR) {
const base::string16 ltr = ASCIIToUTF16(" ab c ");
const int kWordOneStartIndex = 2;
const int kWordTwoStartIndex = 6;
@@ -4042,14 +4042,14 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_LTR) {
{
SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds"));
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
Point(-5, cursor_y), &decorated_word, &baseline_point));
VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word);
EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point));
}
{
SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds"));
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
Point(105, cursor_y), &decorated_word, &baseline_point));
VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word);
EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point));
@@ -4062,8 +4062,8 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_LTR) {
render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false)
.origin();
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word,
- &baseline_point));
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
+ query, &decorated_word, &baseline_point));
if (i < kWordTwoStartIndex) {
VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word);
@@ -4075,9 +4075,10 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_LTR) {
}
}
-// Verify GetDecoratedWordAtPoint returns the correct baseline point and
+// Verify GetDecoratedWordAndBaselineAtPoint returns the correct baseline point
+// and
// decorated word for an RTL string.
-TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_RTL) {
+TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_RTL) {
const base::string16 rtl = WideToUTF16(
L" "
L"\x0634\x0632"
@@ -4126,14 +4127,14 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_RTL) {
{
SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds"));
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
Point(-5, cursor_y), &decorated_word, &baseline_point));
VerifyDecoratedWordsAreEqual(expected_word_2, decorated_word);
EXPECT_TRUE(left_glyph_word_2.Contains(baseline_point));
}
{
SCOPED_TRACE(base::StringPrintf("Query to the right of text bounds"));
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
Point(105, cursor_y), &decorated_word, &baseline_point));
VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word);
EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point));
@@ -4148,8 +4149,8 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_RTL) {
render_text->GetCursorBounds(SelectionModel(i, CURSOR_FORWARD), false)
.top_right();
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word,
- &baseline_point));
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
+ query, &decorated_word, &baseline_point));
if (i < kWordTwoStartIndex) {
VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word);
EXPECT_TRUE(left_glyph_word_1.Contains(baseline_point));
@@ -4160,8 +4161,8 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_RTL) {
}
}
-// Verify the boolean return value of GetDecoratedWordAtPoint.
-TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_Return) {
+// Verify the boolean return value of GetDecoratedWordAndBaselineAtPoint.
+TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAndBaselineAtPoint_Return) {
RenderText* render_text = GetRenderText();
render_text->SetText(ASCIIToUTF16("..."));
@@ -4172,21 +4173,21 @@ TEST_P(RenderTextHarfBuzzTest, GetDecoratedWordAtPoint_Return) {
Point query =
render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false)
.origin();
- EXPECT_FALSE(render_text->GetDecoratedWordAtPoint(query, &decorated_word,
- &baseline_point));
+ EXPECT_FALSE(render_text->GetDecoratedWordAndBaselineAtPoint(
+ query, &decorated_word, &baseline_point));
render_text->SetText(ASCIIToUTF16("abc"));
query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false)
.origin();
- EXPECT_TRUE(render_text->GetDecoratedWordAtPoint(query, &decorated_word,
- &baseline_point));
+ EXPECT_TRUE(render_text->GetDecoratedWordAndBaselineAtPoint(
+ query, &decorated_word, &baseline_point));
// False should be returned for obscured text.
render_text->SetObscured(true);
query = render_text->GetCursorBounds(SelectionModel(0, CURSOR_FORWARD), false)
.origin();
- EXPECT_FALSE(render_text->GetDecoratedWordAtPoint(query, &decorated_word,
- &baseline_point));
+ EXPECT_FALSE(render_text->GetDecoratedWordAndBaselineAtPoint(
+ query, &decorated_word, &baseline_point));
}
// Tests text selection made at end points of individual lines of multiline

Powered by Google App Engine
This is Rietveld 408576698