Added checks to Sibling Order Raise/Lower API 12/117312/4
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 3 Mar 2017 16:51:12 +0000 (16:51 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Mon, 6 Mar 2017 11:39:55 +0000 (11:39 +0000)
Added checks to ensure target actor and actor raising or lowering belong to the same parent

Also checks that both actors are parented.

Change-Id: I346ead160a72cad12192cf4f6b771cf82bb43930

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/devel-api/actors/actor-devel.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h

index 0dfc7e3..5bfa46a 100644 (file)
@@ -4412,9 +4412,9 @@ int UtcDaliActorRaiseToTopLowerToBottom(void)
   END_TEST;
 }
 
-int UtcDaliActorRaiseAboveLowerBelow(void)
+int UtcDaliActorRaiseAbove(void)
 {
-  tet_infoline( "UtcDaliActor RaiseToAbove and LowerBelow test \n" );
+  tet_infoline( "UtcDaliActor RaiseToAbove test \n" );
 
   TestApplication application;
 
@@ -4637,7 +4637,7 @@ int UtcDaliActorLowerBelow(void)
   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
 
   tet_infoline( "Testing B above A and C at bottom\n" );
-  bool BAC = ( indexB > indexA) &&  ( indexA > indexC );
+  bool BAC = ( indexB > indexA) &&  ( indexA > indexC ); // B at TOP, then A then C at bottom
 
   DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
 
@@ -4667,7 +4667,7 @@ int UtcDaliActorLowerBelow(void)
   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
 
-  bool ACB = ( indexA > indexC) &&  ( indexC > indexB );
+  bool ACB = ( indexA > indexC) &&  ( indexC > indexB ); // A on TOP, then C then B at bottom
 
   DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
 
@@ -4677,6 +4677,30 @@ int UtcDaliActorLowerBelow(void)
 
   ResetTouchCallbacks();
 
+  tet_printf( "Lower actor A below Actor C leaving C on top\n" );
+
+  DevelActor::LowerBelow( actorA, actorC );
+
+  application.SendNotification();
+  application.Render();
+
+  application.ProcessEvent( event );
+
+  glAbstraction.ResetSetUniformCallStack();
+  glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+  application.Render();
+  tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+  // Test order of uniforms in stack
+  indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
+  indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
+  indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
+
+  bool CAB = ( indexC > indexA) &&  ( indexA > indexB );
+
+  DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -4735,3 +4759,438 @@ int UtcDaliActorMaxSiblingOrder(void)
 
   END_TEST;
 }
