Chromium Code Reviews| Index: ui/gfx/font_unittest.cc |
| diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc |
| index 2fe61939d14bf6e9f7d8e60583a7b38a3e410c40..d3bd0d9811fc78010fbceeceee590069ebd6f650 100644 |
| --- a/ui/gfx/font_unittest.cc |
| +++ b/ui/gfx/font_unittest.cc |
| @@ -5,6 +5,7 @@ |
| #include "ui/gfx/font.h" |
| #include "base/strings/string16.h" |
| +#include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -63,6 +64,7 @@ TEST_F(FontTest, LoadArial) { |
| EXPECT_EQ(cf.GetStyle(), Font::NORMAL); |
| EXPECT_EQ(cf.GetFontSize(), 16); |
| EXPECT_EQ(cf.GetFontName(), "Arial"); |
| + EXPECT_EQ("arial", StringToLowerASCII(cf.GetActualFontName())); |
| FreeIfNecessary(native); |
| } |
| @@ -72,6 +74,7 @@ TEST_F(FontTest, LoadArialBold) { |
| NativeFont native = bold.GetNativeFont(); |
| EXPECT_TRUE(native); |
| EXPECT_EQ(bold.GetStyle(), Font::BOLD); |
| + EXPECT_EQ("arial", StringToLowerASCII(cf.GetActualFontName())); |
| FreeIfNecessary(native); |
| } |
| @@ -123,6 +126,21 @@ TEST_F(FontTest, Widths) { |
| cf.GetStringWidth(ASCIIToUTF16("ab"))); |
| } |
| +#if !defined(OS_WIN) |
| +// On Windows, Font::GetActualFontName() doesn't work well for now. |
|
msw
2013/12/09 19:27:15
nit: file an issue to follow up.
Yuki
2013/12/10 09:58:59
Done.
|
| +TEST_F(FontTest, GetActualFontName) { |
| + Font arial("Arial", 16); |
| + EXPECT_EQ("arial", StringToLowerASCII(arial.GetActualFontName())); |
| + Font symbol("Symbol", 16); |
| + EXPECT_EQ("symbol", StringToLowerASCII(symbol.GetActualFontName())); |
| + |
| + const char* const invalid_font_name = "no_such_a_font_name"; |
|
msw
2013/12/09 19:27:15
nit: consider "invalid_font_name" or "no_such_font
Yuki
2013/12/10 09:58:59
Done.
|
| + Font fallback_font(invalid_font_name, 16); |
| + EXPECT_NE(invalid_font_name, |
| + StringToLowerASCII(fallback_font.GetActualFontName())); |
| +} |
| +#endif |
| + |
| #if defined(OS_WIN) |
| TEST_F(FontTest, DeriveFontResizesIfSizeTooSmall) { |
| Font cf("Arial", 8); |