Skip to content
Snippets Groups Projects
Commit e38097dc authored by Jean Chalard's avatar Jean Chalard
Browse files

Add tests for start composing

Bug: 10403176
Change-Id: I510bf1dccf6795426e6fb1b36181b18039a0f435
parent 2448159a
No related branches found
No related tags found
No related merge requests found
...@@ -305,5 +305,33 @@ public class InputLogicTests extends InputTestsBase { ...@@ -305,5 +305,33 @@ public class InputLogicTests extends InputTestsBase {
assertEquals("resume suggestion on backspace", 8, assertEquals("resume suggestion on backspace", 8,
BaseInputConnection.getComposingSpanEnd(mEditText.getText())); BaseInputConnection.getComposingSpanEnd(mEditText.getText()));
} }
private void helperTestComposing(final String wordToType, final boolean shouldBeComposing) {
mEditText.setText("");
type(wordToType);
assertEquals("start composing inside text", shouldBeComposing ? 0 : -1,
BaseInputConnection.getComposingSpanStart(mEditText.getText()));
assertEquals("start composing inside text", shouldBeComposing ? wordToType.length() : -1,
BaseInputConnection.getComposingSpanEnd(mEditText.getText()));
}
public void testStartComposing() {
// Should start composing on a letter
helperTestComposing("a", true);
type(" "); // To reset the composing state
// Should not start composing on quote
helperTestComposing("'", false);
type(" ");
helperTestComposing("'-", false);
type(" ");
// Should not start composing on dash
helperTestComposing("-", false);
type(" ");
helperTestComposing("-'", false);
type(" ");
helperTestComposing("a-", true);
type(" ");
helperTestComposing("a'", true);
}
// TODO: Add some tests for non-BMP characters // TODO: Add some tests for non-BMP characters
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment