Skip to content

Commit

Permalink
Change: TtsTest -> SynthesizerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Aug 2, 2023
1 parent 2ce8cd5 commit fd54793
Showing 1 changed file with 52 additions and 0 deletions.
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);
}
}
}

0 comments on commit fd54793

Please sign in to comment.