diff options
Diffstat (limited to 'app/gfx/chrome_font_unittest.cc')
-rw-r--r-- | app/gfx/chrome_font_unittest.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/app/gfx/chrome_font_unittest.cc b/app/gfx/chrome_font_unittest.cc index 5ad7973..0bb840b4 100644 --- a/app/gfx/chrome_font_unittest.cc +++ b/app/gfx/chrome_font_unittest.cc @@ -8,46 +8,48 @@ namespace { -class ChromeFontTest : public testing::Test { +using gfx::Font; + +class FontTest : public testing::Test { }; -TEST_F(ChromeFontTest, LoadArial) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); +TEST_F(FontTest, LoadArial) { + Font cf(Font::CreateFont(L"Arial", 16)); ASSERT_TRUE(cf.nativeFont()); - ASSERT_EQ(cf.style(), ChromeFont::NORMAL); + ASSERT_EQ(cf.style(), Font::NORMAL); ASSERT_EQ(cf.FontSize(), 16); ASSERT_EQ(cf.FontName(), L"Arial"); } -TEST_F(ChromeFontTest, LoadArialBold) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); - ChromeFont bold(cf.DeriveFont(0, ChromeFont::BOLD)); +TEST_F(FontTest, LoadArialBold) { + Font cf(Font::CreateFont(L"Arial", 16)); + Font bold(cf.DeriveFont(0, Font::BOLD)); ASSERT_TRUE(bold.nativeFont()); - ASSERT_EQ(bold.style(), ChromeFont::BOLD); + ASSERT_EQ(bold.style(), Font::BOLD); } -TEST_F(ChromeFontTest, Ascent) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); +TEST_F(FontTest, Ascent) { + Font cf(Font::CreateFont(L"Arial", 16)); ASSERT_GT(cf.baseline(), 2); ASSERT_LT(cf.baseline(), 20); } -TEST_F(ChromeFontTest, Height) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); +TEST_F(FontTest, Height) { + Font cf(Font::CreateFont(L"Arial", 16)); ASSERT_GT(cf.baseline(), 2); ASSERT_LT(cf.baseline(), 20); } -TEST_F(ChromeFontTest, AvgWidths) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); +TEST_F(FontTest, AvgWidths) { + Font cf(Font::CreateFont(L"Arial", 16)); ASSERT_EQ(cf.GetExpectedTextWidth(0), 0); ASSERT_GT(cf.GetExpectedTextWidth(1), cf.GetExpectedTextWidth(0)); ASSERT_GT(cf.GetExpectedTextWidth(2), cf.GetExpectedTextWidth(1)); ASSERT_GT(cf.GetExpectedTextWidth(3), cf.GetExpectedTextWidth(2)); } -TEST_F(ChromeFontTest, Widths) { - ChromeFont cf(ChromeFont::CreateFont(L"Arial", 16)); +TEST_F(FontTest, Widths) { + Font cf(Font::CreateFont(L"Arial", 16)); ASSERT_EQ(cf.GetStringWidth(L""), 0); ASSERT_GT(cf.GetStringWidth(L"a"), cf.GetStringWidth(L"")); ASSERT_GT(cf.GetStringWidth(L"ab"), cf.GetStringWidth(L"a")); |