Browse Source

Add tests verifying that calling getSampleText does not change the apps locale.

master
Reece H. Dunn 12 years ago
parent
commit
6edd17eb0c

+ 3
- 0
android/eSpeakTests/src/com/reecedunn/espeak/test/SpeechSynthesisTest.java View File



public void testGetSampleText() public void testGetSampleText()
{ {
final String[] currentLocales = getContext().getResources().getAssets().getLocales();
for (VoiceData.Voice data : VoiceData.voices) for (VoiceData.Voice data : VoiceData.voices)
{ {
if (mRemoved.contains(data.name)) if (mRemoved.contains(data.name))
{ {
final Locale ianaLocale = new Locale(data.ianaLanguage, data.ianaCountry, data.variant); final Locale ianaLocale = new Locale(data.ianaLanguage, data.ianaCountry, data.variant);
assertThat(SpeechSynthesis.getSampleText(getContext(), ianaLocale), is(data.sampleText)); assertThat(SpeechSynthesis.getSampleText(getContext(), ianaLocale), is(data.sampleText));
assertThat(getContext().getResources().getAssets().getLocales(), is(currentLocales));


if (!data.javaLanguage.equals("")) if (!data.javaLanguage.equals(""))
{ {
final Locale javaLocale = new Locale(data.javaLanguage, data.javaCountry, data.variant); final Locale javaLocale = new Locale(data.javaLanguage, data.javaCountry, data.variant);
assertThat(SpeechSynthesis.getSampleText(getContext(), javaLocale), is(data.sampleText)); assertThat(SpeechSynthesis.getSampleText(getContext(), javaLocale), is(data.sampleText));
assertThat(getContext().getResources().getAssets().getLocales(), is(currentLocales));
} }
} }
catch (AssertionError e) catch (AssertionError e)

Loading…
Cancel
Save