From 5d96585a388a0af8bf0e37fc38ed3d2630733ab9 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 4 Sep 2012 14:40:30 +0900 Subject: Add a first test for the spell checker Bug: 6981919 Change-Id: Idd34150cec70e71bde652428f1631693bbc4a9ff --- .../com/android/inputmethod/latin/InputTestsBase.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java') diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index ffd95f57a..dfb83fa24 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -51,7 +51,7 @@ public class InputTestsBase extends ServiceTestCase { protected LatinIME mLatinIME; protected Keyboard mKeyboard; - protected TextView mTextView; + protected MyTextView mTextView; protected InputConnection mInputConnection; private final HashMap mSubtypeMap = new HashMap(); @@ -86,6 +86,19 @@ public class InputTestsBase extends ServiceTestCase { return (mSpan instanceof SuggestionSpan) && 0 != (SuggestionSpan.FLAG_AUTO_CORRECTION & ((SuggestionSpan)mSpan).getFlags()); } + public String[] getSuggestions() { + return ((SuggestionSpan)mSpan).getSuggestions(); + } + } + + // A helper class to increase control over the TextView + public static class MyTextView extends TextView { + public MyTextView(final Context c) { + super(c); + } + public void onAttachedToWindow() { + super.onAttachedToWindow(); + } } public InputTestsBase() { @@ -112,7 +125,7 @@ public class InputTestsBase extends ServiceTestCase { @Override protected void setUp() throws Exception { super.setUp(); - mTextView = new TextView(getContext()); + mTextView = new MyTextView(getContext()); mTextView.setInputType(InputType.TYPE_CLASS_TEXT); mTextView.setEnabled(true); setupService(); -- cgit v1.2.3-83-g751a