Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffd808b4 authored by Dan Zivkovic's avatar Dan Zivkovic
Browse files

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

Change-Id: I20a470a18ca0cd47fe7588958be904eb23fdf1a2
parent 3e792f61
Loading
Loading
Loading
Loading
+6 −51
Original line number Diff line number Diff line
@@ -645,22 +645,6 @@ public class InputLogicTests extends InputTestsBase {
                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() {
        gesture("this");
        assertEquals("this", mEditText.getText().toString());
@@ -743,18 +727,10 @@ public class InputLogicTests extends InputTestsBase {
        type(" ");
        typeWordAndPutCursorInside(WORD_TO_TYPE, cursorPos + 1 /* startPos */);
        type(Constants.CODE_DELETE);
        sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
        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() {
        final String WORD1_TO_TYPE = "test";
        final String WORD2_TO_TYPE = "!";
@@ -780,13 +756,12 @@ public class InputLogicTests extends InputTestsBase {
                mEditText.getText().toString());
    }

    public void testWordThenSpaceThenPunctuationFromStripTwiceForFrench() {
    public void testWordThenSpaceThenPunctuationFromStripTwice() {
        setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, false, true);

        final String WORD_TO_TYPE = "test ";
        final String PUNCTUATION_FROM_STRIP = "!";
        final String EXPECTED_RESULT = "test!! ";
        changeLanguage("fr");
        type(WORD_TO_TYPE);
        sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
        runMessages();
@@ -794,14 +769,12 @@ public class InputLogicTests extends InputTestsBase {
                mLatinIME.getSuggestedWordsForTest().isPunctuationSuggestions());
        pickSuggestionManually(PUNCTUATION_FROM_STRIP);
        pickSuggestionManually(PUNCTUATION_FROM_STRIP);
        assertEquals("type word then type space then punctuation from strip twice for French",
                EXPECTED_RESULT, mEditText.getText().toString());
        assertEquals(EXPECTED_RESULT, mEditText.getText().toString());
    }

    public void testWordThenSpaceDisplaysPredictions() {
        final String WORD_TO_TYPE = "beaujolais ";
        final String EXPECTED_RESULT = "nouveau";
        changeLanguage("fr");
        final String WORD_TO_TYPE = "Barack ";
        final String EXPECTED_RESULT = "Obama";
        type(WORD_TO_TYPE);
        sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS);
        runMessages();
@@ -809,22 +782,4 @@ public class InputLogicTests extends InputTestsBase {
        assertEquals("type word then type space yields predictions for French",
                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());
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
    protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS = 200;
    // We wait for gesture computation for this delay
    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
    private static final String TYPE_TEST = "test";