Updating Test Harness to show wait channel
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-Capture.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 <adaptor-test-application.h>
19 #include <dali-test-suite-utils.h>
20 #include <dali/public-api/capture/capture.h>
21
22 using namespace Dali;
23
24 void utc_dali_capture_startup(void)
25 {
26   test_return_value = TET_UNDEF;
27 }
28
29 void utc_dali_capture_cleanup(void)
30 {
31   test_return_value = TET_PASS;
32 }
33
34 int UtcDaliCaptureNewPositive(void)
35 {
36   Dali::Capture instance = Dali::Capture::New();
37   DALI_TEST_CHECK(instance);
38   END_TEST;
39 }
40
41 int UtcDaliCaptureNew2Positive(void)
42 {
43   CameraActor   cameraActor;
44   Dali::Capture instance = Dali::Capture::New(cameraActor);
45   DALI_TEST_CHECK(instance);
46   END_TEST;
47 }
48
49 int UtcDaliCaptureDownCast(void)
50 {
51   Dali::Capture instance;
52   DALI_TEST_CHECK(!Capture::DownCast(instance));
53   instance = Dali::Capture::New();
54   DALI_TEST_CHECK(instance);
55   DALI_TEST_CHECK(Capture::DownCast(instance));
56   END_TEST;
57 }
58
59 int UtcDaliCaptureConstructorsPositive(void)
60 {
61   Capture capture1 = Capture::New();
62
63   // copy constructor
64   Capture capture2 = Capture(capture1);
65   DALI_TEST_CHECK(capture1 == capture2);
66
67   capture1.Reset();
68   DALI_TEST_CHECK(!capture1);
69
70   // copy assignment
71   capture1 = capture2;
72
73   capture2.Reset();
74   DALI_TEST_CHECK(capture1);
75   DALI_TEST_CHECK(!capture2);
76
77   // move constructor
78   Capture capture3 = Capture(std::move(capture1));
79   DALI_TEST_CHECK(capture3);
80
81   // move assignemnt
82   DALI_TEST_CHECK(!capture2);
83   capture2 = std::move(capture3);
84   DALI_TEST_CHECK(capture2);
85
86   END_TEST;
87 }
88
89 int UtcDaliCaptureFinishedSignalNegative(void)
90 {
91   Dali::Capture instance;
92   try
93   {
94     instance.FinishedSignal();
95     DALI_TEST_CHECK(false); // Should not get here
96   }
97   catch(...)
98   {
99     DALI_TEST_CHECK(true); // We expect an assert
100   }
101   END_TEST;
102 }
103
104 int UtcDaliCaptureSetImageQualityNegative(void)
105 {
106   Dali::Capture instance;
107   try
108   {
109     unsigned int arg1(0u);
110     instance.SetImageQuality(arg1);
111     DALI_TEST_CHECK(false); // Should not get here
112   }
113   catch(...)
114   {
115     DALI_TEST_CHECK(true); // We expect an assert
116   }
117   END_TEST;
118 }
119
120 int UtcDaliCaptureStartNegative(void)
121 {
122   Dali::Capture instance;
123   try
124   {
125     Dali::Actor   arg1;
126     Dali::Vector2 arg2;
127     std::string   arg3;
128     instance.Start(arg1, arg2, arg3);
129     DALI_TEST_CHECK(false); // Should not get here
130   }
131   catch(...)
132   {
133     DALI_TEST_CHECK(true); // We expect an assert
134   }
135   END_TEST;
136 }
137
138 int UtcDaliCaptureStart2Negative(void)
139 {
140   Dali::Capture instance;
141   try
142   {
143     Dali::Actor   arg1;
144     Dali::Vector2 arg2;
145     std::string   arg3;
146     Dali::Vector4 arg4;
147     instance.Start(arg1, arg2, arg3, arg4);
148     DALI_TEST_CHECK(false); // Should not get here
149   }
150   catch(...)
151   {
152     DALI_TEST_CHECK(true); // We expect an assert
153   }
154   END_TEST;
155 }
156
157 int UtcDaliCaptureStart3Negative(void)
158 {
159   Dali::Capture instance;
160   try
161   {
162     Dali::Actor   arg1;
163     Dali::Vector2 arg2;
164     std::string   arg3;
165     Dali::Vector4 arg4;
166     unsigned int  arg5(0u);
167     instance.Start(arg1, arg2, arg3, arg4, arg5);
168     DALI_TEST_CHECK(false); // Should not get here
169   }
170   catch(...)
171   {
172     DALI_TEST_CHECK(true); // We expect an assert
173   }
174   END_TEST;
175 }
176
177 int UtcDaliCaptureStart4Negative(void)
178 {
179   Dali::Capture instance;
180   try
181   {
182     Dali::Actor   arg1;
183     Dali::Vector2 arg2;
184     Dali::Vector2 arg3;
185     std::string   arg4;
186     Dali::Vector4 arg5;
187     instance.Start(arg1, arg2, arg3, arg4, arg5);
188     DALI_TEST_CHECK(false); // Should not get here
189   }
190   catch(...)
191   {
192     DALI_TEST_CHECK(true); // We expect an assert
193   }
194   END_TEST;
195 }
196
197 int UtcDaliCaptureGetNativeImageSourceNegative(void)
198 {
199   Dali::Capture instance;
200   try
201   {
202     instance.GetNativeImageSource();
203     DALI_TEST_CHECK(false); // Should not get here
204   }
205   catch(...)
206   {
207     DALI_TEST_CHECK(true); // We expect an assert
208   }
209   END_TEST;
210 }