Add a test case for RenderTask 22/228622/1
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 19 Mar 2020 05:38:23 +0000 (14:38 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 24 Mar 2020 07:24:41 +0000 (16:24 +0900)
Change-Id: Ia31772f8f512e52d3030a46861c4c3292485d876

automated-tests/src/dali/utc-Dali-RenderTask.cpp

index b5610a3..4bd248e 100644 (file)
@@ -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)
 {