You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.7 KiB
74 lines
2.7 KiB
import 'package:eaimar/data/services/simul_microsoft.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('日语到英语走 AST,发音人是 JennyNeural', () {
|
|
final route = SimulMicrosoft.plan('ja', 'en');
|
|
expect(route, isNotNull);
|
|
expect(route!.ast, isTrue);
|
|
expect(route.lang, 'ja');
|
|
expect(route.targetLang, 'en');
|
|
expect(route.speaker, 'JennyNeural');
|
|
});
|
|
|
|
test('英语到日语同传没授权时改走转写,识别 en-US,合成 Nanami', () {
|
|
final route = SimulMicrosoft.plan('en', 'ja')!;
|
|
final splice = SimulMicrosoft.spliceInstead(route);
|
|
expect(splice.ast, isFalse);
|
|
expect(splice.languageName, 'en-US');
|
|
expect(splice.speaker, 'ja-JP-NanamiNeural');
|
|
});
|
|
|
|
test('英语到日语走 AST,发音人是 NanamiNeural', () {
|
|
final route = SimulMicrosoft.plan('en-US', 'ja-JP');
|
|
expect(route!.ast, isTrue);
|
|
expect(route.lang, 'en');
|
|
expect(route.targetLang, 'ja');
|
|
expect(route.speaker, 'NanamiNeural');
|
|
});
|
|
|
|
test('普通话到英语走拼接,识别 zh-CN,合成 en-US-JennyNeural', () {
|
|
final route = SimulMicrosoft.plan('zh', 'en');
|
|
expect(route!.ast, isFalse);
|
|
expect(route.languageName, 'zh-CN');
|
|
expect(route.speaker, 'en-US-JennyNeural');
|
|
});
|
|
|
|
test('英语到普通话走拼接,识别 en-US,合成晓晓', () {
|
|
final route = SimulMicrosoft.plan('en', 'zh-CN');
|
|
expect(route!.ast, isFalse);
|
|
expect(route.languageName, 'en-US');
|
|
expect(route.speaker, 'zh-CN-XiaoxiaoNeural');
|
|
});
|
|
|
|
test('普通话到爱尔兰语识别 zh-CN,合成 Orla', () {
|
|
final route = SimulMicrosoft.plan('zh', 'ga');
|
|
expect(route!.ast, isFalse);
|
|
expect(route.languageName, 'zh-CN');
|
|
expect(route.speaker, 'ga-IE-OrlaNeural');
|
|
});
|
|
|
|
test('粤语简体识别 yue-CN,香港繁体识别 zh-HK', () {
|
|
final yue = SimulMicrosoft.plan('yue', 'en');
|
|
expect(yue!.languageName, 'yue-CN');
|
|
expect(yue.speaker, 'en-US-JennyNeural');
|
|
|
|
final hk = SimulMicrosoft.plan('zh-Hant-hk', 'en');
|
|
expect(hk!.languageName, 'zh-HK');
|
|
expect(hk.speaker, 'en-US-JennyNeural');
|
|
});
|
|
|
|
test('威尔士语到冰岛语不启动', () {
|
|
expect(SimulMicrosoft.plan('cy', 'is'), isNull);
|
|
});
|
|
|
|
test('拼接翻译语种码给讯飞 SDK,中文保持 zh-CN', () {
|
|
expect(SimulMicrosoft.translateCode('zh'), 'zh-CN');
|
|
expect(SimulMicrosoft.translateCode('zh-Hant'), 'zh-TW');
|
|
expect(SimulMicrosoft.translateCode('zh-Hant-hk'), 'zh-HK');
|
|
expect(SimulMicrosoft.translateCode('yue'), 'yue');
|
|
expect(SimulMicrosoft.translateCode('ga'), 'ga');
|
|
expect(SimulMicrosoft.translateCode('ja-JP'), 'ja');
|
|
expect(SimulMicrosoft.translateCode('en'), 'en');
|
|
});
|
|
}
|
|
|