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

Unified Diff: ui/gfx/platform_font_win_unittest.cc

Issue 251773002: PlatformFontWin::DeriveFontWithHeight insensitive to base font's height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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/platform_font_win.cc ('K') | « ui/gfx/platform_font_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_win_unittest.cc
diff --git a/ui/gfx/platform_font_win_unittest.cc b/ui/gfx/platform_font_win_unittest.cc
index 1ecdde1d352db9d7b25e5a6c3ee62be48d79ca0a..67446ebc39e3cb2fa828a76f3f48fadfc0b83129 100644
--- a/ui/gfx/platform_font_win_unittest.cc
+++ b/ui/gfx/platform_font_win_unittest.cc
@@ -67,6 +67,23 @@ TEST(PlatformFontWinTest, DeriveFontWithHeight) {
EXPECT_EQ(expected_font.GetFontSize(), rederived_font.GetFontSize());
EXPECT_EQ(expected_font.GetHeight(), rederived_font.GetHeight());
}
+
+ const Font bigger_font(base_font.GetFontName(), base_font.GetFontSize() + 10);
Alexei Svitkine (slow) 2014/05/09 21:21:00 Oops, I see you already added a test. Can you mak
Tomasz Moniuszko 2014/05/29 10:46:40 Done.
+ PlatformFontWin* bigger_platform_font =
+ static_cast<PlatformFontWin*>(bigger_font.platform_font());
+
+ int requested_height = (base_font.GetHeight() + bigger_font.GetHeight()) / 2;
Alexei Svitkine (slow) 2014/05/09 21:21:00 Is it possible to do something more straight forwa
Tomasz Moniuszko 2014/05/29 10:46:40 Done.
+ ASSERT_GT(requested_height, base_font.GetHeight());
+ ASSERT_LT(requested_height, bigger_font.GetHeight());
+
+ Font derived_font_1 =
+ platform_font->DeriveFontWithHeight(requested_height, 0);
+ Font derived_font_2 =
+ bigger_platform_font->DeriveFontWithHeight(requested_height, 0);
+
+ // Derived fonts should be the same height for both higher and lower base
+ // fonts.
+ EXPECT_EQ(derived_font_1.GetHeight(), derived_font_2.GetHeight());
}
// Callback function used by DeriveFontWithHeight_MinSize() below.
« ui/gfx/platform_font_win.cc ('K') | « ui/gfx/platform_font_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698