X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-AnimatedVectorImageVisual.cpp;h=1eb713ea4b0202e100c30b97bffa2e8488098cdc;hb=fa834a987e844fb79531954c882581624aef0e68;hp=edd3a86afb04bb512f6b92de7735bed245e5c746;hpb=478ff1a5aa5c64e5da48f284ae32f5703bd26502;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index edd3a86..1eb713e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -142,7 +143,8 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual03(void) .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME ) .Add( DevelImageVisual::Property::LOOP_COUNT, 3 ) .Add( DevelImageVisual::Property::PLAY_RANGE, playRange ) - .Add( DevelVisual::Property::CORNER_RADIUS, 50.0f ); + .Add( DevelVisual::Property::CORNER_RADIUS, 50.0f ) + .Add( DevelVisual::Property::BORDERLINE_WIDTH, 20.0f ); Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap ); DALI_TEST_CHECK( visual ); @@ -174,6 +176,9 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void) int startFrame = 1, endFrame = 3; float cornerRadius = 22.0f; + float borderlineWidth = 2.0f; + Vector4 borderlineColor = Vector4(1.0f, 1.0f, 1.0f, 1.0f); + float borderlineOffset = 0.1f; Property::Array playRange; playRange.PushBack( startFrame ); playRange.PushBack( endFrame ); @@ -186,7 +191,10 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void) .Add( "stopBehavior", DevelImageVisual::StopBehavior::FIRST_FRAME ) .Add( "loopingMode", DevelImageVisual::LoopingMode::AUTO_REVERSE ) .Add( "redrawInScalingDown", false ) - .Add( "cornerRadius", cornerRadius ); + .Add( "cornerRadius", cornerRadius ) + .Add( "borderlineWidth", borderlineWidth ) + .Add( "borderlineColor", borderlineColor ) + .Add( "borderlineOffset", borderlineOffset ); Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap ); DALI_TEST_CHECK( visual ); @@ -250,6 +258,18 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get< int >() == Visual::Transform::Policy::ABSOLUTE ); + value = resultMap.Find( DevelVisual::Property::BORDERLINE_WIDTH, Property::FLOAT ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< float >(), borderlineWidth, TEST_LOCATION ); + + value = resultMap.Find( DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4 ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< Vector4 >(), borderlineColor, TEST_LOCATION ); + + value = resultMap.Find( DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< float >(), borderlineOffset, TEST_LOCATION ); + actor.Unparent( ); DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); @@ -263,6 +283,9 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void) int startFrame = 1, endFrame = 3; Vector4 cornerRadius(50.0f, 22.0f, 0.0f, 3.0f); + float borderlineWidth = 2.3f; + Vector4 borderlineColor = Vector4(0.3f, 0.3f, 1.0f, 1.0f); + float borderlineOffset = 0.3f; Property::Array playRange; playRange.PushBack( startFrame ); playRange.PushBack( endFrame ); @@ -273,7 +296,10 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void) .Add( DevelImageVisual::Property::LOOP_COUNT, 3 ) .Add( DevelImageVisual::Property::PLAY_RANGE, playRange ) .Add( DevelVisual::Property::CORNER_RADIUS, cornerRadius ) - .Add( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::RELATIVE); + .Add( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::RELATIVE) + .Add( DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth ) + .Add( DevelVisual::Property::BORDERLINE_COLOR, borderlineColor ) + .Add( DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset ); // request AnimatedVectorImageVisual with a property map VisualFactory factory = VisualFactory::Get(); @@ -341,6 +367,18 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get< int >() == Visual::Transform::Policy::RELATIVE ); + value = resultMap.Find( DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth" ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< float >(), borderlineWidth, TEST_LOCATION ); + + value = resultMap.Find( DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4 ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< Vector4 >(), borderlineColor, TEST_LOCATION ); + + value = resultMap.Find( DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT ); + DALI_TEST_CHECK( value ); + DALI_TEST_EQUALS( value->Get< float >(), borderlineOffset, TEST_LOCATION ); + // request AnimatedVectorImageVisual with an URL Visual::Base visual2 = factory.CreateVisual( TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions() ); @@ -670,7 +708,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) attributes.Clear(); attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -709,7 +747,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) attributes.Clear(); attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -788,7 +826,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) attributes.Clear(); attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -812,7 +850,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) attributes.Clear(); attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -919,7 +957,7 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) Property::Map attributes; attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3 ); @@ -942,7 +980,7 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) array.PushBack( 4 ); attributes.Add( DevelImageVisual::Property::PLAY_RANGE, array ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); attributes.Clear(); DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes ); @@ -1037,7 +1075,7 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange ); attributes.Add( DevelImageVisual::Property::LOOP_COUNT, 5 ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -1063,7 +1101,7 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -1088,7 +1126,7 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) attributes.Add( DevelImageVisual::Property::LOOP_COUNT, 10 ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); application.SendNotification(); application.Render(); @@ -1139,7 +1177,7 @@ int UtcDaliAnimatedVectorImageVisualStopBehavior(void) // Change stop behavior attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); attributes.Clear(); @@ -1164,7 +1202,7 @@ int UtcDaliAnimatedVectorImageVisualStopBehavior(void) attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME ); attributes.Add( DevelImageVisual::Property::LOOP_COUNT, -1 ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); attributes.Clear(); @@ -1234,7 +1272,7 @@ int UtcDaliAnimatedVectorImageVisualLoopingMode(void) // Change stop behavior attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); // Play again DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes ); @@ -1252,7 +1290,7 @@ int UtcDaliAnimatedVectorImageVisualLoopingMode(void) // Change looping mode attributes.Add( DevelImageVisual::Property::LOOPING_MODE, DevelImageVisual::LoopingMode::RESTART ); - DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); // Play again DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes ); @@ -1381,8 +1419,8 @@ int UtcDaliAnimatedVectorImageVisualMultipleInstances(void) Property::Map attributes; attributes.Add( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME ); - DevelControl::DoAction( actor1, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); - DevelControl::DoAction( actor2, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor1, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); + DevelControl::DoAction( actor2, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes ); DevelControl::DoAction( actor1, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, Property::Map() ); @@ -1553,26 +1591,26 @@ int UtcDaliAnimatedVectorImageVisualFrameDrops(void) application.GetScene().Add(actor); - application.SendNotification(); - application.Render(); + Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); + Property::Value* value = map.Find( DevelImageVisual::Property::TOTAL_FRAME_NUMBER ); + int totalFrameNumber = value->Get< int >(); Property::Map attributes; DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes); + // Make delay to drop frames + Test::VectorAnimationRenderer::DelayRendering(170); // longer than 16.6 * 10frames + application.SendNotification(); application.Render(); - // Trigger count is 1 - render the first frame - DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); - - // Make delay to drop frames - Test::VectorAnimationRenderer::DelayRendering(170); // longer than 16.6 * 10frames + // Trigger count is 2 - render the first frame & calculating frame drops + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); // Check dropped frame - DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); - uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames(); - DALI_TEST_CHECK(frames >= 9); + DALI_TEST_CHECK(frames > 0); + DALI_TEST_CHECK(frames <= static_cast(totalFrameNumber)); END_TEST; }