Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-RenderTaskList.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 #include <iostream>
18
19 #include <stdlib.h>
20 #include <dali/dali.h>
21 #include <dali-test-suite-utils.h>
22
23 using namespace Dali;
24
25 void utc_dali_render_task_list_startup(void)
26 {
27   test_return_value = TET_UNDEF;
28 }
29
30 void utc_dali_render_task_list_cleanup(void)
31 {
32   test_return_value = TET_PASS;
33 }
34
35 int UtcDaliRenderTaskListDefaultConstructor(void)
36 {
37   TestApplication application;
38
39   tet_infoline("Testing RenderTaskList::RenderTaskList()");
40
41   RenderTaskList taskList;
42
43   DALI_TEST_CHECK( ! taskList );
44   END_TEST;
45 }
46
47 int UtcDaliRenderTaskListDownCast(void)
48 {
49   TestApplication application;
50
51   tet_infoline("Testing RenderTaskList::DownCast()");
52
53   BaseHandle base = Stage::GetCurrent().GetRenderTaskList();
54
55   RenderTaskList taskList = RenderTaskList::DownCast( base );
56
57   DALI_TEST_CHECK( taskList );
58
59   // Try calling a method
60   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
61   END_TEST;
62 }
63
64 int UtcDaliRenderTaskListCreateTask(void)
65 {
66   TestApplication application;
67
68   tet_infoline("Testing RenderTaskList::CreateTask()");
69
70   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
71   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
72
73   taskList.CreateTask();
74   DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
75   END_TEST;
76 }
77
78 int UtcDaliRenderTaskListRemoveTask(void)
79 {
80   TestApplication application;
81
82   tet_infoline("Testing RenderTaskList::RemoveTask()");
83
84   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
85   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
86
87   RenderTask newTask = taskList.CreateTask();
88   DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
89
90   taskList.RemoveTask( newTask );
91   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
92   END_TEST;
93 }
94
95 int UtcDaliRenderTaskListGetTaskCount(void)
96 {
97   TestApplication application;
98
99   tet_infoline("Testing RenderTaskList::GetTaskCount()");
100
101   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
102   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
103
104   taskList.RemoveTask( taskList.GetTask(0u) );
105   DALI_TEST_CHECK( 0u == taskList.GetTaskCount() );
106   END_TEST;
107 }
108
109 int UtcDaliRenderTaskListGetTask(void)
110 {
111   TestApplication application;
112
113   tet_infoline("Testing RenderTaskList::GetTask()");
114
115   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
116   RenderTask defaultTask = taskList.GetTask( 0u );
117   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
118   DALI_TEST_CHECK( defaultTask );
119   DALI_TEST_CHECK( defaultTask == taskList.GetTask( 0u ) );
120
121   RenderTask newTask = taskList.CreateTask();
122   DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
123
124   RenderTask temp = taskList.GetTask( 0u );
125   RenderTask temp2 = taskList.GetTask( 1u );
126
127   DALI_TEST_CHECK( newTask );
128   DALI_TEST_CHECK( defaultTask != newTask );
129   DALI_TEST_CHECK( taskList.GetTask( 0u ) == defaultTask );
130   DALI_TEST_CHECK( taskList.GetTask( 1u ) == newTask );
131   DALI_TEST_CHECK( taskList.GetTask( 1u ) != defaultTask );
132
133   taskList.RemoveTask( taskList.GetTask(0u) );
134   DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
135   DALI_TEST_CHECK( taskList.GetTask( 0u ) != defaultTask  );
136   DALI_TEST_CHECK( taskList.GetTask( 0u ) == newTask );
137   END_TEST;
138 }