+
+int UtcDaliActorRaiseAboveLowerBelowDifferentParentsN(void)
+{
+  tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" );
+
+  TestApplication application;
+
+  Stage stage( Stage::GetCurrent() );
+
+  Actor parentA = Actor::New();
+  Actor parentB = Actor::New();
+  parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+  parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  parentA.SetAnchorPoint( AnchorPoint::CENTER );
+  parentA.SetParentOrigin( ParentOrigin::CENTER );
+
+  parentB.SetAnchorPoint( AnchorPoint::CENTER );
+  parentB.SetParentOrigin( ParentOrigin::CENTER );
+
+  stage.Add( parentA );
+  stage.Add( parentB );
+
+  Actor actorA = Actor::New();
+  Actor actorB = Actor::New();
+  Actor actorC = Actor::New();
+
+  parentA.Add( actorA );
+  parentA.Add( actorB );
+
+  tet_printf( "Actor C added to different parent from A and B \n" );
+  parentB.Add( actorC );
+
+  actorA.SetAnchorPoint( AnchorPoint::CENTER );
+  actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorB.SetAnchorPoint( AnchorPoint::CENTER );
+  actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorC.SetAnchorPoint( AnchorPoint::CENTER );
+  actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  ResetTouchCallbacks();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+  // 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 );
+  actorB.TouchSignal().Connect( TestTouchCallback2 );
+  actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+  Dali::Integration::TouchEvent event;
+  event.AddPoint( point );
+
+  application.ProcessEvent( event );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  tet_printf( "Raise actor A Above Actor C which have different parents\n" );
+
+  DevelActor::RaiseAbove( actorA, actorC );
+
+  application.ProcessEvent( event );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  END_TEST;
+}
+
+int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
+{
+  tet_infoline( "UtcDaliActor Test  raiseAbove and lowerBelow api when target Actor has no parent \n" );
+
+  TestApplication application;
+
+  Stage stage( Stage::GetCurrent() );
+
+  Actor actorA = Actor::New();
+  Actor actorB = Actor::New();
+  Actor actorC = Actor::New();
+
+  actorA.SetAnchorPoint( AnchorPoint::CENTER );
+  actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorB.SetAnchorPoint( AnchorPoint::CENTER );
+  actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorC.SetAnchorPoint( AnchorPoint::CENTER );
+  actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  ResetTouchCallbacks();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+  // 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 );
+  actorB.TouchSignal().Connect( TestTouchCallback2 );
+  actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+  Dali::Integration::TouchEvent event;
+  event.AddPoint( point );
+
+  tet_printf( "Raise actor A Above Actor C which have no parents\n" );
+
+  DevelActor::RaiseAbove( actorA, actorC );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  stage.Add ( actorB );
+
+  application.SendNotification();
+  application.Render();
+
+  tet_printf( "Lower actor A below Actor C when only A is not on stage \n" );
+  DevelActor::LowerBelow( actorA, actorC );
+  application.ProcessEvent( event );
+
+  tet_printf( "Actor A not parented so LowerBelow should show no effect\n" );
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  tet_printf( "Adding Actor A to stage, will be on top\n" );
+
+  stage.Add ( actorA );
+  application.SendNotification();
+  application.Render();
+
+  tet_printf( "Raise actor B Above Actor C when only B has a parent\n" );
+  DevelActor::RaiseAbove( actorB, actorC );
+  application.ProcessEvent( event );
+
+  tet_printf( "C not parented so RaiseAbove should show no effect\n" );
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  tet_printf( "Lower actor A below Actor C when only A has a parent\n" );
+  DevelActor::LowerBelow( actorA, actorC );
+  application.ProcessEvent( event );
+
+  tet_printf( "C not parented so LowerBelow should show no effect\n" );
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  stage.Add ( actorC );
+
+  application.SendNotification();
+  application.Render();
+
+  DevelActor::RaiseAbove( actorA, actorC );
+  application.ProcessEvent( event );
+
+  tet_printf( "Raise actor A Above Actor C, now both have same parent \n" );
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorTestAllAPIwhenActorNotParented(void)
+{
+  tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" );
+
+  TestApplication application;
+
+  Stage stage( Stage::GetCurrent() );
+
+  Actor actorA = Actor::New();
+  Actor actorB = Actor::New();
+  Actor actorC = Actor::New();
+
+  actorA.SetAnchorPoint( AnchorPoint::CENTER );
+  actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorB.SetAnchorPoint( AnchorPoint::CENTER );
+  actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorC.SetAnchorPoint( AnchorPoint::CENTER );
+  actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  ResetTouchCallbacks();
+
+  // 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 );
+  actorB.TouchSignal().Connect( TestTouchCallback2 );
+  actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+  Dali::Integration::TouchEvent event;
+  event.AddPoint( point );
+
+  stage.Add ( actorA );
+
+  application.SendNotification();
+  application.Render();
+
+  tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+
+  DevelActor::Raise( actorB );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+  ResetTouchCallbacks();
+
+  DevelActor::Lower( actorC );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+  ResetTouchCallbacks();
+
+  tet_printf( "Lower actor C below B but C not parented\n" );
+
+  DevelActor::Lower( actorB );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so Lower should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+  ResetTouchCallbacks();
+
+  tet_printf( "Raise actor B to top\n" );
+
+  DevelActor::RaiseToTop( actorB );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so RaiseToTop should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+  ResetTouchCallbacks();
+
+  tet_printf( "Add ActorB to stage so only Actor C not parented\n" );
+
+  stage.Add ( actorB );
+
+  application.SendNotification();
+  application.Render();
+
+  tet_printf( "Lower actor C to Bottom, B stays at top\n" );
+
+  DevelActor::LowerToBottom( actorC );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "Not parented so LowerToBottom should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+  ResetTouchCallbacks();
+
+  END_TEST;
+}
+
+
+int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
+{
+  tet_infoline( "UtcDaliActor RaiseToAbove and  test with actor provided as target resulting in a no operation \n" );
+
+  TestApplication application;
+
+  Stage stage( Stage::GetCurrent() );
+
+  Actor actorA = Actor::New();
+  Actor actorB = Actor::New();
+  Actor actorC = Actor::New();
+
+  actorA.SetAnchorPoint( AnchorPoint::CENTER );
+  actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorB.SetAnchorPoint( AnchorPoint::CENTER );
+  actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorC.SetAnchorPoint( AnchorPoint::CENTER );
+  actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+  actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+  actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+  stage.Add( actorA );
+  stage.Add( actorB );
+  stage.Add( actorC );
+
+  // 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 );
+  actorB.TouchSignal().Connect( TestTouchCallback2 );
+  actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+  ResetTouchCallbacks();
+
+  application.SendNotification();
+  application.Render();
+
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+  Dali::Integration::TouchEvent event;
+  event.AddPoint( point );
+
+  application.ProcessEvent( event );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  tet_printf( "Raise actor A Above Actor A which is the same actor!!\n" );
+
+  DevelActor::RaiseAbove( actorA, actorA );
+
+  application.ProcessEvent( event );
+
+  tet_printf( "No target is source Actor so RaiseAbove should show no effect\n" );
+
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
+
+  ResetTouchCallbacks();
+
+  DevelActor::RaiseAbove( actorA, actorC );
+  application.ProcessEvent( event );
+
+  tet_printf( "Raise actor A Above Actor C which will now be successful \n" );
+  DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
+
+  END_TEST;
+}
+
index 5b63c86..d61216c 100644 (file)
@@ -45,14 +45,14 @@ void LowerToBottom( Actor actor )
   GetImplementation( actor ).LowerToBottom();
 }
 
