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

Unified Diff: ui/gfx/font_unittest.cc

Issue 79263004: Enables font-related unittests again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 7 years 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_unittest.cc ('k') | ui/gfx/platform_font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_unittest.cc
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc
index 2fe61939d14bf6e9f7d8e60583a7b38a3e410c40..2fdaab872f4ce758a293e09ba8e1fabd2ee209d3 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 @@ TEST_F(FontTest, LoadArial) {
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 @@ TEST_F(FontTest, LoadArialBold) {
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 @@ TEST_F(FontTest, Widths) {
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);
« no previous file with comments | « ui/gfx/font_list_unittest.cc ('k') | ui/gfx/platform_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698