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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 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
Index: ui/gfx/render_text_unittest.cc
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index d83fd6ca5a9f3e68b247bc64ede0f002174c29cf..ca8677a35f900a6ac47c0b24c8f35bf95a75a7ee 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -2340,6 +2340,45 @@ TEST_P(RenderTextTest, MinLineHeight) {
EXPECT_EQ(default_size.width(), taller_size.width());
}
+// Check that, for Latin characters, typesetting text in the default fonts and
+// sizes does not discover any glyphs that would exceed the line spacing
+// recommended by gfx::Font.
+// Disabled since this relies on machine configuration. http://crbug.com/701241.
sky 2017/03/20 16:33:11 The bug points at the harmony bug, which isn't at
tapted 2017/03/20 22:31:42 The plan would be to bring this up at the same tim
+TEST_P(RenderTextTest, DISABLED_DefaultLineHeights) {
+ RenderText* render_text = GetRenderText();
+ render_text->SetText(
+ ASCIIToUTF16("A quick brown fox jumped over the lazy dog!"));
+
+#if defined(OS_MACOSX)
+ const FontList body2_font = FontList().DeriveWithSizeDelta(-1);
+#else
+ const FontList body2_font;
+#endif
+
+ const FontList headline_font = body2_font.DeriveWithSizeDelta(8);
+ const FontList title_font = body2_font.DeriveWithSizeDelta(3);
+ const FontList body1_font = body2_font.DeriveWithSizeDelta(1);
+#if defined(OS_WIN)
+ const FontList button_font =
+ body2_font.DeriveWithWeight(gfx::Font::Weight::BOLD);
+#else
+ const FontList button_font =
+ body2_font.DeriveWithWeight(gfx::Font::Weight::MEDIUM);
+#endif
+
+ EXPECT_EQ(12, body2_font.GetFontSize());
+ EXPECT_EQ(20, headline_font.GetFontSize());
+ EXPECT_EQ(15, title_font.GetFontSize());
+ EXPECT_EQ(13, body1_font.GetFontSize());
+ EXPECT_EQ(12, button_font.GetFontSize());
+
+ for (const auto& font :
+ {headline_font, title_font, body1_font, body2_font, button_font}) {
+ render_text->SetFontList(font);
+ EXPECT_EQ(font.GetHeight(), render_text->GetStringSizeF().height());
+ }
+}
+
TEST_P(RenderTextTest, SetFontList) {
RenderText* render_text = GetRenderText();
render_text->SetFontList(

Powered by Google App Engine
This is Rietveld 408576698