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

Unified Diff: ui/gfx/platform_font_win_unittest.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 7 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/platform_font_win.cc ('k') | ui/gfx/render_text.h » ('j') | 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 9fa7be4162211cf6ac00f6664cfd4f300f93180b..854377974d5a142b06bc4848e30bd143927bea85 100644
--- a/ui/gfx/platform_font_win_unittest.cc
+++ b/ui/gfx/platform_font_win_unittest.cc
@@ -17,79 +17,6 @@
namespace gfx {
-TEST(PlatformFontWinTest, DeriveFontWithHeight) {
- const Font base_font;
- PlatformFontWin* platform_font =
- static_cast<PlatformFontWin*>(base_font.platform_font());
-
- for (int i = -10; i < 10; i++) {
- const int target_height = base_font.GetHeight() + i;
-
- Font derived_font = platform_font->DeriveFontWithHeight(target_height, 0);
- EXPECT_LE(derived_font.GetHeight(), target_height);
- EXPECT_GT(derived_font.Derive(1, 0).GetHeight(), target_height);
- EXPECT_EQ(platform_font->GetActualFontNameForTesting(),
- derived_font.GetActualFontNameForTesting());
- EXPECT_EQ(0, derived_font.GetStyle());
-
- derived_font = platform_font->DeriveFontWithHeight(target_height,
- Font::BOLD);
- EXPECT_LE(derived_font.GetHeight(), target_height);
- EXPECT_GT(derived_font.Derive(1, 0).GetHeight(), target_height);
- EXPECT_EQ(platform_font->GetActualFontNameForTesting(),
- derived_font.GetActualFontNameForTesting());
- EXPECT_EQ(Font::BOLD, derived_font.GetStyle());
- }
-}
-
-TEST(PlatformFontWinTest, DeriveFontWithHeight_Consistency) {
- gfx::Font arial_12("Arial", 12);
- ASSERT_GT(16, arial_12.GetHeight());
- gfx::Font derived_1 = static_cast<PlatformFontWin*>(
- arial_12.platform_font())->DeriveFontWithHeight(16, 0);
-
- gfx::Font arial_15("Arial", 15);
- ASSERT_LT(16, arial_15.GetHeight());
- gfx::Font derived_2 = static_cast<PlatformFontWin*>(
- arial_15.platform_font())->DeriveFontWithHeight(16, 0);
-
- EXPECT_EQ(derived_1.GetFontSize(), derived_2.GetFontSize());
- EXPECT_EQ(16, derived_1.GetHeight());
- EXPECT_EQ(16, derived_2.GetHeight());
-}
-
-// Callback function used by DeriveFontWithHeight_MinSize() below.
-static int GetMinFontSize() {
- return 10;
-}
-
-TEST(PlatformFontWinTest, DeriveFontWithHeight_MinSize) {
- PlatformFontWin::GetMinimumFontSizeCallback old_callback =
- PlatformFontWin::get_minimum_font_size_callback;
- PlatformFontWin::get_minimum_font_size_callback = &GetMinFontSize;
-
- const Font base_font;
- const Font min_font(base_font.GetFontName(), GetMinFontSize());
- PlatformFontWin* platform_font =
- static_cast<PlatformFontWin*>(base_font.platform_font());
-
- const Font derived_font =
- platform_font->DeriveFontWithHeight(min_font.GetHeight() - 1, 0);
- EXPECT_EQ(min_font.GetFontSize(), derived_font.GetFontSize());
- EXPECT_EQ(min_font.GetHeight(), derived_font.GetHeight());
-
- PlatformFontWin::get_minimum_font_size_callback = old_callback;
-}
-
-TEST(PlatformFontWinTest, DeriveFontWithHeight_TooSmall) {
- const Font base_font;
- PlatformFontWin* platform_font =
- static_cast<PlatformFontWin*>(base_font.platform_font());
-
- const Font derived_font = platform_font->DeriveFontWithHeight(1, 0);
- EXPECT_GT(derived_font.GetHeight(), 1);
-}
-
// Test whether font metrics retrieved by DirectWrite (skia) and GDI match as
// per assumptions mentioned below:-
// 1. Font size is the same
« no previous file with comments | « ui/gfx/platform_font_win.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698