X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-AnimatedVectorImageVisual.cpp;h=4ca63086b06cd5c4f3951b4fb91e9294892ad234;hp=05296554bfa8971b88433577fb3e5083a625c7c7;hb=6fcd54cf99718c78d77cb8a9bf836059111afe16;hpb=65d548a5d199385f6992cb2bae88e014a6b85042 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index 0529655..4ca6308 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -34,6 +34,8 @@ #include #include #include + +#include #include #include @@ -709,8 +711,9 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) Renderer renderer = actor.GetRendererAt(0u); DALI_TEST_CHECK(renderer); - Property::Map map = actor.GetProperty(DummyControl::Property::TEST_VISUAL); - Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE); + Property::Map map = actor.GetProperty(DummyControl::Property::TEST_VISUAL); + Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE); + int totalFrameNumber = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER)->Get(); int resultStartFrame, resultEndFrame; Property::Array* result = value->GetArray(); @@ -744,8 +747,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) result->GetElementAt(0).Get(resultStartFrame); result->GetElementAt(1).Get(resultEndFrame); - DALI_TEST_EQUALS(startFrame, resultStartFrame, TEST_LOCATION); // Should not be changed - DALI_TEST_EQUALS(endFrame, resultEndFrame, TEST_LOCATION); + DALI_TEST_EQUALS(resultStartFrame, 1, TEST_LOCATION); + DALI_TEST_EQUALS(resultEndFrame, totalFrameNumber - 1, TEST_LOCATION); // Should be clamped DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Map()); @@ -1854,8 +1857,14 @@ int UtcDaliAnimatedVectorImageVisualSize(void) application.SendNotification(); - // Trigger count is 2 - load, resource ready - DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); + // Trigger count is 1 - load + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + // Trigger count is 1 - resource ready + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); textureTrace.Enable(true); @@ -1891,3 +1900,63 @@ int UtcDaliAnimatedVectorImageVisualSize(void) END_TEST; } + +namespace +{ +bool gDynamicPropertyCallbackFired = false; + +Property::Value FillColorCallback(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber) +{ + gDynamicPropertyCallbackFired = true; + + if(frameNumber < 3) + { + return Vector3(0, 0, 1); + } + else + { + return Vector3(1, 0, 0); + } +} +} // namespace + +int UtcDaliAnimatedVectorImageVisualDynamicProperty(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliAnimatedVectorImageVisualDynamicProperty"); + + VisualFactory factory = VisualFactory::Get(); + Visual::Base visual = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions()); + DALI_TEST_CHECK(visual); + + DummyControl actor = DummyControl::New(true); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); + + application.GetScene().Add(actor); + + gDynamicPropertyCallbackFired = false; + + // Set dynamic property + DevelAnimatedVectorImageVisual::DynamicPropertyInfo info; + info.id = 1; + info.keyPath = "Test.Path"; + info.property = static_cast(VectorAnimationRenderer::VectorProperty::FILL_COLOR); + info.callback = MakeCallback(FillColorCallback); + + DevelControl::DoActionExtension(actor, DummyControl::Property::TEST_VISUAL, DevelAnimatedVectorImageVisual::Action::SET_DYNAMIC_PROPERTY, Any(info)); + + Property::Map attributes; + DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes); + + application.SendNotification(); + application.Render(); + + // Trigger count is 2 - load & render a frame + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); + + // Test whether the property callback is called + DALI_TEST_EQUALS(gDynamicPropertyCallbackFired, true, TEST_LOCATION); + + END_TEST; +}