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-EffectsView.cpp;h=fbaa3de9acf820556526367c51f5a4185dd1e576;hp=09b51f244c6cd98e717e9717314409aa17e7d242;hb=dea624eb348a4926d8761c8a1364f03f9f71acf5;hpb=b154e74ada0754b5b47adcdffcf4a70df43ebbec diff --git a/automated-tests/src/dali-toolkit/utc-Dali-EffectsView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-EffectsView.cpp index 09b51f2..fbaa3de 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-EffectsView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-EffectsView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 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. @@ -45,7 +45,7 @@ int UtcDaliEffectsViewNew(void) view = EffectsView::New( EffectsView::DROP_SHADOW ); DALI_TEST_CHECK( view ); - Stage::GetCurrent().Add( view ); + application.GetScene().Add( view ); view.Reset(); view = EffectsView::New( EffectsView::EMBOSS ); @@ -97,33 +97,97 @@ int UtcDaliEffectsViewDownCast(void) } // Positive test case for a method -int UtcDaliEffectsViewAddRemove(void) +int UtcDaliEffectsViewAddRemoveDropShadow(void) { ToolkitTestApplication application; - tet_infoline("UtcDaliGaussianBlurViewAddRemove"); + tet_infoline("UtcDaliEffectsViewAddRemoveDropShadow"); EffectsView view = EffectsView::New( EffectsView::DROP_SHADOW ); DALI_TEST_CHECK( view ); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.OnStage() ); + DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); - view.SetParentOrigin(ParentOrigin::CENTER); - view.SetSize(Stage::GetCurrent().GetSize()); + view.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); + view.SetProperty( Actor::Property::SIZE, application.GetScene().GetSize()); view.Add(actor); - Stage::GetCurrent().Add(view); + application.GetScene().Add(view); - DALI_TEST_CHECK( actor.OnStage() ); + DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); DALI_TEST_CHECK( actor.GetParent() ); DALI_TEST_CHECK( actor.GetParent() != view ); view.Remove(actor); - DALI_TEST_CHECK( !actor.OnStage() ); + DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); END_TEST; } + +int UtcDaliEffectsViewAddRemoveEmboss(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliEffectsViewAddRemoveEmboss"); + + tet_infoline("Checking number of render tasks = 1"); + application.SendNotification(); + application.Render(); + Integration::Scene stage = application.GetScene(); + DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTaskCount(), 1, TEST_LOCATION ); + + tet_infoline("Create effects view"); + + EffectsView view = EffectsView::New( EffectsView::EMBOSS ); + Vector3 offsetSet( 2.f, 3.f, 4.f ); + Vector4 colorSet( 0.2f, 0.3f, 0.4f, 0.5f ); + view.SetProperty( EffectsView::Property::EFFECT_OFFSET, offsetSet); + view.SetProperty( EffectsView::Property::EFFECT_COLOR, colorSet); + Vector3 offsetAnimate( 4.f, 6.f, 8.f ); + float durationSeconds(0.05f); + Animation animation = Animation::New( durationSeconds ); + animation.AnimateTo( Property(view,EffectsView::Property::EFFECT_OFFSET ), offsetAnimate ); + animation.Play(); + + DALI_TEST_CHECK( view ); + + Actor actor = Actor::New(); + actor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + + view.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); + + view.Add(actor); + view.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + + stage.Add(view); + + DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + + application.SendNotification(); + application.Render(); + + tet_infoline("Removing view from stage disables view"); + stage.Remove(view); + + tet_infoline("Checking number of render tasks = 1"); + DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTaskCount(), 1, TEST_LOCATION ); + + tet_infoline("Adding view to stage again re-enables view"); + stage.Add(view); + + tet_infoline("Removing view from stage disables view"); + DALI_TEST_GREATER( stage.GetRenderTaskList().GetTaskCount(), 1u, TEST_LOCATION ); + stage.Remove(view); + view.Reset(); + + tet_infoline("Checking number of render tasks = 1"); + DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTaskCount(), 1, TEST_LOCATION ); + + END_TEST; +} + + int UtcDaliEffectsViewGetTypeP(void) { ToolkitTestApplication application; @@ -143,8 +207,8 @@ int UtcDaliEffectsViewOnStage(void) ToolkitTestApplication application; EffectsView view = EffectsView::New(EffectsView::EMBOSS); - view.SetSize(100.f, 100.f); - Stage stage = Stage::GetCurrent(); + view.SetProperty( Actor::Property::SIZE, Vector2(100.f, 100.f) ); + Integration::Scene stage = application.GetScene(); DALI_TEST_CHECK( stage.GetRenderTaskList().GetTaskCount() == 1 ); stage.Add( view ); @@ -160,8 +224,8 @@ int UtcDaliEffectsViewOffStage(void) ToolkitTestApplication application; EffectsView view = EffectsView::New(EffectsView::DROP_SHADOW); - view.SetSize(100.f, 100.f); - Stage stage = Stage::GetCurrent(); + view.SetProperty( Actor::Property::SIZE, Vector2(100.f, 100.f) ); + Integration::Scene stage = application.GetScene(); DALI_TEST_CHECK( stage.GetRenderTaskList().GetTaskCount() == 1 ); stage.Add( view ); @@ -272,7 +336,7 @@ int UtcDaliEffectsViewOffsetProperty(void) ToolkitTestApplication application; EffectsView view = EffectsView::New( EffectsView::EMBOSS ); - Stage::GetCurrent().Add( view ); + application.GetScene().Add( view ); Property::Value value = view.GetProperty( EffectsView::Property::EFFECT_OFFSET ); Vector3 offsetValue; @@ -295,7 +359,7 @@ int UtcDaliEffectsViewOffsetProperty(void) application.SendNotification(); application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - value = view.GetProperty( EffectsView::Property::EFFECT_OFFSET ); + value = view.GetCurrentProperty( EffectsView::Property::EFFECT_OFFSET ); value.Get(offsetValue); DALI_TEST_EQUALS( offsetValue, offsetAnimate, TEST_LOCATION ); @@ -307,7 +371,7 @@ int UtcDaliEffectsViewColorProperty(void) ToolkitTestApplication application; EffectsView view = EffectsView::New( EffectsView::DROP_SHADOW ); - Stage::GetCurrent().Add( view ); + application.GetScene().Add( view ); Property::Value value = view.GetProperty( EffectsView::Property::EFFECT_COLOR ); Vector4 colorValue; @@ -330,7 +394,7 @@ int UtcDaliEffectsViewColorProperty(void) application.SendNotification(); application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - value = view.GetProperty( EffectsView::Property::EFFECT_COLOR ); + value = view.GetCurrentProperty( EffectsView::Property::EFFECT_COLOR ); value.Get(colorValue); DALI_TEST_EQUALS( colorValue, colorAnimate, TEST_LOCATION ); @@ -393,9 +457,9 @@ int UtcDaliEffectsViewSetRefreshOnDemandP(void) ToolkitTestApplication application; EffectsView view = EffectsView::New(EffectsView::DROP_SHADOW); - view.SetSize(100.f, 100.f); + view.SetProperty( Actor::Property::SIZE, Vector2(100.f, 100.f) ); - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); stage.Add( view ); application.SendNotification(); application.Render(); @@ -433,30 +497,30 @@ int UtcDaliEffectsViewSetRefreshOnDemandN(void) int UtcDaliEffectsViewSizeSet(void) { ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); { EffectsView view = EffectsView::New(EffectsView::DROP_SHADOW); - view.SetSize( 200.0f, 200.0f, 0.0f ); + view.SetProperty( Actor::Property::SIZE, Vector3( 200.0f, 200.0f, 0.0f ) ); stage.Add( view ); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( view.GetCurrentSize(), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); } { EffectsView view = EffectsView::New(EffectsView::EMBOSS); - view.SetSize( 200.0f, 200.0f, 0.0f ); + view.SetProperty( Actor::Property::SIZE, Vector3( 200.0f, 200.0f, 0.0f ) ); stage.Add( view ); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( view.GetCurrentSize(), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); } { EffectsView view = EffectsView::New(EffectsView::DROP_SHADOW); - view.SetSize( 200.0f, 200.0f, 0.0f ); + view.SetProperty( Actor::Property::SIZE, Vector3( 200.0f, 200.0f, 0.0f ) ); stage.Add( view ); application.SendNotification(); application.Render(); @@ -465,7 +529,7 @@ int UtcDaliEffectsViewSizeSet(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( view.GetCurrentSize(), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( view.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), TEST_LOCATION ); } END_TEST;