use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method isStopped_shouldReturnTrueAfterStop.
@Test
public void isStopped_shouldReturnTrueAfterStop() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
textToSpeech.stop();
assertThat(shadowOf(textToSpeech).isStopped()).isTrue();
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method isStopped_shouldReturnTrueBeforeSpeak.
@Test
public void isStopped_shouldReturnTrueBeforeSpeak() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
assertThat(shadowOf(textToSpeech).isStopped()).isTrue();
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method isLanguageAvailable_matchingLanguage_returnsLangAvailable.
@Test
public void isLanguageAvailable_matchingLanguage_returnsLangAvailable() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
ShadowTextToSpeech.addLanguageAvailability(new Locale.Builder().setLanguage("en").setRegion("us").build());
assertThat(textToSpeech.isLanguageAvailable(new Locale.Builder().setLanguage("en").setRegion("gb").build())).isEqualTo(TextToSpeech.LANG_AVAILABLE);
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method threeArgumentSpeak_withUtteranceId_shouldGetCallbackUtteranceId.
@Test
public void threeArgumentSpeak_withUtteranceId_shouldGetCallbackUtteranceId() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
UtteranceProgressListener mockListener = mock(UtteranceProgressListener.class);
textToSpeech.setOnUtteranceProgressListener(mockListener);
HashMap<String, String> paramsMap = new HashMap<>();
paramsMap.put(Engine.KEY_PARAM_UTTERANCE_ID, "ThreeArgument");
textToSpeech.speak("Hello", TextToSpeech.QUEUE_FLUSH, paramsMap);
shadowMainLooper().idle();
verify(mockListener).onStart("ThreeArgument");
verify(mockListener).onDone("ThreeArgument");
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method clearLastSpokenText_shouldSetLastSpokenTextToNull.
@Test
public void clearLastSpokenText_shouldSetLastSpokenTextToNull() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
textToSpeech.speak("Hello", TextToSpeech.QUEUE_FLUSH, null);
shadowOf(textToSpeech).clearLastSpokenText();
assertThat(shadowOf(textToSpeech).getLastSpokenText()).isNull();
}
Aggregations