#include "ui/gfx/platform_font_win.h"
#endif
-using base::ASCIIToUTF16;
-
namespace gfx {
namespace {
TEST_F(FontTest, LoadArialBold) {
Font cf("Arial", 16);
- Font bold(cf.DeriveFont(0, Font::BOLD));
+ Font bold(cf.Derive(0, Font::BOLD));
NativeFont native = bold.GetNativeFont();
EXPECT_TRUE(native);
EXPECT_EQ(bold.GetStyle(), Font::BOLD);
EXPECT_GT(cf.GetExpectedTextWidth(3), cf.GetExpectedTextWidth(2));
}
-TEST_F(FontTest, AvgCharWidth) {
- Font cf("Arial", 16);
- EXPECT_GT(cf.GetAverageCharacterWidth(), 0);
-}
-
-TEST_F(FontTest, Widths) {
- Font cf("Arial", 16);
- EXPECT_EQ(cf.GetStringWidth(base::string16()), 0);
- EXPECT_GT(cf.GetStringWidth(ASCIIToUTF16("a")),
- cf.GetStringWidth(base::string16()));
- EXPECT_GT(cf.GetStringWidth(ASCIIToUTF16("ab")),
- cf.GetStringWidth(ASCIIToUTF16("a")));
- EXPECT_GT(cf.GetStringWidth(ASCIIToUTF16("abc")),
- cf.GetStringWidth(ASCIIToUTF16("ab")));
-}
-
#if !defined(OS_WIN)
// On Windows, Font::GetActualFontNameForTesting() doesn't work well for now.
// http://crbug.com/327287
#endif
#if defined(OS_WIN)
-TEST_F(FontTest, DeriveFontResizesIfSizeTooSmall) {
+TEST_F(FontTest, DeriveResizesIfSizeTooSmall) {
Font cf("Arial", 8);
// The minimum font size is set to 5 in browser_main.cc.
ScopedMinimumFontSizeCallback minimum_size(5);
- Font derived_font = cf.DeriveFont(-4);
+ Font derived_font = cf.Derive(-4, cf.GetStyle());
EXPECT_EQ(5, derived_font.GetFontSize());
}
-TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) {
+TEST_F(FontTest, DeriveKeepsOriginalSizeIfHeightOk) {
Font cf("Arial", 8);
// The minimum font size is set to 5 in browser_main.cc.
ScopedMinimumFontSizeCallback minimum_size(5);
- Font derived_font = cf.DeriveFont(-2);
+ Font derived_font = cf.Derive(-2, cf.GetStyle());
EXPECT_EQ(6, derived_font.GetFontSize());
}
#endif // defined(OS_WIN)