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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp

Issue 2634243002: Fix a bug when inputting text after grapheme cluster (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
index 487ec7c886edcf44a53ac3fe54ea6214c5d952b3..106b8accaecba1c089f187bc5c12753109d12a26 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -183,6 +183,26 @@ TEST_F(InputMethodControllerTest, SetCompositionFromExistingText) {
EXPECT_EQ(5u, plainTextRange.end());
}
+TEST_F(InputMethodControllerTest, SetCompositionAfterEmoji) {
+ // "trophy" = U+1F3C6 = 0xF0 0x9F 0x8F 0x86 (UTF8).
+ Element* div = insertHTMLElement(
+ "<div id='sample' contenteditable>&#x1f3c6</div>", "sample");
+
+ Vector<CompositionUnderline> underlines;
+ underlines.push_back(CompositionUnderline(0, 2, Color(255, 0, 0), false, 0));
+
+ document().updateStyleAndLayout();
+ controller().setEditableSelectionOffsets(PlainTextRange(2, 2));
+ EXPECT_EQ(2, frame().selection().start().computeOffsetInContainerNode());
+ EXPECT_EQ(2, frame().selection().end().computeOffsetInContainerNode());
+
+ controller().setComposition(String("a"), underlines, 1, 1);
+ EXPECT_STREQ("\xF0\x9F\x8F\x86\x61", div->innerText().utf8().data());
+
+ controller().setComposition(String("ab"), underlines, 2, 2);
+ EXPECT_STREQ("\xF0\x9F\x8F\x86\x61\x62", div->innerText().utf8().data());
+}
+
TEST_F(InputMethodControllerTest, SetCompositionKeepingStyle) {
Element* div = insertHTMLElement(
"<div id='sample' "
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698