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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 678683003: Make RenderTextHarfBuzz examine full font list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable test on windows Created 6 years, 2 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 1c6f902d936fb435827912df67561e1d1af51c51..e7115814759bc19c5979bb605416db0265d23d8c 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -2326,4 +2326,30 @@ TEST_F(RenderTextTest, StringFitsOwnWidth) {
EXPECT_EQ(kString, render_text->GetLayoutText());
}
+// TODO(derat): Figure out why this fails on Windows: http://crbug.com/427184
+#if !defined(OS_WIN)
+// Ensure that RenderText examines all of the fonts in its FontList before
+// falling back to other fonts.
+TEST_F(RenderTextTest, FontListFallback) {
+ // Double-check that the requested fonts are present.
+ FontList font_list("Arial, Symbol, 12px");
+ const std::vector<Font>& fonts = font_list.GetFonts();
+ ASSERT_EQ(2u, fonts.size());
+ ASSERT_EQ("arial",
+ base::StringToLowerASCII(fonts[0].GetActualFontNameForTesting()));
+ ASSERT_EQ("symbol",
+ base::StringToLowerASCII(fonts[1].GetActualFontNameForTesting()));
+
+ // "⊕" (CIRCLED PLUS) should be rendered with Symbol rather than falling back
+ // to some other font that's present on the system.
+ scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
+ render_text->SetFontList(font_list);
+ render_text->SetText(UTF8ToUTF16("\xE2\x8A\x95"));
+ const std::vector<RenderText::FontSpan> spans =
+ render_text->GetFontSpansForTesting();
+ ASSERT_EQ(static_cast<size_t>(1), spans.size());
+ EXPECT_EQ("Symbol", spans[0].first.GetFontName());
+}
+#endif // !defined(OS_WIN)
+
} // namespace gfx
« 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