END_TEST;
}
+
+int UtcDaliAnimationCountAndGetAnimationAt(void)
+{
+ tet_infoline( "UtcDaliAnimationCountAndGetAnimationAt");
+
+ TestApplication application;
+
+ auto actor = Actor::New();
+ actor.SetPosition( 100.0f, 100.0f );
+ Stage::GetCurrent().Add( actor );
+
+ auto animation = Animation::New( 1.0f );
+ const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render( 500 );
+
+ uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
+ DALI_TEST_EQUALS( animationCount, 1, TEST_LOCATION );
+
+ DALI_TEST_CHECK( !Dali::DevelAnimation::GetAnimationAt( 5 ) );
+
+ Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt( 0 );
+ DALI_TEST_EQUALS( animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetState(), animationReturned.GetState(), TEST_LOCATION );
+
+ // Stop and clear the animation using the current values
+ animation.Stop();
+ animation.Clear();
+
+ END_TEST;
+}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/devel-api/animation/animation-devel.h>
#include <dali/internal/event/animation/animation-impl.h>
+#include <dali/internal/event/common/thread-local-storage.h>
+#include <dali/internal/event/animation/animation-playlist.h>
namespace Dali
{
return GetImplementation( animation ).ProgressReachedSignal();
}
+uint32_t GetAnimationCount()
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetAnimationPlaylist().GetAnimationCount();
+}
+
+Animation GetAnimationAt( uint32_t index )
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetAnimationPlaylist().GetAnimationAt( index );
+}
+
} // namespace DevelAnimation
} // namespace Dali
#define DALI_ANIMATION_DEVEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* @brief Connects to this signal to be notified when an Animation's animations have reached set progress.
*
* @return A signal object to connect with
- *
*/
DALI_CORE_API Animation::AnimationSignalType& ProgressReachedSignal( Animation animation );
+/**
+ * @brief Retrive the number of Animations.
+ *
+ * @return The number of Animations.
+ */
+DALI_CORE_API uint32_t GetAnimationCount();
+
+/**
+ * @brief Retrieve an Animation by index.
+ *
+ * @param[in] index The index of the Animation to retrieve
+ * @return The animation for the given index or empty handle
+ */
+DALI_CORE_API Animation GetAnimationAt( uint32_t index );
+
} // namespace DevelAnimation
} // namespace Dali
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
}
}
+uint32_t AnimationPlaylist::GetAnimationCount()
+{
+ return mAnimations.Size();
+}
+
+Dali::Animation AnimationPlaylist::GetAnimationAt( uint32_t index )
+{
+ if( index >= mAnimations.Size() )
+ {
+ DALI_LOG_ERROR( "Animation index is out of bounds.\n" );
+ return Dali::Animation();
+ }
+ return Dali::Animation( mAnimations[index] );
+}
+
} // namespace Internal
} // namespace Dali
#define DALI_INTERNAL_ANIMATION_PLAYLIST_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
void NotifyProgressReached( const SceneGraph::Animation* sceneGraphAnimation );
+ /**
+ * @brief Retrive the number of Animations.
+ *
+ * @return The number of Animations.
+ */
+ uint32_t GetAnimationCount();
+
+ /**
+ * @brief Retrieve an Animation by index.
+ *
+ * @param[in] index The index of the Animation to retrieve
+ * @return The Dali::Animation for the given index or empty handle
+ */
+ Dali::Animation GetAnimationAt( uint32_t index );
+
private:
/**