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

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: win/mac test fix 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
« no previous file with comments | « 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 9ece279f9f05586717a4945e94a4dce57ebb1d04..fa10e542cfca27e22674cd67d7187a1fc06b4f74 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -2610,6 +2610,23 @@ 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);
+ const gfx::SizeF text_size = render_text.GetStringSizeF();
+
+ render_text.SetText(kWord + kWord);
+ render_text.SetMultiline(true);
+ EXPECT_EQ(text_size.width() * 2, render_text.GetStringSizeF().width());
+ EXPECT_EQ(text_size.height(), render_text.GetStringSizeF().height());
+ render_text.SetDisplayRect(gfx::Rect(0, 0, std::ceil(text_size.width()), 0));
+ EXPECT_NEAR(text_size.width(), render_text.GetStringSizeF().width(), 1.0f);
+ 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());
« no previous file with comments | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698