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

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

Issue 2568093003: Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText() (Closed)
Patch Set: Fix commitText() logic (I think) Created 4 years 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: 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 d3e75f53cfb9b944f6abb23d6cf3d14b33c7f226..e83db8601041f829b35a0c95ac88f521d447aead 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -284,7 +284,7 @@ TEST_F(InputMethodControllerTest, CommitTextKeepingStyle) {
underlines.push_back(CompositionUnderline(3, 12, Color(255, 0, 0), false, 0));
controller().setCompositionFromExistingText(underlines, 3, 12);
- controller().commitText(String("123789"), 0);
+ controller().commitText(String("123789"), underlines, 0);
EXPECT_STREQ("abc1<b>2</b>37<b>8</b>9", div->innerHTML().utf8().data());
}
@@ -891,7 +891,9 @@ TEST_F(InputMethodControllerTest, InsertLineBreakAfterConfirmingText) {
Element* div =
insertHTMLElement("<div id='sample' contenteditable></div>", "sample");
- controller().commitText("hello", 0);
+ Vector<CompositionUnderline> underlines;
+ underlines.append(CompositionUnderline(0, 2, Color(255, 0, 0), false, 0));
+ controller().commitText("hello", underlines, 0);
EXPECT_STREQ("hello", div->innerText().utf8().data());
controller().setEditableSelectionOffsets(PlainTextRange(2, 2));
@@ -1004,7 +1006,7 @@ TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) {
// Insert new text without previous composition.
document().setTitle(emptyString());
document().updateStyleAndLayout();
- controller().commitText("hello", 0);
+ controller().commitText("hello", underlines, 0);
EXPECT_STREQ("beforeinput.data:hello;input.data:hello;",
document().title().utf8().data());
@@ -1016,7 +1018,7 @@ TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) {
// Insert new text with previous composition.
document().setTitle(emptyString());
document().updateStyleAndLayout();
- controller().commitText("hello", 1);
+ controller().commitText("hello", underlines, 1);
EXPECT_STREQ(
"beforeinput.data:hello;input.data:hello;compositionend.data:hello;",
document().title().utf8().data());
@@ -1032,7 +1034,7 @@ TEST_F(InputMethodControllerTest, CompositionInputEventForInsertEmptyText) {
// Insert empty text without previous composition.
document().setTitle(emptyString());
document().updateStyleAndLayout();
- controller().commitText("", 0);
+ controller().commitText("", underlines, 0);
EXPECT_STREQ("", document().title().utf8().data());
document().setTitle(emptyString());
@@ -1043,7 +1045,7 @@ TEST_F(InputMethodControllerTest, CompositionInputEventForInsertEmptyText) {
// Insert empty text with previous composition.
document().setTitle(emptyString());
document().updateStyleAndLayout();
- controller().commitText("", 1);
+ controller().commitText("", underlines, 1);
EXPECT_STREQ("beforeinput.data:;compositionend.data:;",
document().title().utf8().data());
}
@@ -1080,7 +1082,7 @@ TEST_F(InputMethodControllerTest, CompositionEndEventForInsert) {
// Insert new text with previous composition. Note that it moves the caret to
// [4,4] before firing 'compositonend' event.
document().updateStyleAndLayout();
- controller().commitText("hello", -1);
+ controller().commitText("hello", underlines, -1);
document().updateStyleAndLayout();
EXPECT_EQ(3u, controller().getSelectionOffsets().start());
EXPECT_EQ(3u, controller().getSelectionOffsets().end());

Powered by Google App Engine
This is Rietveld 408576698