2 * Copyright (c) 2014 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.
23 #include <dali/public-api/dali-core.h>
24 #include <dali-toolkit/public-api/controls/tool-bar/tool-bar.h>
25 #include <dali-toolkit/public-api/controls/view/view.h>
26 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
27 #include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
28 #include <dali-toolkit/public-api/controls/default-controls/check-button-factory.h>
30 #include <dali-toolkit-test-suite-utils.h>
33 using namespace Toolkit;
35 static void Startup();
36 static void Cleanup();
39 void (*tet_startup)() = Startup;
40 void (*tet_cleanup)() = Cleanup;
44 POSITIVE_TC_IDX = 0x01,
48 #define MAX_NUMBER_OF_TESTS 10000
50 struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
53 // Add test functionality for all APIs in the class (Positive and Negative)
54 TEST_FUNCTION( UtcDaliDefaultControlsCreateSolidColorActor, POSITIVE_TC_IDX );
55 TEST_FUNCTION( UtcDaliDefaultControlsCreatePushButton, POSITIVE_TC_IDX );
56 TEST_FUNCTION( UtcDaliDefaultControlsCreateCheckBoxButton, POSITIVE_TC_IDX );
58 // Called only once before first test is run.
63 // Called only once after last test is run
68 static void UtcDaliDefaultControlsCreateSolidColorActor()
70 ToolkitTestApplication application;
72 tet_infoline(" UtcDaliDefaultControlsCreateSolidColorActor");
74 ImageActor image1 = CreateSolidColorActor( Color::RED );
75 ImageActor image2 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 2 );
76 ImageActor image3 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 12 );
78 DALI_TEST_CHECK(image1);
79 DALI_TEST_CHECK(image2);
80 DALI_TEST_CHECK(!image3);
83 static void UtcDaliDefaultControlsCreatePushButton()
85 ToolkitTestApplication application;
87 tet_infoline(" UtcDaliDefaultControlsCreatePushButton");
89 const std::string imagePath( "Facke image path" );
90 const std::string voidImagePath( "" );
92 ImageActor image = CreateSolidColorActor( Color::RED );
95 PushButton button0, button1, button2, button3, button4, button5, button6;
99 button0 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
100 button1 = CreatePushButton( imagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
101 button2 = CreatePushButton( voidImagePath, imagePath, voidImagePath, voidImagePath, voidImagePath );
102 button3 = CreatePushButton( voidImagePath, voidImagePath, imagePath, voidImagePath, voidImagePath );
103 button4 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, imagePath, voidImagePath );
104 button5 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, imagePath );
105 button6 = CreatePushButton( imagePath, imagePath, imagePath, imagePath, imagePath );
109 tet_result( TET_FAIL );
112 DALI_TEST_CHECK( button0 );
113 DALI_TEST_CHECK( button1 );
114 DALI_TEST_CHECK( button2 );
115 DALI_TEST_CHECK( button3 );
116 DALI_TEST_CHECK( button4 );
117 DALI_TEST_CHECK( button5 );
118 DALI_TEST_CHECK( button6 );
122 button0 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, voidImage );
123 button1 = CreatePushButton( image, voidImage, voidImage, voidImage, voidImage );
124 button2 = CreatePushButton( voidImage, image, voidImage, voidImage, voidImage );
125 button3 = CreatePushButton( voidImage, voidImage, image, voidImage, voidImage );
126 button4 = CreatePushButton( voidImage, voidImage, voidImage, image, voidImage );
127 button5 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, image );
128 button6 = CreatePushButton( image, image, image, image, image );
132 tet_result( TET_FAIL );
135 DALI_TEST_CHECK( button0 );
136 DALI_TEST_CHECK( button1 );
137 DALI_TEST_CHECK( button2 );
138 DALI_TEST_CHECK( button3 );
139 DALI_TEST_CHECK( button4 );
140 DALI_TEST_CHECK( button5 );
141 DALI_TEST_CHECK( button6 );
145 button0 = CreatePushButton( voidImagePath );
146 button1 = CreatePushButton( imagePath );
150 tet_result( TET_FAIL );
153 DALI_TEST_CHECK( button0 );
154 DALI_TEST_CHECK( button1 );
158 button0 = CreatePushButton( voidImage );
159 button1 = CreatePushButton( image );
163 tet_result( TET_FAIL );
166 DALI_TEST_CHECK( button0 );
167 DALI_TEST_CHECK( button1 );
170 static void UtcDaliDefaultControlsCreateCheckBoxButton()
172 ToolkitTestApplication application;
174 tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton");
176 const std::string imagePath( "Facke image path" );
177 const std::string voidImagePath( "" );
179 ImageActor image = CreateSolidColorActor( Color::RED );
180 ImageActor voidImage;
182 CheckBoxButton button0, button1, button2, button3, button4, button5;
186 button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath );
187 button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath );
188 button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath );
189 button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath );
190 button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath );
191 button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath );
195 tet_result( TET_FAIL );
198 DALI_TEST_CHECK( button0 );
199 DALI_TEST_CHECK( button1 );
200 DALI_TEST_CHECK( button2 );
201 DALI_TEST_CHECK( button3 );
202 DALI_TEST_CHECK( button4 );
203 DALI_TEST_CHECK( button5 );
207 button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage );
208 button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage );
209 button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage );
210 button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage );
211 button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image );
212 button5 = CreateCheckBoxButton( image, image, image, image );
216 tet_result( TET_FAIL );
219 DALI_TEST_CHECK( button0 );
220 DALI_TEST_CHECK( button1 );
221 DALI_TEST_CHECK( button2 );
222 DALI_TEST_CHECK( button3 );
223 DALI_TEST_CHECK( button4 );
224 DALI_TEST_CHECK( button5 );
228 button0 = CreateCheckBoxButton( voidImagePath, voidImagePath );
229 button1 = CreateCheckBoxButton( voidImagePath, imagePath );
230 button2 = CreateCheckBoxButton( imagePath, voidImagePath );
231 button3 = CreateCheckBoxButton( imagePath, imagePath );
235 tet_result( TET_FAIL );
238 DALI_TEST_CHECK( button0 );
239 DALI_TEST_CHECK( button1 );
240 DALI_TEST_CHECK( button2 );
241 DALI_TEST_CHECK( button3 );
245 button0 = CreateCheckBoxButton( voidImage, voidImage );
246 button2 = CreateCheckBoxButton( voidImage, image );
247 button3 = CreateCheckBoxButton( voidImage, image );
248 button4 = CreateCheckBoxButton( image, image );
252 tet_result( TET_FAIL );
255 DALI_TEST_CHECK( button0 );
256 DALI_TEST_CHECK( button1 );
257 DALI_TEST_CHECK( button2 );
258 DALI_TEST_CHECK( button3 );