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_dissolve_effect_startup(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_toolkit_dissolve_effect_cleanup(void)
37 test_return_value = TET_PASS;
41 int UtcDaliDissolveUninitializedEffect(void)
43 ToolkitTestApplication application;
45 Toolkit::DissolveEffect effect;
49 // New() must be called to create a DissolveEffect or it wont be valid.
50 effect.SetDistortion( 2.0f );
51 DALI_TEST_CHECK( false );
53 catch (Dali::DaliException& e)
55 // Tests that a negative test of an assertion succeeds
56 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
57 DALI_TEST_CHECK(!effect);
62 int UtcDaliDissolvePropertyNamesEffect(void)
64 ToolkitTestApplication application;
66 Toolkit::DissolveEffect effectHighPrecision = Toolkit::DissolveEffect::New();
67 Toolkit::DissolveEffect effectMediumPrecision = Toolkit::DissolveEffect::New( false );
69 // Check the names, this names are used in the shaders code,
70 // if they change the shader code has to be updated
71 DALI_TEST_EQUALS( effectHighPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
72 DALI_TEST_EQUALS( effectMediumPrecision.GetDistortionPropertyName(), "uPercentage", TEST_LOCATION );
76 int UtcDaliDissolveDefaultValuesEffect(void)
78 ToolkitTestApplication application;
80 Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
81 DALI_TEST_CHECK( effect );
83 BitmapImage image = CreateBitmapImage();
85 ImageActor actor = ImageActor::New( image );
86 actor.SetSize( 100.0f, 100.0f );
87 actor.SetShaderEffect( effect );
88 effect.SetCentralLine( Vector2(0.0,0.5), Vector2(1.0, -0.1) );
89 Stage::GetCurrent().Add( actor );
91 application.SendNotification();
94 Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
96 (effect.GetProperty(index)).Get( value );
97 DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );
101 int UtcDaliDissolveCustomValuesEffect(void)
103 ToolkitTestApplication application;
105 Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
106 DALI_TEST_CHECK( effect );
108 BitmapImage image = CreateBitmapImage();
110 ImageActor actor = ImageActor::New( image );
111 actor.SetSize( 100.0f, 100.0f );
113 effect.SetDistortion( 0.5f );
115 actor.SetShaderEffect(effect);
116 Stage::GetCurrent().Add(actor);
118 application.SendNotification();
119 application.Render();
121 Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
123 (effect.GetProperty(index)).Get( value );
124 DALI_TEST_EQUALS(value, 0.5f, TEST_LOCATION );
128 int UtcDaliSetEffectImageEffect(void)
130 ToolkitTestApplication application;
132 Toolkit::DissolveEffect effect = Toolkit::DissolveEffect::New();
133 DALI_TEST_CHECK( effect );
135 Image effectImage = CreateBitmapImage();
136 effect.SetEffectImage(effectImage);
138 BitmapImage image = CreateBitmapImage();
140 ImageActor actor = ImageActor::New( image );
141 actor.SetSize( 100.0f, 100.0f );
142 actor.SetShaderEffect( effect );
143 Stage::GetCurrent().Add( actor );
145 application.SendNotification();
146 application.Render();
148 Property::Index index = effect.GetPropertyIndex( effect.GetDistortionPropertyName());
150 (effect.GetProperty(index)).Get( value );
151 DALI_TEST_EQUALS(value, 0.f, TEST_LOCATION );