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

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: Store Position objects as local variables... Created 4 years, 7 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 | « no previous file | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75809c5eed25af2fe6f5d46f93d4f5d330b78796..c49d25aeba12b87378f60b56bc7893f443d49091 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
@@ -21,6 +21,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.UrlUtils;
@@ -151,6 +152,55 @@ public class ImeTest extends ContentShellTestBase {
assertTextsAroundCursor("he", "", "llo");
}
+ // When newCursorPosition != 1, setComposingText doesn't work for ReplicaInputConnection
+ // because there is a bug in BaseInputConnection.
+ @CommandLineFlags.Add("enable-features=ImeThread")
+ @SmallTest
+ @Feature({"TextInput", "Main"})
+ public void testSetComposingTextForDifferentnewCursorPositions() throws Throwable {
+ // 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 exceeds the left boundary.
+ setComposingText("cdef", -100);
+ waitAndVerifyUpdateSelection(2, 0, 0, 2, 6);
+
+ // Cursor is on the left boundary.
+ setComposingText("cd", -2);
+ waitAndVerifyUpdateSelection(3, 0, 0, 2, 4);
+
+ // Cursor is between the left boundary and the composing text.
+ setComposingText("cd", -1);
+ waitAndVerifyUpdateSelection(4, 1, 1, 2, 4);
+
+ // Cursor is on the left of composing text.
+ setComposingText("cd", 0);
+ waitAndVerifyUpdateSelection(5, 2, 2, 2, 4);
+
+ finishComposingText();
+ waitAndVerifyUpdateSelection(6, 2, 2, -1, -1);
+
+ // Cursor is on the right of composing text.
+ setComposingText("ef", 1);
+ waitAndVerifyUpdateSelection(7, 4, 4, 2, 4);
+
+ // Cursor is between the composing text and the right boundary.
+ setComposingText("ef", 2);
+ waitAndVerifyUpdateSelection(8, 5, 5, 2, 4);
+
+ // Cursor is on the right boundary.
+ setComposingText("ef", 3);
+ waitAndVerifyUpdateSelection(9, 6, 6, 2, 4);
+
+ // Cursor exceeds the right boundary.
+ setComposingText("efgh", 100);
+ waitAndVerifyUpdateSelection(10, 8, 8, 2, 6);
+ }
+
@SmallTest
@Feature({"TextInput", "Main"})
public void testCommitWhileComposingText() throws Throwable {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698