зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1123514 - Add test for wrong offset calculation; r=esawin
Add a test that creates conditions for wrong offset calculation and potentially causes an exception.
This commit is contained in:
Родитель
e13c48fba9
Коммит
107b9eb939
|
@ -127,6 +127,17 @@
|
|||
setSelection(3); // Offsets that testInputConnection.java expects.
|
||||
},
|
||||
|
||||
test_bug1123514: function() {
|
||||
document.activeElement.addEventListener('input', function test_bug1123514_listener() {
|
||||
this.removeEventListener('input', test_bug1123514_listener);
|
||||
|
||||
// Only works on input and textarea.
|
||||
if (this.value === 'b') {
|
||||
this.value = 'abc';
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
focus_resetting_input: function(val) {
|
||||
resetting_input.value = val;
|
||||
resetting_input.focus();
|
||||
|
|
|
@ -243,6 +243,19 @@ public class testInputConnection extends JavascriptBridgeTest {
|
|||
ic.deleteSurroundingText(0, 2);
|
||||
assertTextAndSelectionAt("Can clear text", ic, "", 0);
|
||||
|
||||
// Bug 1123514 - exception due to incorrect text replacement offsets.
|
||||
getJS().syncCall("test_bug1123514");
|
||||
// Gecko will change text to 'abc' when we input 'b', potentially causing
|
||||
// incorrect calculation of text replacement offsets.
|
||||
ic.commitText("b", 1);
|
||||
// We don't assert text here because this test only works for input/textarea,
|
||||
// so an assertion would fail for contentEditable/designMode.
|
||||
processGeckoEvents();
|
||||
processInputConnectionEvents();
|
||||
|
||||
ic.deleteSurroundingText(2, 1);
|
||||
assertTextAndSelectionAt("Can clear text", ic, "", 0);
|
||||
|
||||
// Make sure we don't leave behind stale events for the following test.
|
||||
processGeckoEvents();
|
||||
processInputConnectionEvents();
|
||||
|
|
Загрузка…
Ссылка в новой задаче