Set AnimatedVectorVisual play range by single marker 90/292890/1
authorEunki Hong <eunkiki.hong@samsung.com>
Tue, 16 May 2023 16:27:31 +0000 (01:27 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Tue, 16 May 2023 16:46:42 +0000 (01:46 +0900)
Previously, we only accept when we insert array as PLAY_RANGE.
Now let we allow to insert single stirng value.

Change-Id: I3afbbf30cb5bdc211a06aeb0654c5359b28bc147
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
dali-toolkit/devel-api/visuals/image-visual-properties-devel.h
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp

index 1c9daf7..92cc203 100644 (file)
@@ -838,6 +838,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void)
   ToolkitTestApplication application;
   tet_infoline("UtcDaliAnimatedVectorImageVisualPlayRangeMarker");
 
+  // Set 1 marker as array
   Property::Array array;
   array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1);
 
@@ -884,6 +885,31 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void)
   DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION);
   DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION);
 
+  // Set 1 marker as string
+  array.Clear();
+
+  attributes.Clear();
+  attributes.Add(DevelImageVisual::Property::PLAY_RANGE, VECTOR_ANIMATION_MARKER_NAME_1);
+  DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
+
+  // To make event trigger
+  actor.SetProperty(Actor::Property::SIZE, Vector2(40.0f, 40.0f));
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+  map   = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
+  value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
+
+  result = value->GetArray();
+  result->GetElementAt(0).Get(resultStartFrame);
+  result->GetElementAt(1).Get(resultEndFrame);
+
+  DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION);
+  DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION);
+
   // Set 2 markers
   array.Clear();
   array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1);
index 24cc113..9e6d199 100644 (file)
@@ -91,7 +91,7 @@ enum Type
    * Animation will play between the start frame and the end frame of the marker if one marker is specified.
    * Or animation will play between the start frame of the first marker and the end frame of the second marker if two markers are specified.
    *
-   * @details Name "playRange", Type Property::ARRAY of Property::INTEGER or Property::ARRAY of Property::STRING.
+   * @details Name "playRange", Type Property::ARRAY of Property::INTEGER or Property::ARRAY of Property::STRING or Property::STRING (one marker).
    * @note Default 0 and the total frame number.
    */
   PLAY_RANGE = ORIENTATION_CORRECTION + 4,
index 1263fbd..5d987b9 100644 (file)
@@ -294,6 +294,17 @@ void AnimatedVectorImageVisual::DoSetProperty(Property::Index index, const Prope
         mAnimationData.playRange = *array;
         mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE;
       }
+      else if(value.GetType() == Property::STRING)
+      {
+        std::string markerName;
+        if(value.Get(markerName))
+        {
+          Property::Array array;
+          array.Add(markerName);
+          mAnimationData.playRange = std::move(array);
+          mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE;
+        }
+      }
       break;
     }
     case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR: