Move the sample text logic into SpeechSynthesis.getSampleText and add test cases for it.

This commit is contained in:
Reece H. Dunn
2012-12-18 14:38:57 +00:00
parent 026110c64d
commit 2a3a1a0a81
5 changed files with 148 additions and 222 deletions
@@ -16,7 +16,6 @@
package com.reecedunn.espeak.test;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -307,4 +306,26 @@ public class SpeechSynthesisTest extends AndroidTestCase
assertThat(voice.match(eng_GBR_scotland), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(eng_GBR_north), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
}
public void testGetSampleText()
{
for (VoiceData.Voice data : VoiceData.voices)
{
if (mRemoved.contains(data.name))
{
Log.i("SpeechSynthesisTest", "Skipping the missing voice '" + data.name + "'");
continue;
}
try
{
final Locale ianaLocale = new Locale(data.ianaLanguage, data.ianaCountry, data.variant);
assertThat(SpeechSynthesis.getSampleText(getContext(), ianaLocale), is(data.sampleText));
}
catch (AssertionError e)
{
throw new VoiceData.Exception(data, e);
}
}
}
}