From 9eafee5e1177b99eb838264ffbd2af6d7a7988a5 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Thu, 19 Mar 2020 14:38:23 +0900 Subject: [PATCH] Add a test case for RenderTask Change-Id: Ia31772f8f512e52d3030a46861c4c3292485d876 --- .../src/dali/utc-Dali-RenderTask.cpp | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index b5610a3ee..4bd248e1e 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -552,6 +552,41 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) END_TEST; } +int UtcDaliRenderTaskSetSourceActorDestroyed(void) +{ + TestApplication application; + + tet_infoline( "Testing RenderTask::SetSourceActor - Set a source actor and destroy the source actor" ); + + Stage stage = Stage::GetCurrent(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); + + Actor actor = task.GetSourceActor(); + DALI_TEST_CHECK( actor ); + + BufferImage img = BufferImage::New( 1,1 ); + Actor newActor = CreateRenderableActor( img ); + newActor.SetSize(1,1); + stage.Add( newActor ); + + task.SetSourceActor( newActor ); + + DALI_TEST_CHECK( task.GetSourceActor() != actor ); + DALI_TEST_CHECK( task.GetSourceActor() == newActor ); + + application.SendNotification(); + application.Render(); + + // Destroy the source actor + stage.Remove( newActor ); + newActor.Reset(); + + DALI_TEST_CHECK( !task.GetSourceActor() ); // The source actor should be an empty handle. + + END_TEST; +} + int UtcDaliRenderTaskGetSourceActorP01(void) { TestApplication application; @@ -967,6 +1002,29 @@ int UtcDaliRenderTaskSetCameraActorN(void) END_TEST; } +int UtcDaliRenderTaskSetCameraActorDestroyed(void) +{ + TestApplication application; + + tet_infoline( "Testing RenderTask::SetCameraActor - Set a camera actor and destroy the camera actor" ); + + Stage stage = Stage::GetCurrent(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); + + CameraActor newCameraActor = CameraActor::New(); + task.SetCameraActor( newCameraActor ); + + DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION ); + + // Destroy the camera actor + newCameraActor.Reset(); + + CameraActor camera = task.GetCameraActor(); + DALI_TEST_CHECK( !camera ); // The camera actor should be an empty handle. + + END_TEST; +} int UtcDaliRenderTaskGetCameraActorP(void) { -- 2.34.1