Debian Codegraph @

android/eSpeakTests/src/com/reecedunn/espeak/test/VoiceVariantTest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2013 Reece H. Dunn
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.reecedunn.espeak.test;
18
19 import android.test.AndroidTestCase;
20
21 import com.reecedunn.espeak.SpeechSynthesis;
22 import com.reecedunn.espeak.VoiceVariant;
23
24 import static org.hamcrest.MatcherAssert.assertThat;
25 import static org.hamcrest.Matchers.*;
26
27 public class VoiceVariantTest extends AndroidTestCase
28 {
29 public void testMaleVoiceVariant()
30 {
31 VoiceVariant variant = VoiceVariant.parseVoiceVariant("male");
32 assertThat(variant.variant, is(nullValue()));
33 assertThat(variant.gender, is(SpeechSynthesis.GENDER_MALE));
34 assertThat(variant.age, is(SpeechSynthesis.AGE_ANY));
35 assertThat(variant.toString(), is("male"));
36 }
37
38 public void testFemaleVoiceVariant()
39 {
40 VoiceVariant variant = VoiceVariant.parseVoiceVariant("female");
41 assertThat(variant.variant, is(nullValue()));
42 assertThat(variant.gender, is(SpeechSynthesis.GENDER_FEMALE));
43 assertThat(variant.age, is(SpeechSynthesis.AGE_ANY));
44 assertThat(variant.toString(), is("female"));
45 }
46
47 public void testNamedVoiceVariant()
48 {
49 VoiceVariant variant = VoiceVariant.parseVoiceVariant("klatt1");
50 assertThat(variant.variant, is("klatt1"));
51 assertThat(variant.gender, is(SpeechSynthesis.GENDER_UNSPECIFIED));
52 assertThat(variant.age, is(SpeechSynthesis.AGE_ANY));
53 assertThat(variant.toString(), is("klatt1"));
54 }
55
56 public void testMaleVoiceVariantYoung()
57 {
58 VoiceVariant variant = VoiceVariant.parseVoiceVariant("male-young");
59 assertThat(variant.variant, is(nullValue()));
60 assertThat(variant.gender, is(SpeechSynthesis.GENDER_MALE));
61 assertThat(variant.age, is(SpeechSynthesis.AGE_YOUNG));
62 assertThat(variant.toString(), is("male-young"));
63 }
64
65 public void testFemaleVoiceVariantYoung()
66 {
67 VoiceVariant variant = VoiceVariant.parseVoiceVariant("female-young");
68 assertThat(variant.variant, is(nullValue()));
69 assertThat(variant.gender, is(SpeechSynthesis.GENDER_FEMALE));
70 assertThat(variant.age, is(SpeechSynthesis.AGE_YOUNG));
71 assertThat(variant.toString(), is("female-young"));
72 }
73
74 public void testNamedVoiceVariantYoung()
75 {
76 VoiceVariant variant = VoiceVariant.parseVoiceVariant("klatt2-young");
77 assertThat(variant.variant, is("klatt2"));
78 assertThat(variant.gender, is(SpeechSynthesis.GENDER_UNSPECIFIED));
79 assertThat(variant.age, is(SpeechSynthesis.AGE_YOUNG));
80 assertThat(variant.toString(), is("klatt2-young"));
81 }
82
83 public void testMaleVoiceVariantOld()
84 {
85 VoiceVariant variant = VoiceVariant.parseVoiceVariant("male-old");
86 assertThat(variant.variant, is(nullValue()));
87 assertThat(variant.gender, is(SpeechSynthesis.GENDER_MALE));
88 assertThat(variant.age, is(SpeechSynthesis.AGE_OLD));
89 assertThat(variant.toString(), is("male-old"));
90 }
91
92 public void testFemaleVoiceVariantOld()
93 {
94 VoiceVariant variant = VoiceVariant.parseVoiceVariant("female-old");
95 assertThat(variant.variant, is(nullValue()));
96 assertThat(variant.gender, is(SpeechSynthesis.GENDER_FEMALE));
97 assertThat(variant.age, is(SpeechSynthesis.AGE_OLD));
98 assertThat(variant.toString(), is("female-old"));
99 }
100
101 public void testNamedVoiceVariantOld()
102 {
103 VoiceVariant variant = VoiceVariant.parseVoiceVariant("klatt3-old");
104 assertThat(variant.variant, is("klatt3"));
105 assertThat(variant.gender, is(SpeechSynthesis.GENDER_UNSPECIFIED));
106 assertThat(variant.age, is(SpeechSynthesis.AGE_OLD));
107 assertThat(variant.toString(), is("klatt3-old"));
108 }
109 }