2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TTS_TEST_UTIL_H__
19 #define __TTS_TEST_UTIL_H__
23 #include <tts_internal.h>
26 class TtsTestUtility {
28 static void StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *user_data);
29 static void ServiceStateChangedCallback(tts_h tts, tts_service_state_e previous, tts_service_state_e current, void* user_data);
30 static void ScreenReaderChangedCallback(tts_h tts, bool is_on, void* user_data);
31 static void UtteranceStartedCallback(tts_h tts, int utt_id, void* user_data);
32 static void UtteranceCompletedCallback(tts_h tts, int utt_id, void *user_data);
33 static void ErrorCallback(tts_h tts, int utt_id, tts_error_e reason, void* user_data);
35 static void TerminateCurrentEngine();
36 static void WaitUntilEngineTerminated(int duration);
37 static bool IsFeatureSupported();
43 void GetTestPCMData();
55 bool IsStateChanged(tts_state_e targetState, int duration);
56 bool IsServiceStateChanged(tts_service_state_e targetState, int duration);
57 bool IsScreenReaderOn(int duration);
58 bool IsUtteranceStarted(int duration);
59 bool IsUtteranceCompleted(int duration);
60 bool IsErrorOccurring(int duration);
64 tts_state_e mCurrentState;
65 tts_service_state_e mCurrentServiceState;
70 bool mUtteranceStarted;
71 bool mUtteranceCompleted;
79 static bool WaitCondition(std::function<bool(void)> checker, int duration);
83 #endif /* __TTS_TEST_UTIL_H__ */