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

Unified Diff: ui/gfx/font_fallback_mac_unittest.cc

Issue 2927953003: Use CTFontCreateForString for RenderTextHarfbuzz on Mac (Closed)
Patch Set: Fix views::Label tests Created 3 years, 6 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
« no previous file with comments | « ui/gfx/font_fallback_mac.mm ('k') | ui/gfx/font_fallback_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_fallback_mac_unittest.cc
diff --git a/ui/gfx/font_fallback_mac_unittest.cc b/ui/gfx/font_fallback_mac_unittest.cc
index ed0c7390cd34d58f73ad8567bd1b6405ffff0d97..8bdea86c271df1b7ee0c3109c0a8378a41f5493d 100644
--- a/ui/gfx/font_fallback_mac_unittest.cc
+++ b/ui/gfx/font_fallback_mac_unittest.cc
@@ -4,6 +4,7 @@
#include "ui/gfx/font_fallback.h"
+#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/font.h"
@@ -12,7 +13,7 @@ namespace gfx {
// A targeted test for GetFallbackFonts on Mac. It uses a system API that
// only became publicly available in the 10.8 SDK. This test is to ensure it
// behaves sensibly on all supported OS versions.
-GTEST_TEST(FontFallbackMacTest, GetFallbackFonts) {
+TEST(FontFallbackMacTest, GetFallbackFonts) {
Font font("Arial", 12);
std::vector<Font> fallback_fonts = GetFallbackFonts(font);
// If there is only one fallback, it means the only fallback is the font
@@ -20,4 +21,20 @@ GTEST_TEST(FontFallbackMacTest, GetFallbackFonts) {
EXPECT_LT(1u, fallback_fonts.size());
}
+// Sanity check GetFallbackFont() behavior on Mac. This test makes assumptions
+// about font properties and availability on specific macOS versions.
+TEST(FontFallbackMacTest, GetFallbackFont) {
+ Font arial("Helvetica", 12);
+ const base::string16 ascii = base::ASCIIToUTF16("abc");
+ const base::string16 hebrew = base::WideToUTF16(L"\x5d0\x5d1\x5d2");
+ const base::string16 emoji = base::UTF8ToUTF16("😋");
+
+ gfx::Font fallback;
+ EXPECT_FALSE(GetFallbackFont(arial, ascii.data(), ascii.size(), &fallback));
+ EXPECT_TRUE(GetFallbackFont(arial, hebrew.data(), hebrew.size(), &fallback));
+ EXPECT_EQ("Lucida Grande", fallback.GetFontName());
+ EXPECT_TRUE(GetFallbackFont(arial, emoji.data(), emoji.size(), &fallback));
+ EXPECT_EQ("Apple Color Emoji", fallback.GetFontName());
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/font_fallback_mac.mm ('k') | ui/gfx/font_fallback_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698