#include "test_util.h"
-static const char *g_long_text = "Speech Synthesis is the artificial production of human speech. A computer system used for this purpose is called a speech computer or speech synthesizer,\
+static const char *TEST_LONG_TEXT = "Speech Synthesis is the artificial production of human speech. A computer system used for this purpose is called a speech computer or speech synthesizer,\
and can be implemented in software or hardware products. A text-to-speech (TTS) system converts normal language text into speech; other systems render symbolic linguistic\
representations like phonetic transcriptions into speech.\
Synthesized speech can be created by concatenating pieces of recorded speech that are stored in a database. Systems differ in the size of the stored speech units; \
the front-end. The back-end?often referred to as the synthesizer?then converts the symbolic linguistic representation into sound. In certain systems, this part includes the computation \
of the target prosody (pitch contour, phoneme durations),[4] which is then imposed on the output speech. From Wikipedia";
-static const int g_sample_rate = 24000;
+static const int TEST_SAMPLE_RATE = 24000;
static const int STATE_CHECK_WAITING_TIME = 5;
-static bool __tts_supported_voice_cb(tts_h tts, const char* language, int voice_type, void* user_data)
+static bool test_supported_voice_cb(tts_h tts, const char* language, int voice_type, void* user_data)
{
return true;
}
-static void __tts_default_voice_changed_cb(tts_h tts, const char* previous_language, int previous_voice_type, const char* current_language, int current_voice_type, void* user_data)
+static void test_default_voice_changed_cb(tts_h tts, const char* previous_language, int previous_voice_type, const char* current_language, int current_voice_type, void* user_data)
{
}
-static void __tts_engine_changed_cb(tts_h tts, const char* engine_id, const char* language, int voice_type, bool need_credential, void* user_data)
+static void test_engine_changed_cb(tts_h tts, const char* engine_id, const char* language, int voice_type, bool need_credential, void* user_data)
{
}
TEST_F(TTSTest, utc_tts_foreach_supported_voices_p1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, test_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, test_supported_voice_cb, nullptr), TTS_ERROR_NONE);
}
/**
TEST_F(TTSTest, utc_tts_foreach_supported_voices_n1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_foreach_supported_voices(nullptr, __tts_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_foreach_supported_voices(nullptr, test_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_foreach_supported_voices(nullptr, __tts_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_foreach_supported_voices(nullptr, test_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_foreach_supported_voices(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
mTestUtil->DestroyHandle();
- EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, test_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
EXPECT_EQ(tts_add_text(nullptr, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_text(mHandle, nullptr, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_text(mHandle, "", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_add_text(mHandle, g_long_text, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_add_text(mHandle, TEST_LONG_TEXT, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, -1, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, -1, &utt_id), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, 100, &utt_id), TTS_ERROR_INVALID_PARAMETER);
TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_p1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, test_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, test_default_voice_changed_cb, nullptr), TTS_ERROR_NONE);
}
/**
TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_n1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_default_voice_changed_cb(nullptr, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(nullptr, test_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_default_voice_changed_cb(nullptr, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(nullptr, test_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
mTestUtil->DestroyHandle();
- EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, test_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
TEST_F(TTSPreparedTest, utc_tts_set_default_voice_changed_cb_n2)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, test_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, test_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
TEST_F(TTSTest, utc_tts_set_engine_changed_cb_p1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, test_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, test_engine_changed_cb, nullptr), TTS_ERROR_NONE);
}
/**
TEST_F(TTSTest, utc_tts_set_engine_changed_cb_n1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_engine_changed_cb(nullptr, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_engine_changed_cb(nullptr, test_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_engine_changed_cb(nullptr, __tts_engine_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_engine_changed_cb(nullptr, test_engine_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_set_engine_changed_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
TEST_F(TTSPreparedTest, utc_tts_set_engine_changed_cb_n2)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, test_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, test_engine_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
TEST_F(TTSPreparedTest, utc_tts_add_pcm_p1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_NOT_SUPPORTED);
return;
}
char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, g_sample_rate), TTS_ERROR_NONE);
- EXPECT_EQ(tts_add_pcm(mHandle, 2, data, 10, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 2, data, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
}
/**
TEST_F(TTSPreparedTest, utc_tts_add_pcm_p2)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_add_pcm(mHandle, 3, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 3, nullptr, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
}
/**
TEST_F(TTSPreparedTest, utc_tts_add_pcm_n1)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_add_pcm(nullptr, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_add_pcm(nullptr, 1, nullptr, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_NOT_SUPPORTED);
return;
}
char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(nullptr, 1, data, 10, 0, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
- // EXPECT_EQ(tts_add_pcm(mHandle, -1, data, 10, 0, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
- // EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 10, 0, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
- // EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 0, 0, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, -1, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_add_pcm(nullptr, 1, data, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_PARAMETER);
+ // EXPECT_EQ(tts_add_pcm(mHandle, -1, data, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_PARAMETER);
+ // EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_PARAMETER);
+ // EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, -1, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, -1), TTS_ERROR_INVALID_PARAMETER);
}
TEST_F(TTSTest, utc_tts_add_pcm_n2)
{
if (false == mTestUtil->IsFeatureSupported()) {
- EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, TEST_SAMPLE_RATE), TTS_ERROR_NOT_SUPPORTED);
return;
}
char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, g_sample_rate), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, TEST_SAMPLE_RATE), TTS_ERROR_INVALID_STATE);
}
/**
int data_num = mTestUtil->mPCMSize / shift_size;
for (int i = 0; i <= data_num; i++ ) {
if (0 == i) {
- EXPECT_EQ(tts_add_pcm(mHandle, 1, &mTestUtil->mPCMData[i*shift_size], shift_size, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, &mTestUtil->mPCMData[i*shift_size], shift_size, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
} else if (data_num == i) {
- EXPECT_EQ(tts_add_pcm(mHandle, 3, &mTestUtil->mPCMData[i*shift_size], mTestUtil->mPCMSize % shift_size, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 3, &mTestUtil->mPCMData[i*shift_size], mTestUtil->mPCMSize % shift_size, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
} else {
- EXPECT_EQ(tts_add_pcm(mHandle, 2, &mTestUtil->mPCMData[i*shift_size], shift_size, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 2, &mTestUtil->mPCMData[i*shift_size], shift_size, 0, TEST_SAMPLE_RATE), TTS_ERROR_NONE);
}
}