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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 2081273002: RenderText: Fix crash itemizing obscured emoji. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 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/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_unittest.cc
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index 5404dbcaf2409b39d42f88095a15d8032f542b6e..42c299b41b36f0a0022a06491b8eb9508dba45e9 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -649,6 +649,19 @@ TEST_F(RenderTextTest, RevealObscuredText) {
EXPECT_EQ(valid_expect_5_and_6, render_text->GetDisplayText());
}
+TEST_F(RenderTextTest, ObscuredEmoji) {
+ // Ensures text itemization doesn't crash on obscured multi-char glyphs.
+ std::unique_ptr<RenderText> render_text(RenderText::CreateInstance());
+ render_text->SetObscured(true);
+ gfx::Canvas canvas;
+ // Test the "Grinning face with smiling eyes" character followed by 'y'.
+ render_text->SetText(UTF8ToUTF16("\xF0\x9F\x98\x81y"));
+ render_text->Draw(&canvas);
+ // Test two "Camera" characters in a row.
+ render_text->SetText(UTF8ToUTF16("\xF0\x9F\x93\xB7\xF0\x9F\x93\xB7"));
+ render_text->Draw(&canvas);
+}
+
// TODO(PORT): Fails for RenderTextMac.
#if !defined(OS_MACOSX)
« no previous file with comments | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698