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 0d41845bbc8dee65ee09717f7837aa4703645ae6..8f50a34be0eda8cf813c6d5dccf8a6f235cebbd7 100644 |
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
@@ -7,6 +7,7 @@ |
#include "core/dom/Document.h" |
#include "core/dom/Element.h" |
#include "core/dom/Range.h" |
+#include "core/editing/Editor.h" |
#include "core/editing/FrameSelection.h" |
#include "core/events/MouseEvent.h" |
#include "core/frame/FrameView.h" |
@@ -379,6 +380,25 @@ TEST_F(InputMethodControllerTest, SetCompositionWithEmptyText) |
EXPECT_EQ(3u, controller().getSelectionOffsets().end()); |
} |
+TEST_F(InputMethodControllerTest, InsertLineBreakWhileComposingText) |
+{ |
+ Element* div = insertHTMLElement( |
+ "<div id='sample' contenteditable='true'></div>", |
+ "sample"); |
+ |
+ Vector<CompositionUnderline> underlines; |
+ underlines.append(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); |
+ controller().setComposition("hello", underlines, 5, 5); |
+ EXPECT_STREQ("hello", div->innerText().utf8().data()); |
+ EXPECT_EQ(5u, controller().getSelectionOffsets().start()); |
+ EXPECT_EQ(5u, controller().getSelectionOffsets().end()); |
+ |
+ frame().editor().insertLineBreak(); |
+ EXPECT_STREQ("\n\n", div->innerText().utf8().data()); |
+ EXPECT_EQ(1u, controller().getSelectionOffsets().start()); |
+ EXPECT_EQ(1u, controller().getSelectionOffsets().end()); |
+} |
+ |
TEST_F(InputMethodControllerTest, CompositionInputEventIsComposing) |
{ |
document().settings()->setScriptEnabled(true); |