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.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali-toolkit/dali-toolkit.h>
23 using namespace Dali::Toolkit;
25 void shadow_view_startup(void)
27 test_return_value = TET_UNDEF;
30 void shadow_view_cleanup(void)
32 test_return_value = TET_PASS;
36 // Negative test case for a method
37 int UtcDaliShadowViewUninitialized(void)
39 ToolkitTestApplication application;
40 tet_infoline("UtcDaliShadowViewUninitialized");
42 Toolkit::ShadowView view;
45 // New() must be called to create a GaussianBlurView or it wont be valid.
46 Actor a = Actor::New();
48 DALI_TEST_CHECK( false );
50 catch (Dali::DaliException& e)
52 // Tests that a negative test of an assertion succeeds
53 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
54 DALI_TEST_CHECK(!view);
59 // Positive test case for a method
60 int UtcDaliShadowViewNew(void)
62 ToolkitTestApplication application;
63 tet_infoline("UtcDaliShadowViewNew");
65 Toolkit::ShadowView view = Toolkit::ShadowView::New();
66 DALI_TEST_CHECK( view );
68 Toolkit::ShadowView view2 = Toolkit::ShadowView::New(1.0f, 1.0f);
69 DALI_TEST_CHECK( view2 );
73 // Positive test case for a method
74 int UtcDaliShadowViewDownCast(void)
76 ToolkitTestApplication application;
77 tet_infoline("UtcDaliShadowViewDownCast");
79 Toolkit::ShadowView view = Toolkit::ShadowView::New();
80 BaseHandle handle(view);
82 Toolkit::ShadowView shadowView = Toolkit::ShadowView::DownCast( handle );
83 DALI_TEST_CHECK( view );
84 DALI_TEST_CHECK( shadowView );
85 DALI_TEST_CHECK( shadowView == view );
89 // Positive test case for a method
90 int UtcDaliShadowViewPropertyNames(void)
92 ToolkitTestApplication application;
93 tet_infoline("UtcDaliShadowViewPropertyNames");
95 Toolkit::ShadowView view = Toolkit::ShadowView::New();
96 DALI_TEST_CHECK( view );
98 // Check the names, this names are used in the shader code,
99 // if they change in the shader code, then it has to be updated here.
100 DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
101 DALI_TEST_EQUALS( view.GetShadowColorPropertyIndex(), view.GetPropertyIndex("ShadowColorProperty"), TEST_LOCATION );
105 // Positive test case for a method
106 int UtcDaliShadowViewAddRemove(void)
108 ToolkitTestApplication application;
109 tet_infoline("UtcDaliShadowViewAddRemove");
111 Toolkit::ShadowView view = Toolkit::ShadowView::New();
112 DALI_TEST_CHECK( view );
114 Actor actor = Actor::New();
115 DALI_TEST_CHECK( !actor.OnStage() );
118 view.SetParentOrigin(ParentOrigin::CENTER);
119 view.SetSize(Stage::GetCurrent().GetSize());
121 Stage::GetCurrent().Add(view);
123 DALI_TEST_CHECK( actor.OnStage() );
127 DALI_TEST_CHECK( !actor.OnStage() );
131 // Positive test case for a method
132 int UtcDaliShadowViewActivateDeactivate(void)
134 ToolkitTestApplication application;
135 tet_infoline("UtcDaliShadowViewActivateDeactivate");
137 Toolkit::ShadowView view = Toolkit::ShadowView::New();
138 DALI_TEST_CHECK( view );
140 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
141 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
143 view.SetParentOrigin(ParentOrigin::CENTER);
144 view.SetSize(Stage::GetCurrent().GetSize());
145 view.Add(Actor::New());
146 Stage::GetCurrent().Add(view);
149 RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
150 DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
154 RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
155 DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );