2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
24 using namespace Dali::Toolkit;
26 void shadow_view_startup(void)
28 test_return_value = TET_UNDEF;
31 void shadow_view_cleanup(void)
33 test_return_value = TET_PASS;
37 // Negative test case for a method
38 int UtcDaliShadowViewUninitialized(void)
40 ToolkitTestApplication application;
41 tet_infoline("UtcDaliShadowViewUninitialized");
43 Toolkit::ShadowView view;
46 // New() must be called to create a GaussianBlurView or it wont be valid.
47 Actor a = Actor::New();
49 DALI_TEST_CHECK( false );
51 catch (Dali::DaliException& e)
53 // Tests that a negative test of an assertion succeeds
54 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
55 DALI_TEST_CHECK(!view);
60 // Positive test case for a method
61 int UtcDaliShadowViewNew(void)
63 ToolkitTestApplication application;
64 tet_infoline("UtcDaliShadowViewNew");
66 Toolkit::ShadowView view = Toolkit::ShadowView::New();
67 DALI_TEST_CHECK( view );
69 Toolkit::ShadowView view2 = Toolkit::ShadowView::New(1.0f, 1.0f);
70 DALI_TEST_CHECK( view2 );
74 // Positive test case for a method
75 int UtcDaliShadowViewDownCast(void)
77 ToolkitTestApplication application;
78 tet_infoline("UtcDaliShadowViewDownCast");
80 Toolkit::ShadowView view = Toolkit::ShadowView::New();
81 BaseHandle handle(view);
83 Toolkit::ShadowView shadowView = Toolkit::ShadowView::DownCast( handle );
84 DALI_TEST_CHECK( view );
85 DALI_TEST_CHECK( shadowView );
86 DALI_TEST_CHECK( shadowView == view );
90 // Positive test case for a method
91 int UtcDaliShadowViewPropertyNames(void)
93 ToolkitTestApplication application;
94 tet_infoline("UtcDaliShadowViewPropertyNames");
96 Toolkit::ShadowView view = Toolkit::ShadowView::New();
97 DALI_TEST_CHECK( view );
99 // Check the names, this names are used in the shader code,
100 // if they change in the shader code, then it has to be updated here.
101 DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
102 DALI_TEST_EQUALS( view.GetShadowColorPropertyIndex(), view.GetPropertyIndex("ShadowColorProperty"), TEST_LOCATION );
106 // Positive test case for a method
107 int UtcDaliShadowViewAddRemove(void)
109 ToolkitTestApplication application;
110 tet_infoline("UtcDaliShadowViewAddRemove");
112 Toolkit::ShadowView view = Toolkit::ShadowView::New();
113 DALI_TEST_CHECK( view );
115 Actor actor = Actor::New();
116 DALI_TEST_CHECK( !actor.OnStage() );
119 view.SetParentOrigin(ParentOrigin::CENTER);
120 view.SetSize(Stage::GetCurrent().GetSize());
122 Stage::GetCurrent().Add(view);
124 DALI_TEST_CHECK( actor.OnStage() );
128 DALI_TEST_CHECK( !actor.OnStage() );
132 // Positive test case for a method
133 int UtcDaliShadowViewActivateDeactivate(void)
135 ToolkitTestApplication application;
136 tet_infoline("UtcDaliShadowViewActivateDeactivate");
138 Toolkit::ShadowView view = Toolkit::ShadowView::New();
139 DALI_TEST_CHECK( view );
141 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
142 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
144 view.SetParentOrigin(ParentOrigin::CENTER);
145 view.SetSize(Stage::GetCurrent().GetSize());
146 view.Add(Actor::New());
147 Stage::GetCurrent().Add(view);
150 RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
151 DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
155 RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
156 DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );