| Index: ui/gfx/platform_font_mac_unittest.mm
|
| diff --git a/ui/gfx/platform_font_mac_unittest.mm b/ui/gfx/platform_font_mac_unittest.mm
|
| index 362bed44a6fdc67f320af4edeb5ec5d7e77c0493..e65b8b1fd95e1249e00bbcc89c99b7dfa5230e43 100644
|
| --- a/ui/gfx/platform_font_mac_unittest.mm
|
| +++ b/ui/gfx/platform_font_mac_unittest.mm
|
| @@ -36,6 +36,30 @@
|
| traits);
|
| }
|
|
|
| +TEST(PlatformFontMacTest, DeriveFontUnderline) {
|
| + // Create a default font.
|
| + gfx::Font base_font;
|
| +
|
| + // Make the font underlined.
|
| + gfx::Font derived_font(base_font.Derive(
|
| + 0, base_font.GetStyle() | gfx::Font::UNDERLINE, base_font.GetWeight()));
|
| +
|
| + // Validate the derived font properties against its native font instance.
|
| + NSFontTraitMask traits = [[NSFontManager sharedFontManager]
|
| + traitsOfFont:derived_font.GetNativeFont()];
|
| + gfx::Font::Weight actual_weight = (traits & NSFontBoldTrait)
|
| + ? gfx::Font::Weight::BOLD
|
| + : gfx::Font::Weight::NORMAL;
|
| +
|
| + int actual_style = gfx::Font::UNDERLINE;
|
| + if (traits & NSFontItalicTrait)
|
| + actual_style |= gfx::Font::ITALIC;
|
| +
|
| + EXPECT_TRUE(derived_font.GetStyle() & gfx::Font::UNDERLINE);
|
| + EXPECT_EQ(derived_font.GetStyle(), actual_style);
|
| + EXPECT_EQ(derived_font.GetWeight(), actual_weight);
|
| +}
|
| +
|
| TEST(PlatformFontMacTest, ConstructFromNativeFont) {
|
| gfx::Font normal_font([NSFont fontWithName:@"Helvetica" size:12]);
|
| EXPECT_EQ(12, normal_font.GetFontSize());
|
|
|