struct ChildOrderChangedFunctor
{
- ChildOrderChangedFunctor(bool& signalCalled)
- : mSignalCalled( signalCalled )
+ ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
+ : mSignalCalled( signalCalled ),
+ mActor( actor )
{ }
- void operator()()
+ void operator()( Actor actor )
{
mSignalCalled = true;
+ mActor = actor;
}
bool& mSignalCalled;
+ Actor& mActor;
};
} // anonymous namespace
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 );
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();
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 );
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);
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 );
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 );
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();
actorB.TouchSignal().Connect( TestTouchCallback2 );
actorC.TouchSignal().Connect( TestTouchCallback3 );
- bool orderChangedSignal(false);
- ChildOrderChangedFunctor f(orderChangedSignal);
+ bool orderChangedSignal( false );
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
Dali::Integration::Point point;
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();
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();
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);
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();
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();
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();
ResetTouchCallbacks();
+ // Connect ChildOrderChangedSignal
+ bool orderChangedSignal( false );
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
+ DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+
application.SendNotification();
application.Render();
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();
ResetTouchCallbacks();
+ // Connect ChildOrderChangedSignal
+ bool orderChangedSignal( false );
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
+ DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+
application.SendNotification();
application.Render();
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();
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();
ResetTouchCallbacks();
+ orderChangedSignal = false;
+
tet_printf( "Adding Actor A to stage, will be on top\n" );
stage.Add ( actorA );
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();
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();
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();
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 );
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();
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();
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();
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();
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();
ResetTouchCallbacks();
+ // Connect ChildOrderChangedSignal
+ bool orderChangedSignal( false );
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
+ DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+
application.SendNotification();
application.Render();
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();
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();