Enables font-related unittests again.
Enables the unittests which got disabled because Symbol font was missing on trybots.
See http://crrev.com/67523002
Symbol font has been installed on trybots. See http://crbug.com/320391
BUG=316955
TEST=none
Review URL: https://codereview.chromium.org/79263004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240048 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc
index 2fe6193..2fdaab87 100644
--- a/ui/gfx/font_unittest.cc
+++ b/ui/gfx/font_unittest.cc
@@ -5,6 +5,7 @@
#include "ui/gfx/font.h"
#include "base/strings/string16.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -63,6 +64,7 @@
EXPECT_EQ(cf.GetStyle(), Font::NORMAL);
EXPECT_EQ(cf.GetFontSize(), 16);
EXPECT_EQ(cf.GetFontName(), "Arial");
+ EXPECT_EQ("arial", StringToLowerASCII(cf.GetActualFontNameForTesting()));
FreeIfNecessary(native);
}
@@ -72,6 +74,7 @@
NativeFont native = bold.GetNativeFont();
EXPECT_TRUE(native);
EXPECT_EQ(bold.GetStyle(), Font::BOLD);
+ EXPECT_EQ("arial", StringToLowerASCII(cf.GetActualFontNameForTesting()));
FreeIfNecessary(native);
}
@@ -123,6 +126,22 @@
cf.GetStringWidth(ASCIIToUTF16("ab")));
}
+#if !defined(OS_WIN)
+// On Windows, Font::GetActualFontNameForTesting() doesn't work well for now.
+// http://crbug.com/327287
+TEST_F(FontTest, GetActualFontNameForTesting) {
+ Font arial("Arial", 16);
+ EXPECT_EQ("arial", StringToLowerASCII(arial.GetActualFontNameForTesting()));
+ Font symbol("Symbol", 16);
+ EXPECT_EQ("symbol", StringToLowerASCII(symbol.GetActualFontNameForTesting()));
+
+ const char* const invalid_font_name = "no_such_font_name";
+ Font fallback_font(invalid_font_name, 16);
+ EXPECT_NE(invalid_font_name,
+ StringToLowerASCII(fallback_font.GetActualFontNameForTesting()));
+}
+#endif
+
#if defined(OS_WIN)
TEST_F(FontTest, DeriveFontResizesIfSizeTooSmall) {
Font cf("Arial", 8);