use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method getLastTextToSpeechInstance_constructed_returnsInstance.
@Test
public void getLastTextToSpeechInstance_constructed_returnsInstance() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
assertThat(ShadowTextToSpeech.getLastTextToSpeechInstance()).isEqualTo(textToSpeech);
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method getCurrentLanguage_languageSet_returnsLanguage.
@Test
public void getCurrentLanguage_languageSet_returnsLanguage() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
Locale language = Locale.forLanguageTag("pl-pl");
textToSpeech.setLanguage(language);
assertThat(shadowOf(textToSpeech).getCurrentLanguage()).isEqualTo(language);
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method getVoices_returnsAvailableVoices.
@Test
@Config(minSdk = LOLLIPOP)
public void getVoices_returnsAvailableVoices() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
Voice voice = new Voice("test voice", Locale.getDefault(), Voice.QUALITY_VERY_HIGH, Voice.LATENCY_LOW, false, /* requiresNetworkConnection */
ImmutableSet.of());
ShadowTextToSpeech.addVoice(voice);
assertThat(shadowOf(textToSpeech).getVoices()).containsExactly(voice);
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method getCurrentLanguage_languageNeverSet_returnsNull.
@Test
public void getCurrentLanguage_languageNeverSet_returnsNull() {
TextToSpeech textToSpeech = new TextToSpeech(activity, result -> {
});
assertThat(shadowOf(textToSpeech).getCurrentLanguage()).isNull();
}
use of android.speech.tts.TextToSpeech in project robolectric by robolectric.
the class ShadowTextToSpeechTest method getLastTextToSpeechInstance_constructedTwice_returnsMostRecentInstance.
@Test
public void getLastTextToSpeechInstance_constructedTwice_returnsMostRecentInstance() {
TextToSpeech textToSpeechOne = new TextToSpeech(activity, result -> {
});
TextToSpeech textToSpeechTwo = new TextToSpeech(activity, result -> {
});
assertThat(ShadowTextToSpeech.getLastTextToSpeechInstance()).isEqualTo(textToSpeechTwo);
assertThat(ShadowTextToSpeech.getLastTextToSpeechInstance()).isNotEqualTo(textToSpeechOne);
}
Aggregations