Browse Source

SpeechSynthesisTest: Add tests for Voice.match using 3-letter language and country codes.

master
Reece H. Dunn 12 years ago
parent
commit
86fe261425

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

public class SpeechSynthesisTest extends AndroidTestCase public class SpeechSynthesisTest extends AndroidTestCase
{ {
public static final Locale af = new Locale("af"); // Afrikaans public static final Locale af = new Locale("af"); // Afrikaans
public static final Locale afr = new Locale("afr"); // Afrikaans


public static final Locale de = new Locale("de"); // German public static final Locale de = new Locale("de"); // German
public static final Locale de_DE = new Locale("de", "DE"); // German (Germany) public static final Locale de_DE = new Locale("de", "DE"); // German (Germany)
public static final Locale de_1996 = new Locale("de", "", "1996"); // German (1996 Orthography) public static final Locale de_1996 = new Locale("de", "", "1996"); // German (1996 Orthography)
public static final Locale de_CH_1901 = new Locale("de", "CH", "1901"); // German (Traditional Orthography,Switzerland) public static final Locale de_CH_1901 = new Locale("de", "CH", "1901"); // German (Traditional Orthography,Switzerland)


public static final Locale deu = new Locale("deu"); // German
public static final Locale deu_DEU = new Locale("deu", "DEU"); // German (Germany)
public static final Locale deu_1996 = new Locale("deu", "", "1996"); // German (1996 Orthography)
public static final Locale deu_CHE_1901 = new Locale("deu", "CHE", "1901"); // German (Traditional Orthography,Switzerland)

public static final Locale fr = new Locale("fr"); // French public static final Locale fr = new Locale("fr"); // French
public static final Locale fr_FR = new Locale("fr", "FR"); // French (France) public static final Locale fr_FR = new Locale("fr", "FR"); // French (France)
public static final Locale fr_BE = new Locale("fr", "BE"); // French (Belgium) public static final Locale fr_BE = new Locale("fr", "BE"); // French (Belgium)
public static final Locale fr_FR_1694acad = new Locale("fr", "FR", "1694acad"); // French (Early Modern French,France) public static final Locale fr_FR_1694acad = new Locale("fr", "FR", "1694acad"); // French (Early Modern French,France)
public static final Locale fr_BE_1694acad = new Locale("fr", "BE", "1694acad"); // French (Early Modern French,Belgium) public static final Locale fr_BE_1694acad = new Locale("fr", "BE", "1694acad"); // French (Early Modern French,Belgium)


public static final Locale fra = new Locale("fra"); // French
public static final Locale fra_FRA = new Locale("fra", "FRA"); // French (France)
public static final Locale fra_BEL = new Locale("fra", "BEL"); // French (Belgium)
public static final Locale fra_1694acad = new Locale("fra", "", "1694acad"); // French (Early Modern French)
public static final Locale fra_FRA_1694acad = new Locale("fra", "FRA", "1694acad"); // French (Early Modern French,France)
public static final Locale fra_BEL_1694acad = new Locale("fra", "BEL", "1694acad"); // French (Early Modern French,Belgium)

public static final Locale hy = new Locale("hy"); // Armenian public static final Locale hy = new Locale("hy"); // Armenian
public static final Locale hy_AM = new Locale("hy", "AM"); // Armenian (Armenia) public static final Locale hy_AM = new Locale("hy", "AM"); // Armenian (Armenia)
public static final Locale hy_arevela = new Locale("hy", "", "arevela"); // Armenian (Eastern) public static final Locale hy_arevela = new Locale("hy", "", "arevela"); // Armenian (Eastern)
public static final Locale hy_AM_arevela = new Locale("hy", "AM", "arevela"); // Armenian (Eastern,Armenia) public static final Locale hy_AM_arevela = new Locale("hy", "AM", "arevela"); // Armenian (Eastern,Armenia)
public static final Locale hy_AM_arevmda = new Locale("hy", "AM", "arevmda"); // Armenian (Western,Armenia) public static final Locale hy_AM_arevmda = new Locale("hy", "AM", "arevmda"); // Armenian (Western,Armenia)


public static final Locale hye = new Locale("hye"); // Armenian
public static final Locale hye_ARM = new Locale("hye", "ARM"); // Armenian (Armenia)
public static final Locale hye_arevela = new Locale("hye", "", "arevela"); // Armenian (Eastern)
public static final Locale hye_arevmda = new Locale("hye", "", "arevmda"); // Armenian (Western)
public static final Locale hye_ARM_arevela = new Locale("hye", "ARM", "arevela"); // Armenian (Eastern,Armenia)
public static final Locale hye_ARM_arevmda = new Locale("hye", "ARM", "arevmda"); // Armenian (Western,Armenia)

public static final Locale en = new Locale("en"); // English public static final Locale en = new Locale("en"); // English
public static final Locale en_GB = new Locale("en", "GB"); // English (Great Britain) public static final Locale en_GB = new Locale("en", "GB"); // English (Great Britain)
public static final Locale en_US = new Locale("en", "US"); // English (USA) public static final Locale en_US = new Locale("en", "US"); // English (USA)
public static final Locale en_GB_scotland = new Locale("en", "GB", "scotland"); // English (Scottish,Great Britain) public static final Locale en_GB_scotland = new Locale("en", "GB", "scotland"); // English (Scottish,Great Britain)
public static final Locale en_GB_north = new Locale("en", "GB", "north"); // English (North,Great Britain) public static final Locale en_GB_north = new Locale("en", "GB", "north"); // English (North,Great Britain)


public static final Locale eng = new Locale("en"); // English
public static final Locale eng_GBR = new Locale("en", "GBR"); // English (Great Britain)
public static final Locale eng_USA = new Locale("en", "USA"); // English (USA)
public static final Locale eng_scotland = new Locale("en", "", "scotland"); // English (Scottish)
public static final Locale eng_GBR_scotland = new Locale("en", "GBR", "scotland"); // English (Scottish,Great Britain)
public static final Locale eng_GBR_north = new Locale("en", "GBR", "north"); // English (North,Great Britain)

private SpeechSynthesis.SynthReadyCallback mCallback = new SpeechSynthesis.SynthReadyCallback() private SpeechSynthesis.SynthReadyCallback mCallback = new SpeechSynthesis.SynthReadyCallback()
{ {
@Override @Override
assertThat(voice.match(de_1996), is(TextToSpeech.LANG_COUNTRY_AVAILABLE)); assertThat(voice.match(de_1996), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(de_DE), is(TextToSpeech.LANG_AVAILABLE)); assertThat(voice.match(de_DE), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(de_CH_1901), is(TextToSpeech.LANG_AVAILABLE)); assertThat(voice.match(de_CH_1901), is(TextToSpeech.LANG_AVAILABLE));

assertThat(voice.match(deu), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(deu_1996), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(deu_DEU), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(deu_CHE_1901), is(TextToSpeech.LANG_AVAILABLE));
} }


public void testMatchVoiceWithLanguageAndCountry() public void testMatchVoiceWithLanguageAndCountry()
assertThat(voice.match(fr_1694acad), is(TextToSpeech.LANG_AVAILABLE)); assertThat(voice.match(fr_1694acad), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(fr_FR_1694acad), is(TextToSpeech.LANG_COUNTRY_AVAILABLE)); assertThat(voice.match(fr_FR_1694acad), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(fr_BE_1694acad), is(TextToSpeech.LANG_AVAILABLE)); assertThat(voice.match(fr_BE_1694acad), is(TextToSpeech.LANG_AVAILABLE));

assertThat(voice.match(fra), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(fra_FRA), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(fra_BEL), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(fra_1694acad), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(fra_FRA_1694acad), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(fra_BEL_1694acad), is(TextToSpeech.LANG_AVAILABLE));
} }


