-int UtcDaliTextureSetConstraint(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a custom texture set property can be constrained");
-
- Shader shader = Shader::New( "VertexSource", "FragmentSource");
- TextureSet textureSet = TextureSet::New();
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = textureSet.RegisterProperty( "uFadeColor", initialColor );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
-
- // Apply constraint
- Constraint constraint = Constraint::New<Vector4>( textureSet, colorIndex, TestConstraintNoBlue );
- constraint.Apply();
- application.SendNotification();
- application.Render(0);
-
- // Expect no blue component in either buffer - yellow
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
- application.Render(0);
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
-
- textureSet.RemoveConstraints();
- textureSet.SetProperty(colorIndex, Color::WHITE );
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextureSetConstraint02(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a uniform map texture set property can be constrained");
-
- Shader shader = Shader::New( "VertexSource", "FragmentSource");
- TextureSet textureSet = TextureSet::New();
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
- application.SendNotification();
- application.Render(0);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = textureSet.RegisterProperty( "uFadeColor", initialColor );
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
-
- application.SendNotification();
- application.Render(0);
-
- Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
-
- // Apply constraint
- Constraint constraint = Constraint::New<Vector4>( textureSet, colorIndex, TestConstraintNoBlue );
- constraint.Apply();
- application.SendNotification();
- application.Render(0);
-
- // Expect no blue component in either buffer - yellow
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
-
- application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
-
- textureSet.RemoveConstraints();
- textureSet.SetProperty(colorIndex, Color::WHITE );
- application.SendNotification();
- application.Render(0);
-
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextureSetAnimatedProperty01(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a non-uniform texture set property can be animated");
-
- Shader shader = Shader::New( "VertexSource", "FragmentSource");
- TextureSet textureSet = TextureSet::New();
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = textureSet.RegisterProperty( "uFadeColor", initialColor );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
-
- Animation animation = Animation::New(1.0f);
- KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add(0.0f, initialColor);
- keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( textureSet, colorIndex ), keyFrames );
- animation.Play();
-
- application.SendNotification();
- application.Render(500);
-
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
-
- application.Render(500);
-
- DALI_TEST_EQUALS( textureSet.GetProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextureSetAnimatedProperty02(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a uniform map texture set property can be animated");
-
- Shader shader = Shader::New( "VertexSource", "FragmentSource");
- TextureSet textureSet = TextureSet::New();
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
- application.SendNotification();
- application.Render(0);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = textureSet.RegisterProperty( "uFadeColor", initialColor );
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
-
- application.SendNotification();
- application.Render(0);
-
- Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
-
- Animation animation = Animation::New(1.0f);
- KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add(0.0f, initialColor);
- keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( textureSet, colorIndex ), keyFrames );
- animation.Play();
-
- application.SendNotification();
- application.Render(500);
-
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
-
- application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
-
- END_TEST;
-}
-