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>
25 void square_dissolve_effect_startup(void)
27 test_return_value = TET_UNDEF;
30 void square_dissolve_effect_cleanup(void)
32 test_return_value = TET_PASS;
36 int UtcDaliSquareDissolveEffectUninitialized(void)
38 ToolkitTestApplication application;
40 Toolkit::SquareDissolveEffect effect;
44 // New() must be called to create a SquareDissolveEffect or it wont be valid.
45 effect.SetStep( 2.0f );
46 DALI_TEST_CHECK( false );
48 catch (Dali::DaliException& e)
50 // Tests that a negative test of an assertion succeeds
51 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
52 DALI_TEST_CHECK(!effect);
57 int UtcDaliSquareDissolveEffectPropertyNames(void)
59 ToolkitTestApplication application;
61 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
63 // Check the names, this names are used in the shaders code,
64 // if they change the shader code has to be updated
65 DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
66 DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION );
67 DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION );
68 DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION );
72 int UtcDaliSquareDissolveEffectDefaultValues(void)
74 ToolkitTestApplication application;
76 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
77 DALI_TEST_CHECK( effect );
79 BitmapImage image = CreateBitmapImage();
81 ImageActor actor = ImageActor::New( image );
82 actor.SetSize( 100.0f, 100.0f );
83 actor.SetShaderEffect( effect );
84 Stage::GetCurrent().Add( actor );
86 application.SendNotification();
89 // Gets converted to opengl viewport coordinates
91 application.GetGlAbstraction().CheckUniformValue(
92 effect.GetStepPropertyName().c_str(),
96 application.GetGlAbstraction().CheckUniformValue(
97 effect.GetRowsPropertyName().c_str(),
101 application.GetGlAbstraction().CheckUniformValue(
102 effect.GetColumnsPropertyName().c_str(),
106 application.GetGlAbstraction().CheckUniformValue(
107 effect.GetTexSizePropertyName().c_str(),
108 Vector2(1.0f, 1.0f) ) );
112 int UtcDaliSquareDissolveEffectCustomValues(void)
114 ToolkitTestApplication application;
116 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
117 DALI_TEST_CHECK( effect );
119 BitmapImage image = CreateBitmapImage();
121 ImageActor actor = ImageActor::New( image );
122 actor.SetSize( 100.0f, 100.0f );
124 effect.SetStep( 2.0f );
125 effect.SetRows( 3.0f );
126 effect.SetColumns( 4.0f );
127 effect.SetTextureSize( Vector2(12.0f, 13.0f) );
129 actor.SetShaderEffect(effect);
130 Stage::GetCurrent().Add(actor);
132 application.SendNotification();
133 application.Render();
135 // Gets converted to opengl viewport coordinates
137 application.GetGlAbstraction().CheckUniformValue(
138 effect.GetStepPropertyName().c_str(),
142 application.GetGlAbstraction().CheckUniformValue(
143 effect.GetRowsPropertyName().c_str(),
147 application.GetGlAbstraction().CheckUniformValue(
148 effect.GetColumnsPropertyName().c_str(),
152 application.GetGlAbstraction().CheckUniformValue(
153 effect.GetTexSizePropertyName().c_str(),
154 Vector2(12.0f, 13.0f) ) );