2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
22 #include <dali/public-api/dali-core.h>
23 #include <dali-toolkit/public-api/controls/tool-bar/tool-bar.h>
24 #include <dali-toolkit/public-api/controls/view/view.h>
25 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
26 #include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
27 #include <dali-toolkit/public-api/controls/default-controls/check-button-factory.h>
29 #include <dali-toolkit-test-suite-utils.h>
32 using namespace Toolkit;
34 static void Startup();
35 static void Cleanup();
38 void (*tet_startup)() = Startup;
39 void (*tet_cleanup)() = Cleanup;
43 POSITIVE_TC_IDX = 0x01,
47 #define MAX_NUMBER_OF_TESTS 10000
49 struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
52 // Add test functionality for all APIs in the class (Positive and Negative)
53 TEST_FUNCTION( UtcDaliDefaultControlsCreateSolidColorActor, POSITIVE_TC_IDX );
54 TEST_FUNCTION( UtcDaliDefaultControlsCreatePushButton, POSITIVE_TC_IDX );
55 TEST_FUNCTION( UtcDaliDefaultControlsCreateCheckBoxButton, POSITIVE_TC_IDX );
57 // Called only once before first test is run.
62 // Called only once after last test is run
67 static void UtcDaliDefaultControlsCreateSolidColorActor()
69 ToolkitTestApplication application;
71 tet_infoline(" UtcDaliDefaultControlsCreateSolidColorActor");
73 ImageActor image1 = CreateSolidColorActor( Color::RED );
74 ImageActor image2 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 2 );
75 ImageActor image3 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 12 );
77 DALI_TEST_CHECK(image1);
78 DALI_TEST_CHECK(image2);
79 DALI_TEST_CHECK(!image3);
82 static void UtcDaliDefaultControlsCreatePushButton()
84 ToolkitTestApplication application;
86 tet_infoline(" UtcDaliDefaultControlsCreatePushButton");
88 const std::string imagePath( "Facke image path" );
89 const std::string voidImagePath( "" );
91 ImageActor image = CreateSolidColorActor( Color::RED );
94 PushButton button0, button1, button2, button3, button4, button5, button6;
98 button0 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
99 button1 = CreatePushButton( imagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
100 button2 = CreatePushButton( voidImagePath, imagePath, voidImagePath, voidImagePath, voidImagePath );
101 button3 = CreatePushButton( voidImagePath, voidImagePath, imagePath, voidImagePath, voidImagePath );
102 button4 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, imagePath, voidImagePath );
103 button5 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, imagePath );
104 button6 = CreatePushButton( imagePath, imagePath, imagePath, imagePath, imagePath );
108 tet_result( TET_FAIL );
111 DALI_TEST_CHECK( button0 );
112 DALI_TEST_CHECK( button1 );
113 DALI_TEST_CHECK( button2 );
114 DALI_TEST_CHECK( button3 );
115 DALI_TEST_CHECK( button4 );
116 DALI_TEST_CHECK( button5 );
117 DALI_TEST_CHECK( button6 );
121 button0 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, voidImage );
122 button1 = CreatePushButton( image, voidImage, voidImage, voidImage, voidImage );
123 button2 = CreatePushButton( voidImage, image, voidImage, voidImage, voidImage );
124 button3 = CreatePushButton( voidImage, voidImage, image, voidImage, voidImage );
125 button4 = CreatePushButton( voidImage, voidImage, voidImage, image, voidImage );
126 button5 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, image );
127 button6 = CreatePushButton( image, image, image, image, image );
131 tet_result( TET_FAIL );
134 DALI_TEST_CHECK( button0 );
135 DALI_TEST_CHECK( button1 );
136 DALI_TEST_CHECK( button2 );
137 DALI_TEST_CHECK( button3 );
138 DALI_TEST_CHECK( button4 );
139 DALI_TEST_CHECK( button5 );
140 DALI_TEST_CHECK( button6 );
144 button0 = CreatePushButton( voidImagePath );
145 button1 = CreatePushButton( imagePath );
149 tet_result( TET_FAIL );
152 DALI_TEST_CHECK( button0 );
153 DALI_TEST_CHECK( button1 );
157 button0 = CreatePushButton( voidImage );
158 button1 = CreatePushButton( image );
162 tet_result( TET_FAIL );
165 DALI_TEST_CHECK( button0 );
166 DALI_TEST_CHECK( button1 );
169 static void UtcDaliDefaultControlsCreateCheckBoxButton()
171 ToolkitTestApplication application;
173 tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton");
175 const std::string imagePath( "Facke image path" );
176 const std::string voidImagePath( "" );
178 ImageActor image = CreateSolidColorActor( Color::RED );
179 ImageActor voidImage;
181 CheckBoxButton button0, button1, button2, button3, button4, button5;
185 button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath );
186 button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath );
187 button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath );
188 button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath );
189 button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath );
190 button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath );
194 tet_result( TET_FAIL );
197 DALI_TEST_CHECK( button0 );
198 DALI_TEST_CHECK( button1 );
199 DALI_TEST_CHECK( button2 );
200 DALI_TEST_CHECK( button3 );
201 DALI_TEST_CHECK( button4 );
202 DALI_TEST_CHECK( button5 );
206 button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage );
207 button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage );
208 button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage );
209 button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage );
210 button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image );
211 button5 = CreateCheckBoxButton( image, image, image, image );
215 tet_result( TET_FAIL );
218 DALI_TEST_CHECK( button0 );
219 DALI_TEST_CHECK( button1 );
220 DALI_TEST_CHECK( button2 );
221 DALI_TEST_CHECK( button3 );
222 DALI_TEST_CHECK( button4 );
223 DALI_TEST_CHECK( button5 );
227 button0 = CreateCheckBoxButton( voidImagePath, voidImagePath );
228 button1 = CreateCheckBoxButton( voidImagePath, imagePath );
229 button2 = CreateCheckBoxButton( imagePath, voidImagePath );
230 button3 = CreateCheckBoxButton( imagePath, imagePath );
234 tet_result( TET_FAIL );
237 DALI_TEST_CHECK( button0 );
238 DALI_TEST_CHECK( button1 );
239 DALI_TEST_CHECK( button2 );
240 DALI_TEST_CHECK( button3 );
244 button0 = CreateCheckBoxButton( voidImage, voidImage );
245 button2 = CreateCheckBoxButton( voidImage, image );
246 button3 = CreateCheckBoxButton( voidImage, image );
247 button4 = CreateCheckBoxButton( image, image );
251 tet_result( TET_FAIL );
254 DALI_TEST_CHECK( button0 );
255 DALI_TEST_CHECK( button1 );
256 DALI_TEST_CHECK( button2 );
257 DALI_TEST_CHECK( button3 );