public void testMatchVoiceWithLanguageAndVariant() public void testMatchVoiceWithLanguageAndVariant()
assertThat(voice.match(hy_arevmda), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE)); assertThat(voice.match(hy_arevmda), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(hy_AM_arevela), is(TextToSpeech.LANG_AVAILABLE)); assertThat(voice.match(hy_AM_arevela), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(hy_AM_arevmda), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE. assertThat(voice.match(hy_AM_arevmda), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE.

assertThat(voice.match(hye), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(hye_ARM), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(hye_arevela), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(hye_arevmda), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(hye_ARM_arevela), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(hye_ARM_arevmda), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE.
} }


public void testMatchVoiceWithLanguageCountryAndVariant() public void testMatchVoiceWithLanguageCountryAndVariant()
assertThat(voice.match(en_scotland), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE. assertThat(voice.match(en_scotland), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE.
assertThat(voice.match(en_GB_scotland), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE)); assertThat(voice.match(en_GB_scotland), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(en_GB_north), is(TextToSpeech.LANG_COUNTRY_AVAILABLE)); assertThat(voice.match(en_GB_north), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));

assertThat(voice.match(eng), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(eng_GBR), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
assertThat(voice.match(eng_USA), is(TextToSpeech.LANG_AVAILABLE));
assertThat(voice.match(eng_scotland), is(TextToSpeech.LANG_AVAILABLE)); // NOTE: Android does not support LANG_VAR_AVAILABLE.
assertThat(voice.match(eng_GBR_scotland), is(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE));
assertThat(voice.match(eng_GBR_north), is(TextToSpeech.LANG_COUNTRY_AVAILABLE));
} }
} }

Loading…
Cancel
Save