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

Commit c4f71f6b authored by Dan Zivkovic's avatar Dan Zivkovic Committed by Android (Google) Code Review
Browse files

Merge "We can't spell check Russian without an LM."

parents 67c06fc2 4262ef4e
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -107,12 +107,15 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
                throw new RuntimeException("Expected one span, found " + spans.length);
                throw new RuntimeException("Expected one span, found " + spans.length);
            }
            }
        }
        }
        public SuggestionSpan getSpan() {
            return (SuggestionSpan) mSpan;
        }
        public boolean isAutoCorrectionIndicator() {
        public boolean isAutoCorrectionIndicator() {
            return (mSpan instanceof SuggestionSpan) &&
            return (mSpan instanceof SuggestionSpan) &&
                    0 != (SuggestionSpan.FLAG_AUTO_CORRECTION & ((SuggestionSpan)mSpan).getFlags());
                    0 != (SuggestionSpan.FLAG_AUTO_CORRECTION & getSpan().getFlags());
        }
        }
        public String[] getSuggestions() {
        public String[] getSuggestions() {
            return ((SuggestionSpan)mSpan).getSuggestions();
            return getSpan().getSuggestions();
        }
        }
    }
    }


+2 −8
Original line number Original line Diff line number Diff line
@@ -53,14 +53,8 @@ public class AndroidSpellCheckerServiceTest extends InputTestsBase {
        sleep(1000);
        sleep(1000);


        final SpanGetter span = new SpanGetter(mEditText.getText(), SuggestionSpan.class);
        final SpanGetter span = new SpanGetter(mEditText.getText(), SuggestionSpan.class);
        // If no span, the following will crash
        // We don't ship with Russian LM
        final String[] suggestions = span.getSuggestions();
        assertNull(span.getSpan());
        // For this test we consider "годп" should yield at least 2 suggestions (at this moment
        // it yields 5).
        assertTrue(suggestions.length >= 2);
        // We also assume the top suggestion should be "года", which is the top word in the
        // Russian dictionary.
        assertEquals("", "года", suggestions[0]);
    }
    }


    public void testSpellcheckWithPeriods() {
    public void testSpellcheckWithPeriods() {