-void RaiseAbove( Actor actor, Dali::Actor target )
+void RaiseAbove( Actor actor, Actor target )
 {
-  GetImplementation( actor ).RaiseAbove( target );
+  GetImplementation( actor ).RaiseAbove( GetImplementation( target ) );
 }
 
 void LowerBelow( Actor actor, Actor target )
 {
-  GetImplementation( actor ).LowerBelow( target);
+  GetImplementation( actor ).LowerBelow( GetImplementation( target ) );
 }
 
 } // namespace DevelActor
index 5869699..d1bfa59 100644 (file)
@@ -95,6 +95,24 @@ int GetSiblingOrder( ActorPtr actor )
   return order;
 }
 
+bool ValidateActors( const Internal::Actor& actor, const Internal::Actor& target )
+{
+  bool validTarget = true;
+
+  if( &actor == &target )
+  {
+    DALI_LOG_WARNING( "Source actor and target actor can not be the same, Sibling order not changed.\n" );
+    validTarget = false;
+  }
+  else if( actor.GetParent() != target.GetParent() )
+  {
+    DALI_LOG_WARNING( "Source actor and target actor need to have common parent, Sibling order not changed.\n" );
+    validTarget = false;
+  }
+
+  return validTarget;
+}
+
 } // unnamed namespace
 
 /**
@@ -4607,6 +4625,10 @@ void Actor::Raise()
     }
     SetSiblingOrder( mSiblingOrder );
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
 void Actor::Lower()
@@ -4669,6 +4691,10 @@ void Actor::Lower()
       }
     }
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
 void Actor::RaiseToTop()
@@ -4718,6 +4744,10 @@ void Actor::RaiseToTop()
       DefragmentSiblingIndexes( *siblings );
     }
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
 void Actor::LowerToBottom()
@@ -4779,9 +4809,13 @@ void Actor::LowerToBottom()
       }
     }
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
-void Actor::RaiseAbove( Dali::Actor target )
+void Actor::RaiseAbove( Internal::Actor& target )
 {
   /**
     1 ) a) Find target actor's sibling order
@@ -4796,25 +4830,32 @@ void Actor::RaiseAbove( Dali::Actor target )
         defragmention will stop and new sibling orders will be set to same max value.
    */
 
