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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 1847583003: Fix setComposingText when newCursorPosition != 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some C++ unit tests. Created 4 years, 8 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
Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
index d8c1eafd3d0bd5bfcd57611609f6201e431798f5..5a97b5e6891c80860a06c19448c5254d7e73f5a4 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -104,6 +104,44 @@ public class ImeTest extends ContentShellTestBase {
resetAllStates();
}
+ @SmallTest
+ @Feature({"TextInput", "Main"})
+ public void testSetComposingTextForDifferentnewCursorPositions() throws Throwable {
+ // When newCursorPosition != 1, setComposingText doesn't work for ReplicaInputConnection
+ // because there is a bug in BaseInputConnection.
+ if (!usingReplicaInputConnection()) {
+ // Cursor is on the right of composing text when newCursorPosition > 0
+ setComposingText("ab", 1);
+ waitAndVerifyUpdateSelection(0, 2, 2, 0, 2);
+
+ finishComposingText();
+ waitAndVerifyUpdateSelection(1, 2, 2, -1, -1);
+
+ // Cursor is on the left of composing text when newCursorPosition <= 0
+ setComposingText("cd", 0);
+ waitAndVerifyUpdateSelection(2, 2, 2, 2, 4);
+
+ // Cursor is on the left boundary
Changwan Ryu 2016/04/07 11:46:19 for the completeness of tests, could you also add
+ setComposingText("cd", -2);
+ waitAndVerifyUpdateSelection(3, 0, 0, 2, 4);
+
+ // Cursor exceeds the left boundary
+ setComposingText("cdef", -10);
+ waitAndVerifyUpdateSelection(4, 0, 0, 2, 6);
+
+ finishComposingText();
+ waitAndVerifyUpdateSelection(5, 0, 0, -1, -1);
+
+ // Cursor is on the right boundary
Changwan Ryu 2016/04/07 11:46:18 ditto
+ setComposingText("gh", 7);
+ waitAndVerifyUpdateSelection(6, 8, 8, 0, 2);
+
+ // Cursor exceeds the right boundary
+ setComposingText("ghij", 20);
+ waitAndVerifyUpdateSelection(7, 10, 10, 0, 4);
+ }
+ }
+
@MediumTest
@Feature({"TextInput", "Main"})
public void testKeyboardDismissedAfterClickingGo() throws Throwable {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | third_party/WebKit/Source/core/editing/PlainTextRange.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698