END_TEST;
}
-
int utcDaliActorVisibilityChangeSignalSelf(void)
{
TestApplication application;
childData.Check( false /* not called */, TEST_LOCATION );
grandChildData.Check( false /* not called */, TEST_LOCATION );
- 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;
-}
+ END_TEST;}
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
- // We didn't expect the animation to finish yet, but cached value should be the final one
+ // We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty<Vector2>( actor, index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
END_TEST;
}
Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
- // Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
-
// Start the animation
animation.Play();
- // Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
- // Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
-
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
- // We didn't expect the animation to finish yet, but cached value should be the final one
+ // We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
END_TEST;
}
// Build the animation
Animation animation = Animation::New(2.0f);
- tet_infoline("Set target size in animation without initiating play");
+ tet_infoline("Set target size in animation without intiating play");
animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
tet_infoline("Set target position in animation without intiating play");
animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
application.SendNotification();
application.Render();
- tet_infoline("Ensure position of actor is still at initial size and position");
+ tet_infoline("Ensure position of actor is still at intial size and position");
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
application.SendNotification();
application.Render(2000u);
- tet_infoline("Ensure position and size of actor is at target value when animation playing");
+ tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
Vector3 position, tangent;
float tValue;
- DevelHandle::GetCurrentProperty( actor, index ).Get(tValue);
+ actor.GetProperty(index).Get(tValue);
float currentCursor = ( tValue - range.x ) / (range.y-range.x);
path.Sample(currentCursor, position, tangent );
DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
- DevelHandle::GetCurrentProperty( actor, index ).Get(tValue);
+ actor.GetProperty(index).Get(tValue);
currentCursor = ( tValue - range.x ) / (range.y-range.x);
path.Sample(currentCursor, position, tangent );
path.Sample(0.5, position, tangent );
path.Sample(currentCursor, position, tangent );
DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
- // Ensure GetProperty also returns the final result
- actor.GetProperty( index ).Get( tValue );
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
-
END_TEST;
}
animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR );
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION );
-
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
END_TEST;
}
animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR );
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION );
-
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
END_TEST;
}
DALI_TEST_EQUALS( task.GetClearColor(), testColor2, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
-
- Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f);
- Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::CLEAR_COLOR ), newColor3, AlphaFunction::LINEAR );
- animation.Play();
-
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
-
- // Perform 1000ms worth of updates at which point animation should have completed.
- Wait(application, 1000);
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
-
END_TEST;
}
void Actor::SetVisible( bool visible )
{
- SetVisibleInternal( visible, SendMessage::TRUE );
+ if( mVisible != visible )
+ {
+ if( NULL != mNode )
+ {
+ // mNode is being used in a separate thread; queue a message to set the value & base value
+ SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty<bool>::Bake, visible );
+ }
+
+ mVisible = visible;
+
+ // Emit the signal on this actor and all its children
+ EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF );
+ }
}
bool Actor::IsVisible() const
}
}
+void Actor::NotifySizeAnimation( Animation& animation, const Vector3& targetSize )
+{
+ mTargetSize = targetSize;
+
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+}
+
+void Actor::NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property )
+{
+ if ( Dali::Actor::Property::SIZE_WIDTH == property )
+ {
+ mTargetSize.width = targetSize;
+ }
+ else if ( Dali::Actor::Property::SIZE_HEIGHT == property )
+ {
+ mTargetSize.height = targetSize;
+ }
+ else if ( Dali::Actor::Property::SIZE_DEPTH == property )
+ {
+ mTargetSize.depth = targetSize;
+ }
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+}
+
+void Actor::NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition )
+{
+ mTargetPosition = targetPosition;
+}
+
+void Actor::NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property )
+{
+ if ( Dali::Actor::Property::POSITION_X == property )
+ {
+ mTargetPosition.x = targetPosition;
+ }
+ else if ( Dali::Actor::Property::POSITION_Y == property )
+ {
+ mTargetPosition.y = targetPosition;
+ }
+ else if ( Dali::Actor::Property::POSITION_Z == property )
+ {
+ mTargetPosition.z = targetPosition;
+ }
+}
+
void Actor::SetWidth( float width )
{
if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
return value;
}
-void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
-{
- switch( index )
- {
- case Dali::Actor::Property::SIZE:
- {
- if( value.Get( mTargetSize ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
-
- case Dali::Actor::Property::SIZE_WIDTH:
- {
- if( value.Get( mTargetSize.width ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
-
- case Dali::Actor::Property::SIZE_HEIGHT:
- {
- if( value.Get( mTargetSize.height ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
-
- case Dali::Actor::Property::SIZE_DEPTH:
- {
- if( value.Get( mTargetSize.depth ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
-
- case Dali::Actor::Property::POSITION:
- {
- value.Get( mTargetPosition );
- break;
- }
-
- case Dali::Actor::Property::POSITION_X:
- {
- value.Get( mTargetPosition.x );
- break;
- }
-
- case Dali::Actor::Property::POSITION_Y:
- {
- value.Get( mTargetPosition.y );
- break;
- }
-
- case Dali::Actor::Property::POSITION_Z:
- {
- value.Get( mTargetPosition.z );
- break;
- }
-
- case Dali::Actor::Property::ORIENTATION:
- {
- value.Get( mTargetOrientation );
- break;
- }
-
- case Dali::Actor::Property::SCALE:
- {
- value.Get( mTargetScale );
- break;
- }
-
- case Dali::Actor::Property::SCALE_X:
- {
- value.Get( mTargetScale.x );
- break;
- }
-
- case Dali::Actor::Property::SCALE_Y:
- {
- value.Get( mTargetScale.y );
- break;
- }
-
- case Dali::Actor::Property::SCALE_Z:
- {
- value.Get( mTargetScale.z );
- break;
- }
-
- case Dali::Actor::Property::VISIBLE:
- {
- SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
- break;
- }
-
- case Dali::Actor::Property::COLOR:
- {
- value.Get( mTargetColor );
- break;
- }
-
- case Dali::Actor::Property::COLOR_RED:
- {
- value.Get( mTargetColor.r );
- break;
- }
-
- case Dali::Actor::Property::COLOR_GREEN:
- {
- value.Get( mTargetColor.g );
- break;
- }
-
- case Dali::Actor::Property::COLOR_BLUE:
- {
- value.Get( mTargetColor.b );
- break;
- }
-
- case Dali::Actor::Property::COLOR_ALPHA:
- case Dali::DevelActor::Property::OPACITY:
- {
- value.Get( mTargetColor.a );
- break;
- }
-
- default:
- {
- // Not an animatable property. Do nothing.
- break;
- }
- }
-}
-
const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const
{
return mNode;
break;
}
- case Dali::Actor::Property::VISIBLE:
- {
- value = IsVisible();
- break;
- }
-
default:
{
// Must be an event-side only property
return mParent;
}
-void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage )
-{
- if( mVisible != visible )
- {
- if( sendMessage == SendMessage::TRUE && NULL != mNode )
- {
- // mNode is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty<bool>::Bake, visible );
- }
-
- mVisible = visible;
-
- // Emit the signal on this actor and all its children
- EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF );
- }
-}
-
void Actor::SetSiblingOrder( unsigned int order )
{
mSiblingOrder = std::min( order, static_cast<unsigned int>( DevelLayer::SIBLING_ORDER_MULTIPLIER ) );
/**
* Sets the visibility flag of an actor.
- * @param[in] visible The new visibility flag.
+ * @param [in] visible The new visibility flag.
*/
void SetVisible( bool visible );
// For Animation
/**
+ * This should only be called by Animation, when the actors SIZE property is animated.
+ *
+ * @param[in] animation The animation that resized the actor
+ * @param[in] targetSize The new target size of the actor
+ */
+ void NotifySizeAnimation( Animation& animation, const Vector3& targetSize );
+
+ /**
+ * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT or SIZE_DEPTH property is animated.
+ *
+ * @param[in] animation The animation that resized the actor
+ * @param[in] targetSize The new target size of the actor
+ * @param[in] property The index of the property being animated
+ */
+ void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property );
+
+ /**
* For use in derived classes.
* This should only be called by Animation, when the actor is resized using Animation::Resize().
*/
{
}
+ /**
+ * This should only be called by Animation, when the actors POSITION property is animated.
+ *
+ * @param[in] animation The animation that repositioned the actor
+ * @param[in] targetPosition The new target position of the actor
+ */
+ void NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition );
+
+ /**
+ * This should only be called by Animation, when the actors POSITION_X or POSITION_Y or POSITION_Z property is animated.
+ *
+ * @param[in] animation The animation that repositioned the actor
+ * @param[in] targetPosition The new target position of the actor
+ * @param[in] property The index of the property being animated
+ */
+ void NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property );
+
protected:
enum DerivedType
virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
/**
- * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
- */
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
-
- /**
* @copydoc Dali::Internal::Object::GetPropertyOwner()
*/
virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
private:
- struct SendMessage
- {
- enum Type
- {
- FALSE = 0,
- TRUE = 1,
- };
- };
-
// Undefined
Actor();
*/
bool ShiftSiblingsLevels( ActorContainer& siblings, int targetLevelToShiftFrom );
+
/**
* @brief Get the current position of the actor in screen coordinates.
*
*/
const Vector2 GetCurrentScreenPosition() const;
- /**
- * Sets the visibility flag of an actor.
- * @param[in] visible The new visibility flag.
- * @param[in] sendMessage Whether to send a message to the update thread or not.
- */
- void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
-
protected:
Actor* mParent; ///< Each actor (except the root) can have one parent
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/radian.h>
+#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/animation/animation-playlist.h>
#include <dali/internal/event/animation/animator-connector.h>
#include <dali/internal/event/common/notification-manager.h>
mState = Dali::Animation::PLAYING;
- if( mEndAction != EndAction::Discard ) // If the animation is discarded, then we do not want to change the target values
+ unsigned int connectorTargetValuesIndex( 0 );
+ unsigned int numberOfConnectorTargetValues = mConnectorActorTargetValues.size();
+
+ /*
+ * Loop through all Animator connectors, if connector index matches the current index stored in mConnectorActorTargetValues container then
+ * should apply target values for this index to the Actor.
+ * Confirm object is an actor and it is a POSITION or SIZE Property Index before sending Notify message to Actor.
+ */
+ for ( unsigned int connectorIndex = 0; connectorIndex < mConnectors.Count(); connectorIndex ++)
{
- unsigned int connectorTargetValuesIndex( 0 );
- unsigned int numberOfConnectorTargetValues = mConnectorTargetValues.size();
-
- /*
- * Loop through all Animator connectors, if connector index matches the current index stored in mConnectorTargetValues container then
- * should apply target values for this index to the object.
- */
- for ( unsigned int connectorIndex = 0; connectorIndex < mConnectors.Count(); connectorIndex ++)
+ // Use index to check if the current connector is next in the mConnectorActorTargetValues container, meaning targetValues have been pushed in AnimateXXFunction
+ if ( connectorTargetValuesIndex < numberOfConnectorTargetValues )
{
- // Use index to check if the current connector is next in the mConnectorTargetValues container, meaning targetValues have been pushed in AnimateXXFunction
- if ( connectorTargetValuesIndex < numberOfConnectorTargetValues )
+ ConnectorTargetValues& connectorPair = mConnectorActorTargetValues[ connectorTargetValuesIndex ];
+
+ if ( connectorPair.connectorIndex == connectorIndex )
{
- ConnectorTargetValues& connectorPair = mConnectorTargetValues[ connectorTargetValuesIndex ];
+ // Current connector index matches next in the stored connectors with target values so apply target value.
+ connectorTargetValuesIndex++; // Found a match for connector so increment index to next one
- if ( connectorPair.connectorIndex == connectorIndex )
- {
- // Current connector index matches next in the stored connectors with target values so apply target value.
- connectorTargetValuesIndex++; // Found a match for connector so increment index to next one
+ AnimatorConnectorBase* connector = mConnectors[ connectorIndex ];
- AnimatorConnectorBase* connector = mConnectors[ connectorIndex ];
+ Actor* maybeActor = static_cast<Actor*>( connector->GetObject() ); // Only Actors would be in mConnectorActorTargetValues container
- Object* object = connector->GetObject();
- if( object )
+ if ( maybeActor )
+ {
+ // Get Stored Target Value and corresponding connector index
+ const Property::Type valueType = connectorPair.targetValue.GetType();
+ Property::Index propertyIndex = connector->GetPropertyIndex();
+
+ if ( valueType == Property::VECTOR3 )
+ {
+ Vector3 targetVector3 = connectorPair.targetValue.Get<Vector3>();
+
+ if ( propertyIndex == Dali::Actor::Property::POSITION )
+ {
+ maybeActor->NotifyPositionAnimation( *this, targetVector3 );
+ }
+ else if ( propertyIndex == Dali::Actor::Property::SIZE )
+ {
+ maybeActor->NotifySizeAnimation( *this, targetVector3 );
+ }
+ }
+ else if ( valueType == Property::FLOAT )
+ {
+ float targetFloat = connectorPair.targetValue.Get<float>();
+
+ if ( ( Dali::Actor::Property::POSITION_X == propertyIndex ) ||
+ ( Dali::Actor::Property::POSITION_Y == propertyIndex ) ||
+ ( Dali::Actor::Property::POSITION_Z == propertyIndex ) )
+ {
+ maybeActor->NotifyPositionAnimation( *this, targetFloat, propertyIndex );
+ }
+ else if ( ( Dali::Actor::Property::SIZE_WIDTH == propertyIndex ) ||
+ ( Dali::Actor::Property::SIZE_HEIGHT == propertyIndex ) ||
+ ( Dali::Actor::Property::SIZE_DEPTH == propertyIndex ) )
+
+ {
+ maybeActor->NotifySizeAnimation( *this, targetFloat, propertyIndex );
+ }
+ }
+ else
{
- object->NotifyPropertyAnimation( *this, connector->GetPropertyIndex(), connectorPair.targetValue );
+ // Currently only FLOAT and VECTOR3 is supported for Target values in AnimateXXFunctions
+ DALI_LOG_WARNING("Animation::Play Unsupported Value Type provided as TargetValue\n");
}
}
}
// Remove all the connectors
mConnectors.Clear();
- // Reset the connector target values
- mConnectorTargetValues.clear();
-
// Replace the old scene-object with a new one
DestroySceneObject();
CreateSceneObject();
ExtendDuration( period );
- // Store data to later notify the object that its property is being animated
- ConnectorTargetValues connectorPair;
- connectorPair.targetValue = destinationValue;
- connectorPair.connectorIndex = mConnectors.Count();
- mConnectorTargetValues.push_back( connectorPair );
-
switch ( destinationType )
{
case Property::BOOLEAN:
case Property::FLOAT:
{
+ if ( ( Dali::Actor::Property::SIZE_WIDTH == targetPropertyIndex ) ||
+ ( Dali::Actor::Property::SIZE_HEIGHT == targetPropertyIndex ) ||
+ ( Dali::Actor::Property::SIZE_DEPTH == targetPropertyIndex ) ||
+ ( Dali::Actor::Property::POSITION_X == targetPropertyIndex ) ||
+ ( Dali::Actor::Property::POSITION_Y == targetPropertyIndex ) ||
+ ( Dali::Actor::Property::POSITION_Z == targetPropertyIndex ) )
+ {
+
+ Actor* maybeActor = dynamic_cast<Actor*>( &targetObject );
+ if ( maybeActor )
+ {
+ // Store data to later notify the actor that its size or position is being animated
+ ConnectorTargetValues connectorPair;
+ connectorPair.targetValue = destinationValue;
+ connectorPair.connectorIndex = mConnectors.Count();
+
+ mConnectorActorTargetValues.push_back( connectorPair );
+ }
+ }
+
AddAnimatorConnector( AnimatorConnector<float>::New( targetObject,
targetPropertyIndex,
componentIndex,
case Property::VECTOR3:
{
+ if ( Dali::Actor::Property::SIZE == targetPropertyIndex || Dali::Actor::Property::POSITION == targetPropertyIndex )
+ {
+ // Test whether this is actually an Actor
+ Actor* maybeActor = dynamic_cast<Actor*>( &targetObject );
+ if ( maybeActor )
+ {
+ // Store data to later notify the actor that its size or position is being animated
+ ConnectorTargetValues connectorPair;
+ connectorPair.targetValue = destinationValue;
+ connectorPair.connectorIndex = mConnectors.Count();
+
+ mConnectorActorTargetValues.push_back( connectorPair );
+ }
+ }
+
AddAnimatorConnector( AnimatorConnector<Vector3>::New( targetObject,
targetPropertyIndex,
componentIndex,
AnimatorConnectorContainer mConnectors; ///< Owned by the Animation
- std::vector< ConnectorTargetValues > mConnectorTargetValues; //< Used to store animating property target value information
+ std::vector< ConnectorTargetValues > mConnectorActorTargetValues; //< Store Actor target values and matchinf connector index that need to set value on Animation::Play
// Cached for public getters
float mDurationSeconds;
}
}
-void Object::NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
-{
- if ( index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- OnNotifyDefaultPropertyAnimation( animation, index, value );
- }
- else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
- {
- AnimatablePropertyMetadata* animatableProperty = FindAnimatableProperty( index );
- if( animatableProperty )
- {
- // update the cached property value
- animatableProperty->SetPropertyValue( value );
- }
- }
- else
- {
- CustomPropertyMetadata* custom = FindCustomProperty( index );
- if( custom && custom->IsAnimatable() )
- {
- // update the cached property value
- custom->SetPropertyValue( value );
- }
- }
-}
-
void Object::EnablePropertyNotifications()
{
if( mPropertyNotifications )
namespace Internal
{
-class Animation;
class ConstraintBase;
class EventThreadServices;
class Handle;
*/
virtual void RemovePropertyNotifications();
- /**
- * Notifies that a property is being animated.
- * @param[in] animation The animation animating the property.
- * @param[in] index The index of the property.
- * @param[in] value The value of the property after the animation.
- */
- void NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
-
/******************************** Uniform Mappings ********************************/
/**
virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const = 0;
/**
- * Notifies that a default property is being animated so the deriving class should update the cached value.
- * @param[in] animation The animation animating the property.
- * @param[in] index The index of the property.
- * @param[in] value The value of the property after the animation.
- */
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
- { }
-
- /**
* @todo this is virtual so that for now actor can override it,
* it needs to be removed and only have GetSceneObject but that requires changing actor and constraint logic
* Retrieve the scene-graph object added by this object.
return value;
}
-void RenderTask::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
-{
- switch ( index )
- {
- case Dali::RenderTask::Property::VIEWPORT_POSITION:
- {
- value.Get( mViewportPosition );
- break;
- }
- case Dali::RenderTask::Property::VIEWPORT_SIZE:
- {
- value.Get( mViewportSize );
- break;
- }
- case Dali::RenderTask::Property::CLEAR_COLOR:
- {
- value.Get( mClearColor );
- break;
- }
- case Dali::RenderTask::Property::REQUIRES_SYNC:
- default:
- {
- // Nothing to do as not animatable
- break;
- }
- }
-}
-
const SceneGraph::PropertyOwner* RenderTask::GetSceneObject() const
{
return mSceneObject;
virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
/**
- * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
- */
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
-
- /**
* @copydoc Dali::Internal::Object::GetSceneObject()
*/
virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
*
* Using AnimateTo and AnimateBy for the same property of the same Actor will yield undefined behaviour especially if the TimePeriod overlaps.
*
- * After calling Animation::Play(), Handle::GetProperty will return the target value of the animated property.
- *
* Signals
* | %Signal Name | Method |
* |--------------|--------------------------|