X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Actor.cpp;h=4794369ee33744e016b3703c10a25cb0046fce84;hb=72d3e464f0fdaaf6db6206873408e8d845f02cd4;hp=9a41831714ca78d7799bc3fb59e6dc8e5ca5c432;hpb=5bff9714dde9f2b394443337c65e673dcb4a031d;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 9a41831..4794369 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -3859,17 +3859,33 @@ int UtcDaliActorRemoveRendererP1(void) DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); - Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New(geometry, shader); + { + Geometry geometry = CreateQuadGeometry(); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); + actor.AddRenderer( renderer ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); - actor.RemoveRenderer(renderer); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + application.SendNotification(); + application.Render(); + } + + { + Renderer renderer = actor.GetRendererAt(0); + actor.RemoveRenderer(renderer); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + application.SendNotification(); + application.Render(); + } + + // Call one final time to ensure that the renderer is actually removed after + // the handle goes out of scope, and excercises the deletion code path in + // scene graph and render. + application.SendNotification(); + application.Render(); END_TEST; } @@ -3888,13 +3904,19 @@ int UtcDaliActorRemoveRendererP2(void) Renderer renderer = Renderer::New(geometry, shader); actor.AddRenderer( renderer ); + application.SendNotification(); + application.Render(); + DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); actor.RemoveRenderer(0); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + application.SendNotification(); + application.Render(); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + // Shut down whilst holding onto the renderer handle. END_TEST; } @@ -5938,6 +5960,7 @@ int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void) END_TEST; } + int utcDaliActorVisibilityChangeSignalSelf(void) { TestApplication application; @@ -6020,4 +6043,43 @@ int utcDaliActorVisibilityChangeSignalChildren(void) childData.Check( false /* not called */, TEST_LOCATION ); grandChildData.Check( false /* not called */, TEST_LOCATION ); - END_TEST;} + END_TEST; +} + +int utcDaliActorVisibilityChangeSignalAfterAnimation(void) +{ + TestApplication application; + tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" ); + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + VisibilityChangedFunctorData data; + DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) ); + + Animation animation = Animation::New( 1.0f ); + animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false ); + + data.Check( false, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), true, TEST_LOCATION ); + + tet_infoline( "Play the animation and check the property value" ); + animation.Play(); + + data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + + tet_infoline( "Animation not currently finished, so the current visibility should still be true" ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render( 1100 ); // After the animation + + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), false, TEST_LOCATION ); + + END_TEST; +}