We ship with English, so we can't unit test French

Change-Id: I20a470a18ca0cd47fe7588958be904eb23fdf1a2
main
Dan Zivkovic 2015-03-23 14:42:10 -07:00
parent 3e792f61ad
commit ffd808b446
2 changed files with 8 additions and 52 deletions

View File

@ -645,22 +645,6 @@ public class InputLogicTests extends InputTestsBase {
mEditText.getText().toString()); mEditText.getText().toString());
} }
public void testSwitchLanguages() {
final String WORD_TO_TYPE_FIRST_PART = "com";
final String WORD_TO_TYPE_SECOND_PART = "md";
final String EXPECTED_RESULT = "comme";
changeLanguage("en");
type(WORD_TO_TYPE_FIRST_PART);
changeLanguage("fr");
runMessages();
type(WORD_TO_TYPE_SECOND_PART);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
runMessages();
final SuggestedWords suggestedWords = mLatinIME.getSuggestedWordsForTest();
assertEquals("Suggestions updated after switching languages",
EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(1) : null);
}
public void testBasicGesture() { public void testBasicGesture() {
gesture("this"); gesture("this");
assertEquals("this", mEditText.getText().toString()); assertEquals("this", mEditText.getText().toString());
@ -743,18 +727,10 @@ public class InputLogicTests extends InputTestsBase {
type(" "); type(" ");
typeWordAndPutCursorInside(WORD_TO_TYPE, cursorPos + 1 /* startPos */); typeWordAndPutCursorInside(WORD_TO_TYPE, cursorPos + 1 /* startPos */);
type(Constants.CODE_DELETE); type(Constants.CODE_DELETE);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
ensureComposingSpanPos("delete while in the middle of a word cancels composition", -1, -1); ensureComposingSpanPos("delete while in the middle of a word cancels composition", -1, -1);
} }
public void testAutoCorrectForFrench() {
final String STRING_TO_TYPE = "irq ";
final String EXPECTED_RESULT = "ir a ";
changeLanguage("es");
type(STRING_TO_TYPE);
assertEquals("simple auto-correct for Spanish", EXPECTED_RESULT,
mEditText.getText().toString());
}
public void testManualPickThenSeparatorForFrench() { public void testManualPickThenSeparatorForFrench() {
final String WORD1_TO_TYPE = "test"; final String WORD1_TO_TYPE = "test";
final String WORD2_TO_TYPE = "!"; final String WORD2_TO_TYPE = "!";
@ -780,13 +756,12 @@ public class InputLogicTests extends InputTestsBase {
mEditText.getText().toString()); mEditText.getText().toString());
} }
public void testWordThenSpaceThenPunctuationFromStripTwiceForFrench() { public void testWordThenSpaceThenPunctuationFromStripTwice() {
setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, false, true); setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, false, true);
final String WORD_TO_TYPE = "test "; final String WORD_TO_TYPE = "test ";
final String PUNCTUATION_FROM_STRIP = "!"; final String PUNCTUATION_FROM_STRIP = "!";
final String EXPECTED_RESULT = "test !!"; final String EXPECTED_RESULT = "test!! ";
changeLanguage("fr");
type(WORD_TO_TYPE); type(WORD_TO_TYPE);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS); sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
runMessages(); runMessages();
@ -794,14 +769,12 @@ public class InputLogicTests extends InputTestsBase {
mLatinIME.getSuggestedWordsForTest().isPunctuationSuggestions()); mLatinIME.getSuggestedWordsForTest().isPunctuationSuggestions());
pickSuggestionManually(PUNCTUATION_FROM_STRIP); pickSuggestionManually(PUNCTUATION_FROM_STRIP);
pickSuggestionManually(PUNCTUATION_FROM_STRIP); pickSuggestionManually(PUNCTUATION_FROM_STRIP);
assertEquals("type word then type space then punctuation from strip twice for French", assertEquals(EXPECTED_RESULT, mEditText.getText().toString());
EXPECTED_RESULT, mEditText.getText().toString());
} }
public void testWordThenSpaceDisplaysPredictions() { public void testWordThenSpaceDisplaysPredictions() {
final String WORD_TO_TYPE = "beaujolais "; final String WORD_TO_TYPE = "Barack ";
final String EXPECTED_RESULT = "nouveau"; final String EXPECTED_RESULT = "Obama";
changeLanguage("fr");
type(WORD_TO_TYPE); type(WORD_TO_TYPE);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS); sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
runMessages(); runMessages();
@ -809,22 +782,4 @@ public class InputLogicTests extends InputTestsBase {
assertEquals("type word then type space yields predictions for French", assertEquals("type word then type space yields predictions for French",
EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null); EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
} }
public void testAutoCorrectForGerman() {
final String STRING_TO_TYPE = "unf ";
final String EXPECTED_RESULT = "und ";
changeLanguage("de");
type(STRING_TO_TYPE);
assertEquals("simple auto-correct for German", EXPECTED_RESULT,
mEditText.getText().toString());
}
public void testAutoCorrectWithUmlautForGerman() {
final String STRING_TO_TYPE = "ueber ";
final String EXPECTED_RESULT = "über ";
changeLanguage("de");
type(STRING_TO_TYPE);
assertEquals("auto-correct with umlaut for German", EXPECTED_RESULT,
mEditText.getText().toString());
}
} }

View File

@ -66,7 +66,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS = 200; protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS = 200;
// We wait for gesture computation for this delay // We wait for gesture computation for this delay
protected static final int DELAY_TO_WAIT_FOR_GESTURE_MILLIS = 200; protected static final int DELAY_TO_WAIT_FOR_GESTURE_MILLIS = 200;
private final int TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS = 60; // If a dictionary takes longer to load, we could have serious problems.
private final int TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS = 5;
// Type for a test phony dictionary // Type for a test phony dictionary
private static final String TYPE_TEST = "test"; private static final String TYPE_TEST = "test";