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..8daf3f5b02ebbba5acec8025170e03294954978b 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.GetActualFontNameForTest())); |
| 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.GetActualFontNameForTest())); |
| FreeIfNecessary(native); |
| } |
| @@ -123,6 +126,22 @@ 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/10 16:22:12
nit: GetActualFontNameForTest
Yuki
2013/12/11 05:05:58
Done.
|
| +// http://crbug.com/327287 |
| +TEST_F(FontTest, GetActualFontNameForTest) { |
| + Font arial("Arial", 16); |
| + EXPECT_EQ("arial", StringToLowerASCII(arial.GetActualFontNameForTest())); |
| + Font symbol("Symbol", 16); |
| + EXPECT_EQ("symbol", StringToLowerASCII(symbol.GetActualFontNameForTest())); |
| + |
| + const char* const invalid_font_name = "no_such_font_name"; |
| + Font fallback_font(invalid_font_name, 16); |
| + EXPECT_NE(invalid_font_name, |
| + StringToLowerASCII(fallback_font.GetActualFontNameForTest())); |
| +} |
| +#endif |
| + |
| #if defined(OS_WIN) |
| TEST_F(FontTest, DeriveFontResizesIfSizeTooSmall) { |
| Font cf("Arial", 8); |