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.
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
26 #include <dali-toolkit/dali-toolkit.h>
27 #include <dali-toolkit/devel-api/shader-effects/ripple2d-effect.h>
32 void utc_dali_toolkit_ripple_2d_effect_startup(void)
34 test_return_value = TET_UNDEF;
37 void utc_dali_toolkit_ripple_2d_effect_cleanup(void)
39 test_return_value = TET_PASS;
42 int UtcDaliRipple2DEffectUninitialized(void)
44 ToolkitTestApplication application;
46 Toolkit::Ripple2DEffect effect;
50 // New() must be called to create a Ripple2DEffect or it wont be valid.
51 effect.SetAmplitude( 0.5f );
52 DALI_TEST_CHECK( false );
54 catch (Dali::DaliException& e)
56 // Tests that a negative test of an assertion succeeds
57 DALI_TEST_PRINT_ASSERT( e );
58 DALI_TEST_CHECK(!effect);
63 int UtcDaliRipple2DEffectPropertyNames(void)
65 ToolkitTestApplication application;
67 Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
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( effect.GetAmplitudePropertyName(), "uAmplitude", TEST_LOCATION );
72 DALI_TEST_EQUALS( effect.GetTimePropertyName(), "uTime", TEST_LOCATION );
76 int UtcDaliRipple2DEffectDefaultValues(void)
78 ToolkitTestApplication application;
80 Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
81 DALI_TEST_CHECK( effect );
83 BufferImage image = CreateBufferImage();
85 ImageActor actor = ImageActor::New( image );
86 actor.SetSize( 100.0f, 100.0f );
87 actor.SetShaderEffect( effect );
88 Stage::GetCurrent().Add( actor );
90 application.SendNotification();
94 application.GetGlAbstraction().CheckUniformValue(
95 effect.GetAmplitudePropertyName().c_str(),
98 application.GetGlAbstraction().CheckUniformValue(
99 effect.GetTimePropertyName().c_str(),
104 int UtcDaliRipple2DEffectCustomValues(void)
106 ToolkitTestApplication application;
108 Toolkit::Ripple2DEffect effect = Toolkit::Ripple2DEffect::New();
109 DALI_TEST_CHECK( effect );
111 BufferImage image = CreateBufferImage();
113 ImageActor actor = ImageActor::New( image );
114 actor.SetSize( 100.0f, 100.0f );
115 actor.SetShaderEffect( effect );
117 effect.SetAmplitude( 5.0f );
118 effect.SetTime( 2.0f );
120 Stage::GetCurrent().Add( actor );
122 application.SendNotification();
123 application.Render();
126 application.GetGlAbstraction().CheckUniformValue(
127 effect.GetAmplitudePropertyName().c_str(),
130 application.GetGlAbstraction().CheckUniformValue(
131 effect.GetTimePropertyName().c_str(),