Bug 1275371 - Add test for shift+backspace; r=esawin
authorJim Chen <nchen@mozilla.com>
Fri, 27 May 2016 14:29:15 -0400
changeset 338381 867bca2fa2a37ab87fa46045a1970d9f6dc23939
parent 338380 2870fc2fd1ce033c95e614ffc185625f56cf630e
child 338382 1ece2881d7b68ad3119803f1db6d66a4e403c5c7
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1275371
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275371 - Add test for shift+backspace; r=esawin
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testInputConnection.java
@@ -221,16 +221,39 @@ public class testInputConnection extends
             ic.finishComposingText();
             ic.deleteSurroundingText(1, 1);
             ic.endBatchEdit();
             assertTextAndSelectionAt("Can delete after committing", ic, "baoo", 2);
 
             ic.deleteSurroundingText(2, 2);
             assertTextAndSelectionAt("Can clear text", ic, "", 0);
 
+            // Bug 1275371 - shift+backspace should not forward delete on Android.
+            final KeyEvent delKey = new KeyEvent(KeyEvent.ACTION_DOWN,
+                                                 KeyEvent.KEYCODE_DEL);
+
+            ic.beginBatchEdit();
+            ic.commitText("foo", 1);
+            ic.setSelection(1, 1);
+            ic.endBatchEdit();
+            assertTextAndSelectionAt("Can commit text", ic, "foo", 1);
+
+            ic.sendKeyEvent(shiftKey);
+            ic.sendKeyEvent(delKey);
+            ic.sendKeyEvent(KeyEvent.changeAction(delKey, KeyEvent.ACTION_UP));
+            assertTextAndSelectionAt("Can backspace with shift+backspace", ic, "oo", 0);
+
+            ic.sendKeyEvent(delKey);
+            ic.sendKeyEvent(KeyEvent.changeAction(delKey, KeyEvent.ACTION_UP));
+            ic.sendKeyEvent(KeyEvent.changeAction(shiftKey, KeyEvent.ACTION_UP));
+            assertTextAndSelectionAt("Cannot forward delete with shift+backspace", ic, "oo", 0);
+
+            ic.deleteSurroundingText(0, 2);
+            assertTextAndSelectionAt("Can clear text", ic, "", 0);
+
             // Make sure we don't leave behind stale events for the following test.
             processGeckoEvents(ic);
             processInputConnectionEvents();
         }
     }
 
     /**
      * ResettingInputConnectionTest performs tests on the resetting input in