Speakerbox implements TextToSpeech.OnInitListener { @TargetApi(Build.VERSION_CODES.LOLLIPOP) public Set<Locale> getAvailableLanguages() { return textToSpeech.getAvailableLanguages(); } Speakerbox(final Application application); @Override void onInit(int status); void setActivity(Activity activity); Application.ActivityLifecycleCallbacks getCallbacks(); void play(CharSequence text); void playAndOnStart(String text, Runnable onStart); void playAndOnDone(String text, Runnable onDone); void playAndOnError(String text, Runnable onError); void play(String text, Runnable onStart, Runnable onDone, Runnable onError); void stop(); void dontPlayIfContains(String text); void mute(); void unmute(); boolean isMuted(); void remix(String original, String remix); TextToSpeech getTextToSpeech(); void requestAudioFocus(); void abandonAudioFocus(); void enableVolumeControl(Activity activity); void disableVolumeControl(Activity activity); void setQueueMode(int queueMode); @TargetApi(Build.VERSION_CODES.LOLLIPOP) Set<Locale> getAvailableLanguages(); void setLanguage(Locale locale); void shutdown(); static final String UTTERANCE_ID_NONE; }
@Test @Config(sdk = 21) public void getAvailableLanguages_shouldReturnTtsLanguages() throws Exception { Set<Locale> languages = speakerbox.getAvailableLanguages(); assertThat(languages).isEqualTo(shadowTextToSpeech.getAvailableLanguages()); }