Chromium Code Reviews| 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 cfce7ed4321ce2a651f7a175a04aecf55e470121..8d70b90580a4ccd3d17e69fb6abd415e6dd885a3 100644 |
| --- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
| @@ -115,6 +115,30 @@ TEST_F(InputMethodControllerTest, SetCompositionFromExistingText) |
| PlainTextRange plainTextRange(PlainTextRange::create(*div, *range)); |
| EXPECT_EQ(0u, plainTextRange.start()); |
| EXPECT_EQ(5u, plainTextRange.end()); |
| + |
| + controller().setComposition(String("hellobar"), underlines, 8, 8); |
| + range = controller().compositionRange(); |
| + EXPECT_EQ(0, range->startOffset()); |
| + EXPECT_EQ(8, range->endOffset()); |
| +} |
| + |
| +TEST_F(InputMethodControllerTest, SetCompositionKeepingStyle) |
| +{ |
| + // (UTF16) 0xac000 0xb098 0xb2e4 0xb77c = "가나다라" |
|
aelias_OOO_until_Jul13
2016/09/27 04:55:58
Can you also add a simpler test case appending and
yabinh
2016/09/27 08:47:20
Done.
|
| + Element* div = insertHTMLElement( |
| + "<div id='sample' contenteditable='true'><b>가나</b>다라</div>", "sample"); |
| + |
| + Vector<CompositionUnderline> underlines; |
| + underlines.append(CompositionUnderline(0, 4, Color(255, 0, 0), false, 0)); |
| + controller().setCompositionFromExistingText(underlines, 0, 4); |
| + |
| + // (UTF8) 0xEAB080 0xEB8298 0xEB8BA4 0xEB9E8C = "가나다람" |
| + controller().setComposition(String::fromUTF8("\xea\xb0\x80\xeb\x82\x98\xeb\x8b\xa4\xeb\x9e\x8c"), underlines, 4, 4); |
| + EXPECT_STREQ("<b>가나</b>다람", div->innerHTML().utf8().data()); |
| + |
| + // (UTF8) 0xEAB080 0xEB8298 0xEB8BA4 0xeb9dbc = "가나다라" |
| + controller().setComposition(String::fromUTF8("\xea\xb0\x80\xeb\x82\x98\xeb\x8b\xa4\xeb\x9d\xbc"), underlines, 4, 4); |
| + EXPECT_STREQ("<b>가나</b>다라", div->innerHTML().utf8().data()); |
| } |
| TEST_F(InputMethodControllerTest, SelectionOnConfirmExistingText) |
| @@ -485,7 +509,7 @@ TEST_F(InputMethodControllerTest, CompositionInputEventData) |
| document().setTitle(emptyString()); |
| controller().setComposition("ni", underlines, 0, 1); |
| - EXPECT_STREQ("beforeinput.data:ni;input.data:ni;", document().title().utf8().data()); |
| + EXPECT_STREQ("beforeinput.data:i;input.data:i;", document().title().utf8().data()); |
| document().setTitle(emptyString()); |
| controller().finishComposingText(InputMethodController::KeepSelection); |