[dali_1.9.29] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-TtsPlayer.cpp
1 /*
2  * Copyright (c) 2020 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 UtcDaliTtsPlayerAssignmentOperatorP(void)
54 {
55   Dali::TtsPlayer player;
56   Dali::TtsPlayer copy;
57   DALI_TEST_CHECK(!copy);
58   copy = player;
59   DALI_TEST_CHECK(copy == player);
60
61   END_TEST;
62 }
63
64 int UtcDaliTtsPlayerDestructorP(void)
65 {
66   Dali::TtsPlayer* player = new Dali::TtsPlayer();
67   delete player;
68
69   DALI_TEST_CHECK(true);
70   END_TEST;
71 }
72
73 int UtcDaliTtsPlayerConstructorFromInternalPointerN(void)
74 {
75   Internal::Adaptor::TtsPlayer* internalPlayer = NULL;
76   Dali::TtsPlayer               player(internalPlayer);
77   DALI_TEST_CHECK(!player); // Should not reach here!
78
79   END_TEST;
80 }
81
82 int UtcDaliTtsPlayerGetP(void)
83 {
84   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
85   DALI_TEST_CHECK(!player);
86   END_TEST;
87 }
88
89 int UtcDaliTtsPlayerPlayN(void)
90 {
91   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
92
93   try
94   {
95     player.Play("text");
96     DALI_TEST_CHECK(false); // Should not reach here!
97   }
98   catch(...)
99   {
100     DALI_TEST_CHECK(true);
101   }
102
103   END_TEST;
104 }
105
106 int UtcDaliTtsPlayerStopN(void)
107 {
108   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
109
110   try
111   {
112     player.Stop();
113     DALI_TEST_CHECK(false); // Should not reach here!
114   }
115   catch(...)
116   {
117     DALI_TEST_CHECK(true);
118   }
119
120   END_TEST;
121 }
122
123 int UtcDaliTtsPlayerPauseN(void)
124 {
125   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
126
127   try
128   {
129     player.Pause();
130     DALI_TEST_CHECK(false); // Should not reach here!
131   }
132   catch(...)
133   {
134     DALI_TEST_CHECK(true);
135   }
136
137   END_TEST;
138 }
139
140 int UtcDaliTtsPlayerResumeN(void)
141 {
142   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
143
144   try
145   {
146     player.Resume();
147     DALI_TEST_CHECK(false); // Should not reach here!
148   }
149   catch(...)
150   {
151     DALI_TEST_CHECK(true);
152   }
153
154   END_TEST;
155 }
156
157 int UtcDaliTtsPlayerGetStateN(void)
158 {
159   Dali::TtsPlayer player = Dali::TtsPlayer::Get();
160
161   try
162   {
163     Dali::TtsPlayer::State state = player.GetState();
164     tet_printf("Error: TtsPlayer state = %d, expected exception\n", (unsigned int)state);
165     DALI_TEST_CHECK(false); // Should not reach here!
166   }
167   catch(...)
168   {
169     DALI_TEST_CHECK(true);
170   }
171
172   END_TEST;
173 }