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.
20 // Need to override adaptor classes for toolkit test harness, so include
21 // test harness headers before dali headers.
22 #include <dali-toolkit-test-suite-utils.h>
25 #include <dali-toolkit/dali-toolkit.h>
30 void utc_dali_toolkit_swirl_effect_startup(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_toolkit_swirl_effect_cleanup(void)
37 test_return_value = TET_PASS;
40 int UtcDaliSwirlUninitializedEffect(void)
42 ToolkitTestApplication application;
44 Toolkit::SwirlEffect effect;
48 // New() must be called to create a SwirlEffect or it wont be valid.
49 effect.SetRadius( 0.5f );
50 DALI_TEST_CHECK( false );
52 catch (Dali::DaliException& e)
54 // Tests that a negative test of an assertion succeeds
55 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
56 DALI_TEST_CHECK(!effect);
61 int UtcDaliSwirlPropertyNamesEffect(void)
63 ToolkitTestApplication application;
65 Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
67 // Check the names, this names are used in the shaders code,
68 // if they change the shader code has to be updated
69 DALI_TEST_EQUALS( effect.GetAnglePropertyName(), "uAngle", TEST_LOCATION );
70 DALI_TEST_EQUALS( effect.GetCenterPropertyName(), "uCenter", TEST_LOCATION );
71 DALI_TEST_EQUALS( effect.GetRadiusPropertyName(), "uRadius", TEST_LOCATION );
75 int UtcDaliSwirlDefaultValuesEffect(void)
77 ToolkitTestApplication application;
79 Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(true);
80 DALI_TEST_CHECK( effect );
82 BitmapImage image = CreateBitmapImage();
84 ImageActor actor = ImageActor::New( image );
85 actor.SetSize( 100.0f, 100.0f );
86 actor.SetShaderEffect( effect );
87 Stage::GetCurrent().Add( actor );
89 application.SendNotification();
92 // Gets converted to opengl viewport coordinates
94 application.GetGlAbstraction().CheckUniformValue(
95 effect.GetAnglePropertyName().c_str(),
99 application.GetGlAbstraction().CheckUniformValue(
100 effect.GetCenterPropertyName().c_str(),
101 Vector2(0.5f, 0.5f) ) );
104 application.GetGlAbstraction().CheckUniformValue(
105 effect.GetRadiusPropertyName().c_str(),
110 int UtcDaliSwirlCustomValuesEffect(void)
112 ToolkitTestApplication application;
114 Toolkit::SwirlEffect effect = Toolkit::SwirlEffect::New(false);
115 DALI_TEST_CHECK( effect );
117 BitmapImage image = CreateBitmapImage();
119 ImageActor actor = ImageActor::New( image );
120 actor.SetSize( 100.0f, 100.0f );
122 effect.SetAngle( 1.0f );
123 effect.SetCenter( Vector2(0.3f, 0.7f) );
124 effect.SetRadius( 2.0f );
126 actor.SetShaderEffect( effect );
127 Stage::GetCurrent().Add( actor );
129 application.SendNotification();
130 application.Render();
132 // Gets converted to opengl viewport coordinates
134 application.GetGlAbstraction().CheckUniformValue(
135 effect.GetAnglePropertyName().c_str(),
139 application.GetGlAbstraction().CheckUniformValue(
140 effect.GetCenterPropertyName().c_str(),
141 Vector2(0.3f, 0.7f) ) );
144 application.GetGlAbstraction().CheckUniformValue(
145 effect.GetRadiusPropertyName().c_str(),