Dali 3D User Interface Engine
utc-Dali-CheckBoxButton.cpp
Go to the documentation of this file.
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>
22 
23 using namespace Dali;
24 using namespace Toolkit;
25 
26 namespace
27 {
28 
29 static bool gCheckBoxButtonState = false;
31 {
32  gCheckBoxButtonState = button.IsSelected();
33  return true;
34 }
35 
36 } // namespace
37 
39 {
41 }
42 
44 {
46 }
47 
49 {
50  TestApplication application;
51 
52  CheckBoxButton checkBox;
53 
54  DALI_TEST_CHECK( !checkBox );
55  END_TEST;
56 }
57 
59 {
60  TestApplication application;
61 
62  // Initialize an object, ref count == 1
64 
65  CheckBoxButton copy( checkBox );
66  DALI_TEST_CHECK( copy );
67  END_TEST;
68 }
69 
71 {
72  TestApplication application;
73 
75 
76  CheckBoxButton copy( checkBox );
77  DALI_TEST_CHECK( copy );
78 
79  DALI_TEST_CHECK( checkBox == copy );
80  END_TEST;
81 }
82 
84 {
85  TestApplication application;
86 
88 
89  DALI_TEST_CHECK( checkBox );
90  END_TEST;
91 }
92 
94 {
95  TestApplication application;
96 
98 
99  BaseHandle object(checkBox);
100 
101  CheckBoxButton checkBox2 = CheckBoxButton::DownCast( object );
102  DALI_TEST_CHECK(checkBox2);
103 
104  CheckBoxButton checkBox3 = DownCast< CheckBoxButton >(object);
105  DALI_TEST_CHECK(checkBox3);
106  END_TEST;
107 }
108 
110 {
111  TestApplication application;
112 
113  BaseHandle unInitializedObject;
114 
115  CheckBoxButton checkBox1 = CheckBoxButton::DownCast( unInitializedObject );
116  DALI_TEST_CHECK( !checkBox1 );
117 
118  CheckBoxButton checkBox2 = DownCast< CheckBoxButton >( unInitializedObject );
119  DALI_TEST_CHECK( !checkBox2 );
120  END_TEST;
121 }
122 
124 {
125  ToolkitTestApplication application;
126  tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
127 
128  CheckBoxButton checkBoxButton = CheckBoxButton::New();
129  checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked );
130 
131  // global var used to check if CheckBoxButtonClicked is called;
132  gCheckBoxButtonState = false;
133 
134  checkBoxButton.SetSelected( true );
135 
136  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
138 
139  checkBoxButton.SetSelected( false );
140 
141  DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
143 
144  checkBoxButton.SetSelected( true );
145 
146  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
148  END_TEST;
149 }
Dali Docs Home
Read more about Dali