(Images) Reducing thread tennis
[platform/core/uifw/dali-core.git] / automated-tests / dali-test-suite / actors / utc-Dali-Actor.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 <tet_api.h>
21
22 #include <dali/public-api/dali-core.h>
23
24 #include <dali/integration-api/events/touch-event-integ.h>
25 #include <dali-test-suite-utils.h>
26
27 using namespace Dali;
28 using namespace std;
29
30 static void Startup();
31 static void Cleanup();
32
33 extern "C" {
34   void (*tet_startup)() = Startup;
35   void (*tet_cleanup)() = Cleanup;
36 }
37
38 enum {
39   POSITIVE_TC_IDX = 0x01,
40   NEGATIVE_TC_IDX,
41 };
42
43 #define MAX_NUMBER_OF_TESTS 10000
44 extern "C" {
45   struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
46 }
47
48 // Add test functionality for all APIs in the class (Positive and Negative)
49 TEST_FUNCTION( UtcDaliActorNew,                            POSITIVE_TC_IDX );
50 TEST_FUNCTION( UtcDaliActorDownCast,                       POSITIVE_TC_IDX );
51 TEST_FUNCTION( UtcDaliActorDownCast2,                      NEGATIVE_TC_IDX );
52 TEST_FUNCTION( UtcDaliActorGetName,                        POSITIVE_TC_IDX );
53 TEST_FUNCTION( UtcDaliActorSetName,                        POSITIVE_TC_IDX );
54 TEST_FUNCTION( UtcDaliActorGetId,                          POSITIVE_TC_IDX );
55
56 TEST_FUNCTION( UtcDaliActorIsRoot,                         POSITIVE_TC_IDX );
57 TEST_FUNCTION( UtcDaliActorOnStage,                        POSITIVE_TC_IDX );
58 TEST_FUNCTION( UtcDaliActorIsLayer,                        POSITIVE_TC_IDX );
59 TEST_FUNCTION( UtcDaliActorGetLayer,                       POSITIVE_TC_IDX ); // 10
60
61 TEST_FUNCTION( UtcDaliActorAdd,                            POSITIVE_TC_IDX );
62 TEST_FUNCTION( UtcDaliActorRemove01,                       POSITIVE_TC_IDX );
63 TEST_FUNCTION( UtcDaliActorRemove02,                       NEGATIVE_TC_IDX );
64 TEST_FUNCTION( UtcDaliActorGetChildCount,                  POSITIVE_TC_IDX );
65 TEST_FUNCTION( UtcDaliActorGetChildren01,                  POSITIVE_TC_IDX );
66 TEST_FUNCTION( UtcDaliActorGetChildren02,                  POSITIVE_TC_IDX );
67 TEST_FUNCTION( UtcDaliActorGetParent01,                    POSITIVE_TC_IDX );
68 TEST_FUNCTION( UtcDaliActorGetParent02,                    NEGATIVE_TC_IDX );
69
70 TEST_FUNCTION( UtcDaliActorSetParentOrigin,                POSITIVE_TC_IDX );
71 TEST_FUNCTION( UtcDaliActorGetCurrentParentOrigin,         POSITIVE_TC_IDX ); // 20
72 TEST_FUNCTION( UtcDaliActorSetAnchorPoint,                 POSITIVE_TC_IDX );
73 TEST_FUNCTION( UtcDaliActorGetCurrentAnchorPoint,          POSITIVE_TC_IDX );
74
75 TEST_FUNCTION( UtcDaliActorSetSize01,                      POSITIVE_TC_IDX );
76 TEST_FUNCTION( UtcDaliActorSetSize02,                      POSITIVE_TC_IDX );
77 TEST_FUNCTION( UtcDaliActorSetSize03,                      POSITIVE_TC_IDX );
78 TEST_FUNCTION( UtcDaliActorSetSize04,                      POSITIVE_TC_IDX );
79 TEST_FUNCTION( UtcDaliActorGetCurrentSize,                 POSITIVE_TC_IDX );
80
81 TEST_FUNCTION( UtcDaliActorSetPosition01,                  POSITIVE_TC_IDX );
82 TEST_FUNCTION( UtcDaliActorSetPosition02,                  POSITIVE_TC_IDX );
83 TEST_FUNCTION( UtcDaliActorSetPosition03,                  POSITIVE_TC_IDX ); // 30
84 TEST_FUNCTION( UtcDaliActorSetX,                           POSITIVE_TC_IDX );
85 TEST_FUNCTION( UtcDaliActorSetY,                           POSITIVE_TC_IDX );
86 TEST_FUNCTION( UtcDaliActorSetZ,                           POSITIVE_TC_IDX );
87 TEST_FUNCTION( UtcDaliActorMoveBy,                         POSITIVE_TC_IDX );
88 TEST_FUNCTION( UtcDaliActorGetCurrentPosition,             POSITIVE_TC_IDX );
89 TEST_FUNCTION( UtcDaliActorGetCurrentWorldPosition,        POSITIVE_TC_IDX );
90 TEST_FUNCTION( UtcDaliActorInheritPosition,                POSITIVE_TC_IDX );
91
92 TEST_FUNCTION( UtcDaliActorSetRotation01,                  POSITIVE_TC_IDX );
93 TEST_FUNCTION( UtcDaliActorSetRotation02,                  POSITIVE_TC_IDX );
94 TEST_FUNCTION( UtcDaliActorRotateBy01,                     POSITIVE_TC_IDX ); // 40
95 TEST_FUNCTION( UtcDaliActorRotateBy02,                     POSITIVE_TC_IDX );
96 TEST_FUNCTION( UtcDaliActorGetCurrentRotation,             POSITIVE_TC_IDX );
97 TEST_FUNCTION( UtcDaliActorGetCurrentWorldRotation,        POSITIVE_TC_IDX );
98
99 TEST_FUNCTION( UtcDaliActorSetScale01,                     POSITIVE_TC_IDX );
100 TEST_FUNCTION( UtcDaliActorSetScale02,                     POSITIVE_TC_IDX );
101 TEST_FUNCTION( UtcDaliActorSetScale03,                     POSITIVE_TC_IDX );
102 TEST_FUNCTION( UtcDaliActorScaleBy,                        POSITIVE_TC_IDX );
103 TEST_FUNCTION( UtcDaliActorGetCurrentScale,                POSITIVE_TC_IDX );
104 TEST_FUNCTION( UtcDaliActorGetCurrentWorldScale,           POSITIVE_TC_IDX );
105 TEST_FUNCTION( UtcDaliActorInheritScale,                   POSITIVE_TC_IDX ); // 50
106
107 TEST_FUNCTION( UtcDaliActorSetVisible,                     POSITIVE_TC_IDX );
108 TEST_FUNCTION( UtcDaliActorIsVisible,                      POSITIVE_TC_IDX );
109 TEST_FUNCTION( UtcDaliActorSetOpacity,                     POSITIVE_TC_IDX );
110 TEST_FUNCTION( UtcDaliActorGetCurrentOpacity,              POSITIVE_TC_IDX );
111
112 TEST_FUNCTION( UtcDaliActorSetSensitive,                   POSITIVE_TC_IDX );
113 TEST_FUNCTION( UtcDaliActorIsSensitive,                    POSITIVE_TC_IDX );
114
115 TEST_FUNCTION( UtcDaliActorSetInheritShaderEffect,         POSITIVE_TC_IDX );
116 TEST_FUNCTION( UtcDaliActorGetInheritShaderEffect,         POSITIVE_TC_IDX );
117
118 TEST_FUNCTION( UtcDaliActorSetShaderEffect,                POSITIVE_TC_IDX );
119 TEST_FUNCTION( UtcDaliActorGetShaderEffect,                POSITIVE_TC_IDX ); // 60
120 TEST_FUNCTION( UtcDaliActorRemoveShaderEffect01,           POSITIVE_TC_IDX );
121 TEST_FUNCTION( UtcDaliActorRemoveShaderEffect02,           NEGATIVE_TC_IDX );
122
123 TEST_FUNCTION( UtcDaliActorSetColor,                       POSITIVE_TC_IDX );
124 TEST_FUNCTION( UtcDaliActorGetCurrentColor,                POSITIVE_TC_IDX );
125 TEST_FUNCTION( UtcDaliActorSetColorMode,                   POSITIVE_TC_IDX );
126 TEST_FUNCTION( UtcDaliActorGetCurrentWorldColor,           POSITIVE_TC_IDX );
127
128 TEST_FUNCTION( UtcDaliActorScreenToLocal,                  POSITIVE_TC_IDX );
129 TEST_FUNCTION( UtcDaliActorSetLeaveRequired,               POSITIVE_TC_IDX );
130 TEST_FUNCTION( UtcDaliActorGetLeaveRequired,               POSITIVE_TC_IDX );
131
132 TEST_FUNCTION( UtcDaliActorSetKeyboardFocusable,           POSITIVE_TC_IDX ); // 70
133 TEST_FUNCTION( UtcDaliActorIsKeyboardFocusable,            POSITIVE_TC_IDX );
134
135 TEST_FUNCTION( UtcDaliActorApplyConstraint,                POSITIVE_TC_IDX );
136 TEST_FUNCTION( UtcDaliActorApplyConstraintAppliedCallback, POSITIVE_TC_IDX );
137 TEST_FUNCTION( UtcDaliActorRemoveConstraints,              POSITIVE_TC_IDX );
138 TEST_FUNCTION( UtcDaliActorRemoveConstraint,               POSITIVE_TC_IDX );
139
140 TEST_FUNCTION( UtcDaliActorTouchedSignal,                  POSITIVE_TC_IDX );
141 TEST_FUNCTION( UtcDaliActorSetSizeSignal,                  POSITIVE_TC_IDX );
142 TEST_FUNCTION( UtcDaliActorOnOffStageSignal,               POSITIVE_TC_IDX );
143
144 TEST_FUNCTION( UtcDaliActorFindChildByName,                POSITIVE_TC_IDX );
145 TEST_FUNCTION( UtcDaliActorFindChildByAlias,               POSITIVE_TC_IDX ); // 80
146 TEST_FUNCTION( UtcDaliActorFindChildById,                  POSITIVE_TC_IDX );
147
148 TEST_FUNCTION( UtcDaliActorHitTest,                        POSITIVE_TC_IDX );
149
150 TEST_FUNCTION( UtcDaliActorSetDrawMode,                    POSITIVE_TC_IDX );
151 TEST_FUNCTION( UtcDaliActorSetDrawModeOverlayRender,       POSITIVE_TC_IDX );
152 TEST_FUNCTION( UtcDaliActorSetDrawModeOverlayHitTest,      POSITIVE_TC_IDX );
153
154 TEST_FUNCTION( UtcDaliActorGetCurrentWorldMatrix,          POSITIVE_TC_IDX );
155 TEST_FUNCTION( UtcDaliActorConstrainedToWorldMatrix,       POSITIVE_TC_IDX );
156
157 TEST_FUNCTION( UtcDaliActorUnparent,                       POSITIVE_TC_IDX );
158
159 TEST_FUNCTION( UtcDaliActorGetChildAt,                     POSITIVE_TC_IDX );
160
161 TEST_FUNCTION( UtcDaliActorSetGetOverlay,                  POSITIVE_TC_IDX );
162
163 TEST_FUNCTION( UtcDaliActorDynamics,                       POSITIVE_TC_IDX );
164 TEST_FUNCTION( UtcDaliActorCreateDestroy,                  POSITIVE_TC_IDX );
165
166 const char* vertexSource =
167 "void main()\n"
168 "{\n"
169 "  gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
170 "  vTexCoord = aTexCoord;\n"
171 "}\n";
172
173 const char* fragmentSource =
174 "void main()\n"
175 "{\n"
176 "  gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n"
177 "}\n";
178
179 // Called only once before first test is run.
180 static void Startup()
181 {
182   // THERE IS NO MAINLOOP IN THE TEST APPLICATION
183 }
184
185 // Called only once after last test is run
186 static void Cleanup()
187 {
188 }
189
190 static void UtcDaliActorNew()
191 {
192   TestApplication application;
193
194   Actor actor = Actor::New();
195
196   DALI_TEST_CHECK(actor);
197 }
198
199 static void UtcDaliActorDownCast()
200 {
201   TestApplication application;
202   tet_infoline("Testing Dali::Actor::DownCast()");
203
204   Actor actor = Actor::New();
205   BaseHandle object(actor);
206   Actor actor2 = Actor::DownCast(object);
207   DALI_TEST_CHECK(actor2);
208 }
209
210 static void UtcDaliActorDownCast2()
211 {
212   TestApplication application;
213   tet_infoline("Testing Dali::Actor::DownCast()");
214
215   BaseHandle unInitializedObject;
216   Actor actor = Actor::DownCast(unInitializedObject);
217   DALI_TEST_CHECK(!actor);
218 }
219
220 static void UtcDaliActorGetName()
221 {
222   TestApplication application;
223
224   Actor actor = Actor::New();
225
226   DALI_TEST_CHECK(actor.GetName().empty());
227 }
228
229 static void UtcDaliActorSetName()
230 {
231   TestApplication application;
232
233   string str("ActorName");
234   Actor actor = Actor::New();
235
236   actor.SetName(str);
237   DALI_TEST_CHECK(actor.GetName() == str);
238 }
239
240 static void UtcDaliActorGetId()
241 {
242   tet_infoline("Testing Dali::Actor::UtcDaliActorGetId()");
243   TestApplication application;
244
245   Actor first = Actor::New();
246   Actor second = Actor::New();
247   Actor third = Actor::New();
248
249   DALI_TEST_CHECK(first.GetId() != second.GetId());
250   DALI_TEST_CHECK(second.GetId() != third.GetId());
251 }
252
253 static void UtcDaliActorIsRoot()
254 {
255   TestApplication application;
256
257   Actor actor = Actor::New();
258   DALI_TEST_CHECK(!actor.IsRoot());
259
260   // get the root layer
261   actor = Stage::GetCurrent().GetLayer( 0 );
262   DALI_TEST_CHECK( actor.IsRoot() );
263 }
264
265 static void UtcDaliActorOnStage()
266 {
267   TestApplication application;
268
269   Actor actor = Actor::New();
270   DALI_TEST_CHECK( !actor.OnStage() );
271
272   // get the root layer
273   actor = Stage::GetCurrent().GetLayer( 0 );
274   DALI_TEST_CHECK( actor.OnStage() );
275 }
276
277 static void UtcDaliActorIsLayer()
278 {
279   TestApplication application;
280
281   Actor actor = Actor::New();
282   DALI_TEST_CHECK( !actor.IsLayer() );
283
284   // get the root layer
285   actor = Stage::GetCurrent().GetLayer( 0 );
286   DALI_TEST_CHECK( actor.IsLayer() );
287 }
288
289 static void UtcDaliActorGetLayer()
290 {
291   TestApplication application;
292
293   Actor actor = Actor::New();
294   Stage::GetCurrent().Add(actor);
295   Layer layer = actor.GetLayer();
296
297   DALI_TEST_CHECK(layer);
298
299   // get the root layers layer
300   actor = Stage::GetCurrent().GetLayer( 0 );
301   DALI_TEST_CHECK( actor.GetLayer() );
302 }
303
304 static void UtcDaliActorAdd()
305 {
306   tet_infoline("Testing Actor::Add");
307   TestApplication application;
308
309   Actor parent = Actor::New();
310   Actor child = Actor::New();
311
312   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
313
314   parent.Add(child);
315
316   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
317
318   Actor parent2 = Actor::New();
319   parent2.Add( child );
320
321   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
322   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
323
324   // try Adding to same parent again, works
325   parent2.Add( child );
326   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
327
328   // try reparenting an orphaned child
329   {
330     Actor temporaryParent = Actor::New();
331     temporaryParent.Add( child );
332     DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION );
333   }
334   // temporaryParent has now died, reparent the orphaned child
335   parent2.Add( child );
336   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
337
338   // try illegal Add
339   try
340   {
341     parent2.Add( parent2 );
342     tet_printf("Assertion test failed - no Exception\n" );
343     tet_result(TET_FAIL);
344   }
345   catch(Dali::DaliException& e)
346   {
347     tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
348     DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
349     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
350   }
351   catch(...)
352   {
353     tet_printf("Assertion test failed - wrong Exception\n" );
354     tet_result(TET_FAIL);
355   }
356
357   // try reparenting root
358   try
359   {
360     parent2.Add( Stage::GetCurrent().GetLayer( 0 ) );
361     tet_printf("Assertion test failed - no Exception\n" );
362     tet_result(TET_FAIL);
363   }
364   catch(Dali::DaliException& e)
365   {
366     tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
367     DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
368     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
369   }
370   catch(...)
371   {
372     tet_printf("Assertion test failed - wrong Exception\n" );
373     tet_result(TET_FAIL);
374   }
375
376   // try Add empty
377   try
378   {
379     Actor empty;
380     parent2.Add( empty );
381     tet_printf("Assertion test failed - no Exception\n" );
382     tet_result(TET_FAIL);
383   }
384   catch(Dali::DaliException& e)
385   {
386     tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
387     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
388     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
389   }
390   catch(...)
391   {
392     tet_printf("Assertion test failed - wrong Exception\n" );
393     tet_result(TET_FAIL);
394   }
395 }
396
397 static void UtcDaliActorRemove01()
398 {
399   tet_infoline("Testing Actor::Remove");
400   TestApplication application;
401
402   Actor parent = Actor::New();
403   Actor child = Actor::New();
404   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
405
406   parent.Add(child);
407   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
408
409   parent.Remove(child);
410   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
411
412   // remove again, no problem
413   parent.Remove(child);
414   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
415
416   // add child back
417   parent.Add(child);
418   // try illegal Remove
419   try
420   {
421     parent.Remove( parent );
422     tet_printf("Assertion test failed - no Exception\n" );
423     tet_result(TET_FAIL);
424   }
425   catch(Dali::DaliException& e)
426   {
427     tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
428     DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
429     DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
430   }
431   catch(...)
432   {
433     tet_printf("Assertion test failed - wrong Exception\n" );
434     tet_result(TET_FAIL);
435   }
436
437   // try Remove empty
438   try
439   {
440     Actor empty;
441     parent.Remove( empty );
442     tet_printf("Assertion test failed - no Exception\n" );
443     tet_result(TET_FAIL);
444   }
445   catch(Dali::DaliException& e)
446   {
447     tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
448     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
449     DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
450   }
451   catch(...)
452   {
453     tet_printf("Assertion test failed - wrong Exception\n" );
454     tet_result(TET_FAIL);
455   }
456 }
457
458 static void UtcDaliActorRemove02()
459 {
460   TestApplication application;
461
462   Actor parent = Actor::New();
463   Actor child = Actor::New();
464   Actor random = Actor::New();
465
466   Stage::GetCurrent().Add( parent );
467
468   DALI_TEST_CHECK(parent.GetChildCount() == 0);
469
470   parent.Add(child);
471
472   DALI_TEST_CHECK(parent.GetChildCount() == 1);
473
474   parent.Remove(random);
475
476   DALI_TEST_CHECK(parent.GetChildCount() == 1);
477
478   Stage::GetCurrent().Remove( parent );
479
480   DALI_TEST_CHECK(parent.GetChildCount() == 1);
481 }
482
483 static void UtcDaliActorGetChildCount()
484 {
485   TestApplication application;
486
487   Actor parent = Actor::New();
488   Actor child = Actor::New();
489
490   DALI_TEST_CHECK(parent.GetChildCount() == 0);
491
492   parent.Add(child);
493
494   DALI_TEST_CHECK(parent.GetChildCount() == 1);
495 }
496
497 static void UtcDaliActorGetChildren01()
498 {
499   TestApplication application;
500
501   Actor parent = Actor::New();
502   Actor first  = Actor::New();
503   Actor second = Actor::New();
504   Actor third  = Actor::New();
505
506   parent.Add(first);
507   parent.Add(second);
508   parent.Add(third);
509
510   DALI_TEST_CHECK(parent.GetChildAt(0) == first);
511   DALI_TEST_CHECK(parent.GetChildAt(1) == second);
512   DALI_TEST_CHECK(parent.GetChildAt(2) == third);
513 }
514
515 static void UtcDaliActorGetChildren02()
516 {
517   TestApplication application;
518
519   Actor parent = Actor::New();
520   Actor first  = Actor::New();
521   Actor second = Actor::New();
522   Actor third  = Actor::New();
523
524   parent.Add(first);
525   parent.Add(second);
526   parent.Add(third);
527
528   const Actor& constParent = parent;
529
530   DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
531   DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
532   DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
533 }
534
535 static void UtcDaliActorGetParent01()
536 {
537   TestApplication application;
538
539   Actor parent = Actor::New();
540   Actor child = Actor::New();
541
542   parent.Add(child);
543
544   DALI_TEST_CHECK(child.GetParent() == parent);
545 }
546
547 static void UtcDaliActorGetParent02()
548 {
549   TestApplication application;
550
551   Actor actor = Actor::New();
552
553   DALI_TEST_CHECK(!actor.GetParent());
554 }
555
556 static void UtcDaliActorSetParentOrigin()
557 {
558   TestApplication application;
559
560   Actor actor = Actor::New();
561
562   Vector3 vector(0.7f, 0.8f, 0.9f);
563   DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
564
565   actor.SetParentOrigin(vector);
566
567   // flush the queue and render once
568   application.SendNotification();
569   application.Render();
570
571   DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
572
573   Stage::GetCurrent().Add( actor );
574
575   actor.SetParentOrigin( Vector3( 0.1f, 0.2f, 0.3f ) );
576
577   // flush the queue and render once
578   application.SendNotification();
579   application.Render();
580
581   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentParentOrigin(), TEST_LOCATION );
582
583   Stage::GetCurrent().Remove( actor );
584 }
585
586 static void UtcDaliActorGetCurrentParentOrigin()
587 {
588   TestApplication application;
589
590   Actor actor = Actor::New();
591
592   Vector3 vector(0.7f, 0.8f, 0.9f);
593   DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
594
595   actor.SetParentOrigin(vector);
596
597   // flush the queue and render once
598   application.SendNotification();
599   application.Render();
600
601   DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
602 }
603
604 static void UtcDaliActorSetAnchorPoint()
605 {
606   TestApplication application;
607
608   Actor actor = Actor::New();
609
610   Vector3 vector(0.7f, 0.8f, 0.9f);
611   DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
612
613   actor.SetAnchorPoint(vector);
614
615   // flush the queue and render once
616   application.SendNotification();
617   application.Render();
618
619   DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
620
621   Stage::GetCurrent().Add( actor );
622
623   actor.SetAnchorPoint( Vector3( 0.1f, 0.2f, 0.3f ) );
624   // flush the queue and render once
625   application.SendNotification();
626   application.Render();
627
628   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentAnchorPoint(), TEST_LOCATION );
629
630   Stage::GetCurrent().Remove( actor );
631 }
632
633 static void UtcDaliActorGetCurrentAnchorPoint()
634 {
635   TestApplication application;
636
637   Actor actor = Actor::New();
638
639   Vector3 vector(0.7f, 0.8f, 0.9f);
640   DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
641
642   actor.SetAnchorPoint(vector);
643
644   // flush the queue and render once
645   application.SendNotification();
646   application.Render();
647
648   DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
649 }
650
651 // SetSize(float width, float height)
652 static void UtcDaliActorSetSize01()
653 {
654   TestApplication application;
655
656   Actor actor = Actor::New();
657   Vector3 vector(100.0f, 100.0f, 100.0f);
658
659   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
660
661   actor.SetSize(vector.x, vector.y);
662
663   // flush the queue and render once
664   application.SendNotification();
665   application.Render();
666
667   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
668 }
669
670 // SetSize(float width, float height, float depth)
671 static void UtcDaliActorSetSize02()
672 {
673   TestApplication application;
674
675   Actor actor = Actor::New();
676   Vector3 vector(100.0f, 100.0f, 100.0f);
677
678   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
679
680   actor.SetSize(vector.x, vector.y, vector.z);
681
682   // flush the queue and render once
683   application.SendNotification();
684   application.Render();
685
686   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
687 }
688
689 // SetSize(Vector2 size)
690 static void UtcDaliActorSetSize03()
691 {
692   TestApplication application;
693
694   Actor actor = Actor::New();
695   Vector3 vector(100.0f, 100.0f, 100.0f);
696
697   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
698
699   actor.SetSize(Vector2(vector.x, vector.y));
700
701   // flush the queue and render once
702   application.SendNotification();
703   application.Render();
704
705   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
706 }
707
708 // SetSize(Vector3 size)
709 static void UtcDaliActorSetSize04()
710 {
711   TestApplication application;
712
713   Actor actor = Actor::New();
714   Vector3 vector(100.0f, 100.0f, 100.0f);
715
716   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
717
718   actor.SetSize(vector);
719
720   // flush the queue and render once
721   application.SendNotification();
722   application.Render();
723
724   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
725
726   Stage::GetCurrent().Add( actor );
727   actor.SetSize( Vector3( 0.1f, 0.2f, 0.3f ) );
728
729   // flush the queue and render once
730   application.SendNotification();
731   application.Render();
732
733   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentSize(), TEST_LOCATION );
734   Stage::GetCurrent().Remove( actor );
735 }
736
737 static void UtcDaliActorGetCurrentSize()
738 {
739   TestApplication application;
740
741   Actor actor = Actor::New();
742   Vector3 vector(100.0f, 100.0f, 20.0f);
743
744   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
745
746   actor.SetSize(vector);
747
748   // flush the queue and render once
749   application.SendNotification();
750   application.Render();
751
752   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
753 }
754
755 // SetPosition(float x, float y)
756 static void UtcDaliActorSetPosition01()
757 {
758   TestApplication application;
759
760   Actor actor = Actor::New();
761
762   // Set to random to start off with
763   actor.SetPosition(Vector3(120.0f, 120.0f, 0.0f));
764
765   Vector3 vector(100.0f, 100.0f, 0.0f);
766
767   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
768
769   actor.SetPosition(vector.x, vector.y);
770   // flush the queue and render once
771   application.SendNotification();
772   application.Render();
773   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
774
775   Stage::GetCurrent().Add( actor );
776   actor.SetPosition( Vector3( 0.1f, 0.2f, 0.3f ) );
777   // flush the queue and render once
778   application.SendNotification();
779   application.Render();
780   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentPosition(), TEST_LOCATION );
781
782   actor.SetX( 1.0f );
783   actor.SetY( 1.1f );
784   actor.SetZ( 1.2f );
785   // flush the queue and render once
786   application.SendNotification();
787   application.Render();
788   DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentPosition(), TEST_LOCATION );
789
790   actor.MoveBy( Vector3( 0.1f, 0.1f, 0.1f ) );
791   // flush the queue and render once
792   application.SendNotification();
793   application.Render();
794   DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentPosition(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
795
796   Stage::GetCurrent().Remove( actor );
797 }
798
799 // SetPosition(float x, float y, float z)
800 static void UtcDaliActorSetPosition02()
801 {
802   TestApplication application;
803
804   Actor actor = Actor::New();
805
806   // Set to random to start off with
807   actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
808
809   Vector3 vector(100.0f, 100.0f, 100.0f);
810
811   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
812
813   actor.SetPosition(vector.x, vector.y, vector.z);
814
815   // flush the queue and render once
816   application.SendNotification();
817   application.Render();
818
819   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
820 }
821
822 // SetPosition(Vector3 position)
823 static void UtcDaliActorSetPosition03()
824 {
825   TestApplication application;
826
827   Actor actor = Actor::New();
828
829   // Set to random to start off with
830   actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
831
832   Vector3 vector(100.0f, 100.0f, 100.0f);
833
834   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
835
836   actor.SetPosition(vector);
837
838   // flush the queue and render once
839   application.SendNotification();
840   application.Render();
841
842   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
843 }
844
845 static void UtcDaliActorSetX()
846 {
847   TestApplication application;
848
849   Actor actor = Actor::New();
850
851   Vector3 vector(100.0f, 0.0f, 0.0f);
852
853   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
854
855   actor.SetX(100.0f);
856
857   // flush the queue and render once
858   application.SendNotification();
859   application.Render();
860
861   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
862 }
863
864 static void UtcDaliActorSetY()
865 {
866   TestApplication application;
867
868   Actor actor = Actor::New();
869
870   Vector3 vector(0.0f, 100.0f, 0.0f);
871
872   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
873
874   actor.SetY(100.0f);
875
876   // flush the queue and render once
877   application.SendNotification();
878   application.Render();
879
880   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
881 }
882
883 static void UtcDaliActorSetZ()
884 {
885   TestApplication application;
886
887   Actor actor = Actor::New();
888
889   Vector3 vector(0.0f, 0.0f, 100.0f);
890
891   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
892
893   actor.SetZ(100.0f);
894
895   // flush the queue and render once
896   application.SendNotification();
897   application.Render();
898
899   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
900 }
901
902 static void UtcDaliActorMoveBy()
903 {
904   TestApplication application;
905
906   Actor actor = Actor::New();
907   Vector3 vector(100.0f, 100.0f, 100.0f);
908
909   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
910
911   actor.SetPosition(vector);
912
913   // flush the queue and render once
914   application.SendNotification();
915   application.Render();
916
917   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
918
919   actor.MoveBy(vector);
920
921   // flush the queue and render once
922   application.SendNotification();
923   application.Render();
924
925   DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentPosition());
926 }
927
928 static void UtcDaliActorGetCurrentPosition()
929 {
930   TestApplication application;
931
932   Actor actor = Actor::New();
933   Vector3 setVector(100.0f, 100.0f, 0.0f);
934   actor.SetPosition(setVector);
935
936   // flush the queue and render once
937   application.SendNotification();
938   application.Render();
939
940   DALI_TEST_CHECK(actor.GetCurrentPosition() == setVector);
941 }
942
943 static void UtcDaliActorGetCurrentWorldPosition()
944 {
945   TestApplication application;
946
947   Actor parent = Actor::New();
948   Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
949   parent.SetPosition( parentPosition );
950   parent.SetParentOrigin( ParentOrigin::CENTER );
951   parent.SetAnchorPoint( AnchorPoint::CENTER );
952   Stage::GetCurrent().Add( parent );
953
954   Actor child = Actor::New();
955   child.SetParentOrigin( ParentOrigin::CENTER );
956   child.SetAnchorPoint( AnchorPoint::CENTER );
957   Vector3 childPosition( 6.0f, 6.0f, 6.0f );
958   child.SetPosition( childPosition );
959   parent.Add( child );
960
961   // The actors should not have a world position yet
962   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
963   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
964
965   application.SendNotification();
966   application.Render(0);
967
968   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
969   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
970
971   // The actors should have a world position now
972   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
973   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
974 }
975
976 static void UtcDaliActorInheritPosition()
977 {
978   tet_infoline("Testing Actor::SetPositionInheritanceMode");
979   TestApplication application;
980
981   Actor parent = Actor::New();
982   Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
983   parent.SetPosition( parentPosition );
984   parent.SetParentOrigin( ParentOrigin::CENTER );
985   parent.SetAnchorPoint( AnchorPoint::CENTER );
986   Stage::GetCurrent().Add( parent );
987
988   Actor child = Actor::New();
989   child.SetParentOrigin( ParentOrigin::CENTER );
990   child.SetAnchorPoint( AnchorPoint::CENTER );
991   Vector3 childPosition( 10.0f, 11.0f, 12.0f );
992   child.SetPosition( childPosition );
993   parent.Add( child );
994
995   // The actors should not have a world position yet
996   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
997   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
998
999   // first test default, which is INHERIT_PARENT_POSITION
1000   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::INHERIT_PARENT_POSITION, TEST_LOCATION );
1001   application.SendNotification();
1002   application.Render(0); // should only really call Update as Render is not required to update scene
1003   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1004   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1005   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1006   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1007
1008   // Change inheritance mode to use parent
1009   child.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
1010   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::USE_PARENT_POSITION, TEST_LOCATION );
1011   application.SendNotification();
1012   application.Render(0); // should only really call Update as Render is not required to update scene
1013   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1014   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1015   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1016   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1017
1018   // Change inheritance mode to use parent + offset
1019   child.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
1020   Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1021   child.SetPosition( childOffset );
1022   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
1023   application.SendNotification();
1024   application.Render(0); // should only really call Update as Render is not required to update scene
1025   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1026   DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1027   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1028   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childOffset, TEST_LOCATION );
1029
1030   // Change inheritance mode to not inherit
1031   child.SetPositionInheritanceMode( Dali::DONT_INHERIT_POSITION );
1032   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::DONT_INHERIT_POSITION, TEST_LOCATION );
1033   application.SendNotification();
1034   application.Render(0); // should only really call Update as Render is not required to update scene
1035   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1036   DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1037   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1038   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION );
1039 }
1040
1041 // SetRotation(float angleRadians, Vector3 axis)
1042 static void UtcDaliActorSetRotation01()
1043 {
1044   TestApplication application;
1045
1046   Quaternion rotation(0.785f, Vector3(1.0f, 1.0f, 0.0f));
1047   Actor actor = Actor::New();
1048
1049   actor.SetRotation(rotation);
1050
1051   // flush the queue and render once
1052   application.SendNotification();
1053   application.Render();
1054
1055   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1056 }
1057
1058 static void UtcDaliActorSetRotation02()
1059 {
1060   TestApplication application;
1061
1062   Actor actor = Actor::New();
1063
1064   float angle = 0.785f;
1065   Vector3 axis(1.0f, 1.0f, 0.0f);
1066
1067   actor.SetRotation(Radian( angle ), axis);
1068   Quaternion rotation( angle, axis );
1069   // flush the queue and render once
1070   application.SendNotification();
1071   application.Render();
1072   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1073
1074   Stage::GetCurrent().Add( actor );
1075   actor.RotateBy( Degree( 360 ), axis);
1076   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1077
1078   actor.SetRotation( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1079   Quaternion result( 0, Vector3( 1.0f, 0.0f, 0.0f ) );
1080   // flush the queue and render once
1081   application.SendNotification();
1082   application.Render();
1083   DALI_TEST_EQUALS( result, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1084
1085   actor.SetRotation(Radian( angle ), axis);
1086   // flush the queue and render once
1087   application.SendNotification();
1088   application.Render();
1089   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1090
1091   Stage::GetCurrent().Remove( actor );
1092 }
1093
1094 // RotateBy(float angleRadians, Vector3 axis)
1095 static void UtcDaliActorRotateBy01()
1096 {
1097   TestApplication application;
1098
1099   Actor actor = Actor::New();
1100
1101   float angle = M_PI * 0.25f;
1102   actor.RotateBy(Radian( angle ), Vector3::ZAXIS);
1103   // flush the queue and render once
1104   application.SendNotification();
1105   application.Render();
1106   DALI_TEST_EQUALS(Quaternion(M_PI*0.25f, Vector3::ZAXIS), actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1107
1108   Stage::GetCurrent().Add( actor );
1109
1110   actor.RotateBy(Radian( angle ), Vector3::ZAXIS);
1111   // flush the queue and render once
1112   application.SendNotification();
1113   application.Render();
1114   DALI_TEST_EQUALS(Quaternion(M_PI*0.5f, Vector3::ZAXIS), actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1115
1116   Stage::GetCurrent().Remove( actor );
1117 }
1118
1119 // RotateBy(Quaternion relativeRotation)
1120 static void UtcDaliActorRotateBy02()
1121 {
1122   TestApplication application;
1123
1124   Actor actor = Actor::New();
1125
1126   Quaternion rotation(M_PI*0.25f, Vector3::ZAXIS);
1127   actor.RotateBy(rotation);
1128   // flush the queue and render once
1129   application.SendNotification();
1130   application.Render();
1131   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1132
1133   actor.RotateBy(rotation);
1134   // flush the queue and render once
1135   application.SendNotification();
1136   application.Render();
1137   DALI_TEST_EQUALS(Quaternion(M_PI*0.5f, Vector3::ZAXIS), actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1138 }
1139
1140 static void UtcDaliActorGetCurrentRotation()
1141 {
1142   TestApplication application;
1143   Actor actor = Actor::New();
1144
1145   Quaternion rotation(0.785f, Vector3(1.0f, 1.0f, 0.0f));
1146   actor.SetRotation(rotation);
1147   // flush the queue and render once
1148   application.SendNotification();
1149   application.Render();
1150   DALI_TEST_EQUALS(rotation, actor.GetCurrentRotation(), 0.001, TEST_LOCATION);
1151 }
1152
1153 static void UtcDaliActorGetCurrentWorldRotation()
1154 {
1155   tet_infoline("Testing Actor::GetCurrentWorldRotation");
1156   TestApplication application;
1157
1158   Actor parent = Actor::New();
1159   Radian rotationAngle( Degree(90.0f) );
1160   Quaternion rotation( rotationAngle, Vector3::YAXIS );
1161   parent.SetRotation( rotation );
1162   Stage::GetCurrent().Add( parent );
1163
1164   Actor child = Actor::New();
1165   child.SetRotation( rotation );
1166   parent.Add( child );
1167
1168   // The actors should not have a world rotation yet
1169   DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION );
1170   DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION );
1171
1172   application.SendNotification();
1173   application.Render(0);
1174
1175   DALI_TEST_EQUALS( parent.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION );
1176   DALI_TEST_EQUALS( child.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION );
1177
1178   // The actors should have a world rotation now
1179   DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1180   DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1181
1182   // turn off child rotation inheritance
1183   child.SetInheritRotation( false );
1184   DALI_TEST_EQUALS( child.IsRotationInherited(), false, TEST_LOCATION );
1185   application.SendNotification();
1186   application.Render(0);
1187
1188   // The actors should have a world rotation now
1189   DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1190   DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), rotation, 0.001, TEST_LOCATION );
1191 }
1192
1193 // SetScale(float scale)
1194 static void UtcDaliActorSetScale01()
1195 {
1196   TestApplication application;
1197
1198   Actor actor = Actor::New();
1199
1200   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1201   actor.SetScale(0.25f);
1202
1203   Vector3 scale(10.0f, 10.0f, 10.0f);
1204   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1205
1206   actor.SetScale(scale.x);
1207
1208   // flush the queue and render once
1209   application.SendNotification();
1210   application.Render();
1211
1212   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1213 }
1214
1215 // SetScale(float scaleX, float scaleY, float scaleZ)
1216 static void UtcDaliActorSetScale02()
1217 {
1218   TestApplication application;
1219   Vector3 scale(10.0f, 10.0f, 10.0f);
1220
1221   Actor actor = Actor::New();
1222
1223   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1224   actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1225
1226   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1227
1228   actor.SetScale(scale.x, scale.y, scale.z);
1229   // flush the queue and render once
1230   application.SendNotification();
1231   application.Render();
1232   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1233
1234   // add to stage and test
1235   Stage::GetCurrent().Add( actor );
1236   actor.SetScale( 2.0f, 2.0f, 2.0f );
1237   // flush the queue and render once
1238   application.SendNotification();
1239   application.Render();
1240   DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentScale(), 0.001, TEST_LOCATION);
1241
1242   Stage::GetCurrent().Remove( actor );
1243
1244 }
1245
1246 // SetScale(Vector3 scale)
1247 static void UtcDaliActorSetScale03()
1248 {
1249   TestApplication application;
1250   Vector3 scale(10.0f, 10.0f, 10.0f);
1251
1252   Actor actor = Actor::New();
1253
1254   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1255   actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1256
1257   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1258
1259   actor.SetScale(scale);
1260
1261   // flush the queue and render once
1262   application.SendNotification();
1263   application.Render();
1264
1265   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1266 }
1267
1268 static void UtcDaliActorScaleBy()
1269 {
1270   TestApplication application;
1271   Actor actor = Actor::New();
1272   Vector3 vector(100.0f, 100.0f, 100.0f);
1273
1274   DALI_TEST_CHECK(vector != actor.GetCurrentScale());
1275
1276   actor.SetScale(vector);
1277
1278   // flush the queue and render once
1279   application.SendNotification();
1280   application.Render();
1281
1282   DALI_TEST_CHECK(vector == actor.GetCurrentScale());
1283
1284   actor.ScaleBy(vector);
1285
1286   // flush the queue and render once
1287   application.SendNotification();
1288   application.Render();
1289
1290   DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentScale());
1291 }
1292
1293 static void UtcDaliActorGetCurrentScale()
1294 {
1295   TestApplication application;
1296   Vector3 scale(12.0f, 1.0f, 2.0f);
1297
1298   Actor actor = Actor::New();
1299
1300   actor.SetScale(scale);
1301
1302   // flush the queue and render once
1303   application.SendNotification();
1304   application.Render();
1305
1306   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1307 }
1308
1309 static void UtcDaliActorGetCurrentWorldScale()
1310 {
1311   TestApplication application;
1312
1313   Actor parent = Actor::New();
1314   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1315   parent.SetScale( parentScale );
1316   Stage::GetCurrent().Add( parent );
1317
1318   Actor child = Actor::New();
1319   Vector3 childScale( 2.0f, 2.0f, 2.0f );
1320   child.SetScale( childScale );
1321   parent.Add( child );
1322
1323   // The actors should not have a scale yet
1324   DALI_TEST_EQUALS( parent.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1325   DALI_TEST_EQUALS( child.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1326
1327   // The actors should not have a world scale yet
1328   DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1329   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1330
1331   application.SendNotification();
1332   application.Render(0);
1333
1334   DALI_TEST_EQUALS( parent.GetCurrentScale(), parentScale, TEST_LOCATION );
1335   DALI_TEST_EQUALS( child.GetCurrentScale(), childScale, TEST_LOCATION );
1336
1337   // The actors should have a world scale now
1338   DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), parentScale, TEST_LOCATION );
1339   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1340 }
1341
1342 static void UtcDaliActorInheritScale()
1343 {
1344   tet_infoline("Testing Actor::SetInheritScale");
1345   TestApplication application;
1346
1347   Actor parent = Actor::New();
1348   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1349   parent.SetScale( parentScale );
1350   Stage::GetCurrent().Add( parent );
1351
1352   Actor child = Actor::New();
1353   Vector3 childScale( 2.0f, 2.0f, 2.0f );
1354   child.SetScale( childScale );
1355   parent.Add( child );
1356
1357   application.SendNotification();
1358   application.Render(0);
1359
1360   DALI_TEST_EQUALS( child.IsScaleInherited(), true, TEST_LOCATION );
1361   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1362
1363   child.SetInheritScale( false );
1364   DALI_TEST_EQUALS( child.IsScaleInherited(), false, TEST_LOCATION );
1365
1366   application.SendNotification();
1367   application.Render(0);
1368
1369   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), childScale, TEST_LOCATION );
1370 }
1371
1372 static void UtcDaliActorSetVisible()
1373 {
1374   TestApplication application;
1375
1376   Actor actor = Actor::New();
1377   actor.SetVisible(false);
1378   // flush the queue and render once
1379   application.SendNotification();
1380   application.Render();
1381   DALI_TEST_CHECK(actor.IsVisible() == false);
1382
1383   actor.SetVisible(true);
1384   // flush the queue and render once
1385   application.SendNotification();
1386   application.Render();
1387   DALI_TEST_CHECK(actor.IsVisible() == true);
1388
1389   // put actor on stage
1390   Stage::GetCurrent().Add( actor );
1391   actor.SetVisible(false);
1392   // flush the queue and render once
1393   application.SendNotification();
1394   application.Render();
1395   DALI_TEST_CHECK(actor.IsVisible() == false);
1396 }
1397
1398 static void UtcDaliActorIsVisible()
1399 {
1400   TestApplication application;
1401
1402   Actor actor = Actor::New();
1403
1404   DALI_TEST_CHECK(actor.IsVisible() == true);
1405 }
1406
1407 static void UtcDaliActorSetOpacity()
1408 {
1409   TestApplication application;
1410
1411   Actor actor = Actor::New();
1412   // initial opacity is 1
1413   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1414
1415   actor.SetOpacity( 0.4f);
1416   // flush the queue and render once
1417   application.SendNotification();
1418   application.Render();
1419   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.4f, TEST_LOCATION );
1420
1421   // change opacity, actor is on stage to change is not immediate
1422   actor.OpacityBy( 0.1f );
1423   // flush the queue and render once
1424   application.SendNotification();
1425   application.Render();
1426   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1427
1428   // put actor on stage
1429   Stage::GetCurrent().Add( actor );
1430
1431   // change opacity, actor is on stage to change is not immediate
1432   actor.SetOpacity( 0.9f );
1433   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1434   // flush the queue and render once
1435   application.SendNotification();
1436   application.Render();
1437   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.9f, TEST_LOCATION );
1438
1439   // change opacity, actor is on stage to change is not immediate
1440   actor.OpacityBy( -0.9f );
1441   // flush the queue and render once
1442   application.SendNotification();
1443   application.Render();
1444   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1445 }
1446
1447 static void UtcDaliActorGetCurrentOpacity()
1448 {
1449   TestApplication application;
1450
1451   Actor actor = Actor::New();
1452   DALI_TEST_CHECK(actor.GetCurrentOpacity() != 0.5f);
1453
1454   actor.SetOpacity(0.5f);
1455   // flush the queue and render once
1456   application.SendNotification();
1457   application.Render();
1458   DALI_TEST_CHECK(actor.GetCurrentOpacity() == 0.5f);
1459 }
1460
1461 static void UtcDaliActorSetSensitive()
1462 {
1463   TestApplication application;
1464   Actor actor = Actor::New();
1465
1466   bool sensitive = !actor.IsSensitive();
1467
1468   actor.SetSensitive(sensitive);
1469
1470   DALI_TEST_CHECK(sensitive == actor.IsSensitive());
1471 }
1472
1473 static void UtcDaliActorIsSensitive()
1474 {
1475   TestApplication application;
1476   Actor actor = Actor::New();
1477   actor.SetSensitive(false);
1478
1479   DALI_TEST_CHECK(false == actor.IsSensitive());
1480 }
1481
1482 static void UtcDaliActorSetInheritShaderEffect()
1483 {
1484   TestApplication application;
1485
1486   Actor actor = Actor::New();
1487
1488   actor.SetInheritShaderEffect(false);
1489   // flush the queue and render once
1490   application.SendNotification();
1491   application.Render();
1492   DALI_TEST_CHECK(actor.GetInheritShaderEffect() == false);
1493
1494   actor.SetInheritShaderEffect(true);
1495   // flush the queue and render once
1496   application.SendNotification();
1497   application.Render();
1498   DALI_TEST_CHECK(actor.GetInheritShaderEffect() == true);
1499 }
1500
1501 static void UtcDaliActorGetInheritShaderEffect()
1502 {
1503   TestApplication application;
1504
1505   Actor actor = Actor::New();
1506
1507   DALI_TEST_CHECK(actor.GetInheritShaderEffect() == true);
1508 }
1509
1510 static void UtcDaliActorSetShaderEffect()
1511 {
1512   TestApplication application;
1513   Actor actor = Actor::New();
1514
1515   ShaderEffect effect = ShaderEffect::New(vertexSource, fragmentSource);
1516
1517   DALI_TEST_CHECK(effect != actor.GetShaderEffect());
1518
1519   actor.SetShaderEffect(effect);
1520
1521   DALI_TEST_CHECK(effect == actor.GetShaderEffect());
1522 }
1523
1524 static void UtcDaliActorGetShaderEffect()
1525 {
1526   TestApplication application;
1527   Actor actor = Actor::New();
1528
1529   ShaderEffect effect = ShaderEffect::New(vertexSource, fragmentSource);
1530   actor.SetShaderEffect(effect);
1531
1532   DALI_TEST_CHECK(effect == actor.GetShaderEffect());
1533 }
1534
1535 static void UtcDaliActorRemoveShaderEffect01()
1536 {
1537   TestApplication application;
1538   Actor actor = Actor::New();
1539
1540   ShaderEffect defaultEffect = actor.GetShaderEffect();
1541
1542   ShaderEffect effect = ShaderEffect::New(vertexSource, fragmentSource);
1543   actor.SetShaderEffect(effect);
1544
1545   DALI_TEST_CHECK(effect == actor.GetShaderEffect());
1546
1547   actor.RemoveShaderEffect();
1548
1549   DALI_TEST_CHECK(defaultEffect == actor.GetShaderEffect());
1550 }
1551
1552 static void UtcDaliActorRemoveShaderEffect02()
1553 {
1554   TestApplication application;
1555   Actor actor = Actor::New();
1556
1557   ShaderEffect defaultEffect = actor.GetShaderEffect();
1558
1559   actor.RemoveShaderEffect();
1560
1561   DALI_TEST_CHECK(defaultEffect == actor.GetShaderEffect());
1562 }
1563
1564 static void UtcDaliActorSetColor()
1565 {
1566   TestApplication application;
1567   Actor actor = Actor::New();
1568   Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1569
1570   DALI_TEST_CHECK(color != actor.GetCurrentColor());
1571
1572   actor.SetColor(color);
1573   // flush the queue and render once
1574   application.SendNotification();
1575   application.Render();
1576   DALI_TEST_CHECK(color == actor.GetCurrentColor());
1577
1578   actor.ColorBy( Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) );
1579   // flush the queue and render once
1580   application.SendNotification();
1581   application.Render();
1582   DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentColor(),  TEST_LOCATION );
1583
1584   Stage::GetCurrent().Add( actor );
1585   actor.SetColor( color );
1586   // flush the queue and render once
1587   application.SendNotification();
1588   application.Render();
1589   DALI_TEST_EQUALS( color, actor.GetCurrentColor(),  TEST_LOCATION );
1590
1591   actor.ColorBy( Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) );
1592   // flush the queue and render once
1593   application.SendNotification();
1594   application.Render();
1595   // Actor color is not clamped
1596   DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentColor(),  TEST_LOCATION );
1597   // world color is clamped
1598   DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentWorldColor(),  TEST_LOCATION );
1599
1600   Stage::GetCurrent().Remove( actor );
1601 }
1602
1603 static void UtcDaliActorGetCurrentColor()
1604 {
1605   TestApplication application;
1606   Actor actor = Actor::New();
1607   Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1608
1609   actor.SetColor(color);
1610   // flush the queue and render once
1611   application.SendNotification();
1612   application.Render();
1613   DALI_TEST_CHECK(color == actor.GetCurrentColor());
1614 }
1615
1616 static void UtcDaliActorGetCurrentWorldColor()
1617 {
1618   tet_infoline("Actor::GetCurrentWorldColor");
1619   TestApplication application;
1620
1621   Actor parent = Actor::New();
1622   Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f );
1623   parent.SetColor( parentColor );
1624   Stage::GetCurrent().Add( parent );
1625
1626   Actor child = Actor::New();
1627   Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f );
1628   child.SetColor( childColor );
1629   parent.Add( child );
1630
1631   DALI_TEST_EQUALS( parent.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1632   DALI_TEST_EQUALS( child.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1633
1634   // verify the default color mode
1635   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetColorMode(), TEST_LOCATION );
1636
1637   // The actors should not have a world color yet
1638   DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1639   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1640
1641   application.SendNotification();
1642   application.Render(0);
1643
1644   DALI_TEST_EQUALS( parent.GetCurrentColor(), parentColor, TEST_LOCATION );
1645   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1646
1647   // The actors should have a world color now
1648   DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1649   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION );
1650
1651   // use own color
1652   child.SetColorMode( USE_OWN_COLOR );
1653   application.SendNotification();
1654   application.Render(0);
1655   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), childColor, TEST_LOCATION );
1656
1657   // use parent color
1658   child.SetColorMode( USE_PARENT_COLOR );
1659   application.SendNotification();
1660   application.Render(0);
1661   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1662   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1663
1664   // use parent alpha
1665   child.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1666   application.SendNotification();
1667   application.Render(0);
1668   Vector4 expectedColor( childColor );
1669   expectedColor.a *= parentColor.a;
1670   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1671   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), expectedColor, TEST_LOCATION );
1672 }
1673
1674 static void UtcDaliActorSetColorMode()
1675 {
1676   tet_infoline("Actor::SetColorMode");
1677   TestApplication application;
1678   Actor actor = Actor::New();
1679   Actor child = Actor::New();
1680   actor.Add( child );
1681
1682   actor.SetColorMode( USE_OWN_COLOR );
1683   DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetColorMode(), TEST_LOCATION );
1684
1685   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
1686   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1687
1688   actor.SetColorMode( USE_PARENT_COLOR );
1689   DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1690
1691   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1692   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetColorMode(), TEST_LOCATION );
1693 }
1694
1695 static void UtcDaliActorScreenToLocal()
1696 {
1697   TestApplication application;
1698   Actor actor = Actor::New();
1699   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1700   actor.SetSize(100.0f, 100.0f);
1701   actor.SetPosition(10.0f, 10.0f);
1702   Stage::GetCurrent().Add(actor);
1703
1704   // flush the queue and render once
1705   application.SendNotification();
1706   application.Render();
1707
1708   float localX;
1709   float localY;
1710
1711   DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) );
1712
1713   DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
1714   DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
1715 }
1716
1717 static void UtcDaliActorSetLeaveRequired()
1718 {
1719   TestApplication application;
1720
1721   Actor actor = Actor::New();
1722
1723   actor.SetLeaveRequired(false);
1724   DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
1725
1726   actor.SetLeaveRequired(true);
1727   DALI_TEST_CHECK(actor.GetLeaveRequired() == true);
1728 }
1729
1730 static void UtcDaliActorGetLeaveRequired()
1731 {
1732   TestApplication application;
1733
1734   Actor actor = Actor::New();
1735
1736   DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
1737 }
1738
1739 static void UtcDaliActorSetKeyboardFocusable()
1740 {
1741   TestApplication application;
1742
1743   Actor actor = Actor::New();
1744
1745   actor.SetKeyboardFocusable(true);
1746   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == true);
1747
1748   actor.SetKeyboardFocusable(false);
1749   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
1750 }
1751
1752 static void UtcDaliActorIsKeyboardFocusable()
1753 {
1754   TestApplication application;
1755
1756   Actor actor = Actor::New();
1757
1758   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
1759 }
1760
1761 static bool gTestConstraintCalled;
1762
1763 struct TestConstraint
1764 {
1765   Vector4 operator()(const Vector4&    color)
1766   {
1767     gTestConstraintCalled = true;
1768     return Vector4(color.x, color.y, color.z, 0.1f);
1769   }
1770 };
1771
1772 /**
1773  * TestConstraint reference.
1774  * When constraint is called, the resultRef is updated
1775  * with the value supplied.
1776  */
1777 template<typename T>
1778 struct TestConstraintRef
1779 {
1780   TestConstraintRef(unsigned int& resultRef, unsigned int value)
1781   : mResultRef(resultRef),
1782     mValue(value)
1783   {
1784   }
1785
1786   T operator()(const T&    current)
1787   {
1788     mResultRef = mValue;
1789     return current;
1790   }
1791
1792   unsigned int& mResultRef;
1793   unsigned int mValue;
1794 };
1795
1796 static void UtcDaliActorApplyConstraint()
1797 {
1798   TestApplication application;
1799
1800   gTestConstraintCalled = false;
1801
1802   Actor actor = Actor::New();
1803
1804   Constraint constraint = Constraint::New<Vector4>( Actor::COLOR, TestConstraint() );
1805   actor.ApplyConstraint(constraint);
1806
1807   DALI_TEST_CHECK( gTestConstraintCalled == false );
1808   // add to stage
1809   Stage::GetCurrent().Add( actor );
1810
1811   // flush the queue and render once
1812   application.SendNotification();
1813   application.Render();
1814
1815   DALI_TEST_CHECK( gTestConstraintCalled == true );
1816 }
1817
1818 bool wasConstraintCallbackCalled1 = false;
1819 void TestConstraintCallback1( ActiveConstraint& constraint )
1820 {
1821   wasConstraintCallbackCalled1 = true;
1822 }
1823
1824 bool wasConstraintCallbackCalled2 = false;
1825 void TestConstraintCallback2( ActiveConstraint& constraint )
1826 {
1827   wasConstraintCallbackCalled2 = true;
1828 }
1829
1830 bool wasConstraintCallbackCalled3 = false;
1831 void TestConstraintCallback3( ActiveConstraint& constraint )
1832 {
1833   wasConstraintCallbackCalled3 = true;
1834 }
1835
1836 static void UtcDaliActorApplyConstraintAppliedCallback()
1837 {
1838   TestApplication application;
1839
1840   // Build a reusable constraint
1841
1842   Actor parent = Actor::New();
1843   Vector3 parentSize( 100.0f, 100.0f, 100.0f );
1844   parent.SetSize( parentSize );
1845   Stage::GetCurrent().Add( parent );
1846
1847   Constraint constraint = Constraint::New<Vector3>( Actor::SIZE,
1848                                                     Source( parent, Actor::SIZE ),
1849                                                     EqualToConstraint() );
1850
1851   // Create some child actors
1852
1853   Actor child1 = Actor::New();
1854   parent.Add( child1 );
1855
1856   Actor child2 = Actor::New();
1857   parent.Add( child2 );
1858
1859   Actor child3 = Actor::New();
1860   parent.Add( child3 );
1861
1862   // Apply constraint with different timings - everything should be finished after 10 seconds
1863
1864   wasConstraintCallbackCalled1 = false;
1865   wasConstraintCallbackCalled2 = false;
1866   wasConstraintCallbackCalled3 = false;
1867
1868   constraint.SetApplyTime( 5.0f );
1869   ActiveConstraint activeConstraint1 = child1.ApplyConstraint( constraint );
1870   activeConstraint1.AppliedSignal().Connect( TestConstraintCallback1 );
1871
1872   constraint.SetApplyTime( 10.0f );
1873   ActiveConstraint activeConstraint2 = child2.ApplyConstraint( constraint );
1874   activeConstraint2.AppliedSignal().Connect( TestConstraintCallback2 );
1875
1876   constraint.SetApplyTime( TimePeriod( 2.0f/*delay*/, 5.0f/*duration*/ ) );
1877   ActiveConstraint activeConstraint3 = child3.ApplyConstraint( constraint );
1878   activeConstraint3.AppliedSignal().Connect( TestConstraintCallback3 );
1879
1880   DALI_TEST_EQUALS( child1.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
1881   DALI_TEST_EQUALS( child2.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
1882   DALI_TEST_EQUALS( child3.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
1883
1884   application.SendNotification();
1885
1886   application.Render(static_cast<unsigned int>(1000.0f)); // 1 elapsed second
1887   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize*0.20f, TEST_LOCATION ); // 1 /  5 * 100 = 20%
1888   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.10f, TEST_LOCATION ); // 1 / 10 * 100 = 10%
1889   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.00f, TEST_LOCATION ); // 0%
1890
1891   // Check signals have not fired
1892   application.SendNotification();
1893   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1894   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1895   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1896
1897   application.Render(static_cast<unsigned int>(1000.0f)); // 2 elapsed seconds
1898   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize*0.40f, TEST_LOCATION ); // 2 /  5 * 100 = 40%
1899   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.20f, TEST_LOCATION ); // 2 / 10 * 100 = 20%
1900   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.00f, TEST_LOCATION ); // 0%
1901
1902   // Check signals have not fired
1903   application.SendNotification();
1904   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1905   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1906   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1907
1908   application.Render(static_cast<unsigned int>(1000.0f)); // 3 elapsed seconds
1909   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize*0.60f, TEST_LOCATION ); // 3 /  5 * 100 = 60%
1910   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.30f, TEST_LOCATION ); // 3 / 10 * 100 = 30%
1911   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.20f, TEST_LOCATION ); // (3 - 2) / 5 * 100 = 20%
1912
1913   // Check signals have not fired
1914   application.SendNotification();
1915   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1916   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1917   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1918
1919   application.Render(static_cast<unsigned int>(1000.0f)); // 4 elapsed seconds
1920   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize*0.80f, TEST_LOCATION ); // 4 /  5 * 100 = 80%
1921   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.40f, TEST_LOCATION ); // 4 / 10 * 100 = 40%
1922   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.40f, TEST_LOCATION ); // (4 - 2) / 5 * 100 = 40%
1923
1924   // Check signals have not fired
1925   application.SendNotification();
1926   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1927   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1928   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1929
1930   application.Render(static_cast<unsigned int>(1000.0f)); // 5 elapsed seconds
1931   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // 5 /  5 * 100 = 100%
1932   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.50f, TEST_LOCATION ); // 5 / 10 * 100 = 50%
1933   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.60f, TEST_LOCATION ); // (5 - 2) / 5 * 100 = 60%
1934
1935   // Check signals have not fired
1936   application.SendNotification();
1937   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1938   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1939   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1940
1941   application.Render(static_cast<unsigned int>(1000.0f)); // 6 elapsed seconds
1942   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100% (signal 1 should fire)
1943   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.60f, TEST_LOCATION ); // 6 / 10 * 100 = 60%
1944   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize*0.80f, TEST_LOCATION ); // (6 - 2) / 5 * 100 = 80%
1945
1946   // 1st signal should have fired
1947   application.SendNotification();
1948   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, true, TEST_LOCATION );
1949   wasConstraintCallbackCalled1 = false;
1950   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1951   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1952
1953   application.Render(static_cast<unsigned int>(1000.0f)); // 7 elapsed seconds
1954   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1955   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.70f, TEST_LOCATION ); // 7 / 10 * 100 = 70%
1956   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize,       TEST_LOCATION ); // (7 - 2) / 5 * 100 = 100%
1957
1958   // Check signals have not fired
1959   application.SendNotification();
1960   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1961   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1962   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1963
1964   application.Render(static_cast<unsigned int>(1000.0f)); // 8 elapsed seconds
1965   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1966   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.80f, TEST_LOCATION ); // 8 / 10 * 100 = 80%
1967   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100% (signal 3 should fire)
1968
1969   // 3rd signal should have fired
1970   application.SendNotification();
1971
1972   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1973   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1974   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, true, TEST_LOCATION );
1975   wasConstraintCallbackCalled3 = false;
1976
1977   application.Render(static_cast<unsigned int>(1000.0f)); // 9 elapsed seconds
1978   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1979   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize*0.90f, TEST_LOCATION ); // 9 / 10 * 100 = 90%
1980   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1981
1982   // Check signals have not fired
1983   application.SendNotification();
1984   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1985   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
1986   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1987
1988   application.Render(static_cast<unsigned int>(1000.0f + 1.0f)); // over 10 elapsed seconds
1989   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1990   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100% (signal 2 should fire)
1991   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize,       TEST_LOCATION ); // Past 100%
1992
1993   // 2nd signal should have fired
1994   application.SendNotification();
1995   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
1996   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, true, TEST_LOCATION );
1997   wasConstraintCallbackCalled2 = false;
1998   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
1999
2000   // Check that nothing has changed after a couple of buffer swaps
2001
2002   application.Render(0);
2003   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize, TEST_LOCATION );
2004   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize, TEST_LOCATION );
2005   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize, TEST_LOCATION );
2006
2007   application.SendNotification();
2008   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
2009   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
2010   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
2011
2012   application.Render(0);
2013   DALI_TEST_EQUALS( child1.GetCurrentSize(), parentSize, TEST_LOCATION );
2014   DALI_TEST_EQUALS( child2.GetCurrentSize(), parentSize, TEST_LOCATION );
2015   DALI_TEST_EQUALS( child3.GetCurrentSize(), parentSize, TEST_LOCATION );
2016
2017   application.SendNotification();
2018   DALI_TEST_EQUALS( wasConstraintCallbackCalled1, false, TEST_LOCATION );
2019   DALI_TEST_EQUALS( wasConstraintCallbackCalled2, false, TEST_LOCATION );
2020   DALI_TEST_EQUALS( wasConstraintCallbackCalled3, false, TEST_LOCATION );
2021 }
2022
2023 static void UtcDaliActorRemoveConstraints()
2024 {
2025   tet_infoline(" UtcDaliActorRemoveConstraints");
2026   TestApplication application;
2027
2028   gTestConstraintCalled = false;
2029
2030   Actor actor = Actor::New();
2031
2032   Constraint constraint = Constraint::New<Vector4>( Actor::COLOR, TestConstraint() );
2033   actor.ApplyConstraint(constraint);
2034   actor.RemoveConstraints();
2035
2036   DALI_TEST_CHECK( gTestConstraintCalled == false );
2037
2038   Stage::GetCurrent().Add( actor );
2039   actor.ApplyConstraint(constraint);
2040
2041   // flush the queue and render once
2042   application.SendNotification();
2043   application.Render();
2044
2045   actor.RemoveConstraints();
2046
2047   DALI_TEST_CHECK( gTestConstraintCalled == true );
2048 }
2049
2050 static void UtcDaliActorRemoveConstraint()
2051 {
2052   tet_infoline(" UtcDaliActorRemoveConstraint");
2053   TestApplication application;
2054
2055   Actor actor = Actor::New();
2056
2057   // 1. Apply Constraint1 and Constraint2, and test...
2058   unsigned int result1 = 0u;
2059   unsigned int result2 = 0u;
2060   ActiveConstraint activeConstraint1 = actor.ApplyConstraint( Constraint::New<Vector4>( Actor::COLOR, TestConstraintRef<Vector4>(result1, 1) ) );
2061   ActiveConstraint activeConstraint2 = actor.ApplyConstraint( Constraint::New<Vector4>( Actor::COLOR, TestConstraintRef<Vector4>(result2, 2) ) );
2062
2063   Stage::GetCurrent().Add( actor );
2064   // flush the queue and render once
2065   application.SendNotification();
2066   application.Render();
2067
2068   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2069   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2070
2071   // 2. Remove Constraint1 and test...
2072   result1 = 0;
2073   result2 = 0;
2074   actor.RemoveConstraint(activeConstraint1);
2075   // make color property dirty, which will trigger constraints to be reapplied.
2076   actor.SetColor( Color::WHITE );
2077   // flush the queue and render once
2078   application.SendNotification();
2079   application.Render();
2080
2081   DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION );  ///< constraint 1 should not apply now.
2082   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2083
2084   // 3. Re-Apply Constraint1 and test...
2085   result1 = 0;
2086   result2 = 0;
2087   activeConstraint1 = actor.ApplyConstraint( Constraint::New<Vector4>( Actor::COLOR, TestConstraintRef<Vector4>(result1, 1) ) );
2088   // make color property dirty, which will trigger constraints to be reapplied.
2089   actor.SetColor( Color::WHITE );
2090   // flush the queue and render once
2091   application.SendNotification();
2092   application.Render();
2093
2094   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2095   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2096
2097   // 2. Remove Constraint2 and test...
2098   result1 = 0;
2099   result2 = 0;
2100   actor.RemoveConstraint(activeConstraint2);
2101   // make color property dirty, which will trigger constraints to be reapplied.
2102   actor.SetColor( Color::WHITE );
2103   // flush the queue and render once
2104   application.SendNotification();
2105   application.Render();
2106
2107   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2108   DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2109
2110   // 2. Remove Constraint1 as well and test...
2111   result1 = 0;
2112   result2 = 0;
2113   actor.RemoveConstraint(activeConstraint1);
2114   // make color property dirty, which will trigger constraints to be reapplied.
2115   actor.SetColor( Color::WHITE );
2116   // flush the queue and render once
2117   application.SendNotification();
2118   application.Render();
2119
2120   DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
2121   DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2122 }
2123
2124 static bool gTouchCallBackCalled;
2125 static bool gTouchCallBack2Called;
2126
2127 static bool TestCallback(Actor actor, const TouchEvent& event)
2128 {
2129   gTouchCallBackCalled = true;
2130   return false;
2131 }
2132
2133 static bool TestCallback2(Actor actor, const TouchEvent& event)
2134 {
2135   gTouchCallBack2Called = true;
2136   return false;
2137 }
2138
2139
2140 static void UtcDaliActorTouchedSignal()
2141 {
2142   TestApplication application;
2143
2144   gTouchCallBackCalled = false;
2145
2146   // get the root layer
2147   Actor actor = Stage::GetCurrent().GetRootLayer();
2148   DALI_TEST_CHECK( gTouchCallBackCalled == false );
2149
2150   application.SendNotification();
2151   application.Render();
2152
2153   // connect to its touch signal
2154   actor.TouchedSignal().Connect( TestCallback );
2155
2156   // simulate a touch event in the middle of the screen
2157   Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
2158   Dali::TouchPoint point( 1, TouchPoint::Down, touchPoint.x, touchPoint.y );
2159   Dali::Integration::TouchEvent event;
2160   event.AddPoint( point );
2161   application.GetCore().SendEvent( event );
2162
2163   DALI_TEST_CHECK( gTouchCallBackCalled == true );
2164 }
2165
2166 static Vector3 gSetSize;
2167 static bool gSetSizeCallBackCalled;
2168 static void SetSizeCallback( Actor actor, const Vector3& size )
2169 {
2170   gSetSizeCallBackCalled = true;
2171   gSetSize = size;
2172 }
2173
2174 static void UtcDaliActorSetSizeSignal()
2175 {
2176   TestApplication application;
2177
2178   Actor actor = Actor::New();
2179   actor.SetSizeSignal().Connect( SetSizeCallback );
2180
2181   gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
2182   gSetSizeCallBackCalled = false;
2183   Vector2 size2d( 1.0f, 2.0f );
2184   actor.SetSize( size2d );
2185   DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
2186   // SetSize with Vector2 sets depth to be the minimum of width & height
2187   DALI_TEST_EQUALS( Vector3( 1.0f, 2.0f, 1.0f ), gSetSize,  TEST_LOCATION );
2188
2189   gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
2190   gSetSizeCallBackCalled = false;
2191   actor.SetSize( 22.0f, 11.0f );
2192   DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
2193   // SetSize with Vector2 sets depth to be the minimum of width & height
2194   DALI_TEST_EQUALS( Vector3( 22.0f, 11.0f, 11.0f ), gSetSize,  TEST_LOCATION );
2195
2196   gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
2197   gSetSizeCallBackCalled = false;
2198   Vector3 size( 3.0f, 4.0f, 5.0f );
2199   actor.SetSize( size );
2200   DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
2201   DALI_TEST_EQUALS( size, gSetSize,  TEST_LOCATION );
2202
2203   // add actor to stage to see that signal still works
2204   Stage::GetCurrent().Add( actor );
2205
2206   gSetSize.x = gSetSize.y = gSetSize.z = 0.0f;
2207   gSetSizeCallBackCalled = false;
2208   actor.SetSize( -1.0f, -2.0f, -3.0f );
2209   DALI_TEST_CHECK( gSetSizeCallBackCalled == true );
2210   DALI_TEST_EQUALS( Vector3( -1.0f, -2.0f, -3.0f ), gSetSize,  TEST_LOCATION );
2211 }
2212
2213 // validation stuff for onstage & offstage signals
2214 static std::vector< std::string > gActorNamesOnOffStage;
2215 static int gOnStageCallBackCalled;
2216 static void OnStageCallback( Actor actor )
2217 {
2218   ++gOnStageCallBackCalled;
2219   gActorNamesOnOffStage.push_back( actor.GetName() );
2220   DALI_TEST_CHECK( actor.OnStage() == true );
2221 }
2222 static int gOffStageCallBackCalled;
2223 static void OffStageCallback( Actor actor )
2224 {
2225   ++gOffStageCallBackCalled;
2226   gActorNamesOnOffStage.push_back( actor.GetName() );
2227   DALI_TEST_CHECK( actor.OnStage() == false );
2228 }
2229
2230 static void UtcDaliActorOnOffStageSignal()
2231 {
2232   tet_infoline("Testing Dali::Actor::OnStageSignal() and OffStageSignal()");
2233
2234   TestApplication application;
2235
2236   // clean test data
2237   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2238   gActorNamesOnOffStage.clear();
2239
2240   Actor parent = Actor::New();
2241   parent.SetName( "parent" );
2242   parent.OnStageSignal().Connect( OnStageCallback );
2243   parent.OffStageSignal().Connect( OffStageCallback );
2244   // sanity check
2245   DALI_TEST_CHECK( gOnStageCallBackCalled == 0 );
2246   DALI_TEST_CHECK( gOffStageCallBackCalled == 0 );
2247
2248   // add parent to stage
2249   Stage::GetCurrent().Add( parent );
2250   // onstage emitted, offstage not
2251   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 1, TEST_LOCATION );
2252   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2253   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2254
2255   // test adding a child, should get onstage emitted
2256   // clean test data
2257   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2258   gActorNamesOnOffStage.clear();
2259
2260   Actor child = Actor::New();
2261   child.SetName( "child" );
2262   child.OnStageSignal().Connect( OnStageCallback );
2263   child.OffStageSignal().Connect( OffStageCallback );
2264   parent.Add( child ); // add child
2265   // onstage emitted, offstage not
2266   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 1, TEST_LOCATION );
2267   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2268   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2269
2270   // test removing parent from stage
2271   // clean test data
2272   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2273   gActorNamesOnOffStage.clear();
2274
2275   Stage::GetCurrent().Remove( parent );
2276   // onstage not emitted, offstage is
2277   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2278   DALI_TEST_EQUALS( gOffStageCallBackCalled, 2, TEST_LOCATION );
2279   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2280   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2281
2282   // test adding parent back to stage
2283   // clean test data
2284   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2285   gActorNamesOnOffStage.clear();
2286
2287   Stage::GetCurrent().Add( parent );
2288   // onstage emitted, offstage not
2289   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 2, TEST_LOCATION );
2290   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2291   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2292   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2293
2294   // test removing child
2295   // clean test data
2296   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2297   gActorNamesOnOffStage.clear();
2298
2299   parent.Remove( child );
2300   // onstage not emitted, offstage is
2301   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2302   DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2303   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2304
2305   // test removing parent
2306   // clean test data
2307   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2308   gActorNamesOnOffStage.clear();
2309
2310   Stage::GetCurrent().Remove( parent );
2311   // onstage not emitted, offstage is
2312   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2313   DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2314   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2315 }
2316
2317 static void UtcDaliActorFindChildByName()
2318 {
2319   tet_infoline("Testing Dali::Actor::FindChildByName()");
2320   TestApplication application;
2321
2322   Actor parent = Actor::New();
2323   parent.SetName( "parent" );
2324   Actor first  = Actor::New();
2325   first .SetName( "first" );
2326   Actor second = Actor::New();
2327   second.SetName( "second" );
2328
2329   parent.Add(first);
2330   first.Add(second);
2331
2332   Actor found = parent.FindChildByName( "foo" );
2333   DALI_TEST_CHECK( !found );
2334
2335   found = parent.FindChildByName( "parent" );
2336   DALI_TEST_CHECK( found == parent );
2337
2338   found = parent.FindChildByName( "first" );
2339   DALI_TEST_CHECK( found == first );
2340
2341   found = parent.FindChildByName( "second" );
2342   DALI_TEST_CHECK( found == second );
2343 }
2344
2345 static void UtcDaliActorFindChildByAlias()
2346 {
2347   tet_infoline("Testing Dali::Actor::FindChildByAlias()");
2348   TestApplication application;
2349
2350   Actor parent = Actor::New();
2351   parent.SetName( "parent" );
2352   Actor first  = Actor::New();
2353   first .SetName( "first" );
2354   Actor second = Actor::New();
2355   second.SetName( "second" );
2356
2357   parent.Add(first);
2358   first.Add(second);
2359
2360   Actor found = parent.FindChildByAlias( "foo" );
2361   DALI_TEST_CHECK( !found );
2362
2363   found = parent.FindChildByAlias( "parent" );
2364   DALI_TEST_CHECK( found == parent );
2365
2366   found = parent.FindChildByAlias( "first" );
2367   DALI_TEST_CHECK( found == first );
2368
2369   found = parent.FindChildByAlias( "second" );
2370   DALI_TEST_CHECK( found == second );
2371 }
2372
2373 static void UtcDaliActorFindChildById()
2374 {
2375   tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2376   TestApplication application;
2377
2378   Actor parent = Actor::New();
2379   Actor first  = Actor::New();
2380   Actor second = Actor::New();
2381
2382   parent.Add(first);
2383   first.Add(second);
2384
2385   Actor found = parent.FindChildById( 100000 );
2386   DALI_TEST_CHECK( !found );
2387
2388   found = parent.FindChildById( parent.GetId() );
2389   DALI_TEST_CHECK( found == parent );
2390
2391   found = parent.FindChildById( first.GetId() );
2392   DALI_TEST_CHECK( found == first );
2393
2394   found = parent.FindChildById( second.GetId() );
2395   DALI_TEST_CHECK( found == second );
2396 }
2397
2398 static void UtcDaliActorHitTest()
2399 {
2400   struct HitTestData
2401   {
2402   public:
2403     HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result )
2404     : mScale( scale ),
2405       mTouchPoint( touchPoint ),
2406       mResult( result )
2407     {}
2408
2409     Vector3 mScale;
2410     Vector2 mTouchPoint;
2411     bool mResult;
2412   };
2413
2414   TestApplication application;
2415   tet_infoline(" UtcDaliActorHitTest");
2416
2417   // Fill a vector with different hit tests.
2418   struct HitTestData* hitTestData[] = {
2419     //                    scale                     touch point           result
2420     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ),  // touch point close to the right edge (inside)
2421     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside)
2422     new HitTestData( Vector3( 110.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), true ),  // same point as above with a wider scale. Should be inside.
2423     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside)
2424     new HitTestData( Vector3( 100.f, 110.f, 1.f ), Vector2( 200.f, 451.f ), true ),  // same point as above with a wider scale. Should be inside.
2425     NULL,
2426   };
2427
2428   // get the root layer
2429   Actor actor = Actor::New();
2430   actor.SetAnchorPoint( AnchorPoint::CENTER );
2431   actor.SetParentOrigin( ParentOrigin::CENTER );
2432
2433   Stage::GetCurrent().Add( actor );
2434
2435   gTouchCallBackCalled = false;
2436
2437   unsigned int index = 0;
2438   while( NULL != hitTestData[index] )
2439   {
2440     actor.SetSize( 1.f, 1.f );
2441     actor.SetScale( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z );
2442
2443     // flush the queue and render once
2444     application.SendNotification();
2445     application.Render();
2446
2447     DALI_TEST_CHECK( !gTouchCallBackCalled );
2448
2449     // connect to its touch signal
2450     actor.TouchedSignal().Connect(TestCallback);
2451
2452     Dali::TouchPoint point( 0, TouchPoint::Down, hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y );
2453     Dali::Integration::TouchEvent event;
2454     event.AddPoint( point );
2455
2456     // flush the queue and render once
2457     application.SendNotification();
2458     application.Render();
2459     application.GetCore().SendEvent( event );
2460
2461     DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult );
2462
2463     if( gTouchCallBackCalled != hitTestData[index]->mResult )
2464       tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2465                  hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z,
2466                  hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
2467                  hitTestData[index]->mResult );
2468
2469     gTouchCallBackCalled = false;
2470     ++index;
2471   }
2472 }
2473
2474 static void UtcDaliActorSetDrawMode()
2475 {
2476   TestApplication app;
2477   tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2478
2479   Actor a = Actor::New();
2480
2481   Stage::GetCurrent().Add(a);
2482   app.SendNotification();
2483   app.Render(0);
2484   app.SendNotification();
2485   app.Render(1);
2486
2487   DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Ensure overlay is off by default
2488
2489   a.SetDrawMode( DrawMode::OVERLAY );
2490   app.SendNotification();
2491   app.Render(1);
2492
2493   DALI_TEST_CHECK( DrawMode::OVERLAY == a.GetDrawMode() ); // Check Actor is overlay
2494
2495   a.SetDrawMode( DrawMode::STENCIL );
2496   app.SendNotification();
2497   app.Render(1);
2498
2499   DALI_TEST_CHECK( DrawMode::STENCIL == a.GetDrawMode() ); // Check Actor is stencil, not overlay
2500
2501   a.SetDrawMode( DrawMode::NORMAL );
2502   app.SendNotification();
2503   app.Render(1);
2504
2505   DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Check Actor is not stencil
2506 }
2507
2508 static void UtcDaliActorSetDrawModeOverlayRender()
2509 {
2510   TestApplication app;
2511   tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2512
2513   app.SendNotification();
2514   app.Render(1);
2515
2516   std::vector<GLuint> ids;
2517   ids.push_back( 8 );   // first rendered actor
2518   ids.push_back( 9 );   // second rendered actor
2519   ids.push_back( 10 );  // third rendered actor
2520   app.GetGlAbstraction().SetNextTextureIds( ids );
2521
2522   BitmapImage imageA = BitmapImage::New(16, 16);
2523   BitmapImage imageB = BitmapImage::New(16, 16);
2524   BitmapImage imageC = BitmapImage::New(16, 16);
2525   ImageActor a = ImageActor::New( imageA );
2526   ImageActor b = ImageActor::New( imageB );
2527   ImageActor c = ImageActor::New( imageC );
2528
2529   // Render a,b,c as regular non-overlays. so order will be:
2530   // a (8)
2531   // b (9)
2532   // c (10)
2533   Stage::GetCurrent().Add(a);
2534   Stage::GetCurrent().Add(b);
2535   Stage::GetCurrent().Add(c);
2536
2537   app.SendNotification();
2538   app.Render(1);
2539
2540   // Should be 3 textures changes.
2541   const std::vector<GLuint>& boundTextures = app.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
2542   typedef std::vector<GLuint>::size_type TextureSize;
2543   DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
2544   if( boundTextures.size() == 3 )
2545   {
2546     DALI_TEST_CHECK( boundTextures[0] == 8u );
2547     DALI_TEST_CHECK( boundTextures[1] == 9u );
2548     DALI_TEST_CHECK( boundTextures[2] == 10u );
2549   }
2550
2551   // Now texture ids have been set, we can monitor their render order.
2552   // render a as an overlay (last), so order will be:
2553   // b (9)
2554   // c (10)
2555   // a (8)
2556   a.SetDrawMode( DrawMode::OVERLAY );
2557   app.GetGlAbstraction().ClearBoundTextures();
2558
2559   app.SendNotification();
2560   app.Render(1);
2561
2562   // Should be 3 texture changes.
2563   DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
2564   if( boundTextures.size() == 3 )
2565   {
2566     DALI_TEST_CHECK( boundTextures[0] == 9u );
2567     DALI_TEST_CHECK( boundTextures[1] == 10u );
2568     DALI_TEST_CHECK( boundTextures[2] == 8u );
2569   }
2570 }
2571
2572 /**
2573  * Simulates a Down Touch at 25.0, 25.0.
2574  * @param[in] app Test Application instance.
2575  */
2576 static void SimulateTouchForSetOverlayHitTest(TestApplication& app)
2577 {
2578   app.SendNotification();
2579   app.Render(1);
2580   app.SendNotification();
2581   app.Render(1);
2582
2583   gTouchCallBackCalled = false;
2584   gTouchCallBack2Called = false;
2585
2586   // simulate a touch event
2587   Dali::TouchPoint point( 0, TouchPoint::Down, 25.0f, 25.0f );
2588   Dali::Integration::TouchEvent event;
2589   event.AddPoint( point );
2590   app.GetCore().SendEvent( event );
2591
2592   app.SendNotification();
2593   app.Render(1);
2594   app.SendNotification();
2595   app.Render(1);
2596 }
2597
2598 static void UtcDaliActorSetDrawModeOverlayHitTest()
2599 {
2600   TestApplication app;
2601   tet_infoline(" UtcDaliActorSetDrawModeOverlayHitTest");
2602
2603   BitmapImage imageA = BitmapImage::New(16, 16);
2604   BitmapImage imageB = BitmapImage::New(16, 16);
2605   ImageActor a = ImageActor::New( imageA );
2606   ImageActor b = ImageActor::New( imageB );
2607
2608   // Render a,b as regular non-overlays. so order will be:
2609   Stage::GetCurrent().Add(a);
2610   Stage::GetCurrent().Add(b);
2611
2612   a.SetSize(Vector2(100.0f, 100.0f));
2613   b.SetSize(Vector2(100.0f, 100.0f));
2614
2615   // position b overlapping a. (regular non-overlays)
2616   // hit test at point 'x'
2617   // --------
2618   // |      |
2619   // | a    |
2620   // |   --------
2621   // |   |x     |
2622   // |   |      |
2623   // ----|      |
2624   //     |   b  |
2625   //     |      |
2626   //     --------
2627   // note: b is on top, because it's Z position is higher.
2628   a.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
2629   b.SetPosition(Vector3(50.0f, 50.0f, 1.0f));
2630
2631   // connect to their touch signals
2632   a.TouchedSignal().Connect(TestCallback);
2633   b.TouchedSignal().Connect(TestCallback2);
2634
2635   a.SetDrawMode( DrawMode::NORMAL );
2636   b.SetDrawMode( DrawMode::NORMAL );
2637   SimulateTouchForSetOverlayHitTest(app);
2638
2639   DALI_TEST_CHECK( gTouchCallBackCalled == false );
2640   DALI_TEST_CHECK( gTouchCallBack2Called == true );
2641   // Make Actor a an overlay.
2642   // --------
2643   // |      |
2644   // | a    |
2645   // |      |----
2646   // |    x |   |
2647   // |      |   |
2648   // --------   |
2649   //     |   b  |
2650   //     |      |
2651   //     --------
2652   // note: a is on top, because it is an overlay.
2653   a.SetDrawMode( DrawMode::OVERLAY );
2654   b.SetDrawMode( DrawMode::NORMAL );
2655   SimulateTouchForSetOverlayHitTest(app);
2656
2657   DALI_TEST_CHECK( gTouchCallBackCalled == true );
2658   DALI_TEST_CHECK( gTouchCallBack2Called == false );
2659   // Make both Actors as overlays
2660   // --------
2661   // |      |
2662   // | a    |
2663   // |   --------
2664   // |   |x     |
2665   // |   |      |
2666   // ----|      |
2667   //     |   b  |
2668   //     |      |
2669   //     --------
2670   // note: b is on top, because it is the 2nd child in the hierarchy.
2671   a.SetDrawMode( DrawMode::OVERLAY );
2672   b.SetDrawMode( DrawMode::OVERLAY );
2673   SimulateTouchForSetOverlayHitTest(app);
2674
2675   DALI_TEST_CHECK( gTouchCallBackCalled == false );
2676   DALI_TEST_CHECK( gTouchCallBack2Called == true );
2677 }
2678
2679 static void UtcDaliActorGetCurrentWorldMatrix()
2680 {
2681   TestApplication app;
2682   tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
2683
2684   Actor parent = Actor::New();
2685   parent.SetParentOrigin(ParentOrigin::CENTER);
2686   parent.SetAnchorPoint(AnchorPoint::CENTER);
2687   Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2688   Radian rotationAngle(Degree(85.0f));
2689   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2690   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2691   parent.SetPosition( parentPosition );
2692   parent.SetRotation( parentRotation );
2693   parent.SetScale( parentScale );
2694   Stage::GetCurrent().Add( parent );
2695
2696   Actor child = Actor::New();
2697   child.SetParentOrigin(ParentOrigin::CENTER);
2698   Vector3 childPosition( 0.0f, 0.0f, 100.0f );
2699   Radian childRotationAngle(Degree(23.0f));
2700   Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
2701   Vector3 childScale( 2.0f, 2.0f, 2.0f );
2702   child.SetPosition( childPosition );
2703   child.SetRotation( childRotation );
2704   child.SetScale( childScale );
2705   parent.Add( child );
2706
2707   // The actors should not have a world matrix yet
2708   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), Matrix::IDENTITY, 0.001, TEST_LOCATION );
2709   DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), Matrix::IDENTITY, 0.001, TEST_LOCATION );
2710
2711   app.SendNotification();
2712   app.Render(0);
2713   app.Render();
2714   app.SendNotification();
2715
2716   Matrix parentMatrix(false);
2717   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2718
2719   Vector3 childWorldPosition = parentPosition + parentRotation * parentScale * childPosition;
2720   Quaternion childWorldRotation = parentRotation * childRotation;
2721   Vector3 childWorldScale = parentScale * childScale;
2722
2723   Matrix childWorldMatrix(false);
2724   childWorldMatrix.SetTransformComponents(childWorldScale, childWorldRotation, childWorldPosition);
2725
2726   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2727   DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), childWorldMatrix, 0.001, TEST_LOCATION );
2728 }
2729
2730
2731 struct PositionComponentConstraint
2732 {
2733   PositionComponentConstraint(){}
2734
2735   Vector3 operator()(const Vector3& current, const PropertyInput& property)
2736   {
2737     const Matrix& m = property.GetMatrix();
2738     Vector3 pos;
2739     Vector3 scale;
2740     Quaternion rot;
2741     m.GetTransformComponents(pos, rot, scale);
2742     return pos;
2743   }
2744 };
2745
2746
2747 static void UtcDaliActorConstrainedToWorldMatrix()
2748 {
2749   TestApplication app;
2750   tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
2751
2752   Actor parent = Actor::New();
2753   parent.SetParentOrigin(ParentOrigin::CENTER);
2754   parent.SetAnchorPoint(AnchorPoint::CENTER);
2755   Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2756   Radian rotationAngle(Degree(85.0f));
2757   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2758   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2759   parent.SetPosition( parentPosition );
2760   parent.SetRotation( parentRotation );
2761   parent.SetScale( parentScale );
2762   Stage::GetCurrent().Add( parent );
2763
2764   Actor child = Actor::New();
2765   child.SetParentOrigin(ParentOrigin::CENTER);
2766   Constraint posConstraint = Constraint::New<Vector3>( Actor::POSITION, Source( parent, Actor::WORLD_MATRIX), PositionComponentConstraint() );
2767   child.ApplyConstraint(posConstraint);
2768
2769   Stage::GetCurrent().Add( child );
2770
2771   // The actors should not have a world matrix yet
2772   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), Matrix::IDENTITY, 0.001, TEST_LOCATION );
2773   DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), Matrix::IDENTITY, 0.001, TEST_LOCATION );
2774
2775   app.SendNotification();
2776   app.Render(0);
2777   app.Render();
2778   app.SendNotification();
2779
2780   Matrix parentMatrix(false);
2781   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2782
2783   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2784   DALI_TEST_EQUALS( child.GetCurrentPosition(), parent.GetCurrentPosition(), 0.001, TEST_LOCATION );
2785 }
2786
2787 static void UtcDaliActorUnparent()
2788 {
2789   TestApplication app;
2790   tet_infoline(" UtcDaliActorUnparent");
2791
2792   Actor parent = Actor::New();
2793   Stage::GetCurrent().Add( parent );
2794
2795   Actor child = Actor::New();
2796
2797   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2798   DALI_TEST_CHECK( !child.GetParent() );
2799
2800   // Test that calling Unparent with no parent is a NOOP
2801   child.Unparent();
2802
2803   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2804   DALI_TEST_CHECK( !child.GetParent() );
2805
2806   // Test that Unparent works
2807   parent.Add( child );
2808
2809   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2810   DALI_TEST_CHECK( parent == child.GetParent() );
2811
2812   child.Unparent();
2813
2814   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2815   DALI_TEST_CHECK( !child.GetParent() );
2816
2817   // Test that UnparentAndReset works
2818   parent.Add( child );
2819
2820   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2821   DALI_TEST_CHECK( parent == child.GetParent() );
2822
2823   UnparentAndReset( child );
2824
2825   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2826   DALI_TEST_CHECK( !child );
2827
2828   // Test that UnparentAndReset is a NOOP with empty handle
2829   UnparentAndReset( child );
2830
2831   DALI_TEST_CHECK( !child );
2832 }
2833
2834 static void UtcDaliActorGetChildAt()
2835 {
2836   TestApplication app;
2837   tet_infoline(" UtcDaliActorGetChildAt");
2838
2839   Actor parent = Actor::New();
2840   Stage::GetCurrent().Add( parent );
2841
2842   Actor child0 = Actor::New();
2843   parent.Add( child0 );
2844
2845   Actor child1 = Actor::New();
2846   parent.Add( child1 );
2847
2848   Actor child2 = Actor::New();
2849   parent.Add( child2 );
2850
2851   DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
2852   DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
2853   DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
2854 }
2855
2856 static void UtcDaliActorSetGetOverlay()
2857 {
2858   TestApplication app;
2859   tet_infoline(" UtcDaliActorSetGetOverlay");
2860
2861   Actor parent = Actor::New();
2862   parent.SetDrawMode(DrawMode::OVERLAY );
2863   DALI_TEST_CHECK( parent.GetDrawMode() == DrawMode::OVERLAY );
2864 }
2865
2866
2867 // Current Dynamics functions are crashing, so testing these sections are futile
2868
2869 static void UtcDaliActorDynamics()
2870 {
2871   DALI_TEST_CHECK( true );
2872 }
2873
2874 static void UtcDaliActorCreateDestroy()
2875 {
2876   Actor* actor = new Actor;
2877   DALI_TEST_CHECK( actor );
2878   delete actor;
2879 }