If a RenderTask's exclusive actor is destoryed, then ensure the RenderTaskList of...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-RenderTaskList.cpp
index 99f4147..8b097c5 100644 (file)
@@ -1,23 +1,24 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <iostream>
 
 #include <stdlib.h>
-#include <dali/dali.h>
+#include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -44,6 +45,37 @@ int UtcDaliRenderTaskListDefaultConstructor(void)
   END_TEST;
 }
 
+int UtcDaliRenderTaskListCopyConstructor(void)
+{
+  TestApplication application;
+
+  tet_infoline("Testing RenderTaskList::RenderTaskList(const RenderTaskList& handle)");
+
+  RenderTaskList taskList1;
+
+  RenderTaskList taskList2( taskList1 );
+
+  DALI_TEST_CHECK( ! taskList2 );
+  END_TEST;
+}
+
+int UtcDaliRenderTaskListAssignment(void)
+{
+  TestApplication application;
+
+  tet_infoline("Testing RenderTaskList::RenderTaskList(const RenderTaskList& handle)");
+
+  RenderTaskList taskList1;
+
+  RenderTaskList taskList2;
+
+  taskList1 = taskList2;
+
+  DALI_TEST_CHECK( ! taskList1 );
+  END_TEST;
+}
+
+
 int UtcDaliRenderTaskListDownCast(void)
 {
   TestApplication application;
@@ -92,6 +124,29 @@ int UtcDaliRenderTaskListRemoveTask(void)
   END_TEST;
 }
 
+int UtcDaliRenderTaskListRemoveTaskWithExclusiveActor(void)
+{
+  TestApplication application;
+
+  tet_infoline("Testing RenderTaskList::RemoveTask() which has an exclusive actor set");
+
+  RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+  DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+  RenderTask newTask = taskList.CreateTask();
+  DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+
+  auto actor = CreateRenderableActor();
+  newTask.SetSourceActor( actor );
+  newTask.SetExclusive( true );
+  DALI_TEST_EQUALS( actor, newTask.GetSourceActor(), TEST_LOCATION );
+  DALI_TEST_EQUALS( true, newTask.IsExclusive(), TEST_LOCATION );
+  taskList.RemoveTask( newTask );
+
+  DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+  END_TEST;
+}
+
 int UtcDaliRenderTaskListGetTaskCount(void)
 {
   TestApplication application;