Chromium Code Reviews| 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 10050f63a0da18e6569c7fe304c5f4e9bd81e6ea..338be1911826d73848fb0da68f4a5c801d5308ee 100644 |
| --- a/ui/gfx/platform_font_win_unittest.cc |
| +++ b/ui/gfx/platform_font_win_unittest.cc |
| @@ -25,33 +25,38 @@ TEST(PlatformFontWinTest, DeriveFontWithHeight) { |
| for (int i = -10; i < 10; i++) { |
| const int target_height = base_font.GetHeight() + i; |
| - Font derived_font = platform_font->DeriveFontWithHeight(target_height, 0); |
| + Font derived_font = platform_font->DeriveFontWithHeight( |
| + target_height, 0, gfx::Font::WEIGHT_NORMAL); |
| EXPECT_LE(derived_font.GetHeight(), target_height); |
| - EXPECT_GT(derived_font.Derive(1, 0).GetHeight(), target_height); |
| + EXPECT_GT(derived_font.Derive(1, 0, gfx::Font::WEIGHT_NORMAL).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); |
| + derived_font = platform_font->DeriveFontWithHeight(target_height, 0, |
| + gfx::Font::WEIGHT_BOLD); |
| EXPECT_LE(derived_font.GetHeight(), target_height); |
| - EXPECT_GT(derived_font.Derive(1, 0).GetHeight(), target_height); |
| + EXPECT_GT(derived_font.Derive(1, 0, gfx::Font::WEIGHT_NORMAL).GetHeight(), |
|
msw
2016/03/22 01:53:44
nint: shouldn't this be bold to match the old beha
Mikus
2016/03/22 14:19:51
Nope, it should be like this because the weight on
msw
2016/03/22 18:24:10
Acknowledged.
|
| + target_height); |
| EXPECT_EQ(platform_font->GetActualFontNameForTesting(), |
| derived_font.GetActualFontNameForTesting()); |
| - EXPECT_EQ(Font::BOLD, derived_font.GetStyle()); |
| + EXPECT_EQ(Font::WEIGHT_BOLD, derived_font.GetWeight()); |
| } |
| } |
| 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 derived_1 = |
| + static_cast<PlatformFontWin*>(arial_12.platform_font()) |
| + ->DeriveFontWithHeight(16, 0, gfx::Font::WEIGHT_NORMAL); |
| 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); |
| + gfx::Font derived_2 = |
| + static_cast<PlatformFontWin*>(arial_15.platform_font()) |
| + ->DeriveFontWithHeight(16, 0, gfx::Font::WEIGHT_NORMAL); |
| EXPECT_EQ(derived_1.GetFontSize(), derived_2.GetFontSize()); |
| EXPECT_EQ(16, derived_1.GetHeight()); |
| @@ -73,8 +78,8 @@ TEST(PlatformFontWinTest, DeriveFontWithHeight_MinSize) { |
| PlatformFontWin* platform_font = |
| static_cast<PlatformFontWin*>(base_font.platform_font()); |
| - const Font derived_font = |
| - platform_font->DeriveFontWithHeight(min_font.GetHeight() - 1, 0); |
| + const Font derived_font = platform_font->DeriveFontWithHeight( |
| + min_font.GetHeight() - 1, 0, gfx::Font::WEIGHT_NORMAL); |
| EXPECT_EQ(min_font.GetFontSize(), derived_font.GetFontSize()); |
| EXPECT_EQ(min_font.GetHeight(), derived_font.GetHeight()); |
| @@ -86,7 +91,8 @@ TEST(PlatformFontWinTest, DeriveFontWithHeight_TooSmall) { |
| PlatformFontWin* platform_font = |
| static_cast<PlatformFontWin*>(base_font.platform_font()); |
| - const Font derived_font = platform_font->DeriveFontWithHeight(1, 0); |
| + const Font derived_font = |
| + platform_font->DeriveFontWithHeight(1, 0, gfx::Font::WEIGHT_NORMAL); |
| EXPECT_GT(derived_font.GetHeight(), 1); |
| } |