#include <gtest/gtest.h>
#include <Ecore.h>
-#include <system_info.h>
-#include <tzplatform_config.h>
#include <vconf.h>
+#include <memory>
#include <tts.h>
#include <tts_internal.h>
-#include "system_info_mock.h"
-
-static tts_h g_tts = NULL;
-static char *g_language = NULL;
-static int g_voice_type;
-static int is_created_hndl = -1;
-static bool g_supported = false;
-static tts_state_e g_current_state;
-static tts_service_state_e g_current_service_state = TTS_SERVICE_STATE_READY;
-static bool g_utterance_started_cb = false;
-static bool g_utterance_completed_cb = false;
-static bool g_screen_reader_changed_cb = false;
-static bool g_error_cb = false;
-static const char* g_test_engine = "test";
-static int g_utt_id = -1;
-static char* g_pcm_data = nullptr;
-static long g_pcm_size = 0;
-static const char *g_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,\
+#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,\
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; \
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 char* ENGINE_VCONF_KEY = "db/voice/tts/engine/default";
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)
return true;
}
-static void __tts_state_changed_cb(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data)
-{
- g_current_state = current;
-}
-
-static void __tts_state_changed_cb_destroy_test(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data)
-{
- g_current_state = current;
-
- ASSERT_NE(tts_destroy(g_tts), TTS_ERROR_NONE);
-}
-
-static void __tts_utterance_started_cb(tts_h tts, int utt_id, void* user_data)
-{
- g_utterance_started_cb = true;
-}
-
-static void __tts_utterance_completed_cb(tts_h tts, int utt_id, void *user_data)
-{
- g_utterance_completed_cb = true;
- g_utt_id = utt_id;
-}
-
-static void __tts_error_cb(tts_h tts, int utt_id, tts_error_e reason, void* user_data)
-{
- g_error_cb = 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 __tts_screen_reader_changed_cb(tts_h tts, bool is_on, void* user_data)
-{
- g_screen_reader_changed_cb = true;
-}
-
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 __tts_service_state_changed_cb(tts_h tts, tts_service_state_e previous, tts_service_state_e current, void* user_data)
-{
- g_current_service_state = current;
-}
-
-static bool __is_state_changed(tts_state_e state, int wait_delay)
-{
- int max_count = wait_delay * 10;
- int count = 0;
- while (max_count > count && state != g_current_state) {
- ecore_main_loop_iterate();
- usleep(100000);
- count++;
- }
- if (state != g_current_state) {
- return false;
- }
+namespace {
- return true;
-}
+class TTSTest : public testing::Test {
+public:
+ virtual void SetUp() {
+ ecore_init();
+ mTestUtil = new TtsTestUtility();
-static bool __is_service_state_changed(tts_service_state_e service_state, int wait_delay)
-{
- int max_count = wait_delay * 10;
- int count = 0;
- while (max_count > count && service_state != g_current_service_state) {
- ecore_main_loop_iterate();
- usleep(100000);
- count++;
+ mHandle = mTestUtil->mHandle;
}
- if (service_state != g_current_service_state) {
- return false;
- }
+ virtual void TearDown() {
+ mTestUtil->Unprepare();
+ delete mTestUtil;
+ mTestUtil = nullptr;
- return true;
-}
-
-static bool __is_screen_reader_changed(int wait_delay)
-{
- int max_count = wait_delay * 10;
- int count = 0;
- while (max_count > count && false == g_screen_reader_changed_cb) {
- ecore_main_loop_iterate();
- usleep(100000);
- count++;
+ TtsTestUtility::WaitUntilEngineTerminated(1);
+ ecore_shutdown();
}
- return g_screen_reader_changed_cb;
-}
+public:
+ TtsTestUtility *mTestUtil = nullptr;
+ tts_h mHandle = nullptr;
+};
-static bool __is_error_occur(int wait_delay)
-{
- int max_count = wait_delay * 10;
- int count = 0;
- while (max_count > count && false == g_error_cb) {
- ecore_main_loop_iterate();
- usleep(100000);
- count++;
+class TTSPreparedTest : public testing::Test {
+public:
+ virtual void SetUp() {
+ ecore_init();
+ mTestUtil = new TtsTestUtility();
+
+ mHandle = mTestUtil->mHandle;
+ mTestUtil->Prepare();
}
- return g_error_cb;
-}
+ virtual void TearDown() {
+ mTestUtil->Unprepare();
+ delete mTestUtil;
+ mTestUtil = nullptr;
-static void __get_test_PCM_Data()
-{
- const char* pcm_path = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.tts-unittests/res/test_pcm.dat");
- FILE* fp_in = fopen(pcm_path, "rb");
- if (fp_in == nullptr) {
- return;
+ TtsTestUtility::WaitUntilEngineTerminated(1);
+ ecore_shutdown();
}
- fseek(fp_in, 0, SEEK_END);
- long size = ftell(fp_in);
- fseek(fp_in, 0, SEEK_SET);
- if (size <= 0) {
- fclose(fp_in);
- return;
- }
+public:
+ TtsTestUtility *mTestUtil = nullptr;
+ tts_h mHandle = nullptr;
+};
- char* data = (char*)calloc(sizeof(char), size);
- if (NULL == data) {
- fclose(fp_in);
- return;
- }
- size_t read_size = fread(data, sizeof(char), size, fp_in);
- fclose(fp_in);
+class TTSPreparedWithUttCbTest : public testing::Test {
+public:
+ virtual void SetUp() {
+ ecore_init();
+ mTestUtil = new TtsTestUtility();
- if (read_size <= 0) {
- free(data);
- return;
+ mHandle = mTestUtil->mHandle;
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_NONE);
+ mTestUtil->Prepare();
}
- g_pcm_size = size;
- g_pcm_data = data;
-
- return;
-}
+ virtual void TearDown() {
+ mTestUtil->Unprepare();
+ delete mTestUtil;
+ mTestUtil = nullptr;
-static void __createTTSHandle()
-{
- g_current_state = TTS_STATE_CREATED;
- is_created_hndl = tts_create(&g_tts);
- if (g_supported == false) {
- g_tts = nullptr;
- return;
+ TtsTestUtility::WaitUntilEngineTerminated(1);
+ ecore_shutdown();
}
- EXPECT_EQ(tts_set_state_changed_cb(g_tts, __tts_state_changed_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_default_voice(g_tts, &g_language, &g_voice_type), TTS_ERROR_NONE);
-}
+public:
+ TtsTestUtility *mTestUtil = nullptr;
+ tts_h mHandle = nullptr;
+};
-static void __setUttCb()
-{
- EXPECT_EQ(tts_set_utterance_started_cb(g_tts, __tts_utterance_started_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_utterance_completed_cb(g_tts, __tts_utterance_completed_cb, nullptr), TTS_ERROR_NONE);
-}
-static void __destroyTTSHandle()
+TEST_F(TTSTest, utc_tts_create_p1)
{
- if (nullptr == g_tts) {
+ tts_h tts = nullptr;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_create(&tts), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NONE);
-
- g_tts = nullptr;
+ EXPECT_EQ(tts_create(&tts), TTS_ERROR_NONE);
+ tts_destroy(tts);
}
-static void __clearGlobalValue()
+TEST_F(TTSTest, utc_tts_create_n1)
{
- free(g_language);
- g_language = nullptr;
-
- is_created_hndl = -1;
-
- free(g_pcm_data);
- g_pcm_data = nullptr;
- g_pcm_size = 0;
-}
-
-namespace {
-
-class TTSTest : public testing::Test {
- public:
- virtual void SetUp() {
- ecore_init();
- system_info_get_platform_bool("http://tizen.org/feature/speech.synthesis", &g_supported);
- g_supported = true;
-
- /* start of TC */
- __createTTSHandle();
- }
-
- virtual void TearDown() {
- __destroyTTSHandle();
- __clearGlobalValue();
-
- sleep(1);
- ecore_shutdown();
- }
-};
-
-class TTSPreparedTest : public testing::Test {
- public:
- virtual void SetUp() {
- ecore_init();
- system_info_get_platform_bool("http://tizen.org/feature/speech.synthesis", &g_supported);
- g_supported = true;
-
- /* start of TC */
- __createTTSHandle();
-
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
- }
-
- virtual void TearDown() {
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
-
- __destroyTTSHandle();
- __clearGlobalValue();
-
- sleep(1);
- ecore_shutdown();
- }
-};
-
-class TTSPreparedWithUttCbTest : public testing::Test {
- public:
- virtual void SetUp() {
- ecore_init();
- system_info_get_platform_bool("http://tizen.org/feature/speech.synthesis", &g_supported);
- g_supported = true;
-
- /* start of TC */
- __createTTSHandle();
- __setUttCb();
-
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
- }
-
- virtual void TearDown() {
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
-
- __destroyTTSHandle();
- __clearGlobalValue();
-
- sleep(1);
- ecore_shutdown();
- }
-};
-
-TEST_F(TTSTest, utc_tts_create_p)
-{
- if (g_supported == false) {
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_create(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-}
-
-TEST_F(TTSTest, utc_tts_create_n)
-{
- int ret = tts_create(NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_create(nullptr), TTS_ERROR_INVALID_PARAMETER);
}
-TEST_F(TTSTest, utc_tts_destroy_p)
+TEST_F(TTSTest, utc_tts_destroy_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- g_tts = NULL;
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NONE);
+ mTestUtil->mHandle = nullptr;
}
TEST_F(TTSTest, utc_tts_destroy_p2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_mode(g_tts, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_DEFAULT), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_destroy(g_tts);
- g_tts = NULL;
- EXPECT_EQ(ret, TTS_ERROR_NONE);}
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NONE);
+ mTestUtil->mHandle = nullptr;
+}
TEST_F(TTSTest, utc_tts_destroy_p3)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_mode(g_tts, TTS_MODE_NOTIFICATION);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_NOTIFICATION), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_destroy(g_tts);
- g_tts = NULL;
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NONE);
+ mTestUtil->mHandle = nullptr;
}
/**
*/
TEST_F(TTSTest, utc_tts_destroy_p4)
{
- int ret = TTS_ERROR_NONE;
- if(g_supported == false){
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- tts_h tts = NULL;
- ret = tts_create(&tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ auto localUtil = std::make_unique<TtsTestUtility>();
- ret = tts_destroy(tts);
- tts = NULL;
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- g_tts = NULL;
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
}
-TEST_F(TTSTest, utc_tts_destroy_n)
+TEST_F(TTSTest, utc_tts_destroy_n1)
{
- int ret = tts_destroy(NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_destroy(nullptr), TTS_ERROR_INVALID_PARAMETER);
+
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
TEST_F(TTSTest, utc_tts_destroy_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_destroy(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_destroy(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ auto destroy_callback = [](tts_h tts, tts_state_e previous, tts_state_e current, void* user_data)
+ {
+ auto util = reinterpret_cast<TtsTestUtility *>(user_data);
- ret = tts_destroy(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ ASSERT_EQ(util->mHandle, tts);
+ ASSERT_NE(tts_destroy(util->mHandle), TTS_ERROR_NONE);
+ };
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, destroy_callback, mTestUtil), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NONE);
}
-TEST_F(TTSTest, utc_tts_destroy_n3)
+TEST_F(TTSTest, utc_tts_set_mode_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_DEFAULT), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_state_changed_cb(g_tts, __tts_state_changed_cb_destroy_test, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare_sync(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_DEFAULT), TTS_ERROR_NONE);
}
-TEST_F(TTSTest, utc_tts_set_mode_p)
+TEST_F(TTSTest, utc_tts_set_mode_p2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_mode(g_tts, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_mode(g_tts, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
}
-TEST_F(TTSTest, utc_tts_set_mode_p2)
+TEST_F(TTSTest, utc_tts_set_mode_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_mode(g_tts, TTS_MODE_SCREEN_READER);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_mode(nullptr, TTS_MODE_SCREEN_READER), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_mode(g_tts, TTS_MODE_SCREEN_READER);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-}
-
-TEST_F(TTSTest, utc_tts_set_mode_n)
-{
- int ret = tts_set_mode(NULL, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_mode(nullptr, TTS_MODE_DEFAULT), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_mode(mHandle, (tts_mode_e)100), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_mode(mHandle, (tts_mode_e)-1), TTS_ERROR_INVALID_PARAMETER);
}
TEST_F(TTSPreparedTest, utc_tts_set_mode_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_mode(NULL, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_DEFAULT), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_mode(g_tts, TTS_MODE_DEFAULT);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_DEFAULT), TTS_ERROR_INVALID_STATE);
}
-TEST_F(TTSTest, utc_tts_set_mode_n3)
+TEST_F(TTSTest, utc_tts_get_mode_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_mode(NULL, TTS_MODE_DEFAULT);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_mode_e mode = TTS_MODE_DEFAULT;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_mode(mHandle, &mode), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_mode(g_tts, (tts_mode_e)100);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ ASSERT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+
+ EXPECT_EQ(tts_get_mode(mHandle, &mode), TTS_ERROR_NONE);
+ EXPECT_EQ(mode, TTS_MODE_SCREEN_READER);
}
-TEST_F(TTSTest, utc_tts_get_mode_p)
+TEST_F(TTSTest, utc_tts_get_mode_n1)
{
- tts_mode_e mode;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_mode(g_tts, &mode);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_mode_e mode = TTS_MODE_DEFAULT;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_mode(nullptr, &mode), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_mode(g_tts, &mode);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- return;
-}
-
-TEST_F(TTSTest, utc_tts_get_mode_n)
-{
- tts_mode_e mode;
- int ret = tts_get_mode(NULL, &mode);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_mode(nullptr, &mode), TTS_ERROR_INVALID_PARAMETER);
}
TEST_F(TTSPreparedTest, utc_tts_get_mode_n2)
{
- tts_mode_e mode;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_mode(g_tts, &mode);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_mode_e mode = TTS_MODE_SCREEN_READER;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_mode(mHandle, &mode), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_get_mode(g_tts, &mode);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_mode(mHandle, &mode), TTS_ERROR_INVALID_STATE);
}
-TEST_F(TTSTest, utc_tts_get_speed_range_p)
+TEST_F(TTSTest, utc_tts_get_speed_range_p1)
{
- int min;
- int normal;
- int max;
- int ret = TTS_ERROR_NONE;
+ int min = -1;
+ int normal = -1;
+ int max = -1;
- if (g_supported == false) {
- ret = tts_get_speed_range(g_tts, &min, &normal, &max);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_speed_range(mHandle, &min, &normal, &max), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_get_speed_range(g_tts, &min, &normal, &max);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_speed_range(mHandle, &min, &normal, &max), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_get_speed_range_n)
+TEST_F(TTSTest, utc_tts_get_speed_range_n1)
{
- int min;
- int normal;
- int max;
- int ret = TTS_ERROR_NONE;
+ int min = -1;
+ int normal = -1;
+ int max = -1;
- if (g_supported == false) {
- ret = tts_get_speed_range(NULL, &min, &normal, &max);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_speed_range(nullptr, &min, &normal, &max), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_get_speed_range(NULL, &min, &normal, &max);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_get_speed_range_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_get_speed_range_n2)
-{
- int min;
- int normal;
- int max;
- int ret = TTS_ERROR_NONE;
+ EXPECT_EQ(tts_get_speed_range(nullptr, &min, &normal, &max), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_speed_range(mHandle, nullptr, &normal, &max), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_speed_range(mHandle, &min, nullptr, &max), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_speed_range(mHandle, &min, &normal, nullptr), TTS_ERROR_INVALID_PARAMETER);
- if (g_supported == false) {
- ret = tts_get_speed_range(NULL, &min, &normal, &max);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_get_speed_range(g_tts, &min, &normal, &max);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_get_speed_range(mHandle, &min, &normal, &max), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @since_tizen 2.3
* @description test whether tts daemon is prepared properly.
*/
-TEST_F(TTSTest, utc_tts_prepare_p)
+TEST_F(TTSTest, utc_tts_prepare_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- tts_unprepare(g_tts);
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 2.3
* @description test whether tts daemon is prepared properly.
*/
-TEST_F(TTSTest, utc_tts_prepare_p2)
+TEST_F(TTSPreparedTest, utc_tts_prepare_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_current_state = TTS_STATE_CREATED;
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(__is_state_changed(TTS_STATE_READY, 5), true);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
- sleep(1);
+ EXPECT_EQ(mTestUtil->Unprepare(), true);
+ mTestUtil->WaitUntilEngineTerminated(STATE_CHECK_WAITING_TIME);
- g_current_state = TTS_STATE_CREATED;
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(__is_state_changed(TTS_STATE_READY, 5), true);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
-TEST_F(TTSTest, utc_tts_prepare_n)
+TEST_F(TTSTest, utc_tts_prepare_n1)
{
- int ret = tts_prepare(NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_prepare(nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @since_tizen 2.3
* @description test whether function returns error when tts is ready state, not create state.
*/
-TEST_F(TTSTest, utc_tts_prepare_n2)
+TEST_F(TTSPreparedTest, utc_tts_prepare_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_prepare(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- tts_unprepare(g_tts);
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
*/
TEST_F(TTSTest, utc_tts_prepare_n3)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_mode(g_tts, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
- ASSERT_NE(tts_prepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+ ASSERT_NE(tts_prepare(mHandle), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_prepare_n4
* @since_tizen 2.3
- * @description test whether state does not change to ready. (expired handle)
+ * @description test whether state does not change to ready. (expired mHandle)
*/
TEST_F(TTSTest, utc_tts_prepare_n4)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NONE);
-
- EXPECT_EQ(false, __is_state_changed(TTS_STATE_READY, 5));
-
- EXPECT_EQ(tts_create(&g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), false);
}
/**
*/
TEST_F(TTSTest, utc_tts_prepare_n5)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_mode(g_tts, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, true), 0);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NONE);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, false), 0);
- EXPECT_EQ(false, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), false);
}
/**
* @since_tizen 2.3
* @description test whether tts daemon is prepared properly.
*/
-TEST_F(TTSTest, utc_tts_prepare_sync_p)
+TEST_F(TTSTest, utc_tts_prepare_sync_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_prepare_sync(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_prepare_sync(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ tts_state_e state = TTS_STATE_CREATED;
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_STATE_READY);
}
/**
* @since_tizen 2.3
* @description test whether tts daemon is prepared properly.
*/
-TEST_F(TTSTest, utc_tts_prepare_sync_p2)
+TEST_F(TTSPreparedTest, utc_tts_prepare_sync_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare_sync(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Unprepare(), true);
+ mTestUtil->WaitUntilEngineTerminated(STATE_CHECK_WAITING_TIME);
tts_state_e state = TTS_STATE_CREATED;
- EXPECT_EQ(tts_prepare_sync(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_state(g_tts, &state), TTS_ERROR_NONE);
- EXPECT_EQ(state, TTS_STATE_READY);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
- sleep(1);
-
- state = TTS_STATE_CREATED;
- EXPECT_EQ(tts_prepare_sync(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_state(g_tts, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
EXPECT_EQ(state, TTS_STATE_READY);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error when tts is not created.
*/
-TEST_F(TTSTest, utc_tts_prepare_sync_n)
+TEST_F(TTSTest, utc_tts_prepare_sync_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_prepare_sync(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_prepare_sync(NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_prepare_sync(nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @since_tizen 2.3
* @description test whether function returns error when tts is ready state, not create state.
*/
-TEST_F(TTSTest, utc_tts_prepare_sync_n2)
+TEST_F(TTSPreparedTest, utc_tts_prepare_sync_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_prepare_sync(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_prepare_sync(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_prepare_sync(g_tts);
- EXPECT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
*/
TEST_F(TTSTest, utc_tts_prepare_sync_n3)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_prepare_sync(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_mode(g_tts, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
- ASSERT_NE(tts_prepare_sync(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+ ASSERT_NE(tts_prepare_sync(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether each supported voices are gotten properly.
*/
-TEST_F(TTSTest, utc_tts_foreach_supported_voices_p)
+TEST_F(TTSTest, utc_tts_foreach_supported_voices_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_foreach_supported_voices(g_tts, __tts_supported_voice_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_foreach_supported_voices(g_tts, __tts_supported_voice_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_foreach_supported_voices_n)
+TEST_F(TTSTest, utc_tts_foreach_supported_voices_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_foreach_supported_voices(NULL, __tts_supported_voice_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_foreach_supported_voices(nullptr, __tts_supported_voice_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_foreach_supported_voices(NULL, __tts_supported_voice_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_foreach_supported_voices_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_foreach_supported_voices_n2)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_foreach_supported_voices(NULL, __tts_supported_voice_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_foreach_supported_voices(g_tts, __tts_supported_voice_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_foreach_supported_voices(nullptr, __tts_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_foreach_supported_voices(mHandle, __tts_supported_voice_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
-
/**
* @testcase utc_tts_get_default_voice_p
* @since_tizen 2.3
* @description test whether default voice is gotten properly.
*/
-TEST_F(TTSTest, utc_tts_get_default_voice_p)
+TEST_F(TTSTest, utc_tts_get_default_voice_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_default_voice(g_tts, &g_language, &g_voice_type);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ char *language = nullptr;
+ int voice_type = -1;
+
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_default_voice(mHandle, &language, &voice_type), TTS_ERROR_NOT_SUPPORTED);
return;
}
- free (g_language);
- g_language = NULL;
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_get_default_voice(g_tts, &g_language, &g_voice_type);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_default_voice(mHandle, &language, &voice_type), TTS_ERROR_NONE);
+ free(language);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_get_default_voice_n)
+TEST_F(TTSTest, utc_tts_get_default_voice_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_default_voice(NULL, &g_language, &g_voice_type);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- free (g_language);
- g_language = NULL;
- ret = tts_get_default_voice(NULL, &g_language, &g_voice_type);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_get_default_voice_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_get_default_voice_n2)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_default_voice(NULL, &g_language, &g_voice_type);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
+ char *language = nullptr;
+ int voice_type = -1;
- free (g_language);
- g_language = NULL;
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_get_default_voice(g_tts, &g_language, &g_voice_type);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_get_default_voice_n3
- * @since_tizen 2.3
- * @description test whether function returns error with NULL parameter as type.
- */
-TEST_F(TTSTest, utc_tts_get_default_voice_n3)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_default_voice(NULL, &g_language, &g_voice_type);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_default_voice(nullptr, &language, &voice_type), TTS_ERROR_NOT_SUPPORTED);
return;
}
- free(g_language);
- g_language = NULL;
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_default_voice(nullptr, &language, &voice_type), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_default_voice(mHandle, nullptr, &voice_type), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_default_voice(mHandle, &language, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_get_default_voice(g_tts, &g_language, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_get_default_voice(mHandle, &language, &voice_type), TTS_ERROR_INVALID_PARAMETER);
}
-
/**
* @testcase utc_tts_get_max_text_size_p
* @since_tizen 2.3
* @description test whether max text size is gotten properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_get_max_text_size_p)
+TEST_F(TTSPreparedTest, utc_tts_get_max_text_size_p1)
{
- unsigned int size;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_max_text_size(g_tts, &size);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ unsigned int size = 0;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_max_text_size(mHandle, &size), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_max_text_size(g_tts, &size);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_max_text_size(mHandle, &size), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_get_max_text_size_n)
+TEST_F(TTSTest, utc_tts_get_max_text_size_n1)
{
- unsigned int size;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_max_text_size(NULL, &size);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ unsigned int size = 0;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_max_text_size(nullptr, &size), TTS_ERROR_NOT_SUPPORTED);
return;
}
- ret = tts_get_max_text_size(NULL, &size);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_max_text_size(nullptr, &size), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_max_text_size(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
+
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_get_max_text_size(mHandle, &size), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @testcase utc_tts_get_max_text_size_n2
* @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
+ * @description test whether function returns error when tts is in create state.
*/
TEST_F(TTSTest, utc_tts_get_max_text_size_n2)
{
- unsigned int size;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_max_text_size(NULL, &size);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ unsigned int size = 0;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_max_text_size(mHandle, &size), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_get_max_text_size(g_tts, &size);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_max_text_size(mHandle, &size), TTS_ERROR_INVALID_STATE);
}
-
-/**
- * @testcase utc_tts_get_max_text_size_n3
- * @since_tizen 2.3
- * @description test whether function returns error when tts is in create state.
- */
-TEST_F(TTSTest, utc_tts_get_max_text_size_n3)
-{
- unsigned int size;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_max_text_size(NULL, &size);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_max_text_size(g_tts, &size);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-
/**
* @testcase utc_tts_get_state_p
* @since_tizen 2.3
* @description test whether state is gotten properly in create state.
*/
-TEST_F(TTSTest, utc_tts_get_state_p)
+TEST_F(TTSTest, utc_tts_get_state_p1)
{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_state_e state = TTS_STATE_CREATED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_STATE_CREATED);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_get_state_p2)
{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_state_e state = TTS_STATE_CREATED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_STATE_READY);
}
-
/**
* @testcase utc_tts_get_state_p3
* @since_tizen 2.3
*/
TEST_F(TTSPreparedTest, utc_tts_get_state_p3)
{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_state_e state = TTS_STATE_CREATED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_STATE_PLAYING);
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_get_state_p4)
{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_state_e state = TTS_STATE_CREATED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- ret = tts_pause(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PAUSED, 5));
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
+ EXPECT_EQ(mTestUtil->Pause(), true);
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_STATE_PAUSED);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
-
/**
* @testcase utc_tts_get_state_n
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_get_state_n)
+TEST_F(TTSTest, utc_tts_get_state_n1)
{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(NULL, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_state(NULL, &state);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_get_state_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_get_state_n2)
-{
- tts_state_e state;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_state(g_tts, &state);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ tts_state_e state = TTS_STATE_CREATED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_state(nullptr, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_get_state(g_tts, &state);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_state(nullptr, &state), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_state(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_get_state(mHandle, &state), TTS_ERROR_INVALID_PARAMETER);
}
-
/**
* @testcase utc_tts_get_service_state_p
* @since_tizen 7.0
* @description test whether state is gotten properly in service state ready
*/
-TEST_F(TTSPreparedTest, utc_tts_get_service_state_p)
+TEST_F(TTSPreparedTest, utc_tts_get_service_state_p1)
{
- tts_service_state_e state;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NOT_SUPPORTED);
+ tts_service_state_e state = TTS_SERVICE_STATE_BLOCKED;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NONE);
EXPECT_EQ(state, TTS_SERVICE_STATE_READY);
}
* @since_tizen 7.0
* @description test whether state is gotten properly when client requests to play.
*/
-TEST_F(TTSTest, utc_tts_get_service_state_p2)
+TEST_F(TTSPreparedTest, utc_tts_get_service_state_p2)
{
tts_service_state_e state;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- g_current_service_state = TTS_SERVICE_STATE_READY;
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(__is_state_changed(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
-
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NONE);
EXPECT_EQ(state, TTS_SERVICE_STATE_READY);
int utt_id = 0;
- EXPECT_EQ(tts_add_text(g_tts, "1 2 3 4 5", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3 4 5", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NONE);
EXPECT_EQ(state, TTS_SERVICE_STATE_SYNTHESIZING);
- EXPECT_EQ(__is_service_state_changed(TTS_SERVICE_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NONE);
- EXPECT_EQ(state, TTS_SERVICE_STATE_PLAYING);
+ EXPECT_EQ(mTestUtil->IsServiceStateChanged(TTS_SERVICE_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_stop(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NONE);
+ EXPECT_EQ(state, TTS_SERVICE_STATE_PLAYING);
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 7.0
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSPreparedTest, utc_tts_get_service_state_n)
+TEST_F(TTSPreparedTest, utc_tts_get_service_state_n1)
{
- tts_service_state_e state;
- if (g_supported == false) {
+ tts_service_state_e state = TTS_SERVICE_STATE_BLOCKED;
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_get_service_state(nullptr, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
EXPECT_EQ(tts_get_service_state(nullptr, &state), TTS_ERROR_INVALID_PARAMETER);
-}
-
-/**
- * @testcase utc_tts_get_service_state_n2
- * @since_tizen 7.0
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_get_service_state_n2)
-{
- tts_service_state_e state;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_service_state(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_create(&g_tts), TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_get_service_state_n3
+ * @testcase utc_tts_get_service_state_n2
* @since_tizen 7.0
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSTest, utc_tts_get_service_state_n3)
+TEST_F(TTSTest, utc_tts_get_service_state_n2)
{
tts_service_state_e state;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_get_service_state(g_tts, &state), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_INVALID_STATE);
}
-
/**
* @testcase utc_tts_add_text_p
* @since_tizen 2.3
* @description test whether text is added properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_add_text_p)
+TEST_F(TTSPreparedTest, utc_tts_add_text_p1)
{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ int utt_id = -1;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_add_text_n
* @since_tizen 2.3
- * @description test whether function returns error with NULL parameter.
+ * @description test whether function returns error with invalid parameter.
*/
-TEST_F(TTSTest, utc_tts_add_text_n)
+TEST_F(TTSTest, utc_tts_add_text_n1)
{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(NULL, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_add_text(NULL, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_add_text_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_add_text_n2)
-{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(NULL, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ int utt_id = -1;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_text(nullptr, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ 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, "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);
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_add_text_n3
+ * @testcase utc_tts_add_text_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSTest, utc_tts_add_text_n3)
-{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(NULL, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_add_text_n4
- * @since_tizen 2.3
- * @description test whether function returns error when text is over max text size.
- */
-TEST_F(TTSPreparedTest, utc_tts_add_text_n4)
-{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_add_text(g_tts, g_text, g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_add_text_n5
- * @since_tizen 2.3
- * @description test whether function returns error when tts speed is abnormal.
- */
-TEST_F(TTSPreparedTest, utc_tts_add_text_n5)
-{
- int utt_id;
- int speed = -1;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, speed, &utt_id);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_add_text_n6
- * @since_tizen 2.3
- * @description test whether function returns error with empty string.
- */
-TEST_F(TTSPreparedTest, utc_tts_add_text_n6)
+TEST_F(TTSTest, utc_tts_add_text_n2)
{
- int utt_id;
- if (g_supported == false) {
- EXPECT_EQ(tts_add_text(g_tts, "", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NOT_SUPPORTED);
+ int utt_id = -1;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_NE(tts_add_text(g_tts, "", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether tts is played properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_play_p)
+TEST_F(TTSPreparedTest, utc_tts_play_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
*/
TEST_F(TTSPreparedWithUttCbTest, utc_tts_play_p2)
{
- int utt_id;
- int ret = TTS_ERROR_NONE;
-
- if (g_supported == false) {
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_utterance_completed_cb = false;
-
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
+ int utt_id = -1;
+ ASSERT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ ASSERT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
+ ASSERT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
+ EXPECT_EQ(mTestUtil->mUttId, utt_id);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
*/
TEST_F(TTSPreparedWithUttCbTest, utc_tts_play_p3)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_utterance_completed_cb = false;
-
int utt_id1 = -1;
int utt_id2 = -1;
- EXPECT_EQ(tts_add_text(g_tts, "1 2 3 4 5", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id1), TTS_ERROR_NONE);
- EXPECT_EQ(tts_add_text(g_tts, "1 2 3 4 5", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id2), TTS_ERROR_NONE);
+ const char *text = "1 2 3 4 5";
+ ASSERT_EQ(tts_add_text(mHandle, text, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id1), TTS_ERROR_NONE);
+ ASSERT_EQ(tts_add_text(mHandle, text, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id2), TTS_ERROR_NONE);
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ ASSERT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
+ ASSERT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
- g_utterance_completed_cb = false;
- EXPECT_EQ(utt_id1, g_utt_id);
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
+ EXPECT_EQ(mTestUtil->mUttId, utt_id1);
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
- EXPECT_EQ(utt_id2, g_utt_id);
+ mTestUtil->mUtteranceCompleted = false;
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
+ EXPECT_EQ(mTestUtil->mUttId, utt_id2);
- EXPECT_EQ(tts_stop(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_play_p4)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- tts_h tts = NULL;
- EXPECT_EQ(tts_create(&tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare_sync(tts), TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ auto localUtil = std::make_unique<TtsTestUtility>();
+ EXPECT_EQ(localUtil->Prepare(), true);
- EXPECT_EQ(tts_play(tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(localUtil->Play(), true);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(localUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_stop(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_stop(tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_unprepare(tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_destroy(tts), TTS_ERROR_NONE);
- tts = NULL;
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_play_n)
+TEST_F(TTSTest, utc_tts_play_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_play(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_play(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(nullptr), TTS_ERROR_INVALID_PARAMETER);
+
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @testcase utc_tts_play_n2
* @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
+ * @description test whether function returns error when tts is in create state.
*/
TEST_F(TTSTest, utc_tts_play_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_play(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @testcase utc_tts_play_n3
* @since_tizen 2.3
- * @description test whether function returns error when tts is in create state.
- */
-TEST_F(TTSTest, utc_tts_play_n3)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_play_n4
- * @since_tizen 2.3
* @description test whether function returns error when interrupt mode client plays.
*/
-TEST_F(TTSPreparedTest, utc_tts_play_n4)
+TEST_F(TTSPreparedTest, utc_tts_play_n3)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- tts_h tts = NULL;
- EXPECT_EQ(tts_create(&tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_mode(tts, (tts_mode_e)TTS_MODE_INTERRUPT), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare_sync(tts), TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_play(tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ auto localUtil = std::make_unique<TtsTestUtility>();
+ EXPECT_EQ(tts_set_mode(localUtil->mHandle, (tts_mode_e)TTS_MODE_INTERRUPT), TTS_ERROR_NONE);
+ EXPECT_EQ(localUtil->Prepare(), true);
+ EXPECT_EQ(localUtil->Play(), true);
- EXPECT_NE(tts_play(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_AUDIO_POLICY_BLOCKED);
- EXPECT_EQ(tts_stop(tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_unprepare(tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_destroy(tts), TTS_ERROR_NONE);
- tts = NULL;
+ EXPECT_EQ(localUtil->Stop(), true);
}
/**
* @since_tizen 2.3
* @description test whether tts is paused properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_pause_p)
+TEST_F(TTSPreparedTest, utc_tts_pause_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_pause(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_pause(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_pause(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PAUSED, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- ret = tts_pause(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PAUSED, 5));
-
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_pause_n)
+TEST_F(TTSTest, utc_tts_pause_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_pause(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_pause(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_pause(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
+ EXPECT_EQ(tts_pause(nullptr), TTS_ERROR_INVALID_PARAMETER);
-/**
- * @testcase utc_tts_pause_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_pause_n2)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_pause(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_pause(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_pause(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_pause_n3
+ * @testcase utc_tts_pause_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSTest, utc_tts_pause_n3)
+TEST_F(TTSTest, utc_tts_pause_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_pause(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_pause(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_pause(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_pause(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether tts is stopped properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_stop_p)
+TEST_F(TTSPreparedTest, utc_tts_stop_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_stop(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(tts_stop(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_stop_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_stop(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_stop(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_stop_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_stop_n2)
+TEST_F(TTSTest, utc_tts_stop_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_stop(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_stop(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_stop(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_stop(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_stop(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_stop_n3
+ * @testcase utc_tts_stop_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSTest, utc_tts_stop_n3)
+TEST_F(TTSTest, utc_tts_stop_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_stop(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_stop(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_stop(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_stop(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 5.0
* @description test whether tts is repeated properly.
*/
-TEST_F(TTSPreparedWithUttCbTest, utc_tts_repeat_p)
+TEST_F(TTSPreparedWithUttCbTest, utc_tts_repeat_p1)
{
- int ret = TTS_ERROR_NONE;
- char* text_repeat = NULL;
+ char* text_repeat = nullptr;
int utt_id = -1;
- if (g_supported == false) {
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_utterance_completed_cb = false;
-
- ret = tts_add_text(g_tts, "repeat success", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
-
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- g_utterance_completed_cb = false;
-
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ const char *text = "repeat success";
+ mTestUtil->mUtteranceCompleted = false;
+ EXPECT_EQ(tts_add_text(mHandle, text, mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
- ret = strncmp(text_repeat, "repeat success", strlen(text_repeat));
- free(text_repeat);
- EXPECT_EQ(ret, 0);
+ EXPECT_EQ(mTestUtil->Stop(), true);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ mTestUtil->mUtteranceCompleted = false;
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_NONE);
+ EXPECT_STREQ(text_repeat, text);
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
-
- EXPECT_EQ(utt_id, g_utt_id);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(utt_id, mTestUtil->mUttId);
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 5.0
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_repeat_n)
+TEST_F(TTSTest, utc_tts_repeat_n1)
{
- int ret = TTS_ERROR_NONE;
+ char* text_repeat = nullptr;
+ int utt_id = -1;
- if (g_supported == false) {
- ret = tts_repeat(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_repeat(nullptr, &text_repeat, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_repeat(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_repeat(nullptr, &text_repeat, &utt_id), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_repeat(mHandle, nullptr, &utt_id), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSTest, utc_tts_repeat_n2)
{
- int ret = TTS_ERROR_NONE;
- char* text_repeat = NULL;
+ char* text_repeat = nullptr;
int utt_id = -1;
- if (g_supported == false) {
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 5.0
* @description test whether function returns error with operation failed when there is no previous text.
*/
-TEST_F(TTSTest, utc_tts_repeat_n3)
+TEST_F(TTSPreparedTest, utc_tts_repeat_n3)
{
- int ret = TTS_ERROR_NONE;
- char* text_repeat = NULL;
+ char* text_repeat = nullptr;
int utt_id = -1;
- if (g_supported == false) {
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_repeat(g_tts, &text_repeat, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_OPERATION_FAILED);
-
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_repeat(mHandle, &text_repeat, &utt_id), TTS_ERROR_OPERATION_FAILED);
}
/**
* @since_tizen 2.3
* @description test whether tts is unprepared properly.
*/
-TEST_F(TTSTest, utc_tts_unprepare_p)
+TEST_F(TTSPreparedTest, utc_tts_unprepare_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSTest, utc_tts_unprepare_p2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_mode(g_tts, TTS_MODE_NOTIFICATION);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_prepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- ret = tts_unprepare(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_NOTIFICATION), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSTest, utc_tts_unprepare_p3)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, true), 0);
- EXPECT_EQ(tts_set_mode(g_tts, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, false), 0);
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NONE);
}
-TEST_F(TTSTest, utc_tts_unprepare_n)
+TEST_F(TTSTest, utc_tts_unprepare_n1)
{
- int ret = tts_unprepare(NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
-}
-
-/**
- * @testcase utc_tts_unprepare_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unprepare_n2)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unprepare(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unprepare(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_unprepare(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unprepare(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unprepare_n3
+ * @testcase utc_tts_unprepare_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSTest, utc_tts_unprepare_n3)
+TEST_F(TTSTest, utc_tts_unprepare_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unprepare(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unprepare(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unprepare(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether state_changed callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_state_changed_cb_p)
+TEST_F(TTSTest, utc_tts_set_state_changed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_state_changed_cb(g_tts, __tts_state_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_state_changed_cb(g_tts, __tts_state_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_set_state_changed_cb_n
* @since_tizen 2.3
- * @description test whether function returns error with NULL parameter.
- */
-TEST_F(TTSTest, utc_tts_set_state_changed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_state_changed_cb(NULL, __tts_state_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_state_changed_cb(NULL, __tts_state_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_set_state_changed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
+ * @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_state_changed_cb_n2)
+TEST_F(TTSTest, utc_tts_set_state_changed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_state_changed_cb(NULL, __tts_state_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_state_changed_cb(nullptr, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_set_state_changed_cb(g_tts, __tts_state_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_state_changed_cb(nullptr, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_state_changed_cb_n3
+ * @testcase utc_tts_set_state_changed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_state_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_state_changed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_state_changed_cb(NULL, __tts_state_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_state_changed_cb(g_tts, __tts_state_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_state_changed_cb(mHandle, mTestUtil->StateChangedCallback, mTestUtil), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether state_changed callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_state_changed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_state_changed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_state_changed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_state_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_state_changed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_state_changed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_state_changed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_state_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_unset_state_changed_cb(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_unset_state_changed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_state_changed_cb_n2)
+TEST_F(TTSTest, utc_tts_unset_state_changed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_state_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_state_changed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_unset_state_changed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_state_changed_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_state_changed_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_state_changed_cb_n3
+ * @testcase utc_tts_unset_state_changed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_state_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_state_changed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_state_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_state_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_state_changed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_state_changed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether utterance_started callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_utterance_started_cb_p)
+TEST_F(TTSTest, utc_tts_set_utterance_started_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_started_cb(g_tts, __tts_utterance_started_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_utterance_started_cb(g_tts, __tts_utterance_started_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_utterance_started_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_started_cb(NULL, __tts_utterance_started_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_set_utterance_started_cb(NULL, __tts_utterance_started_cb, NULL);
- EXPECT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_set_utterance_started_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_set_utterance_started_cb_n2)
+TEST_F(TTSTest, utc_tts_set_utterance_started_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_started_cb(NULL, __tts_utterance_started_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_started_cb(nullptr, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_set_utterance_started_cb(g_tts, __tts_utterance_started_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_started_cb(nullptr, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_utterance_started_cb_n3
+ * @testcase utc_tts_set_utterance_started_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_utterance_started_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_utterance_started_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_started_cb(NULL, __tts_utterance_started_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_utterance_started_cb(g_tts, __tts_utterance_started_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_started_cb(mHandle, mTestUtil->UtteranceStartedCallback, mTestUtil), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether utterance_started callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_utterance_started_cb_p)
+TEST_F(TTSTest, utc_tts_unset_utterance_started_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_started_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_started_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_unset_utterance_started_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_started_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_utterance_started_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_started_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_unset_utterance_started_cb(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_unset_utterance_started_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_utterance_started_cb_n2)
+TEST_F(TTSTest, utc_tts_unset_utterance_started_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_started_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_started_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_started_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_unset_utterance_started_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_utterance_started_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_utterance_started_cb_n3
+ * @testcase utc_tts_unset_utterance_started_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_utterance_started_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_utterance_started_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_started_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_started_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_utterance_started_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_started_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether utterance_completed callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_utterance_completed_cb_p)
+TEST_F(TTSTest, utc_tts_set_utterance_completed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_completed_cb(g_tts, __tts_utterance_completed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_utterance_completed_cb(g_tts, __tts_utterance_completed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_utterance_completed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_completed_cb(NULL, __tts_utterance_completed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_set_utterance_completed_cb(NULL, __tts_utterance_completed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_set_utterance_completed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_set_utterance_completed_cb_n2)
+TEST_F(TTSTest, utc_tts_set_utterance_completed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_completed_cb(NULL, __tts_utterance_completed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_completed_cb(nullptr, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_set_utterance_completed_cb(g_tts, __tts_utterance_completed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_completed_cb(nullptr, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, nullptr, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_utterance_completed_cb_n3
+ * @testcase utc_tts_set_utterance_completed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_utterance_completed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_utterance_completed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_utterance_completed_cb(NULL, __tts_utterance_completed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_utterance_completed_cb(g_tts, __tts_utterance_completed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_utterance_completed_cb(mHandle, mTestUtil->UtteranceCompletedCallback, mTestUtil), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether utterance_completed callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_utterance_completed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_utterance_completed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_completed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_completed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_unset_utterance_completed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_completed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_utterance_completed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_completed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_unset_utterance_completed_cb(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_unset_utterance_completed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_utterance_completed_cb_n2)
+TEST_F(TTSTest, utc_tts_unset_utterance_completed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_completed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_completed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_completed_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_unset_utterance_completed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_utterance_completed_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_utterance_completed_cb_n3
+ * @testcase utc_tts_unset_utterance_completed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_utterance_completed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_utterance_completed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_utterance_completed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_utterance_completed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_utterance_completed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_utterance_completed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether error callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_error_cb_p)
+TEST_F(TTSTest, utc_tts_set_error_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_error_cb(g_tts, __tts_error_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_error_cb(g_tts, __tts_error_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSTest, utc_tts_set_error_cb_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_error_cb(g_tts, __tts_error_cb, NULL), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- char* engine_id = vconf_get_str(ENGINE_VCONF_KEY);
-
- g_error_cb = false;
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_error_cb(g_tts, __tts_error_cb, NULL), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- EXPECT_EQ(vconf_set_str(ENGINE_VCONF_KEY, g_test_engine), 0);
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
- EXPECT_EQ(__is_error_occur(5), true);
- sleep(1);
+ mTestUtil->TerminateCurrentEngine();
+ EXPECT_EQ(mTestUtil->IsErrorOccurring(STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(vconf_set_str(ENGINE_VCONF_KEY, engine_id), 0);
- g_current_state = TTS_STATE_CREATED;
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ mTestUtil->mCurrentState = TTS_STATE_CREATED;
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_error_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_error_cb(NULL, __tts_error_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_set_error_cb(NULL, __tts_error_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_set_error_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_set_error_cb_n2)
+TEST_F(TTSTest, utc_tts_set_error_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_error_cb(NULL, __tts_error_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(nullptr, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_error_cb(nullptr, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_error_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_set_error_cb(g_tts, __tts_error_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_error_cb_n3
+ * @testcase utc_tts_set_error_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_error_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_error_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_error_cb(NULL, __tts_error_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_error_cb(g_tts, __tts_error_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, mTestUtil), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether error callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_error_cb_p)
+TEST_F(TTSTest, utc_tts_unset_error_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_error_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_error_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_unset_error_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_error_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_error_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_error_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_unset_error_cb(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_unset_error_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_error_cb_n2)
+TEST_F(TTSTest, utc_tts_unset_error_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_error_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_error_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_error_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_unset_error_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_error_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_error_cb_n3
+ * @testcase utc_tts_unset_error_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_error_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_error_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_error_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_error_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_error_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_error_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether default_voice_changed callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_p)
+TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_default_voice_changed_cb(g_tts, __tts_default_voice_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_default_voice_changed_cb(g_tts, __tts_default_voice_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_default_voice_changed_cb(NULL, __tts_default_voice_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_set_default_voice_changed_cb(NULL, __tts_default_voice_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_set_default_voice_changed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_n2)
+TEST_F(TTSTest, utc_tts_set_default_voice_changed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_default_voice_changed_cb(NULL, __tts_default_voice_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_default_voice_changed_cb(nullptr, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
- ret = tts_set_default_voice_changed_cb(g_tts, __tts_default_voice_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ 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(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_default_voice_changed_cb_n3
+ * @testcase utc_tts_set_default_voice_changed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_default_voice_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_default_voice_changed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_default_voice_changed_cb(NULL, __tts_default_voice_changed_cb, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_set_default_voice_changed_cb(g_tts, __tts_default_voice_changed_cb, NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_default_voice_changed_cb(mHandle, __tts_default_voice_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether default_voice_changed callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_default_voice_changed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_default_voice_changed_cb_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_default_voice_changed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_unset_default_voice_changed_cb(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_default_voice_changed_cb_n)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_default_voice_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- ret = tts_unset_default_voice_changed_cb(NULL);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-}
-
-/**
- * @testcase utc_tts_unset_default_voice_changed_cb_n2
- * @since_tizen 2.3
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_default_voice_changed_cb_n2)
+TEST_F(TTSTest, utc_tts_unset_default_voice_changed_cb_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_default_voice_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_destroy(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
- ret = tts_unset_default_voice_changed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
-
- ret = tts_create(&g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_default_voice_changed_cb_n3
+ * @testcase utc_tts_unset_default_voice_changed_cb_n2
* @since_tizen 2.3
* @description test whether function returns error when tts is not in create state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_default_voice_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_default_voice_changed_cb_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_unset_default_voice_changed_cb(NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- ret = tts_unset_default_voice_changed_cb(g_tts);
- ASSERT_NE(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_default_voice_changed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 7.0
* @description test whether service_state_changed callback function is set properly.
*/
-TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_p)
+TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_current_service_state = TTS_SERVICE_STATE_READY;
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(__is_state_changed(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
int utt_id = 0;
- EXPECT_EQ(tts_add_text(g_tts, "1 2 3 4 5", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3 4 5", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_play(mHandle), TTS_ERROR_NONE);
- EXPECT_EQ(__is_service_state_changed(TTS_SERVICE_STATE_SYNTHESIZING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_stop(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsServiceStateChanged(TTS_SERVICE_STATE_SYNTHESIZING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 7.0
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_n)
+TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_n1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_service_state_changed_cb(nullptr, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_service_state_changed_cb(nullptr, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_service_state_changed_cb(nullptr, __tts_service_state_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
-}
-/**
- * @testcase utc_tts_set_service_state_changed_cb_n2
- * @since_tizen 7.0
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_set_service_state_changed_cb_n2)
-{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_service_state_changed_cb(nullptr, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_create(&g_tts), TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_set_service_state_changed_cb_n3
+ * @testcase utc_tts_set_service_state_changed_cb_n2
* @since_tizen 7.0
* @description test whether function returns error when tts is not in ready state.
*/
-TEST_F(TTSPreparedTest, utc_tts_set_service_state_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_set_service_state_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, mTestUtil), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_service_state_changed_cb(g_tts, __tts_service_state_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_service_state_changed_cb(mHandle, mTestUtil->ServiceStateChangedCallback, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 7.0
* @description test whether service_state_changed callback function is unset properly.
*/
-TEST_F(TTSTest, utc_tts_unset_service_state_changed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_service_state_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_service_state_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_service_state_changed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @since_tizen 7.0
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_unset_service_state_changed_cb_n)
+TEST_F(TTSTest, utc_tts_unset_service_state_changed_cb_n1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_service_state_changed_cb(NULL), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_service_state_changed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
EXPECT_EQ(tts_unset_service_state_changed_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
-}
-
-/**
- * @testcase utc_tts_unset_service_state_changed_cb_n2
- * @since_tizen 7.0
- * @description test whether function returns error when tts handle is already destroyed.
- */
-TEST_F(TTSTest, utc_tts_unset_service_state_changed_cb_n2)
-{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_destroy(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_INVALID_PARAMETER);
- EXPECT_EQ(tts_create(&g_tts), TTS_ERROR_NONE);
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_unset_service_state_changed_cb(mHandle), TTS_ERROR_INVALID_PARAMETER);
}
/**
- * @testcase utc_tts_unset_service_state_changed_cb_n3
+ * @testcase utc_tts_unset_service_state_changed_cb_n2
* @since_tizen 7.0
* @description test whether function returns error when tts is not in ready state.
*/
-TEST_F(TTSPreparedTest, utc_tts_unset_service_state_changed_cb_n3)
+TEST_F(TTSPreparedTest, utc_tts_unset_service_state_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_service_state_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_unset_service_state_changed_cb(g_tts), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_unset_service_state_changed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
-
/**
* @testcase utc_tts_get_error_message_p
* @since_tizen 3.0
* @description Positive UTC for get error message
*/
-TEST_F(TTSTest, utc_tts_get_error_message_p)
+TEST_F(TTSTest, utc_tts_get_error_message_p1)
{
char* error_message = nullptr;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_error_message(g_tts, &error_message), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_error_message(mHandle, &error_message), TTS_ERROR_NOT_SUPPORTED);
free(error_message);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_get_error_message(g_tts, &error_message), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_error_message(mHandle, &error_message), TTS_ERROR_NONE);
free(error_message);
}
* @since_tizen 3.0
* @description Positive UTC for get error message
*/
-TEST_F(TTSTest, utc_tts_get_error_message_p2)
+TEST_F(TTSPreparedTest, utc_tts_get_error_message_p2)
{
char* error_message = nullptr;
- if (g_supported == false) {
- EXPECT_EQ(tts_get_error_message(g_tts, &error_message), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_error_message(mHandle, &error_message), TTS_ERROR_NOT_SUPPORTED);
free(error_message);
return;
}
- char* engine_id = vconf_get_str(ENGINE_VCONF_KEY);
-
- g_error_cb = false;
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_error_cb(g_tts, __tts_error_cb, NULL), TTS_ERROR_NONE);
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- EXPECT_EQ(vconf_set_str(ENGINE_VCONF_KEY, g_test_engine), 0);
-
- EXPECT_EQ(__is_error_occur(5), true);
+ mTestUtil->TerminateCurrentEngine();
+ EXPECT_EQ(mTestUtil->IsErrorOccurring(STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_get_error_message(g_tts, &error_message), TTS_ERROR_NONE);
- EXPECT_NE(error_message, nullptr);
+ EXPECT_EQ(tts_get_error_message(mHandle, &error_message), TTS_ERROR_NONE);
+ ASSERT_NE(error_message, nullptr);
free(error_message);
- sleep(1);
-
- EXPECT_EQ(vconf_set_str(ENGINE_VCONF_KEY, engine_id), 0);
- g_current_state = TTS_STATE_CREATED;
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ mTestUtil->mCurrentState = TTS_STATE_CREATED;
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 3.0
* @description Negative UTC for get error message (invalid parameter)
*/
- TEST_F(TTSTest, utc_tts_get_error_message_n)
+TEST_F(TTSTest, utc_tts_get_error_message_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_error_message(g_tts, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ char* error_message = nullptr;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_error_message(mHandle, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_error_message(g_tts, NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_error_message(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_error_message(nullptr, &error_message), TTS_ERROR_INVALID_PARAMETER);
}
/**
* @since_tizen 3.0
* @description Positive UTC for get private data
*/
-TEST_F(TTSPreparedTest, utc_tts_get_private_data_p)
+TEST_F(TTSPreparedTest, utc_tts_get_private_data_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ char *data = nullptr;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_private_data(mHandle, "version", &data), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- char *data = NULL;
- ret = tts_get_private_data(g_tts, "version", &data);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_get_private_data(mHandle, "version", &data), TTS_ERROR_NONE);
free(data);
}
* @since_tizen 3.0
* @description Negative UTC for get private data (invalid parameter)
*/
-TEST_F(TTSTest, utc_tts_get_private_data_n)
+TEST_F(TTSTest, utc_tts_get_private_data_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ char *data = nullptr;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_private_data(nullptr, "version", &data), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_get_private_data(NULL, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_private_data(nullptr, "version", &data), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_private_data(mHandle, nullptr, &data), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_private_data(mHandle, "version", nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSTest, utc_tts_get_private_data_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- char* data = NULL;
- ret = tts_get_private_data(g_tts, "version", &data);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_STATE);
-}
-
-/**
- * @testcase utc_tts_get_private_data_n3
- * @since_tizen 3.0
- * @description Negative UTC for get private data (invalid parameter)
- */
-TEST_F(TTSTest, utc_tts_get_private_data_n3)
-{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_get_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ char* data = nullptr;
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_get_private_data(mHandle, "version", &data), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- char* data = NULL;
- ret = tts_get_private_data(g_tts, NULL, &data);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_get_private_data(mHandle, "version", &data), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 3.0
* @description Positive UTC for set private data
*/
-TEST_F(TTSPreparedTest, utc_tts_set_private_data_p)
+TEST_F(TTSPreparedTest, utc_tts_set_private_data_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_private_data(mHandle, "version", "2.0"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_private_data(g_tts, "version", "2.0");
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_private_data(mHandle, "version", "2.0"), TTS_ERROR_NONE);
}
/**
* @since_tizen 3.0
* @description Negative UTC for set private data (invalid parameter)
*/
-TEST_F(TTSTest, utc_tts_set_private_data_n)
+TEST_F(TTSTest, utc_tts_set_private_data_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_private_data(nullptr, "version", "2.0"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_private_data(NULL, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_private_data(nullptr, "version", "2.0"), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_private_data(mHandle, nullptr, "2.0"), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_private_data(mHandle, "version", nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSTest, utc_tts_set_private_data_n2)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_private_data(mHandle, "version", "2.0"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_private_data(g_tts, "version", "2.0");
- EXPECT_EQ(ret, TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_private_data(mHandle, "version", "2.0"), TTS_ERROR_INVALID_STATE);
}
/**
- * @testcase utc_tts_set_private_data_n3
+ * @testcase utc_tts_set_credential_p
* @since_tizen 3.0
- * @description Negative UTC for set private data (invalid parameter)
+ * @description Positive UTC for set credential
*/
-TEST_F(TTSTest, utc_tts_set_private_data_n3)
+TEST_F(TTSTest, utc_tts_set_credential_p1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_private_data(g_tts, NULL, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_credential(mHandle, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_private_data(g_tts, NULL, "2.0");
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_credential(mHandle, "test"), TTS_ERROR_NONE);
}
-/**
- * @testcase utc_tts_set_credential_p
- * @since_tizen 3.0
- * @description Positive UTC for set credential
- */
-TEST_F(TTSTest, utc_tts_set_credential_p)
+TEST_F(TTSTest, utc_tts_set_credential_n1)
{
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_credential(g_tts, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_credential(nullptr, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_set_credential(g_tts, "test");
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-}
-
-TEST_F(TTSTest, utc_tts_set_credential_n)
-{
- int ret = tts_set_credential(NULL, "credential");
- EXPECT_EQ(ret, TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_credential(nullptr, "test"), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_credential(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_set_credential_n2)
{
- int utt_id;
- int ret = TTS_ERROR_NONE;
- if (g_supported == false) {
- ret = tts_set_credential(g_tts, NULL);
- EXPECT_EQ(ret, TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_credential(mHandle, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- ret = tts_add_text(g_tts, "1 2 3", g_language, g_voice_type, TTS_SPEED_AUTO, &utt_id);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- ret = tts_play(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
-
- while (TTS_STATE_PLAYING != g_current_state) {
- ecore_main_loop_iterate();
- }
-
- ret = tts_set_credential(g_tts, "test");
- EXPECT_EQ(ret, TTS_ERROR_INVALID_STATE);
+ int utt_id = -1;
+ EXPECT_EQ(tts_add_text(mHandle, "1 2 3", mTestUtil->mLanguage, mTestUtil->mVoiceType, TTS_SPEED_AUTO, &utt_id), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->Play(), true);
- ret = tts_stop(g_tts);
- EXPECT_EQ(ret, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_credential(mHandle, "test"), TTS_ERROR_INVALID_STATE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
-
/**
* @testcase utc_tts_set_server_tts_p
* @since_tizen 3.0
* @description Positive UTC for set server TTS as enabled
*/
-TEST_F(TTSPreparedTest, utc_tts_set_server_tts_p)
+TEST_F(TTSPreparedTest, utc_tts_set_server_tts_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_server_tts(g_tts, "test"), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_server_tts(mHandle, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_server_tts(g_tts, "test"), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_server_tts(mHandle, "test"), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_set_server_tts_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_server_tts(g_tts, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_server_tts(mHandle, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_server_tts(g_tts, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_server_tts(mHandle, nullptr), TTS_ERROR_NONE);
}
/**
* @since_tizen 3.0
* @description Negative UTC for set server TTS (Invalid parameter)
*/
-TEST_F(TTSTest, utc_tts_set_server_tts_n)
+TEST_F(TTSTest, utc_tts_set_server_tts_n1)
{
- if (g_supported == false) {
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_set_server_tts(nullptr, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_server_tts(nullptr, "test"), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_server_tts(nullptr, "test"), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_set_server_tts_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_server_tts(g_tts, "test"), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_server_tts(mHandle, "test"), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_play(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ EXPECT_EQ(mTestUtil->Play(), true);
- EXPECT_EQ(tts_set_server_tts(g_tts, "test"), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_server_tts(mHandle, "test"), TTS_ERROR_INVALID_STATE);
- EXPECT_EQ(tts_stop(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(mTestUtil->Stop(), true);
}
/**
* @since_tizen 6.5
* @description Positive UTC for checking screen reader on
*/
-TEST_F(TTSTest, utc_tts_check_screen_reader_on_p)
+TEST_F(TTSTest, utc_tts_check_screen_reader_on_p1)
{
bool is_on = false;
- if (g_supported == false) {
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, &is_on), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, &is_on), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, &is_on), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, &is_on), TTS_ERROR_NONE);
}
/**
TEST_F(TTSTest, utc_tts_check_screen_reader_on_p2)
{
bool is_on = false;
- if (g_supported == false) {
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, &is_on), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, &is_on), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_mode(mHandle, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
- EXPECT_EQ(tts_set_mode(g_tts, TTS_MODE_SCREEN_READER), TTS_ERROR_NONE);
+ EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, true), 0);
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, &is_on), TTS_ERROR_NONE);
+ EXPECT_EQ(is_on, true);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, false), 0);
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, &is_on), TTS_ERROR_NONE);
-
- EXPECT_EQ(is_on, false);
}
/**
* @since_tizen 6.5
* @description Negative UTC for checking screen reader on (invalid parameter)
*/
-TEST_F(TTSTest, utc_tts_check_screen_reader_on_n)
+TEST_F(TTSTest, utc_tts_check_screen_reader_on_n1)
{
bool is_on = false;
- if (g_supported == false) {
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_check_screen_reader_on(g_tts, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, nullptr), TTS_ERROR_INVALID_PARAMETER);
EXPECT_EQ(tts_check_screen_reader_on(nullptr, &is_on), TTS_ERROR_INVALID_PARAMETER);
}
* @since_tizen 6.5
* @description Positive UTC for set screen reader changed callback
*/
-TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_p)
+TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_NONE);
}
/**
*/
TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_screen_reader_changed_cb = false;
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, mTestUtil), TTS_ERROR_NONE);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, true), 0);
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsScreenReaderOn(STATE_CHECK_WAITING_TIME), true);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, false), 0);
- EXPECT_EQ(__is_screen_reader_changed(5), true);
}
/**
* @testcase utc_tts_set_screen_reader_changed_cb_n
* @since_tizen 6.5
- * @description Negative UTC for set screen reader changed callback (Invalid handle)
- */
-TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_n)
-{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_screen_reader_changed_cb(nullptr, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- EXPECT_EQ(tts_set_screen_reader_changed_cb(nullptr, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
-}
-
-/**
- * @testcase utc_tts_set_screen_reader_changed_cb_n2
- * @since_tizen 6.5
- * @description Negative UTC for set screen reader changed callback (Invalid parameter)
+ * @description Negative UTC for set screen reader changed callback (Invalid mHandle)
*/
-TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_n2)
+TEST_F(TTSTest, utc_tts_set_screen_reader_changed_cb_n1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, nullptr, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(nullptr, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(nullptr, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_set_screen_reader_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_screen_reader_changed_cb(mHandle, mTestUtil->ScreenReaderChangedCallback, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 6.5
* @description Positive UTC for unset screen reader changed callback
*/
-TEST_F(TTSTest, utc_tts_unset_screen_reader_changed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_screen_reader_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_screen_reader_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_screen_reader_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_unset_screen_reader_changed_cb(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_screen_reader_changed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_unset_screen_reader_changed_cb_n
* @since_tizen 6.5
- * @description Negative UTC for unset screen reader changed callback (Invalid handle)
+ * @description Negative UTC for unset screen reader changed callback (Invalid mHandle)
*/
-TEST_F(TTSTest, utc_tts_unset_screen_reader_changed_cb_n)
+TEST_F(TTSTest, utc_tts_unset_screen_reader_changed_cb_n1)
{
- if (g_supported == false) {
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_unset_screen_reader_changed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
* @since_tizen 6.5
* @description Negative UTC for unset screen reader changed callback (Invalid state)
*/
-TEST_F(TTSTest, utc_tts_unset_screen_reader_changed_cb_n2)
+TEST_F(TTSPreparedTest, utc_tts_unset_screen_reader_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_screen_reader_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_screen_reader_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_screen_reader_changed_cb(g_tts, __tts_screen_reader_changed_cb, nullptr), TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- EXPECT_EQ(tts_unset_screen_reader_changed_cb(g_tts), TTS_ERROR_INVALID_STATE);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_screen_reader_changed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 3.0
* @description Positive UTC for set current engine changed callback
*/
-TEST_F(TTSTest, utc_tts_set_engine_changed_cb_p)
+TEST_F(TTSTest, utc_tts_set_engine_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_set_engine_changed_cb_n
* @since_tizen 3.0
- * @description Negative UTC for set current engine changed callback (Invalid handle)
+ * @description Negative UTC for set current engine changed callback (Invalid mHandle)
*/
-TEST_F(TTSTest, utc_tts_set_engine_changed_cb_n)
+TEST_F(TTSTest, utc_tts_set_engine_changed_cb_n1)
{
- if (g_supported == false) {
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_set_engine_changed_cb(nullptr, __tts_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(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_set_engine_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
+ EXPECT_EQ(tts_set_engine_changed_cb(mHandle, __tts_engine_changed_cb, nullptr), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 3.0
* @description Positive UTC for unset current engine changed callback
*/
-TEST_F(TTSTest, utc_tts_unset_engine_changed_cb_p)
+TEST_F(TTSTest, utc_tts_unset_engine_changed_cb_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_engine_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_engine_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_NONE);
- EXPECT_EQ(tts_unset_engine_changed_cb(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_engine_changed_cb(mHandle), TTS_ERROR_NONE);
}
/**
* @testcase utc_tts_unset_engine_changed_cb_n
* @since_tizen 3.0
- * @description Negative UTC for unset current engine changed callback (Invalid handle)
+ * @description Negative UTC for unset current engine changed callback (Invalid mHandle)
*/
-TEST_F(TTSTest, utc_tts_unset_engine_changed_cb_n)
+TEST_F(TTSTest, utc_tts_unset_engine_changed_cb_n1)
{
- if (g_supported == false) {
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_unset_engine_changed_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
* @since_tizen 3.0
* @description Negative UTC for unset current engine changed callback (Invalid state)
*/
-TEST_F(TTSTest, utc_tts_unset_engine_changed_cb_n2)
+TEST_F(TTSPreparedTest, utc_tts_unset_engine_changed_cb_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_unset_engine_changed_cb(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_engine_changed_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_set_engine_changed_cb(g_tts, __tts_engine_changed_cb, nullptr), TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_prepare(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
-
- EXPECT_EQ(tts_unset_engine_changed_cb(g_tts), TTS_ERROR_INVALID_STATE);
-
- EXPECT_EQ(tts_unprepare(g_tts), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_unset_engine_changed_cb(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether pcm data is added properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_add_pcm_p)
+TEST_F(TTSPreparedTest, utc_tts_add_pcm_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(g_tts, 1, data, 10, 0, g_sample_rate), TTS_ERROR_NONE);
- EXPECT_EQ(tts_add_pcm(g_tts, 2, data, 10, 0, g_sample_rate), TTS_ERROR_NONE);
+ 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);
}
/**
*/
TEST_F(TTSPreparedTest, utc_tts_add_pcm_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_add_pcm(g_tts, 3, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NONE);
+ EXPECT_EQ(tts_add_pcm(mHandle, 3, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NONE);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSPreparedTest, utc_tts_add_pcm_n)
+TEST_F(TTSPreparedTest, utc_tts_add_pcm_n1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_pcm(nullptr, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
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(mHandle, 1, data, 10, 0, -1), TTS_ERROR_INVALID_PARAMETER);
}
/**
*/
TEST_F(TTSTest, utc_tts_add_pcm_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(g_tts, 1, data, 10, 0, g_sample_rate), TTS_ERROR_INVALID_STATE);
-}
-
-/**
- * @testcase utc_tts_add_pcm_n3
- * @since_tizen 2.3
- * @description test whether function returns error with invalid audio type.
- */
-TEST_F(TTSPreparedTest, utc_tts_add_pcm_n3)
-{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(g_tts, 1, data, 10, -1, g_sample_rate), TTS_ERROR_INVALID_PARAMETER);
-}
-
-/**
- * @testcase utc_tts_add_pcm_n4
- * @since_tizen 2.3
- * @description test whether function returns error with invalid sampling rate.
- */
-TEST_F(TTSPreparedTest, utc_tts_add_pcm_n4)
-{
- if (g_supported == false) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, nullptr, 0, 0, g_sample_rate), TTS_ERROR_NOT_SUPPORTED);
- return;
- }
-
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
char data[10] = {0, };
- EXPECT_EQ(tts_add_pcm(g_tts, 1, data, 10, 0, -1), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_add_pcm(mHandle, 1, data, 10, 0, g_sample_rate), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether tts is played properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_play_pcm_p)
+TEST_F(TTSPreparedTest, utc_tts_play_pcm_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
*/
TEST_F(TTSPreparedWithUttCbTest, utc_tts_play_pcm_p2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- g_utterance_completed_cb = false;
- __get_test_PCM_Data();
- ASSERT_NE(g_pcm_data, nullptr);
- ASSERT_GT(g_pcm_size, 0);
+ mTestUtil->GetTestPCMData();
+ ASSERT_NE(mTestUtil->mPCMData, nullptr);
+ ASSERT_GT(mTestUtil->mPCMSize, 0);
const size_t shift_size = 12000;
- int data_num = g_pcm_size / shift_size;
+ int data_num = mTestUtil->mPCMSize / shift_size;
for (int i = 0; i <= data_num; i++ ) {
if (0 == i) {
- EXPECT_EQ(tts_add_pcm(g_tts, 1, &g_pcm_data[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, g_sample_rate), TTS_ERROR_NONE);
} else if (data_num == i) {
- EXPECT_EQ(tts_add_pcm(g_tts, 3, &g_pcm_data[i*shift_size], g_pcm_size % 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, g_sample_rate), TTS_ERROR_NONE);
} else {
- EXPECT_EQ(tts_add_pcm(g_tts, 2, &g_pcm_data[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, g_sample_rate), TTS_ERROR_NONE);
}
}
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
-
- while (true != g_utterance_completed_cb) {
- ecore_main_loop_iterate();
- }
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
+ EXPECT_EQ(mTestUtil->IsUtteranceCompleted(10), true);
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_play_pcm_n)
+TEST_F(TTSTest, utc_tts_play_pcm_n1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play_pcm(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+
EXPECT_EQ(tts_play_pcm(nullptr), TTS_ERROR_INVALID_PARAMETER);
}
*/
TEST_F(TTSTest, utc_tts_play_pcm_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_INVALID_STATE);
+
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_INVALID_STATE);
}
/**
* @since_tizen 2.3
* @description test whether tts is stopped properly.
*/
-TEST_F(TTSPreparedTest, utc_tts_stop_pcm_p)
+TEST_F(TTSPreparedTest, utc_tts_stop_pcm_p1)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
-
- EXPECT_EQ(tts_play_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));
+ EXPECT_EQ(tts_play_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_PLAYING, STATE_CHECK_WAITING_TIME), true);
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_NONE);
- EXPECT_EQ(true, __is_state_changed(TTS_STATE_READY, 5));
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
/**
* @since_tizen 2.3
* @description test whether function returns error with NULL parameter.
*/
-TEST_F(TTSTest, utc_tts_stop_pcm_n)
+TEST_F(TTSTest, utc_tts_stop_pcm_n1)
{
- if (g_supported == false) {
+ if (false == mTestUtil->IsFeatureSupported()) {
EXPECT_EQ(tts_stop_pcm(nullptr), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
+
EXPECT_EQ(tts_stop_pcm(nullptr), TTS_ERROR_INVALID_PARAMETER);
}
*/
TEST_F(TTSTest, utc_tts_stop_pcm_n2)
{
- if (g_supported == false) {
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_NOT_SUPPORTED);
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_NOT_SUPPORTED);
return;
}
- EXPECT_EQ(is_created_hndl, TTS_ERROR_NONE);
- EXPECT_EQ(tts_stop_pcm(g_tts), TTS_ERROR_INVALID_STATE);
+
+ EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_INVALID_STATE);
}
} // namespace