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>
26 void square_dissolve_effect_startup(void)
28 test_return_value = TET_UNDEF;
31 void square_dissolve_effect_cleanup(void)
33 test_return_value = TET_PASS;
37 int UtcDaliSquareDissolveEffectUninitialized(void)
39 ToolkitTestApplication application;
41 Toolkit::SquareDissolveEffect effect;
45 // New() must be called to create a SquareDissolveEffect or it wont be valid.
46 effect.SetStep( 2.0f );
47 DALI_TEST_CHECK( false );
49 catch (Dali::DaliException& e)
51 // Tests that a negative test of an assertion succeeds
52 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
53 DALI_TEST_CHECK(!effect);
58 int UtcDaliSquareDissolveEffectPropertyNames(void)
60 ToolkitTestApplication application;
62 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
64 // Check the names, this names are used in the shaders code,
65 // if they change the shader code has to be updated
66 DALI_TEST_EQUALS( effect.GetStepPropertyName(), "uStep", TEST_LOCATION );
67 DALI_TEST_EQUALS( effect.GetRowsPropertyName(), "uRows", TEST_LOCATION );
68 DALI_TEST_EQUALS( effect.GetColumnsPropertyName(), "uColumns", TEST_LOCATION );
69 DALI_TEST_EQUALS( effect.GetTexSizePropertyName(), "texSize", TEST_LOCATION );
73 int UtcDaliSquareDissolveEffectDefaultValues(void)
75 ToolkitTestApplication application;
77 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
78 DALI_TEST_CHECK( effect );
80 BitmapImage image = CreateBitmapImage();
82 ImageActor actor = ImageActor::New( image );
83 actor.SetSize( 100.0f, 100.0f );
84 actor.SetShaderEffect( effect );
85 Stage::GetCurrent().Add( actor );
87 application.SendNotification();
90 // Gets converted to opengl viewport coordinates
92 application.GetGlAbstraction().CheckUniformValue(
93 effect.GetStepPropertyName().c_str(),
97 application.GetGlAbstraction().CheckUniformValue(
98 effect.GetRowsPropertyName().c_str(),
102 application.GetGlAbstraction().CheckUniformValue(
103 effect.GetColumnsPropertyName().c_str(),
107 application.GetGlAbstraction().CheckUniformValue(
108 effect.GetTexSizePropertyName().c_str(),
109 Vector2(1.0f, 1.0f) ) );
113 int UtcDaliSquareDissolveEffectCustomValues(void)
115 ToolkitTestApplication application;
117 Toolkit::SquareDissolveEffect effect = Toolkit::SquareDissolveEffect::New();
118 DALI_TEST_CHECK( effect );
120 BitmapImage image = CreateBitmapImage();
122 ImageActor actor = ImageActor::New( image );
123 actor.SetSize( 100.0f, 100.0f );
125 effect.SetStep( 2.0f );
126 effect.SetRows( 3.0f );
127 effect.SetColumns( 4.0f );
128 effect.SetTextureSize( Vector2(12.0f, 13.0f) );
130 actor.SetShaderEffect(effect);
131 Stage::GetCurrent().Add(actor);
133 application.SendNotification();
134 application.Render();
136 // Gets converted to opengl viewport coordinates
138 application.GetGlAbstraction().CheckUniformValue(
139 effect.GetStepPropertyName().c_str(),
143 application.GetGlAbstraction().CheckUniformValue(
144 effect.GetRowsPropertyName().c_str(),
148 application.GetGlAbstraction().CheckUniformValue(
149 effect.GetColumnsPropertyName().c_str(),
153 application.GetGlAbstraction().CheckUniformValue(
154 effect.GetTexSizePropertyName().c_str(),
155 Vector2(12.0f, 13.0f) ) );