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

Unified Diff: ui/gfx/font_unittest.cc

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes per feedback plus new tests Created 7 years, 3 months 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
Index: ui/gfx/font_unittest.cc
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc
index 6b5cb798657b250450f6192ac53be3a73482a69a..473cfb552299d1928f32903a3c14a646ca348c13 100644
--- a/ui/gfx/font_unittest.cc
+++ b/ui/gfx/font_unittest.cc
@@ -132,5 +132,20 @@ TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) {
}
#endif // defined(OS_WIN)
+#if defined(OS_MACOSX)
+TEST_F(FontTest, FractionalWidth) {
+ Font cf("Arial", 16);
+
+ float width = cf.GetAverageCharacterWidth();
+ EXPECT_GT(width - static_cast<int>(width), 0);
+
+ width = cf.GetExpectedTextWidth(1);
+ EXPECT_GT(width - static_cast<int>(width), 0);
+
+ width = cf.GetStringWidth(ASCIIToUTF16("This is a test"));
+ EXPECT_GT(width - static_cast<int>(width), 0);
+}
+#endif
+
} // namespace
} // namespace gfx
« ui/gfx/font.h ('K') | « ui/gfx/font_list.cc ('k') | ui/gfx/platform_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698