Index: ui/gfx/font_list_unittest.cc |
diff --git a/ui/gfx/font_list_unittest.cc b/ui/gfx/font_list_unittest.cc |
index 6cbb41fbecda73ecb0e8b51efc395488233a54c9..66cb26065f3810eb7b3522a66dc181a722188939 100644 |
--- a/ui/gfx/font_list_unittest.cc |
+++ b/ui/gfx/font_list_unittest.cc |
@@ -24,6 +24,8 @@ std::string FontToString(const gfx::Font& font) { |
font_string += "|bold"; |
if (style & gfx::Font::ITALIC) |
font_string += "|italic"; |
+ if (style & gfx::Font::UNDERLINE) |
+ font_string += "|underline"; |
return font_string; |
} |
@@ -43,9 +45,10 @@ TEST(FontListTest, FontDescString_FromFontNamesStyleAndSize) { |
std::vector<std::string> font_names; |
font_names.push_back("Arial"); |
font_names.push_back("Droid Sans serif"); |
- int font_style = Font::BOLD | Font::ITALIC; |
+ int font_style = Font::BOLD | Font::ITALIC | Font::UNDERLINE; |
int font_size = 11; |
FontList font_list = FontList(font_names, font_style, font_size); |
+ // "Underline" doesn't appear in the font description string. |
EXPECT_EQ("Arial,Droid Sans serif,Bold Italic 11px", |
font_list.GetFontDescriptionString()); |
} |
@@ -65,6 +68,10 @@ TEST(FontListTest, FontDescString_FromFontWithNonNormalStyle) { |
font_list = FontList(font.DeriveFont(-2, Font::ITALIC)); |
EXPECT_EQ("Arial,Italic 6px", font_list.GetFontDescriptionString()); |
+ |
+ // "Underline" doesn't appear in the font description string. |
+ font_list = FontList(font.DeriveFont(-4, Font::UNDERLINE)); |
+ EXPECT_EQ("Arial,4px", font_list.GetFontDescriptionString()); |
} |
TEST(FontListTest, FontDescString_FromFontVector) { |
@@ -269,10 +276,18 @@ TEST(FontListTest, Fonts_DeriveFontListWithSizeDelta) { |
TEST(FontListTest, FontDescString_DeriveFontListWithSizeDeltaAndStyle) { |
FontList font_list = FontList("Arial,Sans serif,Bold Italic 8px"); |
- FontList derived = |
- font_list.DeriveFontListWithSizeDeltaAndStyle(10, Font::ITALIC); |
+ FontList derived = font_list.DeriveFontListWithSizeDeltaAndStyle( |
+ 10, Font::ITALIC | Font::UNDERLINE); |
EXPECT_EQ("Arial,Sans serif,Italic 18px", |
derived.GetFontDescriptionString()); |
+ EXPECT_EQ(Font::ITALIC | Font::UNDERLINE, |
+ derived.GetFontStyle()); |
+ |
+ // FontList has a special care for Font::UNDERLINE. See if the handling of |
+ // Font::UNDERLINE in GetFonts() is okay or not. |
+ derived.GetFonts(); |
+ EXPECT_EQ(Font::ITALIC | Font::UNDERLINE, |
+ derived.GetFontStyle()); |
} |
TEST(FontListTest, Fonts_DeriveFontListWithSizeDeltaAndStyle) { |
@@ -281,13 +296,13 @@ TEST(FontListTest, Fonts_DeriveFontListWithSizeDeltaAndStyle) { |
fonts.push_back(gfx::Font("Sans serif", 8)); |
FontList font_list = FontList(fonts); |
- FontList derived = |
- font_list.DeriveFontListWithSizeDeltaAndStyle(5, Font::BOLD); |
+ FontList derived = font_list.DeriveFontListWithSizeDeltaAndStyle( |
+ 5, Font::BOLD | Font::UNDERLINE); |
const std::vector<Font>& derived_fonts = derived.GetFonts(); |
EXPECT_EQ(2U, derived_fonts.size()); |
- EXPECT_EQ("Arial|13|bold", FontToString(derived_fonts[0])); |
- EXPECT_EQ("Sans serif|13|bold", FontToString(derived_fonts[1])); |
+ EXPECT_EQ("Arial|13|bold|underline", FontToString(derived_fonts[0])); |
+ EXPECT_EQ("Sans serif|13|bold|underline", FontToString(derived_fonts[1])); |
} |
TEST(FontListTest, Fonts_GetHeight_GetBaseline) { |