Dali 3D User Interface Engine
utc-Dali-StyleManager.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 #include <iostream>
18 #include <stdlib.h>
23 
24 
25 using namespace Dali;
26 using namespace Dali::Toolkit;
27 
29 {
31 }
32 
34 {
36 }
37 
39 {
40  ToolkitTestApplication application;
41 
42  tet_infoline(" UtcDaliStyleManagerGet");
43 
44  // Register Type
45  TypeInfo type;
46  type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
47  DALI_TEST_CHECK( type );
48  BaseHandle handle = type.CreateInstance();
49  DALI_TEST_CHECK( handle );
50 
51  StyleManager manager;
52 
53  manager = StyleManager::Get();
54  DALI_TEST_CHECK(manager);
55 
56  StyleManager newManager = StyleManager::Get();
57  DALI_TEST_CHECK(newManager);
58 
59  // Check that focus manager is a singleton
60  DALI_TEST_CHECK(manager == newManager);
61  END_TEST;
62 }
63 
65 {
66  ToolkitTestApplication application;
67 
68  tet_infoline( " UtcDaliStyleManagerSetOrientationValue" );
69 
70  StyleManager manager = StyleManager::Get();
71 
72  int orientation1 = 0;
73  manager.SetOrientationValue( orientation1 );
74  DALI_TEST_CHECK( manager.GetOrientationValue() == orientation1 );
75 
76  int orientation2 = 180;
77  manager.SetOrientationValue( orientation2 );
78  DALI_TEST_CHECK( manager.GetOrientationValue() == orientation2 );
79 
80  END_TEST;
81 }
82 
84 {
85  ToolkitTestApplication application;
86 
87  tet_infoline( " UtcDaliStyleManagerSetOrientation" );
88 
89  StyleManager manager = StyleManager::Get();
90 
91  Orientation orientation;
92 
93  manager.SetOrientation( orientation );
94 
95  DALI_TEST_CHECK( manager.GetOrientation() == orientation );
96 
97  END_TEST;
98 }
99 
101 {
102  ToolkitTestApplication application;
103 
104  tet_infoline( " UtcDaliStyleManagerSetStyleConstant" );
105 
106  StyleManager manager = StyleManager::Get();
107 
108  std::string key( "key" );
109  Property::Value value( 100 );
110 
111  manager.SetStyleConstant( key, value );
112 
113  Property::Value returnedValue;
114  manager.GetStyleConstant( key, returnedValue );
115 
116  DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
117 
118  std::string key2( "key2" );
119  Property::Value returnedValue2;
120  DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) );
121 
122  END_TEST;
123 }
Dali Docs Home
Read more about Dali