From 9218e320f0fe2badcde5527ca4fb4c127ee779bc Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Tue, 31 Mar 2015 18:20:27 -0400 Subject: [PATCH] Bug 1149189 - Add test for setting the same composing text; r=esawin --- .../base/tests/testInputConnection.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mobile/android/base/tests/testInputConnection.java b/mobile/android/base/tests/testInputConnection.java index 5217b3166cc..661a6718fbd 100644 --- a/mobile/android/base/tests/testInputConnection.java +++ b/mobile/android/base/tests/testInputConnection.java @@ -89,6 +89,26 @@ public class testInputConnection extends UITest { // Test getTextAfterCursor fAssertEquals("Can retrieve text after cursor", "", ic.getTextAfterCursor(3, 0)); + + ic.deleteSurroundingText(6, 0); + assertTextAndSelectionAt("Can clear text", ic, "", 0); + + // Bug 1133802, duplication when setting the same composing text more than once. + ic.setComposingText("foo", 1); + assertTextAndSelectionAt("Can set the composing text", ic, "foo", 3); + ic.setComposingText("foo", 1); + assertTextAndSelectionAt("Can set the same composing text", ic, "foo", 3); + ic.setComposingText("bar", 1); + assertTextAndSelectionAt("Can set different composing text", ic, "bar", 3); + ic.setComposingText("bar", 1); + assertTextAndSelectionAt("Can set the same composing text", ic, "bar", 3); + ic.setComposingText("bar", 1); + assertTextAndSelectionAt("Can set the same composing text again", ic, "bar", 3); + ic.finishComposingText(); + assertTextAndSelectionAt("Can finish composing text", ic, "bar", 3); + + ic.deleteSurroundingText(3, 0); + assertTextAndSelectionAt("Can clear text", ic, "", 0); } } }