1+ using System . Xml . Linq ;
2+ using System ;
13using OpenUtau . Api ;
24using OpenUtau . Plugin . Builtin ;
35using Xunit ;
@@ -12,36 +14,234 @@ protected override Phonemizer CreatePhonemizer() {
1214
1315 [ Theory ]
1416 [ InlineData ( "ja_cvvc" ,
15- new string [ ] { "test" , "words" } ,
16- new string [ ] { "" , "" , } ,
17- new string [ ] { "C3" , "C3" } ,
18- new string [ ] { "" , "" , } ,
19- new string [ ] { "て_A3" , "e s_A3" , "と_A3" , "うぉ_A3" , "o d_A3" , "ず_A3" } ) ]
20- public void BasicPhonemizingTest ( string singerName , string [ ] lyrics , string [ ] alts , string [ ] tones , string [ ] colors , string [ ] aliases ) {
21- RunPhonemizeTest ( singerName , lyrics , alts , tones , colors , aliases ) ;
17+ new string [ ] { "て_C4" , "e s_C4" , "と_C4" , "うぉ_C4" , "o d_C4" , "ず_C4" } ) ]
18+ [ InlineData ( "ja_vcv" ,
19+ new string [ ] { "- てA3" , "e すA3" , "u とA3" , "o うぉA3" , "o どA3" , "o ずA3" } ) ]
20+ [ InlineData ( "ja_cv" ,
21+ new string [ ] { "て" , "す" , "と" , "を" , "ど" , "ず" } ) ]
22+ public void BasicPhonemizingTest ( string singerName , string [ ] aliases ) {
23+ SameAltsTonesColorsTest ( singerName , aliases ,
24+ new string [ ] { "test" , "words" } ) ;
2225 }
2326
2427 [ Theory ]
2528 [ InlineData ( "ja_cvvc" ,
26- new string [ ] { "test" , "words" } ,
27- new string [ ] { "" , "" , } ,
2829 new string [ ] { "C3" , "C4" } ,
29- new string [ ] { "" , "" , } ,
3030 new string [ ] { "て_A3" , "e s_A3" , "と_A3" , "うぉ_C4" , "o d_C4" , "ず_C4" } ) ]
31- public void MultipitchTest ( string singerName , string [ ] lyrics , string [ ] alts , string [ ] tones , string [ ] colors , string [ ] aliases ) {
32- RunPhonemizeTest ( singerName , lyrics , alts , tones , colors , aliases ) ;
31+ [ InlineData ( "ja_vcv" ,
32+ new string [ ] { "C4" , "C5" } ,
33+ new string [ ] { "- てA3" , "e すA3" , "u とA3" , "o うぉC5" , "o どC5" , "o ずC5" } ) ]
34+ public void MultipitchTest ( string singerName , string [ ] tones , string [ ] aliases ) {
35+ RunPhonemizeTest ( singerName , new string [ ] { "test" , "words" } ,
36+ RepeatString ( 2 , "" ) , tones , RepeatString ( 2 , "" ) , aliases ) ;
3337 }
3438
3539 [ Theory ]
3640 [ InlineData ( "ja_cvvc" ,
37- new string [ ] { "test" , "words" } ,
38- new string [ ] { "" , "" , } ,
39- new string [ ] { "C4" , "C4" } ,
4041 new string [ ] { "" , "強" , } ,
4142 new string [ ] { "て_C4" , "e s_強B3" , "と_C4" , "うぉ_C4" , "o d_C4" , "ず_C4" } ) ]
43+ [ InlineData ( "ja_vcv" ,
44+ new string [ ] { "" , "Clear" , } ,
45+ new string [ ] { "- てA3" , "e すCA3" , "u とA3" , "o うぉA3" , "o どA3" , "o ずA3" } ) ]
4246 // Colors are per-phoneme
43- public void VoiceColorTest ( string singerName , string [ ] lyrics , string [ ] alts , string [ ] tones , string [ ] colors , string [ ] aliases ) {
44- RunPhonemizeTest ( singerName , lyrics , alts , tones , colors , aliases ) ;
47+ public void VoiceColorTest ( string singerName , string [ ] colors , string [ ] aliases ) {
48+ RunPhonemizeTest ( singerName , new string [ ] { "test" , "words" } ,
49+ RepeatString ( 2 , "" ) , RepeatString ( 2 , "C4" ) , colors , aliases ) ;
50+ }
51+
52+ [ Theory ]
53+ [ InlineData ( "ja_cvvc" ,
54+ new string [ ] { "て_C4" , "e s_C4" , "て_C4" , "e n_C4" } ) ]
55+ [ InlineData ( "ja_vcv" ,
56+ new string [ ] { "- てA3" , "e すA3" , "u てA3" , "e んA3" , "n RA3" } ) ]
57+ [ InlineData ( "ja_cv" ,
58+ new string [ ] { "て" , "す" , "て" , "ん" } ) ]
59+ // Should have one て only, not become てえ
60+ public void SyllableExtendTest ( string singerName , string [ ] aliases ) {
61+ SameAltsTonesColorsTest ( singerName , aliases ,
62+ new string [ ] { "testing" , "+*" , "+" , "+" } ) ;
63+ }
64+
65+ [ Theory ]
66+ [ InlineData ( "ja_cvvc" ,
67+ new string [ ] { "- お_C4" , "o ry_C4" , "りゅ_C4" , "u ky_C4" , "きゅ_C4" , "u ts_C4" , "つ_C4" , "u n_C4" } ) ]
68+ [ InlineData ( "ja_vcv" ,
69+ new string [ ] { "- おA3" , "o りゅA3" , "u きゅA3" , "u つA3" , "u んA3" , "n RA3" } ) ]
70+ [ InlineData ( "ja_cv" ,
71+ new string [ ] { "お" , "りゅ" , "きゅ" , "つ" , "ん" } ) ]
72+ public void SyllableSpecialClusterTest ( string singerName , string [ ] aliases ) {
73+ SameAltsTonesColorsTest ( singerName , aliases ,
74+ new string [ ] { "all" , "you" , "cute" , "soon" } ) ;
75+ }
76+
77+ [ Theory ]
78+ [ InlineData ( "ja_cvvc" ,
79+ new string [ ] { "- あ_C4" , "a s_C4" , "た_C4" , "a w_C4" } ) ]
80+ [ InlineData ( "ja_vcv" ,
81+ new string [ ] { "- あA3" , "a すA3" , "u たA3" , "a うA3" } ) ]
82+ [ InlineData ( "ja_cv" ,
83+ new string [ ] { "あ" , "す" , "た" , "う" } ) ]
84+ public void SyllableClusterTest ( string singerName , string [ ] aliases ) {
85+ SameAltsTonesColorsTest ( singerName , aliases ,
86+ new string [ ] { "a" , "star" } ) ;
87+ }
88+
89+ [ Theory ]
90+ [ InlineData ( "ja_cvvc" ,
91+ new string [ ] { "ヴ_C4" } ) ]
92+ [ InlineData ( "ja_vcv" ,
93+ new string [ ] { "- ヴA3" , "u RA3" } ) ]
94+ [ InlineData ( "ja_cv" ,
95+ new string [ ] { "ふ" } ) ]
96+ public void SyllableConditionalAltTest ( string singerName , string [ ] aliases ) {
97+ SameAltsTonesColorsTest ( singerName , aliases ,
98+ new string [ ] { "vu" } ) ;
99+ }
100+
101+ [ Theory ]
102+ [ InlineData ( "ja_cvvc" ,
103+ new string [ ] { "てぃ_C4" } ) ]
104+ [ InlineData ( "ja_vcv" ,
105+ new string [ ] { "- てぃA3" , "i RA3" } ) ]
106+ [ InlineData ( "ja_cv" ,
107+ new string [ ] { "て" , "い" } ) ]
108+ public void SyllableExtraCvTest ( string singerName , string [ ] aliases ) {
109+ SameAltsTonesColorsTest ( singerName , aliases ,
110+ new string [ ] { "tea" } ) ;
111+ }
112+
113+ [ Theory ]
114+ [ InlineData ( "ja_cvvc" ,
115+ new string [ ] { "- あ_C4" } ) ]
116+ [ InlineData ( "ja_vcv" ,
117+ new string [ ] { "- あA3" , "a RA3" } ) ]
118+ [ InlineData ( "ja_cv" ,
119+ new string [ ] { "あ" } ) ]
120+ public void EndingVowelTest ( string singerName , string [ ] aliases ) {
121+ SameAltsTonesColorsTest ( singerName , aliases ,
122+ new string [ ] { "a" } ) ;
123+ }
124+
125+ [ Theory ]
126+ [ InlineData ( "ja_cvvc" ,
127+ new string [ ] { "- え_C4" , "e n_C4" } ) ]
128+ [ InlineData ( "ja_vcv" ,
129+ new string [ ] { "- えA3" , "e んA3" , "n RA3" } ) ]
130+ [ InlineData ( "ja_cv" ,
131+ new string [ ] { "え" , "ん" } ) ]
132+ public void EndingNasalTest ( string singerName , string [ ] aliases ) {
133+ SameAltsTonesColorsTest ( singerName , aliases ,
134+ new string [ ] { "an" } ) ;
135+ }
136+
137+ [ Theory ]
138+ [ InlineData ( "ja_cvvc" ,
139+ new string [ ] { "ば_C4" , "a w_C4" , "- ん_C4" } ) ]
140+ [ InlineData ( "ja_vcv" ,
141+ new string [ ] { "- ばA3" , "a うA3" , "u んA3" , "n RA3" } ) ]
142+ [ InlineData ( "ja_cv" ,
143+ new string [ ] { "ば" , "う" , "ん" } ) ]
144+ public void EndingClusterNasalTest ( string singerName , string [ ] aliases ) {
145+ SameAltsTonesColorsTest ( singerName , aliases ,
146+ new string [ ] { "barn" } ) ;
147+ }
148+
149+ [ Theory ]
150+ [ InlineData ( "ja_cvvc" ,
151+ new string [ ] { "- あ_C4" , "a p_C4" } ) ]
152+ [ InlineData ( "ja_vcv" ,
153+ new string [ ] { "- あA3" , "a ぷA3" } ) ]
154+ [ InlineData ( "ja_cv" ,
155+ new string [ ] { "あ" , "ぷ" } ) ]
156+ public void EndingSingleConsonantTest ( string singerName , string [ ] aliases ) {
157+ SameAltsTonesColorsTest ( singerName , aliases ,
158+ new string [ ] { "up" } ) ;
159+ }
160+
161+ [ Theory ]
162+ [ InlineData ( "ja_cvvc" ,
163+ new string [ ] { "- あ_C4" , "a v_C4" } ) ]
164+ [ InlineData ( "ja_vcv" ,
165+ new string [ ] { "- あA3" , "a ヴA3" } ) ]
166+ [ InlineData ( "ja_cv" ,
167+ new string [ ] { "あ" , "ふ" } ) ]
168+ public void EndingConditionalAltTest ( string singerName , string [ ] aliases ) {
169+ SameAltsTonesColorsTest ( singerName , aliases ,
170+ new string [ ] { "of" } ) ;
171+ }
172+
173+ [ Theory ]
174+ [ InlineData ( "ja_cvvc" ,
175+ new string [ ] { "- あ_C4" , "a n_C4" , "ど_C4" } ) ]
176+ [ InlineData ( "ja_vcv" ,
177+ new string [ ] { "- あA3" , "a んA3" , "n どA3" } ) ]
178+ [ InlineData ( "ja_cv" ,
179+ new string [ ] { "あ" , "ん" , "ど" } ) ]
180+ public void EndingClusterTest ( string singerName , string [ ] aliases ) {
181+ SameAltsTonesColorsTest ( singerName , aliases ,
182+ new string [ ] { "and" } ) ;
183+ }
184+
185+ [ Theory ]
186+ [ InlineData ( "ja_cvvc" ,
187+ new string [ ] { "- え_C4" , "e ts_C4" , "つ_C4" } ) ]
188+ [ InlineData ( "ja_vcv" ,
189+ new string [ ] { "- えA3" , "e つA3" } ) ]
190+ [ InlineData ( "ja_cv" ,
191+ new string [ ] { "え" , "つ" } ) ]
192+ public void EndingSpecialClusterTest ( string singerName , string [ ] aliases ) {
193+ SameAltsTonesColorsTest ( singerName , aliases ,
194+ new string [ ] { "its" } ) ;
195+ }
196+
197+ [ Theory ]
198+ [ InlineData ( "ja_vcv" ,
199+ new string [ ] { "its" , "its" } ,
200+ new string [ ] { "- えA3" , "e つぇA3" , "e つA3" } ) ]
201+ [ InlineData ( "ja_vcv" ,
202+ new string [ ] { "itch" , "itch" } ,
203+ new string [ ] { "- えA3" , "e ちぇA3" , "e ちゅA3" } ) ]
204+ [ InlineData ( "ja_vcv" ,
205+ new string [ ] { "age" , "age" } ,
206+ new string [ ] { "- えA3" , "e いA3" , "i じぇA3" , "e いA3" , "i じゅA3" } ) ]
207+ public void EndingVcvAffricateTest ( string singerName , string [ ] lyrics , string [ ] aliases ) {
208+ SameAltsTonesColorsTest ( singerName , aliases , lyrics ) ;
209+ }
210+
211+ [ Theory ]
212+ [ InlineData (
213+ new string [ ] { "a" , "the" } ,
214+ new string [ ] { "- あ_C4" , "a d_C4" , "だ_C4" } ) ]
215+ [ InlineData (
216+ new string [ ] { "a" , "thin" } ,
217+ new string [ ] { "- あ_C4" , "a s_C4" , "せ_C4" , "e n_C4" } ) ]
218+ [ InlineData (
219+ new string [ ] { "a" , "zha" } ,
220+ new string [ ] { "- あ_C4" , "a sh_C4" , "しゃ_C4" } ) ]
221+ [ InlineData (
222+ new string [ ] { "a" , "ra" } ,
223+ new string [ ] { "- あ_C4" , "a w_C4" , "わ_C4" } ) ]
224+ [ InlineData (
225+ new string [ ] { "a" , "la" } ,
226+ new string [ ] { "- あ_C4" , "a r_C4" , "ら_C4" } ) ]
227+ [ InlineData (
228+ new string [ ] { "all" , "you" } ,
229+ new string [ ] { "- お_C4" , "o ry_C4" , "りゅ_C4" } ) ]
230+ public void SyllableDigraphVCTest ( string [ ] lyrics , string [ ] aliases ) {
231+ SameAltsTonesColorsTest ( "ja_cvvc" , aliases , lyrics ) ;
232+ }
233+
234+ private void SameAltsTonesColorsTest ( string singerName , string [ ] aliases , string [ ] lyrics ) {
235+ RunPhonemizeTest ( singerName , lyrics ,
236+ RepeatString ( lyrics . Length , "" ) ,
237+ RepeatString ( lyrics . Length , "C4" ) ,
238+ RepeatString ( lyrics . Length , "" ) , aliases ) ;
239+ }
240+
241+ private string [ ] RepeatString ( int count , string s ) {
242+ string [ ] array = new string [ count ] ;
243+ Array . Fill ( array , s ) ;
244+ return array ;
45245 }
46246 }
47247}
0 commit comments