Index: ui/gfx/font_unittest.cc |
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc |
index 247b2f3f1badeceb8ea6da060a8761013c1db106..6f9324e27924bfa82d085b53ff4f69ee1be7d0bc 100644 |
--- a/ui/gfx/font_unittest.cc |
+++ b/ui/gfx/font_unittest.cc |
@@ -143,5 +143,27 @@ TEST_F(FontTest, DeriveFontKeepsOriginalSizeIfHeightOk) { |
} |
#endif // defined(OS_WIN) |
+#if defined(OS_MACOSX) |
+// TODO(ios): This test fails on iOS because iOS version of gfx::GetStringWidth |
+// that calls [NSString sizeWithFont] returns the rounded string width. |
+#if defined(OS_IOS) |
+#define MAYBE_FractionalWidth DISABLED_FractionalWidth |
+#else |
+#define MAYBE_FractionalWidth FractionalWidth |
+#endif |
+TEST_F(FontTest, MAYBE_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 |