Index: ui/gfx/render_text_unittest.cc |
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc |
index 42825579ec6cb0b68fe701de431a2c1444d5c1f7..54ba5317a9dc0722bbd226f2b9f2ca759d30ac94 100644 |
--- a/ui/gfx/render_text_unittest.cc |
+++ b/ui/gfx/render_text_unittest.cc |
@@ -2577,6 +2577,21 @@ TEST_F(RenderTextTest, HarfBuzz_EmptyRun) { |
EXPECT_EQ(Range(0, 0), glyphs); |
} |
+// Ensure the line breaker doesn't compute the word's width bigger than the |
+// actual size. See http://crbug.com/470073 |
+TEST_F(RenderTextTest, HarfBuzz_WordWidthWithDiacritics) { |
+ RenderTextHarfBuzz render_text; |
+ const base::string16 kWord = WideToUTF16(L"\u0906\u092A\u0915\u0947 "); |
+ render_text.SetText(kWord); |
+ gfx::SizeF text_size = render_text.GetStringSizeF(); |
msw
2015/03/25 20:25:16
nit: const
Jun Mukai
2015/03/25 21:50:05
Done.
|
+ |
+ render_text.SetText(kWord + kWord); |
msw
2015/03/25 20:25:16
nit: after this, but before SetDisplayRect, can yo
Jun Mukai
2015/03/25 21:50:05
Done.
|
+ render_text.SetMultiline(true); |
+ render_text.SetDisplayRect(gfx::Rect(0, 0, text_size.width(), 0)); |
msw
2015/03/25 20:25:16
nit: instead of setting the display rect, can you
Jun Mukai
2015/03/25 21:50:05
'\n' doesn't work well in this case, since RTHB sp
msw
2015/03/25 22:51:44
Acknowledged.
|
+ EXPECT_EQ(text_size.width(), render_text.GetStringSizeF().width()); |
+ EXPECT_EQ(text_size.height() * 2, render_text.GetStringSizeF().height()); |
+} |
+ |
// Ensure a string fits in a display rect with a width equal to the string's. |
TEST_F(RenderTextTest, StringFitsOwnWidth) { |
scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |