DALi Version 1.0.28
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-unmanaged / utc-Dali-DefaultControls.cpp
1 /*
2  * Copyright (c) 2014 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 <iostream>
19 #include <stdlib.h>
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22
23 using namespace Dali;
24 using namespace Toolkit;
25
26 void dali_default_controls_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void dali_default_controls_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36
37
38 int UtcDaliDefaultControlsCreateCheckBoxButton(void)
39 {
40   ToolkitTestApplication application;
41
42   tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton");
43
44   const std::string imagePath( "Facke image path" );
45   const std::string voidImagePath( "" );
46
47   ImageActor image = CreateSolidColorActor( Color::RED );
48   ImageActor voidImage;
49
50   CheckBoxButton button0, button1, button2, button3, button4, button5;
51
52   try
53   {
54     button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath );
55     button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath );
56     button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath );
57     button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath );
58     button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath );
59     button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath );
60   }
61   catch( ... )
62   {
63     tet_result( TET_FAIL );
64   }
65
66   DALI_TEST_CHECK( button0 );
67   DALI_TEST_CHECK( button1 );
68   DALI_TEST_CHECK( button2 );
69   DALI_TEST_CHECK( button3 );
70   DALI_TEST_CHECK( button4 );
71   DALI_TEST_CHECK( button5 );
72
73   try
74   {
75     button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage );
76     button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage );
77     button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage );
78     button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage );
79     button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image );
80     button5 = CreateCheckBoxButton( image, image, image, image );
81   }
82   catch( ... )
83   {
84     tet_result( TET_FAIL );
85   }
86
87   DALI_TEST_CHECK( button0 );
88   DALI_TEST_CHECK( button1 );
89   DALI_TEST_CHECK( button2 );
90   DALI_TEST_CHECK( button3 );
91   DALI_TEST_CHECK( button4 );
92   DALI_TEST_CHECK( button5 );
93
94   try
95   {
96     button0 = CreateCheckBoxButton( voidImagePath, voidImagePath );
97     button1 = CreateCheckBoxButton( voidImagePath, imagePath );
98     button2 = CreateCheckBoxButton( imagePath, voidImagePath );
99     button3 = CreateCheckBoxButton( imagePath, imagePath );
100   }
101   catch( ... )
102   {
103     tet_result( TET_FAIL );
104   }
105
106   DALI_TEST_CHECK( button0 );
107   DALI_TEST_CHECK( button1 );
108   DALI_TEST_CHECK( button2 );
109   DALI_TEST_CHECK( button3 );
110
111   try
112   {
113     button0 = CreateCheckBoxButton( voidImage, voidImage );
114     button2 = CreateCheckBoxButton( voidImage, image );
115     button3 = CreateCheckBoxButton( voidImage, image );
116     button4 = CreateCheckBoxButton( image, image );
117   }
118   catch( ... )
119   {
120     tet_result( TET_FAIL );
121   }
122
123   DALI_TEST_CHECK( button0 );
124   DALI_TEST_CHECK( button1 );
125   DALI_TEST_CHECK( button2 );
126   DALI_TEST_CHECK( button3 );
127   END_TEST;
128 }