aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java20
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java6
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java5
-rw-r--r--tests/src/com/android/inputmethod/latin/PunctuationTests.java24
4 files changed, 30 insertions, 25 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 11eb6ab19..6c3cb16c7 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -30,7 +30,7 @@ public class InputLogicTests extends InputTestsBase {
final String WORD_TO_TYPE = "this";
final String EXPECTED_RESULT = "this";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1);
type(Keyboard.CODE_DELETE);
assertEquals("press suggestion then backspace", EXPECTED_RESULT,
@@ -44,7 +44,7 @@ public class InputLogicTests extends InputTestsBase {
type(WORD_TO_TYPE);
// Choose the auto-correction, which is always in position 0. For "tgis", the
// auto-correction should be "this".
- mLatinIME.pickSuggestionManually(0, WORD_TO_PICK);
+ pickSuggestionManually(0, WORD_TO_PICK);
mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1);
assertEquals("pick typed word over auto-correction then backspace", WORD_TO_PICK,
mTextView.getText().toString());
@@ -59,7 +59,7 @@ public class InputLogicTests extends InputTestsBase {
type(WORD_TO_TYPE);
// Choose the typed word, which should be in position 1 (because position 0 should
// be occupied by the "this" auto-correction, as checked by testAutoCorrect())
- mLatinIME.pickSuggestionManually(1, WORD_TO_TYPE);
+ pickSuggestionManually(1, WORD_TO_TYPE);
mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1);
assertEquals("pick typed word over auto-correction then backspace", WORD_TO_TYPE,
mTextView.getText().toString());
@@ -75,7 +75,7 @@ public class InputLogicTests extends InputTestsBase {
type(WORD_TO_TYPE);
// Choose the second suggestion, which should be in position 2 and should be "thus"
// when "tgis is typed.
- mLatinIME.pickSuggestionManually(2, WORD_TO_PICK);
+ pickSuggestionManually(2, WORD_TO_PICK);
mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1);
assertEquals("pick different suggestion then backspace", WORD_TO_PICK,
mTextView.getText().toString());
@@ -171,7 +171,7 @@ public class InputLogicTests extends InputTestsBase {
final String WORD_TO_TYPE = "this";
final String EXPECTED_RESULT = WORD_TO_TYPE;
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
assertEquals("no space after manual pick", EXPECTED_RESULT,
mTextView.getText().toString());
}
@@ -181,7 +181,7 @@ public class InputLogicTests extends InputTestsBase {
final String WORD2_TO_TYPE = "is";
final String EXPECTED_RESULT = "this is";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
type(WORD2_TO_TYPE);
assertEquals("manual pick then type", EXPECTED_RESULT, mTextView.getText().toString());
}
@@ -191,7 +191,7 @@ public class InputLogicTests extends InputTestsBase {
final String WORD2_TO_TYPE = "!";
final String EXPECTED_RESULT = "this!";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
type(WORD2_TO_TYPE);
assertEquals("manual pick then separator", EXPECTED_RESULT, mTextView.getText().toString());
}
@@ -201,7 +201,7 @@ public class InputLogicTests extends InputTestsBase {
final String WORD2_TO_TYPE = " is";
final String EXPECTED_RESULT = "this is";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
type(WORD2_TO_TYPE);
assertEquals("manual pick then space then type", EXPECTED_RESULT,
mTextView.getText().toString());
@@ -212,11 +212,11 @@ public class InputLogicTests extends InputTestsBase {
final String WORD2_TO_PICK = "is";
final String EXPECTED_RESULT = "this is";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
// Here we fake picking a word through bigram prediction. This test is taking
// advantage of the fact that Latin IME blindly trusts the caller of #pickSuggestionManually
// to actually pass the right string.
- mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
+ pickSuggestionManually(1, WORD2_TO_PICK);
assertEquals("manual pick then manual pick", EXPECTED_RESULT,
mTextView.getText().toString());
}
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
index b2b9601b6..78143ac5b 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
@@ -33,7 +33,7 @@ public class InputLogicTestsNonEnglish extends InputTestsBase {
final String EXPECTED_RESULT = "test !";
changeLanguage("fr");
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
type(WORD2_TO_TYPE);
assertEquals("manual pick then separator for French", EXPECTED_RESULT,
mTextView.getText().toString());
@@ -49,8 +49,8 @@ public class InputLogicTestsNonEnglish extends InputTestsBase {
runMessages();
assertTrue("type word then type space should display punctuation strip",
mLatinIME.isShowingPunctuationList());
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
assertEquals("type word then type space then punctuation from strip twice for French",
EXPECTED_RESULT, mTextView.getText().toString());
}
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 991635e3f..838effe2c 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -278,6 +278,11 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> {
waitForDictionaryToBeLoaded();
}
+ protected void pickSuggestionManually(final int index, final CharSequence suggestion) {
+ mLatinIME.pickSuggestionManually(index, suggestion,
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
+ }
// Helper to avoid writing the try{}catch block each time
protected static void sleep(final int milliseconds) {
diff --git a/tests/src/com/android/inputmethod/latin/PunctuationTests.java b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
index b907970f0..e1d4c46f8 100644
--- a/tests/src/com/android/inputmethod/latin/PunctuationTests.java
+++ b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
@@ -38,8 +38,8 @@ public class PunctuationTests extends InputTestsBase {
runMessages();
assertTrue("type word then type space should display punctuation strip",
mLatinIME.isShowingPunctuationList());
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
assertEquals("type word then type space then punctuation from strip twice",
EXPECTED_RESULT, mTextView.getText().toString());
} finally {
@@ -62,9 +62,9 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION_FROM_STRIP = "!";
final String EXPECTED_RESULT = "this!! is";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
- mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
type(WORD2_TO_TYPE);
assertEquals("pick word then pick punctuation twice then type", EXPECTED_RESULT,
mTextView.getText().toString());
@@ -75,8 +75,8 @@ public class PunctuationTests extends InputTestsBase {
final String WORD2_TO_PICK = "!is";
final String EXPECTED_RESULT = "this!is";
type(WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
- mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(1, WORD2_TO_PICK);
assertEquals("manual pick then manual pick a word with punct at start", EXPECTED_RESULT,
mTextView.getText().toString());
}
@@ -86,7 +86,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = ":";
final String EXPECTED_RESULT = "this:";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then colon",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -97,7 +97,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = "(";
final String EXPECTED_RESULT = "this (";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then open paren",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -108,7 +108,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = ")";
final String EXPECTED_RESULT = "this)";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then close paren",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -119,7 +119,7 @@ public class PunctuationTests extends InputTestsBase {
final String SPECIAL_KEY = ":-)";
final String EXPECTED_RESULT = "this :-)";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
mLatinIME.onTextInput(SPECIAL_KEY);
assertEquals("manually pick word then press the smiley key",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -130,7 +130,7 @@ public class PunctuationTests extends InputTestsBase {
final String SPECIAL_KEY = ".com";
final String EXPECTED_RESULT = "this.com";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
mLatinIME.onTextInput(SPECIAL_KEY);
assertEquals("manually pick word then press the .com key",
EXPECTED_RESULT, mTextView.getText().toString());