{
}
+static void test_synthesized_pcm_cb(tts_h tts, int utt_id, tts_synthesized_pcm_event_e event, const char* pcm_data, int pcm_data_size, tts_audio_type_e audio_type, int sample_rate, void *user_data)
+{
+}
+
namespace {
EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
}
+/**
+ * @testcase utc_tts_prepare_p3
+ * @since_tizen 8.0
+ * @description test whether tts daemon is prepared properly.
+ */
+TEST_F(TTSTest, utc_tts_prepare_p3)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_prepare(mHandle), 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_n1)
{
if (false == mTestUtil->IsFeatureSupported()) {
}
/**
+ * @testcase utc_tts_prepare_n6
+ * @since_tizen 8.0
+ * @description Test if the function is failed when the invalid engine is set
+ */
+TEST_F(TTSTest, utc_tts_prepare_n6)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ char* engine_id = vconf_get_str(VCONFKEY_TTS_ENGINE_DEFAULT);
+ EXPECT_EQ(vconf_set_str(VCONFKEY_TTS_ENGINE_DEFAULT, "test"), 0);
+
+ EXPECT_EQ(tts_prepare(mHandle), TTS_ERROR_NONE);
+ EXPECT_EQ(mTestUtil->IsErrorOccurring(30), true);
+
+ EXPECT_EQ(vconf_set_str(VCONFKEY_TTS_ENGINE_DEFAULT, engine_id), 0);
+}
+
+/**
* @testcase utc_tts_prepare_sync_p
* @since_tizen 2.3
* @description test whether tts daemon is prepared properly.
}
/**
+ * @testcase utc_tts_prepare_sync_n4
+ * @since_tizen 8.0
+ * @description Test if the function is failed when the invalid engine is set
+ */
+TEST_F(TTSTest, utc_tts_prepare_sync_n4)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ char* engine_id = vconf_get_str(VCONFKEY_TTS_ENGINE_DEFAULT);
+ EXPECT_EQ(vconf_set_str(VCONFKEY_TTS_ENGINE_DEFAULT, "test"), 0);
+
+ EXPECT_EQ(tts_prepare_sync(mHandle), TTS_ERROR_OPERATION_FAILED);
+ EXPECT_EQ(vconf_set_str(VCONFKEY_TTS_ENGINE_DEFAULT, engine_id), 0);
+}
+
+/**
* @testcase utc_tts_foreach_supported_voices_p
* @since_tizen 2.3
* @description test whether each supported voices are gotten properly.
EXPECT_EQ(is_on, true);
EXPECT_EQ(vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, false), 0);
+ EXPECT_EQ(tts_check_screen_reader_on(mHandle, &is_on), TTS_ERROR_NONE);
+ EXPECT_EQ(is_on, false);
}
/**
EXPECT_EQ(tts_stop_pcm(mHandle), TTS_ERROR_INVALID_STATE);
}
+/**
+ * @testcase utc_tts_set_playing_mode_p1
+ * @since_tizen 8.0
+ * @description Test if the function properly set the playing mode.
+ */
+TEST_F(TTSTest, utc_tts_set_playing_mode_p1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_playing_mode(mHandle, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_playing_mode(mHandle, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_NONE);
+}
+
+/**
+ * @testcase utc_tts_set_playing_mode_n1
+ * @since_tizen 8.0
+ * @description Test if the function returns the error with invalid parameters.
+ */
+TEST_F(TTSTest, utc_tts_set_playing_mode_n1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_playing_mode(nullptr, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_playing_mode(nullptr, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_playing_mode(mHandle, static_cast<tts_playing_mode_e>(-1)), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_playing_mode(mHandle, static_cast<tts_playing_mode_e>(100)), TTS_ERROR_INVALID_PARAMETER);
+
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_playing_mode(mHandle, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_INVALID_PARAMETER);
+}
+
+/**
+ * @testcase utc_tts_set_playing_mode_n2
+ * @since_tizen 8.0
+ * @description Test if the function returns the error when the state is not created.
+ */
+TEST_F(TTSPreparedTest, utc_tts_set_playing_mode_n2)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_playing_mode(mHandle, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_playing_mode(mHandle, TTS_PLAYING_MODE_BY_CLIENT), TTS_ERROR_INVALID_STATE);
+}
+
+/**
+ * @testcase utc_tts_set_synthesized_pcm_cb_p1
+ * @since_tizen 8.0
+ * @description Test if the function properly set the synthesized pcm callback
+ */
+TEST_F(TTSTest, utc_tts_set_synthesized_pcm_cb_p1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, test_synthesized_pcm_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, test_synthesized_pcm_cb, nullptr), TTS_ERROR_NONE);
+}
+
+/**
+ * @testcase utc_tts_set_synthesized_pcm_cb_n1
+ * @since_tizen 8.0
+ * @description Test if the function returns error with invalid parameters
+ */
+TEST_F(TTSTest, utc_tts_set_synthesized_pcm_cb_n1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(nullptr, test_synthesized_pcm_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(nullptr, test_synthesized_pcm_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, nullptr, nullptr), TTS_ERROR_INVALID_PARAMETER);
+
+ mTestUtil->DestroyHandle();
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, test_synthesized_pcm_cb, nullptr), TTS_ERROR_INVALID_PARAMETER);
+}
+
+/**
+ * @testcase utc_tts_set_synthesized_pcm_cb_n2
+ * @since_tizen 8.0
+ * @description Test if the function returns error when the state is not created
+ */
+TEST_F(TTSPreparedTest, utc_tts_set_synthesized_pcm_cb_n2)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, test_synthesized_pcm_cb, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_set_synthesized_pcm_cb(mHandle, test_synthesized_pcm_cb, nullptr), TTS_ERROR_INVALID_STATE);
+}
+
+/**
+ * @testcase utc_tts_unset_synthesized_pcm_cb_p
+ * @since_tizen 8.0
+ * @description Positive UTC for unset current engine changed callback
+ */
+TEST_F(TTSTest, utc_tts_unset_synthesized_pcm_cb_p1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(mHandle), TTS_ERROR_NONE);
+}
+
+/**
+ * @testcase utc_tts_unset_synthesized_pcm_cb_n1
+ * @since_tizen 8.0
+ * @description Test if the function returns error with invalid parameters
+ */
+TEST_F(TTSTest, utc_tts_unset_synthesized_pcm_cb_n1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(nullptr), TTS_ERROR_INVALID_PARAMETER);
+}
+
+/**
+ * @testcase utc_tts_unset_synthesized_pcm_cb_n2
+ * @since_tizen 8.0
+ * @description Test if the function returns error when the state is not created
+ */
+TEST_F(TTSPreparedTest, utc_tts_unset_synthesized_pcm_cb_n2)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(mHandle), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ EXPECT_EQ(tts_unset_synthesized_pcm_cb(mHandle), TTS_ERROR_INVALID_STATE);
+}
+
+/**
+ * @testcase utc_reprepare_logic_p1
+ * @since_tizen 8.0
+ * @description Test if the tts properly connects again after error occurring.
+ */
+TEST_F(TTSTest, utc_reprepare_logic_p1)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ auto localUtil = std::make_unique<TtsTestUtility>();
+
+ EXPECT_EQ(mTestUtil->Prepare(), true);
+ EXPECT_EQ(localUtil->Prepare(), true);
+
+ mTestUtil->TerminateCurrentEngine();
+ EXPECT_EQ(mTestUtil->IsErrorOccurring(STATE_CHECK_WAITING_TIME), true);
+ mTestUtil->mCurrentState = TTS_STATE_CREATED;
+
+ sleep(1);
+ EXPECT_EQ(mTestUtil->IsStateChanged(TTS_STATE_READY, STATE_CHECK_WAITING_TIME), true);
+}
+
+/**
+ * @testcase utc_reprepare_logic_p2
+ * @since_tizen 8.0
+ * @description Test if the tts properly connects again after error occurring.
+ */
+TEST_F(TTSTest, utc_reprepare_logic_p2)
+{
+ if (false == mTestUtil->IsFeatureSupported()) {
+ EXPECT_EQ(tts_set_error_cb(mHandle, mTestUtil->ErrorCallback, nullptr), TTS_ERROR_NOT_SUPPORTED);
+ return;
+ }
+
+ auto localUtil = std::make_unique<TtsTestUtility>();
+
+ EXPECT_EQ(localUtil->Prepare(), true);
+ EXPECT_EQ(mTestUtil->Prepare(), true);
+
+ mTestUtil->TerminateCurrentEngine();
+ EXPECT_EQ(mTestUtil->IsErrorOccurring(STATE_CHECK_WAITING_TIME), true);
+ sleep(2);
+
+ tts_service_state_e state = TTS_SERVICE_STATE_NONE;
+ EXPECT_EQ(tts_get_service_state(mHandle, &state), TTS_ERROR_NONE);
+}
+
} // namespace