+int UtcDaliVisualAnimatedGradientVisual01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatedGradientVisual with default" );
+
+ {
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ for(int step_iter = 0; step_iter < 3; step_iter++)
+ {
+ application.SendNotification();
+ application.Render(0);
+ application.Render(750u); // step i/4
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector2>( "start_point" , Vector2( -0.5f, 0.0f ) ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector2>( "end_point" , Vector2( 0.5f, 0.0f ) ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>( "start_color" , Vector4( 143.0f, 170.0f, 220.0f, 255.0f ) / 255.0f ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>( "end_color" , Vector4( 255.0f, 163.0f, 163.0f, 255.0f ) / 255.0f ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector2>( "rotate_center", Vector2( 0.0f, 0.0f ) ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>( "rotate_angle" , 0.0f ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>( "gradient_offset", 0.5f * step_iter + 0.5f ), true, TEST_LOCATION );
+ }
+
+ //Not check here. cause gradient_offset value can be 2.0f or 0.0f
+ application.Render(750u); // go to end
+ application.SendNotification();
+
+ application.Render(10u); // finish
+ application.SendNotification();
+
+ actor.Unparent();
+ application.SendNotification();
+ application.Render(0u);
+ application.SendNotification();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualAnimatedGradientVisual02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatedGradientVisual with full-option" );
+
+ {
+ float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
+ int _direction[2] = {0, 1};
+ int _loop_count[3] = {-1, 0, 1};
+ int _motion[2] = {0, 1};
+ int _easing[4] = {0, 1, 2, 3};
+
+ int test_case_max = 4 * 2 * 3 * 2 * 4;
+ int test_case = 0;
+ int test_case_d = 7; // 7 is the number of animated properties.
+
+ float _duration = 0.4f;
+ float _repeat_delay = _duration * 0.25f; // < _duration. cause real_duration = _duration - _repeat_delay;
+ float noise_maker = 0.0f;
+ // total testing time = ceil((4*2*3*2*4) / 7) * (_duration(=0.4) * 2 + 0.01) = 22.68 seconds
+ for( test_case = 0; test_case < test_case_max + test_case_d; test_case += test_case_d )
+ {
+ tet_printf( "test [%d ~ %d / %d]\n" , test_case, test_case + test_case_d - 1, test_case_max);
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ Property::Map animationMap;
+ propertyMap.Insert(Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT);
+
+ int gradient_type = DevelAnimatedGradientVisual::GradientType::LINEAR;
+ int unit_type = DevelAnimatedGradientVisual::UnitType::USER_SPACE;
+ int spread_type = DevelAnimatedGradientVisual::SpreadType::REPEAT;
+
+ auto buildAnimatedMap = [&animationMap, &_direction, &_duration, &_delay, &_loop_count, &_repeat_delay, &_motion, &_easing, &test_case](const Property::Value &start, const Property::Value &target, int tc_offset)->Property::Map&
+ {
+ int tc = (test_case + tc_offset);
+ int idx_easing = tc % 4; tc /= 4;
+ int idx_motion = tc % 2; tc /= 2;
+ int idx_loop_count = tc % 3; tc /= 3;
+ int idx_direction = tc % 2; tc /= 2;
+ int idx_delay = tc % 4; tc /= 4;
+
+ float duration = _duration - _repeat_delay;
+ float repeat_delay = _repeat_delay;
+ float delay = _delay[idx_delay] * _duration;
+ int direction = _direction[idx_direction];
+ int loop_count = _loop_count[idx_loop_count];
+ int motion = _motion[idx_motion];
+ int easing = _easing[idx_easing];
+
+ animationMap.Clear();
+ animationMap.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::START, start );
+ animationMap.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET, target );
+ if( direction == 0 )
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION, DevelAnimatedGradientVisual::AnimationParameter::DirectionType::FORWARD);
+ }
+ else
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION, DevelAnimatedGradientVisual::AnimationParameter::DirectionType::BACKWARD);
+ }
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::DURATION, duration);
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::DELAY, delay);
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::REPEAT, loop_count);
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::REPEAT_DELAY, repeat_delay);
+ if( motion == 0 )
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::MOTION_TYPE, DevelAnimatedGradientVisual::AnimationParameter::MotionType::LOOP);
+ }
+ else
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::MOTION_TYPE, DevelAnimatedGradientVisual::AnimationParameter::MotionType::MIRROR);
+ }
+ if( easing == 0 )
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::LINEAR);
+ }
+ else if( easing == 1 )
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::IN);
+ }
+ else if( easing == 2 )
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::OUT);
+ }
+ else
+ {
+ animationMap.Insert(DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::IN_OUT);
+ }
+
+ return animationMap;
+ };
+
+ // Give different values for debuging
+ noise_maker += 1.0f;
+ Vector2 start1(-0.5f + noise_maker * 0.1f, 0.5f + noise_maker * 0.1f);
+ Vector2 end1 (0.5f + noise_maker * 0.1f, -0.5f + noise_maker * 0.1f);
+ Vector4 start_color1(1.0f, 0.7f, 0.5f, 1.0f);
+ Vector4 end_color1 (0.7f, 0.5f, 1.0f, 1.0f);
+ Vector2 rotate_center1(0.0f + noise_maker * 0.1f, 0.4f + noise_maker * 0.1f);
+ float rotate_amount1 = 0.0f + noise_maker * 0.1f;
+ float offset1 = 0.f + noise_maker * 0.1f;
+
+ Vector2 start2(0.2f + noise_maker * 0.1f, -0.7f + noise_maker * 0.1f);
+ Vector2 end2 (0.5f + noise_maker * 0.1f, 0.5f + noise_maker * 0.1f);
+ Vector4 start_color2(0.0f, 0.1f, 0.8f, 1.0f);
+ Vector4 end_color2 (0.3f, 1.0f, 0.1f, 0.0f);
+ Vector2 rotate_center2(0.0f + noise_maker * 0.1f, -0.4f + noise_maker * 0.1f);
+ float rotate_amount2 = 7.0f + noise_maker * 0.1f;
+ float offset2 = 2.f + noise_maker * 0.1f;
+
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::GRADIENT_TYPE, gradient_type);
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::UNIT_TYPE, unit_type);
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::SPREAD_TYPE, spread_type);
+
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::START_POSITION, buildAnimatedMap(start1 , start2 ,0));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::END_POSITION, buildAnimatedMap(end1 , end2 ,1));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::START_COLOR, buildAnimatedMap(start_color1 , start_color2 ,2));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::END_COLOR, buildAnimatedMap(end_color1 , end_color2 ,3));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::ROTATE_CENTER, buildAnimatedMap(rotate_center1, rotate_center2,4));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT, buildAnimatedMap(rotate_amount1, rotate_amount2,5));
+ propertyMap.Insert(DevelAnimatedGradientVisual::Property::OFFSET, buildAnimatedMap(offset1 , offset2 ,6));
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>( actor.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ actor.SetSize( 2000, 2000 );
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render( 0 );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ application.SendNotification();
+
+ //Compare between CPU calculated value and Shader Visual calculated value
+ auto testProperty = [&application, &_direction, &_duration, &_delay, &_loop_count, &_repeat_delay, &_motion, &_easing, &test_case](const char* name, const Property::Value& start, const Property::Value& target, int tc_offset, int value_type, float progress)->void
+ {
+ int tc = (test_case + tc_offset);
+ int idx_easing = tc % 4; tc /= 4;
+ int idx_motion = tc % 2; tc /= 2;
+ int idx_loop_count = tc % 3; tc /= 3;
+ int idx_direction = tc % 2; tc /= 2;
+ int idx_delay = tc % 4; tc /= 4;
+
+ float duration = _duration - _repeat_delay;
+ float repeat_delay = _repeat_delay;
+ float delay = _delay[idx_delay] * _duration;
+ int direction = _direction[idx_direction];
+ int loop_count = _loop_count[idx_loop_count];
+ int motion = _motion[idx_motion];
+ int easing = _easing[idx_easing];
+
+ progress -= delay / _duration;
+
+ Property::Value s = start;
+ Property::Value t = target;
+ if( direction == 1 )
+ {
+ s = target;
+ t = start;
+ }
+ float x; ///< Animator progress value
+ if( loop_count == 0 )
+ {
+ x = 1.0f;
+ }
+ else if( loop_count > 0 && progress + 0.01f > loop_count )
+ {
+ x = ( motion == 0 ) ? 1.0f : 0.0f;
+ }
+ else
+ {
+ if( progress < 0.0f )
+ {
+ progress = 0.0f;
+ }
+ progress = fmodf( progress, 1.0f );
+ progress = Dali::Clamp( (progress * (duration + repeat_delay) - repeat_delay) / duration, 0.0f, 1.0f );
+
+ x = progress;
+ if( motion == 1 )
+ {
+ x = progress * 2.0f;
+ if( x > 1.0f )
+ {
+ x = 2.0f - x;
+ }
+ }
+
+ if( easing == 1 ) // EASE_IN
+ {
+ x = x*x;
+ }
+ else if( easing == 2 ) // EASE_OUT
+ {
+ x = 2.0f*x - x*x;
+ }
+ else if( easing == 3 ) // EASE_IN_OUT
+ {
+ x = x * x * (3.0f - 2.0f * x);
+ }
+ }
+ if( value_type == 0 ) // result type is Float
+ {
+ float res;
+ float cur;
+ res = s.Get<float>() * (1.0f - x) + t.Get<float>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<float>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else if( value_type == 1 ) // result type is Vector2
+ {
+ Vector2 res;
+ Vector2 cur;
+ res = s.Get<Vector2>() * (1.0f - x) + t.Get<Vector2>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector2>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else if( value_type == 2 ) // result type is Vector3
+ {
+ Vector3 res;
+ Vector3 cur;
+ res = s.Get<Vector3>() * (1.0f - x) + t.Get<Vector3>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector3>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else // result type is Vector4
+ {
+ Vector4 res;
+ Vector4 cur;
+ res = s.Get<Vector4>() * (1.0f - x) + t.Get<Vector4>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector4>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ };
+
+ float step = 0.0f;
+ for( int iter = 0; iter < 2; iter++ ) // test 2*duration seconds
+ {
+ for( int step_iter = 0; step_iter < 3; step_iter++ )
+ {
+ application.SendNotification();
+ application.Render( _duration * 250.f ); // step i/4
+ application.SendNotification();
+ step += 0.25f;
+
+ testProperty( "start_point" , Property::Value( start1 ) , Property::Value( start2 ) , 0, 1, step );
+ testProperty( "end_point" , Property::Value( end1 ) , Property::Value( end2 ) , 1, 1, step );
+ testProperty( "start_color" , Property::Value( start_color1 ) , Property::Value( start_color2 ) , 2, 3, step );
+ testProperty( "end_color" , Property::Value( end_color1 ) , Property::Value( end_color2 ) , 3, 3, step );
+ testProperty( "rotate_center" , Property::Value( rotate_center1 ), Property::Value( rotate_center2 ), 4, 1, step );
+ testProperty( "rotate_angle" , Property::Value( rotate_amount1 ), Property::Value( rotate_amount2 ), 5, 0, step );
+ testProperty( "gradient_offset", Property::Value( offset1 ) , Property::Value( offset2 ) , 6, 0, step );
+ }
+ application.SendNotification();
+ application.Render(_duration * 250.f); // step 4/4 will not test
+ application.SendNotification();
+ step += 0.25f;
+ }
+
+ application.SendNotification();
+ actor.Unparent();
+ application.SendNotification();
+ application.Render(10.f); // tempral time
+ application.SendNotification();
+ }
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualAnimatedGradientVisual03(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatedGradientVisual with full-option use string key" );
+
+ {
+ float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
+ int _direction[2] = {0, 1};
+ int _loop_count[3] = {-1, 0, 1};
+ int _motion[2] = {0, 1};
+ int _easing[4] = {0, 1, 2, 3};
+
+ int test_case_max = 4 * 2 * 3 * 2 * 4;
+ int test_case = 0;
+ int test_case_d = 7; // 7 is the number of animated properties.
+
+ float _duration = 0.4f;
+ float _repeat_delay = _duration * 0.25f; // < _duration. cause real_duration = _duration - _repeat_delay;
+ float noise_maker = 0.2f;
+ // total testing time = ceil((4*2*3*2*4) / 7) * (_duration(=0.4) * 2 + 0.01) = 22.68 seconds
+ for( test_case = 0; test_case < test_case_max + test_case_d; test_case += test_case_d )
+ {
+ tet_printf( "test [%d ~ %d / %d]\n" , test_case, test_case + test_case_d - 1, test_case_max);
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ Property::Map animationMap;
+ propertyMap.Insert(Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT);
+
+ auto buildAnimatedMap = [&animationMap, &_direction, &_duration, &_delay, &_loop_count, &_repeat_delay, &_motion, &_easing, &test_case](const Property::Value &start, const Property::Value &target, int tc_offset)->Property::Map&
+ {
+ int tc = (test_case + tc_offset);
+ int idx_easing = tc % 4; tc /= 4;
+ int idx_motion = tc % 2; tc /= 2;
+ int idx_loop_count = tc % 3; tc /= 3;
+ int idx_direction = tc % 2; tc /= 2;
+ int idx_delay = tc % 4; tc /= 4;
+
+ float duration = _duration - _repeat_delay;
+ float repeat_delay = _repeat_delay;
+ float delay = _delay[idx_delay] * _duration;
+ int direction = _direction[idx_direction];
+ int loop_count = _loop_count[idx_loop_count];
+ int motion = _motion[idx_motion];
+ int easing = _easing[idx_easing];
+
+ animationMap.Clear();
+ animationMap.Insert( "startValue", start );
+ animationMap.Insert( "targetValue", target );
+ if( direction == 0 )
+ {
+ animationMap.Insert("directionType", "FORWARD");
+ }
+ else
+ {
+ animationMap.Insert("directionType", "BACKWARD");
+ }
+ animationMap.Insert("duration", duration);
+ animationMap.Insert("delay", delay);
+ animationMap.Insert("repeat", loop_count);
+ animationMap.Insert("repeatDelay", repeat_delay);
+ if( motion == 0 )
+ {
+ animationMap.Insert("motionType", "LOOP");
+ }
+ else
+ {
+ animationMap.Insert("motionType", "MIRROR");
+ }
+ if( easing == 0 )
+ {
+ animationMap.Insert("easingType", "LINEAR");
+ }
+ else if( easing == 1 )
+ {
+ animationMap.Insert("easingType", "IN");
+ }
+ else if( easing == 2 )
+ {
+ animationMap.Insert("easingType", "OUT");
+ }
+ else
+ {
+ animationMap.Insert("easingType", "IN_OUT");
+ }
+
+ return animationMap;
+ };
+
+ // Give different values for debuging
+ noise_maker += 0.8f;
+ Vector2 start1(-0.5f + noise_maker * 0.1f, 0.5f + noise_maker * 0.1f);
+ Vector2 end1 (0.5f + noise_maker * 0.1f, -0.5f + noise_maker * 0.1f);
+ Vector4 start_color1(1.0f, 0.7f, 0.5f, 1.0f);
+ Vector4 end_color1 (0.7f, 0.5f, 1.0f, 1.0f);
+ Vector2 rotate_center1(0.0f + noise_maker * 0.1f, 0.4f + noise_maker * 0.1f);
+ float rotate_amount1 = 0.0f + noise_maker * 0.1f;
+ float offset1 = 0.f + noise_maker * 0.1f;
+
+ Vector2 start2(0.2f + noise_maker * 0.1f, -0.7f + noise_maker * 0.1f);
+ Vector2 end2 (0.5f + noise_maker * 0.1f, 0.5f + noise_maker * 0.1f);
+ Vector4 start_color2(0.0f, 0.1f, 0.8f, 1.0f);
+ Vector4 end_color2 (0.3f, 1.0f, 0.1f, 0.0f);
+ Vector2 rotate_center2(0.0f + noise_maker * 0.1f, -0.4f + noise_maker * 0.1f);
+ float rotate_amount2 = 7.0f + noise_maker * 0.1f;
+ float offset2 = 2.f + noise_maker * 0.1f;
+
+ propertyMap.Insert("gradientType", "LINEAR");
+ propertyMap.Insert("unitType", "USER_SPACE");
+ propertyMap.Insert("spreadType", "CLAMP");
+
+ propertyMap.Insert("startPosition", buildAnimatedMap(start1 , start2 ,0));
+ propertyMap.Insert("endPosition", buildAnimatedMap(end1 , end2 ,1));
+ propertyMap.Insert("startColor", buildAnimatedMap(start_color1 , start_color2 ,2));
+ propertyMap.Insert("endColor", buildAnimatedMap(end_color1 , end_color2 ,3));
+ propertyMap.Insert("rotateCenter", buildAnimatedMap(rotate_center1, rotate_center2,4));
+ propertyMap.Insert("rotateAmount", buildAnimatedMap(rotate_amount1, rotate_amount2,5));
+ propertyMap.Insert("offset", buildAnimatedMap(offset1 , offset2 ,6));
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>( actor.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ actor.SetSize( 2000, 2000 );
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render( 0 );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ application.SendNotification();
+
+ //Compare between CPU calculated value and Shader Visual calculated value
+ auto testProperty = [&application, &_direction, &_duration, &_delay, &_loop_count, &_repeat_delay, &_motion, &_easing, &test_case](const char* name, const Property::Value& start, const Property::Value& target, int tc_offset, int value_type, float progress)->void
+ {
+ int tc = (test_case + tc_offset);
+ int idx_easing = tc % 4; tc /= 4;
+ int idx_motion = tc % 2; tc /= 2;
+ int idx_loop_count = tc % 3; tc /= 3;
+ int idx_direction = tc % 2; tc /= 2;
+ int idx_delay = tc % 4; tc /= 4;
+
+ float duration = _duration - _repeat_delay;
+ float repeat_delay = _repeat_delay;
+ float delay = _delay[idx_delay] * _duration;
+ int direction = _direction[idx_direction];
+ int loop_count = _loop_count[idx_loop_count];
+ int motion = _motion[idx_motion];
+ int easing = _easing[idx_easing];
+
+ progress -= delay / _duration;
+
+ Property::Value s = start;
+ Property::Value t = target;
+ if( direction == 1 )
+ {
+ s = target;
+ t = start;
+ }
+ float x; ///< Animator progress value
+ if( loop_count == 0 )
+ {
+ x = 1.0f;
+ }
+ else if( loop_count > 0 && progress + 0.01f > loop_count )
+ {
+ x = ( motion == 0 ) ? 1.0f : 0.0f;
+ }
+ else
+ {
+ if( progress < 0.0f )
+ {
+ progress = 0.0f;
+ }
+ progress = fmodf( progress, 1.0f );
+ progress = Dali::Clamp( (progress * (duration + repeat_delay) - repeat_delay) / duration, 0.0f, 1.0f );
+
+ x = progress;
+ if( motion == 1 )
+ {
+ x = progress * 2.0f;
+ if( x > 1.0f )
+ {
+ x = 2.0f - x;
+ }
+ }
+
+ if( easing == 1 ) // EASE_IN
+ {
+ x = x*x;
+ }
+ else if( easing == 2 ) // EASE_OUT
+ {
+ x = 2.0f*x - x*x;
+ }
+ else if( easing == 3 ) // EASE_IN_OUT
+ {
+ x = x * x * (3.0f - 2.0f * x);
+ }
+ }
+ if( value_type == 0 ) // result type is Float
+ {
+ float res;
+ float cur;
+ res = s.Get<float>() * (1.0f - x) + t.Get<float>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<float>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else if( value_type == 1 ) // result type is Vector2
+ {
+ Vector2 res;
+ Vector2 cur;
+ res = s.Get<Vector2>() * (1.0f - x) + t.Get<Vector2>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector2>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else if( value_type == 2 ) // result type is Vector3
+ {
+ Vector3 res;
+ Vector3 cur;
+ res = s.Get<Vector3>() * (1.0f - x) + t.Get<Vector3>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector3>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ else // result type is Vector4
+ {
+ Vector4 res;
+ Vector4 cur;
+ res = s.Get<Vector4>() * (1.0f - x) + t.Get<Vector4>() * (x);
+ DALI_TEST_EQUALS( application.GetGlAbstraction().GetUniformValue<Vector4>(name, cur), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( res, cur, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+ }
+ };
+
+ float step = 0.0f;
+ for( int iter = 0; iter < 2; iter++ ) // test 2*duration seconds
+ {
+ for( int step_iter = 0; step_iter < 3; step_iter++ )
+ {
+ application.SendNotification();
+ application.Render( _duration * 250.f ); // step i/4
+ application.SendNotification();
+ step += 0.25f;
+
+ testProperty( "start_point" , Property::Value( start1 ) , Property::Value( start2 ) , 0, 1, step );
+ testProperty( "end_point" , Property::Value( end1 ) , Property::Value( end2 ) , 1, 1, step );
+ testProperty( "start_color" , Property::Value( start_color1 ) , Property::Value( start_color2 ) , 2, 3, step );
+ testProperty( "end_color" , Property::Value( end_color1 ) , Property::Value( end_color2 ) , 3, 3, step );
+ testProperty( "rotate_center" , Property::Value( rotate_center1 ), Property::Value( rotate_center2 ), 4, 1, step );
+ testProperty( "rotate_angle" , Property::Value( rotate_amount1 ), Property::Value( rotate_amount2 ), 5, 0, step );
+ testProperty( "gradient_offset", Property::Value( offset1 ) , Property::Value( offset2 ) , 6, 0, step );
+ }
+ application.SendNotification();
+ application.Render(_duration * 250.f); // step 4/4 will not test
+ application.SendNotification();
+ step += 0.25f;
+ }
+
+ application.SendNotification();
+ actor.Unparent();
+ application.SendNotification();
+ application.Render(10.f); // tempral time
+ application.SendNotification();
+ }
+ }
+
+ END_TEST;
+}