X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Renderer.cpp;h=3a12e966e50bdf4f6799072ed065342eeae21819;hb=baef81c81217e013c1cc253ac636f154c7e61370;hp=d1c81f61103cbd0c2b967e29179a3a7ed0a1e86d;hpb=15bd1b3858f6ba396685bc68eb9b196fc388d777;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index d1c81f6..3a12e96 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2897,9 +2897,10 @@ int UtcDaliRendererOpacityAnimation(void) DALI_TEST_CHECK( value.Get( opacity ) ); DALI_TEST_EQUALS( opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + // Need to clear the animation before setting the property as the animation value is baked and will override any previous setters + animation.Clear(); renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.1f ); - animation.Clear(); animation.AnimateBy( Property( renderer, DevelRenderer::Property::OPACITY ), 0.5f ); animation.Play(); @@ -2909,6 +2910,7 @@ int UtcDaliRendererOpacityAnimation(void) value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); DALI_TEST_CHECK( value.Get( opacity ) ); DALI_TEST_EQUALS( opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( opacity, renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY ).Get< float >(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; } @@ -3007,3 +3009,51 @@ int UtcDaliRendererRenderingBehavior(void) END_TEST; } + +int UtcDaliRendererRegenerateUniformMap(void) +{ + TestApplication application; + + tet_infoline( "Test regenerating uniform map when attaching renderer to the node" ); + + Geometry geometry = CreateQuadGeometry(); + Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); + Renderer renderer = Renderer::New( geometry, shader ); + + Actor actor = Actor::New(); + actor.AddRenderer( renderer ); + actor.SetSize( 400, 400 ); + actor.SetColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + actor.RemoveRenderer( renderer ); + shader = Shader::New( "vertexSrc", "fragmentSrc" ); + shader.RegisterProperty( "opacity", 0.5f ); + renderer.SetShader( shader ); + + Stage::GetCurrent().KeepRendering( 1.0f ); + + // Update for several frames + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // Add Renderer + actor.AddRenderer( renderer ); + application.SendNotification(); + application.Render(); + + // Nothing to test here, the test must not crash + auto updateStatus = application.GetUpdateStatus(); + DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ); + + END_TEST; +}