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;
27 void bloom_view_startup(void)
29 test_return_value = TET_UNDEF;
32 void bloom_view_cleanup(void)
34 test_return_value = TET_PASS;
37 // Negative test case for a method
38 int UtcDaliBloomViewUninitialized(void)
40 ToolkitTestApplication application;
41 tet_infoline(" UtcDaliBloomViewUninitialized");
43 Toolkit::BloomView view;
47 // New() must be called to create a BloomView or it wont be valid.
48 Actor a = Actor::New();
50 DALI_TEST_CHECK( false );
52 catch (Dali::DaliException& e)
54 // Tests that a negative test of an assertion succeeds
55 DALI_TEST_PRINT_ASSERT( e );
56 DALI_TEST_CHECK(!view);
61 // Positive test case for a method
62 int UtcDaliBloomViewNew(void)
64 ToolkitTestApplication application;
65 tet_infoline(" UtcDaliBloomViewNew");
67 Toolkit::BloomView view = Toolkit::BloomView::New();
68 DALI_TEST_CHECK( view );
70 Toolkit::BloomView view2 = Toolkit::BloomView::New(10, 1.0f, Pixel::RGB888, 0.5f, 0.5f);
71 DALI_TEST_CHECK( view2 );
75 // Positive test case for a method
76 int UtcDaliBloomViewDownCast(void)
78 ToolkitTestApplication application;
79 tet_infoline(" UtcDaliBloomViewDownCast");
81 Toolkit::BloomView view = Toolkit::BloomView::New();
82 BaseHandle handle(view);
84 Toolkit::BloomView bloomView = Toolkit::BloomView::DownCast( handle );
85 DALI_TEST_CHECK( view );
86 DALI_TEST_CHECK( bloomView );
87 DALI_TEST_CHECK( bloomView == view );
92 // Positive test case for a method
93 int UtcDaliBloomViewPropertyNames(void)
95 ToolkitTestApplication application;
96 tet_infoline(" UtcDaliBloomViewPropertyNames");
98 Toolkit::BloomView view = Toolkit::BloomView::New();
99 DALI_TEST_CHECK( view );
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.GetBloomThresholdPropertyIndex(), view.GetPropertyIndex("uBloomThreshold"), TEST_LOCATION );
104 DALI_TEST_EQUALS( view.GetBlurStrengthPropertyIndex(), view.GetPropertyIndex("BlurStrengthProperty"), TEST_LOCATION );
105 DALI_TEST_EQUALS( view.GetBloomIntensityPropertyIndex(), view.GetPropertyIndex("uBloomIntensity"), TEST_LOCATION );
106 DALI_TEST_EQUALS( view.GetBloomSaturationPropertyIndex(), view.GetPropertyIndex("uBloomSaturation"), TEST_LOCATION );
107 DALI_TEST_EQUALS( view.GetImageIntensityPropertyIndex(), view.GetPropertyIndex("uImageIntensity"), TEST_LOCATION );
108 DALI_TEST_EQUALS( view.GetImageSaturationPropertyIndex(), view.GetPropertyIndex("uImageSaturation"), TEST_LOCATION );
112 // Positive test case for a method
113 int UtcDaliBloomViewAddRemove(void)
115 ToolkitTestApplication application;
116 tet_infoline(" UtcDaliBloomViewAddRemove");
118 Toolkit::BloomView view = Toolkit::BloomView::New();
119 DALI_TEST_CHECK( view );
121 Actor actor = Actor::New();
122 DALI_TEST_CHECK( !actor.OnStage() );
125 view.SetParentOrigin(ParentOrigin::CENTER);
126 view.SetSize(Stage::GetCurrent().GetSize());
128 Stage::GetCurrent().Add(view);
130 DALI_TEST_CHECK( actor.OnStage() );
134 DALI_TEST_CHECK( !actor.OnStage() );
138 // Positive test case for a method
139 int UtcDaliBloomActivateDeactivate(void)
141 ToolkitTestApplication application;
142 tet_infoline(" UtcDaliBloomActivateDeactivate");
144 Toolkit::BloomView view = Toolkit::BloomView::New();
145 DALI_TEST_CHECK( view );
147 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
148 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
150 view.SetParentOrigin(ParentOrigin::CENTER);
151 view.SetSize(Stage::GetCurrent().GetSize());
152 view.Add(Actor::New());
153 Stage::GetCurrent().Add(view);
156 RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
157 DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
161 RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
162 DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );