-int UtcDaliGeometryPropertyRequiresDepthTest(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetRequiresDepthTesting, GetRequiresDepthTesting");
-
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- DALI_TEST_EQUALS( geometry.GetProperty<bool>(Geometry::Property::REQUIRES_DEPTH_TEST), false, TEST_LOCATION );
-
- geometry.SetProperty(Geometry::Property::REQUIRES_DEPTH_TEST, true );
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
- application.SendNotification();
- application.Render();
-// TODO: Not supported yet
-// TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
-// std::ostringstream out;
-// out << GL_DEPTH_TEST;
-// DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", out.str().c_str() ) );
-
- DALI_TEST_EQUALS( geometry.GetProperty<bool>(Geometry::Property::REQUIRES_DEPTH_TEST), true, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliGeometryConstraint(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a custom geometry property can be constrained");
-
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
-
- // Apply constraint
- Constraint constraint = Constraint::New<Vector4>( geometry, colorIndex, TestConstraintNoBlue );
- constraint.Apply();
- application.SendNotification();
- application.Render(0);
-
- // Expect no blue component in either buffer - yellow
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
- application.Render(0);
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
-
- geometry.RemoveConstraints();
- geometry.SetProperty(colorIndex, Color::WHITE );
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliGeometryConstraint02(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a uniform map geometry property can be constrained");
-
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
-
- 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 = geometry.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>( geometry, 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 );
-
- geometry.RemoveConstraints();
- geometry.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 UtcDaliGeometryAnimatedProperty01(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a custom geometry property can be animated");
-
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = geometry.RegisterProperty( "uFadeColor", initialColor );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( geometry.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( geometry, colorIndex ), keyFrames );
- animation.Play();
-
- application.SendNotification();
- application.Render(500);
-
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
-
- application.Render(500);
-
- DALI_TEST_EQUALS( geometry.GetProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliGeometryAnimatedProperty02(void)
-{
- TestApplication application;
-
- tet_infoline("Test that a uniform map geometry property can be animated");
-
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
-
- 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 = geometry.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( geometry, 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;
-}