Change string16 to std::string in the gfx::Font() interface.
Most consumers on all platforms (including windows!) were converting the font family/GetFontName() result to UTF8. (Windows was still having to convert for the SkTypeface calls.) On Linux, we're performing a UTF16ToUTF8 on each string print (and this is showing up in pprof output.)
BUG=100803
TEST=none
Review URL: http://codereview.chromium.org/8392017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107659 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc
index 06e260e..d495213 100644
--- a/ui/gfx/font_unittest.cc
+++ b/ui/gfx/font_unittest.cc
@@ -57,17 +57,17 @@
TEST_F(FontTest, LoadArial) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
gfx::NativeFont native = cf.GetNativeFont();
ASSERT_TRUE(native);
ASSERT_EQ(cf.GetStyle(), Font::NORMAL);
ASSERT_EQ(cf.GetFontSize(), 16);
- ASSERT_EQ(cf.GetFontName(), ASCIIToUTF16("Arial"));
+ ASSERT_EQ(cf.GetFontName(), "Arial");
FreeIfNecessary(native);
}
TEST_F(FontTest, LoadArialBold) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
Font bold(cf.DeriveFont(0, Font::BOLD));
gfx::NativeFont native = bold.GetNativeFont();
ASSERT_TRUE(native);
@@ -76,20 +76,20 @@
}
TEST_F(FontTest, Ascent) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
ASSERT_GT(cf.GetBaseline(), 2);
ASSERT_LE(cf.GetBaseline(), 22);
}
TEST_F(FontTest, Height) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
ASSERT_GE(cf.GetHeight(), 16);
// TODO(akalin): Figure out why height is so large on Linux.
ASSERT_LE(cf.GetHeight(), 26);
}
TEST_F(FontTest, AvgWidths) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
ASSERT_EQ(cf.GetExpectedTextWidth(0), 0);
ASSERT_GT(cf.GetExpectedTextWidth(1), cf.GetExpectedTextWidth(0));
ASSERT_GT(cf.GetExpectedTextWidth(2), cf.GetExpectedTextWidth(1));
@@ -97,12 +97,12 @@
}
TEST_F(FontTest, AvgCharWidth) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
ASSERT_GT(cf.GetAverageCharacterWidth(), 0);
}
TEST_F(FontTest, Widths) {
- Font cf(ASCIIToUTF16("Arial"), 16);
+ Font cf("Arial", 16);
ASSERT_EQ(cf.GetStringWidth(ASCIIToUTF16("")), 0);
ASSERT_GT(cf.GetStringWidth(ASCIIToUTF16("a")),
cf.GetStringWidth(ASCIIToUTF16("")));
@@ -114,7 +114,7 @@
#if defined(OS_WIN)
TEST_F(FontTest, DeriveFontResizesIfSizeTooSmall) {
- Font cf(L"Arial", 8);
+ Font cf("Arial", 8);
// The minimum font size is set to 5 in browser_main.cc.
ScopedMinimumFontSizeCallback minimum_size(5);
@@ -123,7 +123,7 @@
}
TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) {
- Font cf(L"Arial", 8);
+ Font cf("Arial", 8);
// The minimum font size is set to 5 in browser_main.cc.
ScopedMinimumFontSizeCallback minimum_size(5);