2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
26 void utc_dali_render_task_list_startup(void)
28 test_return_value = TET_UNDEF;
31 void utc_dali_render_task_list_cleanup(void)
33 test_return_value = TET_PASS;
36 int UtcDaliRenderTaskListDefaultConstructor(void)
38 TestApplication application;
40 tet_infoline("Testing RenderTaskList::RenderTaskList()");
42 RenderTaskList taskList;
44 DALI_TEST_CHECK( ! taskList );
48 int UtcDaliRenderTaskListCopyConstructor(void)
50 TestApplication application;
52 tet_infoline("Testing RenderTaskList::RenderTaskList(const RenderTaskList& handle)");
54 RenderTaskList taskList1;
56 RenderTaskList taskList2( taskList1 );
58 DALI_TEST_CHECK( ! taskList2 );
62 int UtcDaliRenderTaskListAssignment(void)
64 TestApplication application;
66 tet_infoline("Testing RenderTaskList::RenderTaskList(const RenderTaskList& handle)");
68 RenderTaskList taskList1;
70 RenderTaskList taskList2;
72 taskList1 = taskList2;
74 DALI_TEST_CHECK( ! taskList1 );
79 int UtcDaliRenderTaskListDownCast(void)
81 TestApplication application;
83 tet_infoline("Testing RenderTaskList::DownCast()");
85 BaseHandle base = Stage::GetCurrent().GetRenderTaskList();
87 RenderTaskList taskList = RenderTaskList::DownCast( base );
89 DALI_TEST_CHECK( taskList );
91 // Try calling a method
92 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
96 int UtcDaliRenderTaskListCreateTask(void)
98 TestApplication application;
100 tet_infoline("Testing RenderTaskList::CreateTask()");
102 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
103 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
105 taskList.CreateTask();
106 DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
110 int UtcDaliRenderTaskListRemoveTask(void)
112 TestApplication application;
114 tet_infoline("Testing RenderTaskList::RemoveTask()");
116 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
117 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
119 RenderTask newTask = taskList.CreateTask();
120 DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
122 taskList.RemoveTask( newTask );
123 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
127 int UtcDaliRenderTaskListGetTaskCount(void)
129 TestApplication application;
131 tet_infoline("Testing RenderTaskList::GetTaskCount()");
133 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
134 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
136 taskList.RemoveTask( taskList.GetTask(0u) );
137 DALI_TEST_CHECK( 0u == taskList.GetTaskCount() );
141 int UtcDaliRenderTaskListGetTask(void)
143 TestApplication application;
145 tet_infoline("Testing RenderTaskList::GetTask()");
147 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
148 RenderTask defaultTask = taskList.GetTask( 0u );
149 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
150 DALI_TEST_CHECK( defaultTask );
151 DALI_TEST_CHECK( defaultTask == taskList.GetTask( 0u ) );
153 RenderTask newTask = taskList.CreateTask();
154 DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
156 RenderTask temp = taskList.GetTask( 0u );
157 RenderTask temp2 = taskList.GetTask( 1u );
159 DALI_TEST_CHECK( newTask );
160 DALI_TEST_CHECK( defaultTask != newTask );
161 DALI_TEST_CHECK( taskList.GetTask( 0u ) == defaultTask );
162 DALI_TEST_CHECK( taskList.GetTask( 1u ) == newTask );
163 DALI_TEST_CHECK( taskList.GetTask( 1u ) != defaultTask );
165 taskList.RemoveTask( taskList.GetTask(0u) );
166 DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
167 DALI_TEST_CHECK( taskList.GetTask( 0u ) != defaultTask );
168 DALI_TEST_CHECK( taskList.GetTask( 0u ) == newTask );