X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-AnimatedVectorImageVisual.cpp;h=7f432401227533c2d55a073557cc2fbdeeb987ca;hb=bd04df1ac18ac7446e95192724272d6a95f8e0eb;hp=dfd0b72be7043f0ef5bf072b9081ecdc94a87928;hpb=be75977689673c6a0467c051984f1b482f9f00b8;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 dfd0b72..7f43240 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -50,6 +50,7 @@ namespace { const char* TEST_VECTOR_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insta_camera.json"; +const char* TEST_VECTOR_IMAGE_FILE_NAME_FRAME_DROP = "framedrop.json"; const char* TEST_VECTOR_IMAGE_INVALID_FILE_NAME = "invalid.json"; bool gAnimationFinishedSignalFired = false; @@ -141,7 +142,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 ); @@ -173,6 +175,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 ); @@ -185,7 +190,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 ); @@ -249,6 +257,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 ); @@ -262,6 +282,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 ); @@ -272,7 +295,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(); @@ -340,6 +366,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() ); @@ -1530,3 +1568,48 @@ int UtcDaliAnimatedVectorImageVisualInvalidFile(void) END_TEST; } + +int UtcDaliAnimatedVectorImageVisualFrameDrops(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliAnimatedVectorImageVisualFrameDrops"); + + Property::Map propertyMap; + propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE) + .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME_FRAME_DROP); + + Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap); + DALI_TEST_CHECK(visual); + + DummyControl actor = DummyControl::New(true); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); + + Vector2 controlSize(20.f, 30.f); + actor.SetProperty(Actor::Property::SIZE, controlSize); + + application.GetScene().Add(actor); + + 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 2 - render the first frame & calculating frame drops + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); + + // Check dropped frame + uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames(); + DALI_TEST_CHECK(frames > 0); + DALI_TEST_CHECK(frames <= static_cast(totalFrameNumber)); + + END_TEST; +}