[Tizen] Return Animation information 46/235146/5 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200608.142156 accepted/tizen/5.5/unified/wearable/hotfix/20201027.110347 submit/tizen_5.5/20200608.012733 submit/tizen_5.5_wearable_hotfix/20201026.184305
authorSeungho, Baek <sbsh.baek@samsung.com>
Tue, 2 Jun 2020 06:29:18 +0000 (15:29 +0900)
committerSeungho, Baek <sbsh.baek@samsung.com>
Tue, 2 Jun 2020 09:16:27 +0000 (18:16 +0900)
Change-Id: Icc69c676d45ae5205bfa8a30bdae83aa9bff01a4
Signed-off-by: Seungho, Baek <sbsh.baek@samsung.com>
automated-tests/src/dali/utc-Dali-Animation.cpp
dali/devel-api/animation/animation-devel.cpp
dali/devel-api/animation/animation-devel.h
dali/internal/event/animation/animation-playlist.cpp
dali/internal/event/animation/animation-playlist.h

index addc288..f3c1d94 100644 (file)
@@ -13528,3 +13528,42 @@ int UtcDaliAnimationCombineToAndByWithStop(void)
 
   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;
+}
index 0840ae7..32c3dff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -18,6 +18,8 @@
 // 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
 {
@@ -40,6 +42,18 @@ Animation::AnimationSignalType& ProgressReachedSignal( Animation animation )
   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 Animation( tls.GetAnimationPlaylist().GetAnimationAt( index ) );
+}
+
 } // namespace DevelAnimation
 
 } // namespace Dali
index f003075..b7b6019 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -47,10 +47,24 @@ DALI_CORE_API float GetProgressNotification( Animation animation );
  * @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
index 55c9b91..beda208 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -127,6 +127,21 @@ void AnimationPlaylist::NotifyProgressReached( const SceneGraph::Animation* scen
   }
 }
 
+uint32_t AnimationPlaylist::GetAnimationCount()
+{
+  return mAnimations.Size();
+}
+
+Animation* AnimationPlaylist::GetAnimationAt( uint32_t index )
+{
+  if( index >= mAnimations.Size() )
+  {
+    DALI_LOG_ERROR( "Animation index is out of bounds.\n" );
+    return NULL;
+  }
+  return mAnimations[index];
+}
+
 } // namespace Internal
 
 } // namespace Dali
index 2fa0787..47aa3b6 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -81,6 +81,21 @@ public:
    */
   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 animation for the given index or empty handle
+   */
+  Animation* GetAnimationAt( uint32_t index );
+
 private:
 
   /**