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>
22 #include <dali-toolkit/devel-api/shader-effects/square-dissolve-effect.h>
27 void square_dissolve_effect_startup(void)
29 test_return_value = TET_UNDEF;
32 void square_dissolve_effect_cleanup(void)
34 test_return_value = TET_PASS;
38 int UtcDaliSquareDissolveEffectUninitialized(void)
40 ToolkitTestApplication application;
42 Toolkit::SquareDissolveEffect effect;
46 // New() must be called to create a SquareDissolveEffect or it wont be valid.
47 effect.SetStep( 2.0f );
48 DALI_TEST_CHECK( false );
50 catch (Dali::DaliException& e)
52 // Tests that a negative test of an assertion succeeds
53 DALI_TEST_PRINT_ASSERT( e );
54 DALI_TEST_CHECK(!effect);
59 int UtcDaliSquareDissolveEffectPropertyNames(void)
61 ToolkitTestApplication application;
63 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
65 // Check the names, this names are used in the shaders code,
66 // if they change the shader code has to be updated
67 DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
68 DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION );
69 DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION );
70 DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION );
74 int UtcDaliSquareDissolveEffectDefaultValues(void)
76 ToolkitTestApplication application;
78 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
79 DALI_TEST_CHECK( effect );
81 BufferImage image = CreateBufferImage();
83 ImageActor actor = ImageActor::New( image );
84 actor.SetSize( 100.0f, 100.0f );
85 actor.SetShaderEffect( effect );
86 Stage::GetCurrent().Add( actor );
88 application.SendNotification();
91 // Gets converted to opengl viewport coordinates
93 application.GetGlAbstraction().CheckUniformValue(
94 effect.GetStepPropertyName().c_str(),
98 application.GetGlAbstraction().CheckUniformValue(
99 effect.GetRowsPropertyName().c_str(),
103 application.GetGlAbstraction().CheckUniformValue(
104 effect.GetColumnsPropertyName().c_str(),
108 application.GetGlAbstraction().CheckUniformValue(
109 effect.GetTexSizePropertyName().c_str(),
110 Vector2(1.0f, 1.0f) ) );
114 int UtcDaliSquareDissolveEffectCustomValues(void)
116 ToolkitTestApplication application;
118 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
119 DALI_TEST_CHECK( effect );
121 BufferImage image = CreateBufferImage();
123 ImageActor actor = ImageActor::New( image );
124 actor.SetSize( 100.0f, 100.0f );
126 effect.SetStep( 2.0f );
127 effect.SetRows( 3.0f );
128 effect.SetColumns( 4.0f );
129 effect.SetTextureSize( Vector2(12.0f, 13.0f) );
131 actor.SetShaderEffect(effect);
132 Stage::GetCurrent().Add(actor);
134 application.SendNotification();
135 application.Render();
137 // Gets converted to opengl viewport coordinates
139 application.GetGlAbstraction().CheckUniformValue(
140 effect.GetStepPropertyName().c_str(),
144 application.GetGlAbstraction().CheckUniformValue(
145 effect.GetRowsPropertyName().c_str(),
149 application.GetGlAbstraction().CheckUniformValue(
150 effect.GetColumnsPropertyName().c_str(),
154 application.GetGlAbstraction().CheckUniformValue(
155 effect.GetTexSizePropertyName().c_str(),
156 Vector2(12.0f, 13.0f) ) );