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