(Automated Tests) Added more tests to increase TEM score
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-TtsPlayer.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <dali/dali.h>
20
21 using namespace Dali;
22
23 void utc_dali_ttsplayer_startup(void)
24 {
25   test_return_value = TET_UNDEF;
26 }
27
28 void utc_dali_ttsplayer_cleanup(void)
29 {
30   test_return_value = TET_PASS;
31 }
32
33 namespace
34 {
35 } // unnamed namespace
36
37 int UtcDaliTtsPlayerConstructorP(void)
38 {
39   Dali::TtsPlayer player;
40   DALI_TEST_CHECK(!player);
41   END_TEST;
42 }
43
44 int UtcDaliTtsPlayerCopyConstructorP(void)
45 {
46   Dali::TtsPlayer player;
47   Dali::TtsPlayer copy(player);
48   DALI_TEST_CHECK(copy == player);
49
50   END_TEST;
51 }
52
53 int UtcDaliTtsPlayerMoveConstructorP(void)
54 {
55   Dali::TtsPlayer player;
56   Dali::TtsPlayer copy(std::move(player));
57   DALI_TEST_CHECK(player == copy);
58
59   END_TEST;
60 }
61
62 int UtcDaliTtsPlayerAssignmentOperatorP(void)
63 {
64   Dali::TtsPlayer player;
65   Dali::TtsPlayer copy;
66   DALI_TEST_CHECK(!copy);
67   copy = player;
68   DALI_TEST_CHECK(copy == player);
69
70   END_TEST;
71 }
72
73 int UtcDaliTtsPlayerMoveAssignmentOperatorP(void)
74 {
75   Dali::TtsPlayer player;
76   Dali::TtsPlayer copy;
77   DALI_TEST_CHECK(!copy);
78   copy = std::move(player);
79   DALI_TEST_CHECK(copy == player);
80
81   END_TEST;
82 }
83
84 int UtcDaliTtsPlayerDestructorP(void)
85 {
86   Dali::TtsPlayer* player = new Dali::TtsPlayer();
87   delete player;
88
89   DALI_TEST_CHECK(true);
90   END_TEST;
91 }
92
93 int UtcDaliTtsPlayerConstructorFromInternalPointerN(void)
94 {
95   Internal::Adaptor::TtsPlayer* internalPlayer = NULL;
96   Dali::TtsPlayer               player(internalPlayer);
97   DALI_TEST_CHECK(!player); // Should not reach here!
98
99   END_TEST;
100 }
101
102 int UtcDaliTtsPlayerGetP(void)
103 {
104   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
105   DALI_TEST_CHECK(!player);
106   END_TEST;
107 }
108
109 int UtcDaliTtsPlayerPlayN(void)
110 {
111   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
112
113   try
114   {
115     player.Play("text");
116     DALI_TEST_CHECK(false); // Should not reach here!
117   }
118   catch(...)
119   {
120     DALI_TEST_CHECK(true);
121   }
122
123   END_TEST;
124 }
125
126 int UtcDaliTtsPlayerStopN(void)
127 {
128   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
129
130   try
131   {
132     player.Stop();
133     DALI_TEST_CHECK(false); // Should not reach here!
134   }
135   catch(...)
136   {
137     DALI_TEST_CHECK(true);
138   }
139
140   END_TEST;
141 }
142
143 int UtcDaliTtsPlayerPauseN(void)
144 {
145   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
146
147   try
148   {
149     player.Pause();
150     DALI_TEST_CHECK(false); // Should not reach here!
151   }
152   catch(...)
153   {
154     DALI_TEST_CHECK(true);
155   }
156
157   END_TEST;
158 }
159
160 int UtcDaliTtsPlayerResumeN(void)
161 {
162   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
163
164   try
165   {
166     player.Resume();
167     DALI_TEST_CHECK(false); // Should not reach here!
168   }
169   catch(...)
170   {
171     DALI_TEST_CHECK(true);
172   }
173
174   END_TEST;
175 }
176
177 int UtcDaliTtsPlayerGetStateN(void)
178 {
179   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
180
181   try
182   {
183     Dali::TtsPlayer::State state = player.GetState();
184     tet_printf("Error: TtsPlayer state = %d, expected exception\n", (unsigned int)state);
185     DALI_TEST_CHECK(false); // Should not reach here!
186   }
187   catch(...)
188   {
189     DALI_TEST_CHECK(true);
190   }
191
192   END_TEST;
193 }
194
195 int UtcDaliTtsPlayerStateChangedSignalN(void)
196 {
197   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
198
199   try
200   {
201     player.StateChangedSignal();
202     DALI_TEST_CHECK(false); // Should not reach here!
203   }
204   catch(...)
205   {
206     DALI_TEST_CHECK(true);
207   }
208
209   END_TEST;
210 }