-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ce8cd5
commit fd54793
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...s/voicevox_core_java_api/lib/src/test/java/jp/Hiroshiba/VoicevoxCore/SynthesizerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 音声合成のテスト。 | ||
* ttsaudioQuery -> synthesisの順に実行する。 | ||
*/ | ||
package jp.Hiroshiba.VoicevoxCore; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.File; | ||
|
||
class SynthesizerTest { | ||
VoiceModel model() { | ||
// cwdはvoicevox_core/crates/voicevox_core_java_api/lib | ||
String cwd = System.getProperty("user.dir"); | ||
File path = new File( | ||
cwd + "/../../../model/sample.vvm"); | ||
|
||
return new VoiceModel(path.getAbsolutePath()); | ||
|
||
} | ||
|
||
OpenJtalk openJtalk() { | ||
String cwd = System.getProperty("user.dir"); | ||
File path = new File( | ||
cwd + "/../../test_util/data/open_jtalk_dic_utf_8-1.11"); | ||
return new OpenJtalk(path.getAbsolutePath()); | ||
} | ||
|
||
@Test | ||
void checkModel() { | ||
try (VoiceModel model = model(); | ||
OpenJtalk openJtalk = new OpenJtalk(); | ||
Synthesizer synthesizer = Synthesizer.builder(openJtalk).build()) { | ||
synthesizer.loadVoiceModel(model); | ||
assertTrue(synthesizer.isLoadedVoiceModel(model.id)); | ||
synthesizer.unloadVoiceModel(model.id); | ||
assertFalse(synthesizer.isLoadedVoiceModel(model.id)); | ||
} | ||
} | ||
|
||
@Test | ||
void checkTts() { | ||
try (VoiceModel model = model(); | ||
OpenJtalk openJtalk = new OpenJtalk(); | ||
Synthesizer synthesizer = Synthesizer.builder(openJtalk).build()) { | ||
synthesizer.loadVoiceModel(model); | ||
} | ||
} | ||
} |