Dali 3D User Interface Engine
utc-Dali-ShadowView.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>
23 
24 
25 using namespace Dali;
26 using namespace Dali::Toolkit;
27 
29 {
31 }
32 
34 {
36 }
37 
38 
39 // Negative test case for a method
41 {
42  ToolkitTestApplication application;
43  tet_infoline("UtcDaliShadowViewUninitialized");
44 
46  try
47  {
48  // New() must be called to create a GaussianBlurView or it wont be valid.
49  Actor a = Actor::New();
50  view.Add( a );
51  DALI_TEST_CHECK( false );
52  }
53  catch (Dali::DaliException& e)
54  {
55  // Tests that a negative test of an assertion succeeds
57  DALI_TEST_CHECK(!view);
58  }
59  END_TEST;
60 }
61 
62 // Positive test case for a method
64 {
65  ToolkitTestApplication application;
66  tet_infoline("UtcDaliShadowViewNew");
67 
69  DALI_TEST_CHECK( view );
70 
72  DALI_TEST_CHECK( view2 );
73  END_TEST;
74 }
75 
76 // Positive test case for a method
78 {
79  ToolkitTestApplication application;
80  tet_infoline("UtcDaliShadowViewDownCast");
81 
83  BaseHandle handle(view);
84 
86  DALI_TEST_CHECK( view );
87  DALI_TEST_CHECK( shadowView );
88  DALI_TEST_CHECK( shadowView == view );
89  END_TEST;
90 }
91 
92 // Positive test case for a method
94 {
95  ToolkitTestApplication application;
96  tet_infoline("UtcDaliShadowViewPropertyNames");
97 
99  DALI_TEST_CHECK( view );
100 
101  // Check the names, this names are used in the shader code,
102  // if they change in the shader code, then it has to be updated here.
103  DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
104  DALI_TEST_EQUALS( view.GetShadowColorPropertyIndex(), view.GetPropertyIndex("ShadowColorProperty"), TEST_LOCATION );
105  END_TEST;
106 }
107 
108 // Positive test case for a method
110 {
111  ToolkitTestApplication application;
112  tet_infoline("UtcDaliShadowViewAddRemove");
113 
115  DALI_TEST_CHECK( view );
116 
117  Actor actor = Actor::New();
118  DALI_TEST_CHECK( !actor.OnStage() );
119 
120 
122  view.SetSize(Stage::GetCurrent().GetSize());
123  view.Add(actor);
124  Stage::GetCurrent().Add(view);
125 
126  DALI_TEST_CHECK( actor.OnStage() );
127 
128  view.Remove(actor);
129 
130  DALI_TEST_CHECK( !actor.OnStage() );
131  END_TEST;
132 }
133 
134 // Positive test case for a method
136 {
137  ToolkitTestApplication application;
138  tet_infoline("UtcDaliShadowViewActivateDeactivate");
139 
141  DALI_TEST_CHECK( view );
142 
144  DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
145 
147  view.SetSize(Stage::GetCurrent().GetSize());
148  view.Add(Actor::New());
149  Stage::GetCurrent().Add(view);
150  view.Activate();
151 
153  DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
154 
155  view.Deactivate();
156 
158  DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
159  END_TEST;
160 }
Dali Docs Home
Read more about Dali