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

Unified Diff: ui/gfx/font_list_unittest.cc

Issue 142523003: Renames gfx::FontList::Derive* family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 11 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/font_list.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_list_unittest.cc
diff --git a/ui/gfx/font_list_unittest.cc b/ui/gfx/font_list_unittest.cc
index 66cb26065f3810eb7b3522a66dc181a722188939..b13e736c9ef7445235f2df9d5bed441f4a80be1d 100644
--- a/ui/gfx/font_list_unittest.cc
+++ b/ui/gfx/font_list_unittest.cc
@@ -207,65 +207,48 @@ TEST(FontListTest, Fonts_GetStyle) {
EXPECT_EQ(Font::ITALIC | Font::BOLD, font_list.GetFontStyle());
}
-TEST(FontListTest, FontDescString_DeriveFontList) {
- FontList font_list = FontList("Arial,Sans serif, 8px");
-
- FontList derived = font_list.DeriveFontList(Font::BOLD | Font::ITALIC);
- EXPECT_EQ("Arial,Sans serif,Bold Italic 8px",
- derived.GetFontDescriptionString());
-}
-
-TEST(FontListTest, Fonts_DeriveFontList) {
- std::vector<Font> fonts;
- fonts.push_back(gfx::Font("Arial", 8));
- fonts.push_back(gfx::Font("Sans serif", 8));
- FontList font_list = FontList(fonts);
+TEST(FontListTest, FontDescString_Derive) {
+ FontList font_list = FontList("Arial,Sans serif,Bold Italic 8px");
- FontList derived = font_list.DeriveFontList(Font::BOLD | Font::ITALIC);
- const std::vector<Font>& derived_fonts = derived.GetFonts();
+ FontList derived = font_list.Derive(10, Font::ITALIC | Font::UNDERLINE);
+ EXPECT_EQ("Arial,Sans serif,Italic 18px", derived.GetFontDescriptionString());
+ EXPECT_EQ(Font::ITALIC | Font::UNDERLINE, derived.GetFontStyle());
- EXPECT_EQ(2U, derived_fonts.size());
- EXPECT_EQ("Arial|8|bold|italic", FontToString(derived_fonts[0]));
- EXPECT_EQ("Sans serif|8|bold|italic", FontToString(derived_fonts[1]));
-}
-
-TEST(FontListTest, FontDescString_DeriveFontListWithSize) {
- FontList font_list = FontList("Arial,Sans serif,Bold Italic 8px");
-
- FontList derived = font_list.DeriveFontListWithSize(10);
- EXPECT_EQ("Arial,Sans serif,Bold Italic 10px",
- derived.GetFontDescriptionString());
+ // FontList has a special case 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_DeriveFontListWithSize) {
+TEST(FontListTest, Fonts_Derive) {
std::vector<Font> fonts;
fonts.push_back(gfx::Font("Arial", 8));
fonts.push_back(gfx::Font("Sans serif", 8));
FontList font_list = FontList(fonts);
- FontList derived = font_list.DeriveFontListWithSize(5);
+ FontList derived = font_list.Derive(5, Font::BOLD | Font::UNDERLINE);
const std::vector<Font>& derived_fonts = derived.GetFonts();
EXPECT_EQ(2U, derived_fonts.size());
- EXPECT_EQ("Arial|5", FontToString(derived_fonts[0]));
- EXPECT_EQ("Sans serif|5", 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, FontDescString_DeriveFontListWithSizeDelta) {
+TEST(FontListTest, FontDescString_DeriveWithSizeDelta) {
FontList font_list = FontList("Arial,Sans serif,Bold 18px");
- FontList derived = font_list.DeriveFontListWithSizeDelta(-8);
+ FontList derived = font_list.DeriveWithSizeDelta(-8);
EXPECT_EQ("Arial,Sans serif,Bold 10px",
derived.GetFontDescriptionString());
}
-TEST(FontListTest, Fonts_DeriveFontListWithSizeDelta) {
+TEST(FontListTest, Fonts_DeriveWithSizeDelta) {
std::vector<Font> fonts;
fonts.push_back(gfx::Font("Arial", 18).DeriveFont(0, Font::ITALIC));
fonts.push_back(gfx::Font("Sans serif", 18).DeriveFont(0, Font::ITALIC));
FontList font_list = FontList(fonts);
- FontList derived = font_list.DeriveFontListWithSizeDelta(-5);
+ FontList derived = font_list.DeriveWithSizeDelta(-5);
const std::vector<Font>& derived_fonts = derived.GetFonts();
EXPECT_EQ(2U, derived_fonts.size());
@@ -273,38 +256,6 @@ TEST(FontListTest, Fonts_DeriveFontListWithSizeDelta) {
EXPECT_EQ("Sans serif|13|italic", FontToString(derived_fonts[1]));
}
-TEST(FontListTest, FontDescString_DeriveFontListWithSizeDeltaAndStyle) {
- FontList font_list = FontList("Arial,Sans serif,Bold Italic 8px");
-
- 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) {
- std::vector<Font> fonts;
- fonts.push_back(gfx::Font("Arial", 8));
- fonts.push_back(gfx::Font("Sans serif", 8));
- FontList font_list = FontList(fonts);
-
- 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|underline", FontToString(derived_fonts[0]));
- EXPECT_EQ("Sans serif|13|bold|underline", FontToString(derived_fonts[1]));
-}
-
TEST(FontListTest, Fonts_GetHeight_GetBaseline) {
// If a font list has only one font, the height and baseline must be the same.
Font font1("Arial", 16);
« no previous file with comments | « ui/gfx/font_list.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698