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

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 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 247b2f3f1badeceb8ea6da060a8761013c1db106..10a905d479e5d71fad016e60da9ab6afe13557af 100644
--- a/ui/gfx/font_unittest.cc
+++ b/ui/gfx/font_unittest.cc
@@ -143,5 +143,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/canvas_unittest_mac.mm ('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