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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 1036663003: Break runs by clusters rather than iteration over code points (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GetClusterAt() Created 5 years, 9 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
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698