Issue accessing ShadowInputMethodManager methods

20 views
Skip to first unread message

Rick Mutzke

unread,
Mar 29, 2022, 1:30:42 PM3/29/22
to Robolectric
Greetings!

I am in the process of creating unit tests relating to IMEs, and therefore would like to make use of the ShadowInputMethodManager class.  The unit tests are built and run from the command line, using an Android.bp file.  I believe I have all the imports set up correctly, as the project compiles with the following code:

iMM = (InputMethodManager)
                ApplicationProvider.getApplicationContext()
                        .getSystemService(Activity.INPUT_METHOD_SERVICE);
shadowIMM = Shadows.shadowOf(iMM);


Yet, the following code, when added, will not compile:

        InputMethodInfo inputMethodInfo =
               new InputMethodInfo("pkg", "ClassName", "customIME", "customImeSettingsActivity");
        shadowIMM.setEnabledInputMethodInfoList(ImmutableList.of(inputMethodInfo));

        List<InputMethodInfo> imiList = shadowIMM.getInputMethodList();

For example:   error: cannot find symbol
mShadowIMM.setEnabledInputMethodInfoList(ImmutableList.of(inputMethodInfo));

Anything obvious I missed that would explain this?  Please let me know what other information is required to answer this.

Regards,
Rick Mutzke

utzcoz

unread,
Apr 2, 2022, 11:44:29 PM4/2/22
to Robolectric
Hi Rick,

Looks like your code can work. Could you provide a minimum reproduce sample for it by following https://github.com/robolectric/robolectric/wiki/How-to-Report-Issues?  I can check it locally for your problem. Thanks.

BR,
utzcoz

Rick Mutzke

unread,
Apr 5, 2022, 11:23:35 AM4/5/22
to Robolectric
Thank you for your reply.  I am confirming now whether our build system is even using the latest version of Robolectric.
Reply all
Reply to author
Forward
0 new messages