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

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

Issue 2206923002: Change InputMethodController#setSelectionOffsets() to use NotUserTriggered parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a unit test. Created 4 years, 4 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 | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | 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 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);
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698