-  if ( this != target )
+  if ( mParent )
   {
-     // Find target's sibling order
-     // Set actor sibling order to this number +1
-    int targetSiblingOrder = GetSiblingOrder( &GetImplementation( target ) );
-    ActorContainer* siblings = mParent->mChildren;
-    mSiblingOrder = targetSiblingOrder + 1;
-    bool defragmentationRequired = ShiftSiblingsLevels( *siblings, mSiblingOrder );
+    if ( ValidateActors( *this, target ) )
+    {
+       // Find target's sibling order
+       // Set actor sibling order to this number +1
+      int targetSiblingOrder = GetSiblingOrder( &target );
+      ActorContainer* siblings = mParent->mChildren;
+      mSiblingOrder = targetSiblingOrder + 1;
+      bool defragmentationRequired = ShiftSiblingsLevels( *siblings, mSiblingOrder );
 
-    SetSiblingOrder( mSiblingOrder );
+      SetSiblingOrder( mSiblingOrder );
 
-    if ( defragmentationRequired )
-    {
-      DefragmentSiblingIndexes( *(mParent->mChildren) );
+      if ( defragmentationRequired )
+      {
+        DefragmentSiblingIndexes( *(mParent->mChildren) );
+      }
     }
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
-void Actor::LowerBelow( Dali::Actor target )
+void Actor::LowerBelow( Internal::Actor& target )
 {
   /**
      1 ) a) Find target actor's sibling order
@@ -4829,45 +4870,52 @@ void Actor::LowerBelow( Dali::Actor target )
          defragmention will stop and new sibling orders will be set to same max value.
    */
 
-  if ( this != target  )
+  if ( mParent )
   {
-    bool defragmentationRequired ( false );
-    // Find target's sibling order
-    // Set actor sibling order to target sibling order - 1
-    int targetSiblingOrder = GetSiblingOrder( &GetImplementation( target ) );
-    ActorContainer* siblings = mParent->mChildren;
-    if ( targetSiblingOrder == 0 )
+    if ( ValidateActors( *this, target )  )
     {
-      //lower to botton
-      ActorIter end = siblings->end();
-      for( ActorIter iter = siblings->begin(); ( iter != end ) ; ++iter )
+      bool defragmentationRequired ( false );
+      // Find target's sibling order
+      // Set actor sibling order to target sibling order - 1
+      int targetSiblingOrder = GetSiblingOrder( &target);
+      ActorContainer* siblings = mParent->mChildren;
+      if ( targetSiblingOrder == 0 )
       {
-        ActorPtr sibling = (*iter);
-        if ( sibling != this )
+        //lower to botton
+        ActorIter end = siblings->end();
+        for( ActorIter iter = siblings->begin(); ( iter != end ) ; ++iter )
         {
-          sibling->mSiblingOrder++;
-          if ( sibling->mSiblingOrder + 1 >= DevelLayer::SIBLING_ORDER_MULTIPLIER )
+          ActorPtr sibling = (*iter);
+          if ( sibling != this )
           {
-            defragmentationRequired = true;
+            sibling->mSiblingOrder++;
+            if ( sibling->mSiblingOrder + 1 >= DevelLayer::SIBLING_ORDER_MULTIPLIER )
+            {
+              defragmentationRequired = true;
+            }
+            sibling->SetSiblingOrder( sibling->mSiblingOrder );
           }
-          sibling->SetSiblingOrder( sibling->mSiblingOrder );
         }
+        mSiblingOrder = 0;
       }
-      mSiblingOrder = 0;
-    }
-    else
-    {
-      defragmentationRequired = ShiftSiblingsLevels( *siblings, targetSiblingOrder );
+      else
+      {
+        defragmentationRequired = ShiftSiblingsLevels( *siblings, targetSiblingOrder );
 
-      mSiblingOrder = targetSiblingOrder;
-    }
-    SetSiblingOrder( mSiblingOrder );
+        mSiblingOrder = targetSiblingOrder;
+      }
+      SetSiblingOrder( mSiblingOrder );
 
-    if ( defragmentationRequired )
-    {
-      DefragmentSiblingIndexes( *(mParent->mChildren) );
+      if ( defragmentationRequired )
+      {
+        DefragmentSiblingIndexes( *(mParent->mChildren) );
+      }
     }
   }
+  else
+  {
+    DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+  }
 }
 
 } // namespace Internal
index 9345f23..0867eef 100644 (file)
@@ -1675,12 +1675,12 @@ public:
   /**
    * @copydoc Dali::DevelActor::RaiseAbove()
    */
-  void RaiseAbove( Dali::Actor target );
+  void RaiseAbove( Internal::Actor& target );
 
   /**
    * @copydoc Dali::DevelActor::LowerBelow()
    */
-  void LowerBelow( Dali::Actor target );
+  void LowerBelow( Internal::Actor& target );
 
 private: