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

Unified Diff: ui/gfx/platform_font_mac_unittest.mm

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_mac.mm ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d2ae55ff02ced413de2fac422627e35c14135eb2..362bed44a6fdc67f320af4edeb5ec5d7e77c0493 100644
--- a/ui/gfx/platform_font_mac_unittest.mm
+++ b/ui/gfx/platform_font_mac_unittest.mm
@@ -14,20 +14,22 @@ TEST(PlatformFontMacTest, DeriveFont) {
gfx::Font base_font("Helvetica", 13);
// Bold
- gfx::Font bold_font(base_font.Derive(0, gfx::Font::BOLD));
+ gfx::Font bold_font(
+ base_font.Derive(0, gfx::Font::NORMAL, gfx::Font::Weight::BOLD));
NSFontTraitMask traits = [[NSFontManager sharedFontManager]
traitsOfFont:bold_font.GetNativeFont()];
EXPECT_EQ(NSBoldFontMask, traits);
// Italic
- gfx::Font italic_font(base_font.Derive(0, gfx::Font::ITALIC));
+ gfx::Font italic_font(
+ base_font.Derive(0, gfx::Font::ITALIC, gfx::Font::Weight::NORMAL));
traits = [[NSFontManager sharedFontManager]
traitsOfFont:italic_font.GetNativeFont()];
EXPECT_EQ(NSItalicFontMask, traits);
// Bold italic
- gfx::Font bold_italic_font(base_font.Derive(
- 0, gfx::Font::BOLD | gfx::Font::ITALIC));
+ gfx::Font bold_italic_font(
+ base_font.Derive(0, gfx::Font::ITALIC, gfx::Font::Weight::BOLD));
traits = [[NSFontManager sharedFontManager]
traitsOfFont:bold_italic_font.GetNativeFont()];
EXPECT_EQ(static_cast<NSFontTraitMask>(NSBoldFontMask | NSItalicFontMask),
@@ -43,7 +45,7 @@ TEST(PlatformFontMacTest, ConstructFromNativeFont) {
gfx::Font bold_font([NSFont fontWithName:@"Helvetica-Bold" size:14]);
EXPECT_EQ(14, bold_font.GetFontSize());
EXPECT_EQ("Helvetica", bold_font.GetFontName());
- EXPECT_EQ(gfx::Font::BOLD, bold_font.GetStyle());
+ EXPECT_EQ(gfx::Font::Weight::BOLD, bold_font.GetWeight());
gfx::Font italic_font([NSFont fontWithName:@"Helvetica-Oblique" size:14]);
EXPECT_EQ(14, italic_font.GetFontSize());
@@ -54,7 +56,8 @@ TEST(PlatformFontMacTest, ConstructFromNativeFont) {
[NSFont fontWithName:@"Helvetica-BoldOblique" size:14]);
EXPECT_EQ(14, bold_italic_font.GetFontSize());
EXPECT_EQ("Helvetica", bold_italic_font.GetFontName());
- EXPECT_EQ(gfx::Font::BOLD | gfx::Font::ITALIC, bold_italic_font.GetStyle());
+ EXPECT_EQ(gfx::Font::ITALIC, bold_italic_font.GetStyle());
+ EXPECT_EQ(gfx::Font::Weight::BOLD, bold_italic_font.GetWeight());
}
// Ensures that the Font's reported height is consistent with the native font's
@@ -63,15 +66,15 @@ TEST(PlatformFontMacTest, ValidateFontHeight) {
// Use the default ResourceBundle system font. E.g. Helvetica Neue in 10.10,
// Lucida Grande before that, and San Francisco after.
gfx::Font default_font;
- gfx::Font::FontStyle styles[] = {
- gfx::Font::NORMAL, gfx::Font::BOLD, gfx::Font::ITALIC, gfx::Font::UNDERLINE
- };
+ gfx::Font::FontStyle styles[] = {gfx::Font::NORMAL, gfx::Font::ITALIC,
+ gfx::Font::UNDERLINE};
for (size_t i = 0; i < arraysize(styles); ++i) {
SCOPED_TRACE(testing::Message() << "Font::FontStyle: " << styles[i]);
// Include the range of sizes used by ResourceBundle::FontStyle (-1 to +8).
for (int delta = -1; delta <= 8; ++delta) {
- gfx::Font font = default_font.Derive(delta, styles[i]);
+ gfx::Font font =
+ default_font.Derive(delta, styles[i], gfx::Font::Weight::NORMAL);
SCOPED_TRACE(testing::Message() << "FontSize(): " << font.GetFontSize());
NSFont* native_font = font.GetNativeFont();
« no previous file with comments | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698