X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Actor.cpp;h=7ced69b25dacd6f4f67bb2dca675c823840bc713;hb=b43741a90b40ca9dfbd33d6a9d390d3c09230e89;hp=74b6c87eb859983b2301bd64cec3bb7e35e4f9e2;hpb=16a5f5c82adbf76b9c015bb2e00171b1e8c95e82;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 old mode 100644 new mode 100755 index 74b6c87..7ced69b --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 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. @@ -231,6 +231,55 @@ struct VisibilityChangedFunctor VisibilityChangedFunctorData& data; }; + +struct VisibilityChangedVoidFunctor +{ + VisibilityChangedVoidFunctor(bool& signalCalled) + : mSignalCalled( signalCalled ) + { } + + void operator()() + { + mSignalCalled = true; + } + + bool& mSignalCalled; +}; + +struct ChildOrderChangedFunctor +{ + ChildOrderChangedFunctor(bool& signalCalled, Actor& actor) + : mSignalCalled( signalCalled ), + mActor( actor ) + { } + + void operator()( Actor actor ) + { + mSignalCalled = true; + mActor = actor; + } + + bool& mSignalCalled; + Actor& mActor; +}; + +struct CulledPropertyNotificationFunctor +{ + CulledPropertyNotificationFunctor( bool& signalCalled, PropertyNotification& propertyNotification ) + : mSignalCalled( signalCalled ), + mPropertyNotification( propertyNotification ) + { } + + void operator()( PropertyNotification& source ) + { + mSignalCalled = true; + mPropertyNotification = source; + } + + bool& mSignalCalled; + PropertyNotification& mPropertyNotification; +}; + } // anonymous namespace @@ -1220,6 +1269,29 @@ int UtcDaliActorGetCurrentSizeImmediate(void) END_TEST; } +int UtcDaliActorCalculateScreenExtents(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + actor.SetPosition(Vector3(2.0f, 2.0f, 16.0f)); + actor.SetSize(Vector3{ 1.0f, 1.0f, 1.0f }); + + application.SendNotification(); + application.Render(); + + auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f }; + auto actualExtent = DevelActor::CalculateScreenExtents( actor ); + DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + + Stage::GetCurrent().Remove( actor ); + END_TEST; +} + // SetPosition(float x, float y) int UtcDaliActorSetPosition01(void) { @@ -1504,55 +1576,6 @@ int UtcDaliActorGetCurrentWorldPosition(void) END_TEST; } -int UtcDaliActorInheritPosition(void) -{ - tet_infoline("Testing Actor::SetPositionInheritanceMode"); - TestApplication application; - - Actor parent = Actor::New(); - Vector3 parentPosition( 1.0f, 2.0f, 3.0f ); - parent.SetPosition( parentPosition ); - parent.SetParentOrigin( ParentOrigin::CENTER ); - parent.SetAnchorPoint( AnchorPoint::CENTER ); - Stage::GetCurrent().Add( parent ); - - Actor child = Actor::New(); - child.SetParentOrigin( ParentOrigin::CENTER ); - child.SetAnchorPoint( AnchorPoint::CENTER ); - Vector3 childPosition( 10.0f, 11.0f, 12.0f ); - child.SetPosition( childPosition ); - parent.Add( child ); - - // The actors should not have a world position yet - DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION ); - - // first test default, which is to inherit position - DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::INHERIT_PARENT_POSITION, TEST_LOCATION ); - application.SendNotification(); - application.Render(0); // should only really call Update as Render is not required to update scene - DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION ); - - - //Change child position - Vector3 childOffset( -1.0f, 1.0f, 0.0f ); - child.SetPosition( childOffset ); - - // Change inheritance mode to not inherit - child.SetPositionInheritanceMode( Dali::DONT_INHERIT_POSITION ); - DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::DONT_INHERIT_POSITION, TEST_LOCATION ); - application.SendNotification(); - application.Render(0); // should only really call Update as Render is not required to update scene - DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION ); - END_TEST; -} - int UtcDaliActorSetInheritPosition(void) { tet_infoline("Testing Actor::SetInheritPosition"); @@ -1611,6 +1634,41 @@ int UtcDaliActorSetInheritPosition(void) END_TEST; } +int UtcDaliActorInheritOpacity(void) +{ + tet_infoline("Testing Actor::Inherit Opacity"); + TestApplication application; + + Actor parent = Actor::New(); + Actor child = Actor::New(); + parent.Add( child ); + Stage::GetCurrent().Add( parent ); + + DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); + + // flush the queue and render once + application.SendNotification(); + application.Render(); + + parent.SetOpacity( 0.1f ); + + DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 0.1f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get(), 0.1f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.f, 0.0001f, TEST_LOCATION ); + + END_TEST; +} + // SetOrientation(float angleRadians, Vector3 axis) int UtcDaliActorSetOrientation01(void) { @@ -3213,7 +3271,6 @@ const PropertyStringIndex PROPERTY_TABLE[] = { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN }, { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN }, { "colorMode", Actor::Property::COLOR_MODE, Property::STRING }, - { "positionInheritance", Actor::Property::POSITION_INHERITANCE, Property::STRING }, { "drawMode", Actor::Property::DRAW_MODE, Property::STRING }, { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 }, { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING }, @@ -3227,6 +3284,7 @@ const PropertyStringIndex PROPERTY_TABLE[] = { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN }, { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING }, { "opacity", DevelActor::Property::OPACITY, Property::FLOAT }, + { "updateSizeHint", DevelActor::Property::UPDATE_SIZE_HINT, Property::VECTOR2 }, }; const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] ); } // unnamed namespace @@ -3732,31 +3790,6 @@ int UtcDaliActorColorModePropertyAsString(void) END_TEST; } -int UtcDaliActorPositionInheritancePropertyAsString(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INHERIT_PARENT_POSITION" ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION" ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION_PLUS_LOCAL_POSITION" ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "DONT_INHERIT_POSITION" ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION ); - - // Invalid should not change anything - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION ); - - END_TEST; -} - int UtcDaliActorDrawModePropertyAsString(void) { TestApplication application; @@ -3769,12 +3802,9 @@ int UtcDaliActorDrawModePropertyAsString(void) actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" ); DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION ); - actor.SetProperty( Actor::Property::DRAW_MODE, "STENCIL" ); - DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION ); - // Invalid should not change anything actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION ); END_TEST; } @@ -3800,27 +3830,6 @@ int UtcDaliActorColorModePropertyAsEnum(void) END_TEST; } -int UtcDaliActorPositionInheritancePropertyAsEnum(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, INHERIT_PARENT_POSITION ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION_PLUS_LOCAL_POSITION ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION ); - - actor.SetProperty( Actor::Property::POSITION_INHERITANCE, DONT_INHERIT_POSITION ); - DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION ); - - END_TEST; -} - int UtcDaliActorDrawModePropertyAsEnum(void) { TestApplication application; @@ -3833,9 +3842,6 @@ int UtcDaliActorDrawModePropertyAsEnum(void) actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION ); - actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::STENCIL ); - DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION ); - END_TEST; } @@ -4777,6 +4783,12 @@ int UtcDaliActorRaiseLower(void) actorB.TouchSignal().Connect( TestTouchCallback2 ); actorC.TouchSignal().Connect( TestTouchCallback3 ); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + Dali::Integration::Point point; point.SetDeviceId( 1 ); point.SetState( PointState::DOWN ); @@ -4800,7 +4812,11 @@ int UtcDaliActorRaiseLower(void) Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); value.Get( preActorOrder ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.Raise(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + // Ensure sort order is calculated before next touch event application.SendNotification(); @@ -4822,7 +4838,13 @@ int UtcDaliActorRaiseLower(void) value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); value.Get( preActorOrder ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.Lower(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + application.SendNotification(); // ensure sort order calculated before next touch event value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); @@ -4900,6 +4922,12 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + // Set up gl abstraction trace so can query the set uniform order TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableSetUniformCallTrace(true); @@ -4949,7 +4977,11 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "RaiseToTop ActorA\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseToTop(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + application.SendNotification(); // ensure sorting order is calculated before next touch event application.ProcessEvent( touchEvent ); @@ -4980,7 +5012,13 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "RaiseToTop ActorB\n" ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.RaiseToTop(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + application.SendNotification(); // Ensure sort order is calculated before next touch event application.ProcessEvent( touchEvent ); @@ -5011,11 +5049,23 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.LowerToBottom(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + application.SendNotification(); application.Render(); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.LowerToBottom(); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -5097,6 +5147,11 @@ int UtcDaliActorRaiseAbove(void) actorB.TouchSignal().Connect( TestTouchCallback2 ); actorC.TouchSignal().Connect( TestTouchCallback3 ); + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + Dali::Integration::Point point; point.SetDeviceId( 1 ); point.SetState( PointState::DOWN ); @@ -5114,10 +5169,13 @@ int UtcDaliActorRaiseAbove(void) tet_printf( "Raise actor B Above Actor C\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); @@ -5128,7 +5186,12 @@ int UtcDaliActorRaiseAbove(void) tet_printf( "Raise actor A Above Actor B\n" ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorB ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5208,6 +5271,12 @@ int UtcDaliActorLowerBelow(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( container ).Connect( &application, f ) ; + // Set up gl abstraction trace so can query the set uniform order TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableSetUniformCallTrace(true); @@ -5262,7 +5331,11 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorC.LowerBelow( actorB ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5294,7 +5367,13 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor C below Actor A leaving B on top\n" ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorC.LowerBelow( actorA ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5323,7 +5402,13 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor B below Actor C leaving A on top\n" ); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.LowerBelow( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5402,6 +5487,12 @@ int UtcDaliActorRaiseAboveDifferentParentsN(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + application.SendNotification(); application.Render(); @@ -5432,7 +5523,10 @@ int UtcDaliActorRaiseAboveDifferentParentsN(void) tet_printf( "Raise actor A Above Actor C which have different parents\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5479,6 +5573,12 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + application.SendNotification(); application.Render(); @@ -5501,7 +5601,10 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) tet_printf( "Raise actor A Above Actor C which have no parents\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5515,9 +5618,14 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); + orderChangedSignal = false; + stage.Add ( actorB ); tet_printf( "Lower actor A below Actor C when only A is not on stage \n" ); + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.LowerBelow( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5532,6 +5640,8 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); + orderChangedSignal = false; + tet_printf( "Adding Actor A to stage, will be on top\n" ); stage.Add ( actorA ); @@ -5539,7 +5649,11 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) application.Render(); tet_printf( "Raise actor B Above Actor C when only B has a parent\n" ); + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5552,8 +5666,14 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); + orderChangedSignal = false; + tet_printf( "Lower actor A below Actor C when only A has a parent\n" ); + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.LowerBelow( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5566,8 +5686,15 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); + orderChangedSignal = false; + stage.Add ( actorC ); + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5614,6 +5741,12 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. actorA.TouchSignal().Connect( TestTouchCallback ); @@ -5629,7 +5762,10 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) stage.Add ( actorA ); tet_printf( "Raise actor B Above Actor C but B not parented\n" ); + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.Raise(); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); application.SendNotification(); application.Render(); @@ -5645,7 +5781,12 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) tet_printf( "Raise actor B Above Actor C but B not parented\n" ); ResetTouchCallbacks(); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorC.Lower(); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5659,9 +5800,14 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); ResetTouchCallbacks(); + orderChangedSignal = false; + tet_printf( "Lower actor C below B but C not parented\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.Lower(); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5675,9 +5821,14 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); ResetTouchCallbacks(); + orderChangedSignal = false; + tet_printf( "Raise actor B to top\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorB.RaiseToTop(); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5691,13 +5842,18 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); ResetTouchCallbacks(); + orderChangedSignal = false; + tet_printf( "Add ActorB to stage so only Actor C not parented\n" ); stage.Add ( actorB ); tet_printf( "Lower actor C to Bottom, B stays at top\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorC.LowerToBottom(); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -5756,6 +5912,12 @@ int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) ResetTouchCallbacks(); + // Connect ChildOrderChangedSignal + bool orderChangedSignal( false ); + Actor orderChangedActor; + ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); + DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + application.SendNotification(); application.Render(); @@ -5776,7 +5938,11 @@ int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" ); + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorA ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -5790,7 +5956,13 @@ int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) ResetTouchCallbacks(); + orderChangedSignal = false; + + DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); actorA.RaiseAbove( actorC ); + DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -6513,6 +6685,38 @@ int utcDaliActorVisibilityChangeSignalAfterAnimation(void) } +int utcDaliActorVisibilityChangeSignalByName(void) +{ + TestApplication application; + tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" ); + + Actor actor = Actor::New(); + + bool signalCalled=false; + actor.ConnectSignal( &application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled) ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.SetVisible( false ); + DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + + tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" ); + signalCalled = false; + actor.SetVisible( false ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + + tet_infoline( "Change the visibility using properties, ensure called" ); + actor.SetProperty( Actor::Property::VISIBLE, true ); + DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + + tet_infoline( "Set the visibility to current using properties, ensure not called" ); + signalCalled = false; + + actor.SetProperty( Actor::Property::VISIBLE, true ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + + END_TEST; +} + + static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type ) { gLayoutDirectionType = type; @@ -6605,3 +6809,474 @@ int UtcDaliActorLayoutDirectionProperty(void) END_TEST; } + + +struct LayoutDirectionFunctor +{ + LayoutDirectionFunctor(bool& signalCalled) + : mSignalCalled( signalCalled ) + { + } + + LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs) + : mSignalCalled( rhs.mSignalCalled ) + { + } + + void operator()() + { + mSignalCalled = true; + } + + bool& mSignalCalled; +}; + +int UtcDaliActorLayoutDirectionSignal(void) +{ + TestApplication application; + tet_infoline( "Check changing layout direction property sends a signal" ); + + Actor actor = Actor::New(); + DALI_TEST_EQUALS( actor.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + Stage::GetCurrent().Add( actor ); + bool signalCalled = false; + LayoutDirectionFunctor layoutDirectionFunctor(signalCalled); + + actor.ConnectSignal( &application, "layoutDirectionChanged", layoutDirectionFunctor ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + + // Test that writing the same value doesn't send a signal + actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + + // Test that writing a different value sends the signal + signalCalled = false; + actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); + DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + + signalCalled = false; + actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); + DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + + END_TEST; +} + +struct ChildAddedSignalCheck +{ + ChildAddedSignalCheck( bool& signalReceived, Actor& childHandle ) + : mSignalReceived( signalReceived ), + mChildHandle( childHandle ) + { + } + + void operator() ( Actor childHandle ) + { + mSignalReceived = true; + mChildHandle = childHandle; + } + void operator() () + { + mSignalReceived = true; + mChildHandle = Actor(); + } + + bool& mSignalReceived; + Actor& mChildHandle; +}; + +int UtcDaliChildAddedSignalP1(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildAddedSignalCheck signal( signalReceived, childActor ); + DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); + signalReceived = false; + + auto actorB = Actor::New(); + stage.Add( actorB ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliChildAddedSignalP2(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildAddedSignalCheck signal( signalReceived, childActor ); + tet_infoline( "Connect to childAdded signal by name" ); + + stage.GetRootLayer().ConnectSignal( &application, "childAdded", signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + + // Can't test which actor was added; signal signature is void() when connecting via name. + signalReceived = false; + + auto actorB = Actor::New(); + stage.Add( actorB ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliChildAddedSignalN(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildAddedSignalCheck signal( signalReceived, childActor ); + DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); + signalReceived = false; + + auto actorB = Actor::New(); + actorA.Add( actorB ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + END_TEST; +} + + +struct ChildRemovedSignalCheck +{ + ChildRemovedSignalCheck( bool& signalReceived, Actor& childHandle ) + : mSignalReceived( signalReceived ), + mChildHandle( childHandle ) + { + } + + void operator() ( Actor childHandle ) + { + mSignalReceived = true; + mChildHandle = childHandle; + } + + void operator() () + { + mSignalReceived = true; + } + + bool& mSignalReceived; + Actor& mChildHandle; +}; + +int UtcDaliChildRemovedSignalP1(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildRemovedSignalCheck signal( signalReceived, childActor ); + DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + DALI_TEST_CHECK( !childActor ); + + stage.Remove( actorA ); + DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + + signalReceived = false; + auto actorB = Actor::New(); + stage.Add( actorB ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + stage.Remove( actorB ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliChildRemovedSignalP2(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildAddedSignalCheck signal( signalReceived, childActor ); + tet_infoline( "Connect to childRemoved signal by name" ); + + stage.GetRootLayer().ConnectSignal( &application, "childRemoved", signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + stage.Remove( actorA ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + + signalReceived = false; + auto actorB = Actor::New(); + stage.Add( actorB ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + stage.Remove( actorB ); + DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliChildRemovedSignalN(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool signalReceived=false; + Actor childActor; + + ChildRemovedSignalCheck signal( signalReceived, childActor ); + DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + + auto actorA = Actor::New(); + stage.Add( actorA ); + + auto actorB = Actor::New(); + actorA.Add( actorB ); + + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + DALI_TEST_CHECK( ! childActor ); + + actorA.Remove( actorB ); + DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + END_TEST; +} + + +int UtcDaliChildMovedSignalP(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + bool addedASignalReceived = false; + bool removedASignalReceived = false; + bool addedBSignalReceived = false; + bool removedBSignalReceived = false; + Actor childActor; + + auto actorA = Actor::New(); + auto actorB = Actor::New(); + stage.Add( actorA ); + stage.Add( actorB ); + + ChildAddedSignalCheck addedSignalA( addedASignalReceived, childActor ); + ChildRemovedSignalCheck removedSignalA( removedASignalReceived, childActor ); + ChildAddedSignalCheck addedSignalB( addedBSignalReceived, childActor ); + ChildRemovedSignalCheck removedSignalB( removedBSignalReceived, childActor ); + + DevelActor::ChildAddedSignal( actorA ).Connect( &application, addedSignalA ); + DevelActor::ChildRemovedSignal( actorA ).Connect( &application, removedSignalA ); + DevelActor::ChildAddedSignal( actorB ).Connect( &application, addedSignalB ); + DevelActor::ChildRemovedSignal( actorB ).Connect( &application, removedSignalB ); + + DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); + + // Create a child of A + + auto child = Actor::New(); + actorA.Add( child ); + + DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( childActor, child, TEST_LOCATION ); + + // Move child to B: + addedASignalReceived = false; + addedBSignalReceived = false; + removedASignalReceived = false; + removedBSignalReceived = false; + + actorB.Add( child ); // Expect this child to be re-parented + DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( removedASignalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( addedBSignalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); + + // Move child back to A: + addedASignalReceived = false; + addedBSignalReceived = false; + removedASignalReceived = false; + removedBSignalReceived = false; + + actorA.Add( child ); // Expect this child to be re-parented + DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION ); + DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS( removedBSignalReceived, true, TEST_LOCATION ); + + + END_TEST; +} + +int utcDaliActorCulled(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + tet_infoline( "Check that the actor is culled if the actor is out of the screen" ); + + Actor actor = Actor::New(); + actor.SetSize( 10.0f, 10.0f ); + + Geometry geometry = CreateQuadGeometry(); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); + actor.AddRenderer( renderer ); + + stage.Add( actor ); + + application.SendNotification(); + application.Render( 0 ); + + DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), false, TEST_LOCATION ); + + PropertyNotification notification = actor.AddPropertyNotification( DevelActor::Property::CULLED, LessThanCondition( 0.5f ) ); + notification.SetNotifyMode( PropertyNotification::NotifyOnChanged ); + + // Connect NotifySignal + bool propertyNotificationSignal( false ); + PropertyNotification source; + CulledPropertyNotificationFunctor f( propertyNotificationSignal, source ); + notification.NotifySignal().Connect( &application, f ) ; + + actor.SetPosition( 1000.0f, 1000.0f ); + + application.SendNotification(); + application.Render(); + + application.SendNotification(); + + DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), true, TEST_LOCATION ); + + DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( DevelActor::Property::CULLED ), TEST_LOCATION ); + DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliActorUpdateSizeHint(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Vector3 vector(100.0f, 100.0f, 0.0f); + + DALI_TEST_CHECK(vector != actor.GetCurrentSize()); + + actor.SetSize(vector.x, vector.y); + + + Vector2 updateSizeHint = Vector2(150.f, 150.f); + actor.SetProperty(Dali::DevelActor::Property::UPDATE_SIZE_HINT, updateSizeHint); + + // Flush the queue and render once + application.SendNotification(); + application.Render(); + + + Vector2 currentSizeHint = actor.GetProperty( Dali::DevelActor::Property::UPDATE_SIZE_HINT ).Get< Vector2 >(); + DALI_TEST_EQUALS( currentSizeHint, updateSizeHint, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + + // Flush the queue and render once + application.SendNotification(); + application.Render(); + + END_TEST; +} + +int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + tet_infoline( "Ensure we clear the screen when the last actor is removed" ); + + Actor actor = CreateRenderableActor(); + actor.SetSize( 100.0f, 100.0f ); + stage.Add( actor ); + + application.SendNotification(); + application.Render(); + + auto& glAbstraction = application.GetGlAbstraction(); + const auto clearCountBefore = glAbstraction.GetClearCountCalled(); + + actor.Unparent(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION ); + + END_TEST; +} + +int utcDaliEnsureRenderWhenMakingLastActorInvisible(void) +{ + TestApplication application; + auto stage = Stage::GetCurrent(); + + tet_infoline( "Ensure we clear the screen when the last actor is made invisible" ); + + Actor actor = CreateRenderableActor(); + actor.SetSize( 100.0f, 100.0f ); + stage.Add( actor ); + + application.SendNotification(); + application.Render(); + + auto& glAbstraction = application.GetGlAbstraction(); + const auto clearCountBefore = glAbstraction.GetClearCountCalled(); + + actor.SetVisible( false ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION ); + + END_TEST; +}