[dali_1.9.29] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Actor.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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
18 // Enable debug log for test coverage
19 #define DEBUG_ENABLED 1
20
21 #include <dali-test-suite-utils.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali/integration-api/events/touch-event-integ.h>
26 #include <dali/public-api/dali-core.h>
27 #include <mesh-builder.h>
28
29 #include <cfloat> // For FLT_MAX
30 #include <string>
31
32 #include "assert.h"
33
34 //& set: DaliActor
35
36 using std::string;
37 using namespace Dali;
38
39 void utc_dali_actor_startup(void)
40 {
41   test_return_value = TET_UNDEF;
42 }
43
44 void utc_dali_actor_cleanup(void)
45 {
46   test_return_value = TET_PASS;
47 }
48
49 namespace
50 {
51 bool gTouchCallBackCalled  = false;
52 bool gTouchCallBackCalled2 = false;
53 bool gTouchCallBackCalled3 = false;
54
55 bool gHoverCallBackCalled = false;
56
57 static bool gTestConstraintCalled;
58
59 LayoutDirection::Type gLayoutDirectionType;
60
61 struct TestConstraint
62 {
63   void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
64   {
65     gTestConstraintCalled = true;
66   }
67 };
68
69 /**
70  * TestConstraint reference.
71  * When constraint is called, the resultRef is updated
72  * with the value supplied.
73  */
74 template<typename T>
75 struct TestConstraintRef
76 {
77   TestConstraintRef(unsigned int& resultRef, unsigned int value)
78   : mResultRef(resultRef),
79     mValue(value)
80   {
81   }
82
83   void operator()(T& current, const PropertyInputContainer& /* inputs */)
84   {
85     mResultRef = mValue;
86   }
87
88   unsigned int& mResultRef;
89   unsigned int  mValue;
90 };
91
92 static bool TestTouchCallback(Actor, const TouchEvent&)
93 {
94   gTouchCallBackCalled = true;
95   return true;
96   END_TEST;
97 }
98
99 static bool TestTouchCallback2(Actor, const TouchEvent&)
100 {
101   gTouchCallBackCalled2 = true;
102   return true;
103   END_TEST;
104 }
105
106 static bool TestTouchCallback3(Actor, const TouchEvent&)
107 {
108   gTouchCallBackCalled3 = true;
109   return true;
110   END_TEST;
111 }
112
113 static void ResetTouchCallbacks()
114 {
115   gTouchCallBackCalled  = false;
116   gTouchCallBackCalled2 = false;
117   gTouchCallBackCalled3 = false;
118 }
119
120 static bool TestCallback3(Actor actor, const HoverEvent& event)
121 {
122   gHoverCallBackCalled = true;
123   return false;
124   END_TEST;
125 }
126
127 // validation stuff for onstage & offstage signals
128 static std::vector<std::string> gActorNamesOnOffScene;
129 static int                      gOnSceneCallBackCalled;
130 void                            OnSceneCallback(Actor actor)
131 {
132   ++gOnSceneCallBackCalled;
133   gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
134   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
135 }
136 static int gOffSceneCallBackCalled;
137 void       OffSceneCallback(Actor actor)
138 {
139   ++gOffSceneCallBackCalled;
140   gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
141   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
142 }
143
144 struct PositionComponentConstraint
145 {
146   PositionComponentConstraint()
147   {
148   }
149
150   void operator()(Vector3& pos, const PropertyInputContainer& inputs)
151   {
152     const Matrix& m = inputs[0]->GetMatrix();
153     Vector3       scale;
154     Quaternion    rot;
155     m.GetTransformComponents(pos, rot, scale);
156   }
157 };
158
159 struct OrientationComponentConstraint
160 {
161   OrientationComponentConstraint()
162   {
163   }
164
165   void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
166   {
167     const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
168     Vector3           pos, scale;
169     Quaternion        rot;
170     orientation = parentOrientation;
171   }
172 };
173 // OnRelayout
174
175 static bool                     gOnRelayoutCallBackCalled = false;
176 static std::vector<std::string> gActorNamesRelayout;
177
178 void OnRelayoutCallback(Actor actor)
179 {
180   gOnRelayoutCallBackCalled = true;
181   gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
182 }
183
184 struct VisibilityChangedFunctorData
185 {
186   VisibilityChangedFunctorData()
187   : actor(),
188     visible(false),
189     type(DevelActor::VisibilityChange::SELF),
190     called(false)
191   {
192   }
193
194   void Reset()
195   {
196     actor.Reset();
197     visible = false;
198     type    = DevelActor::VisibilityChange::SELF;
199     called  = false;
200   }
201
202   void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
203   {
204     DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
205     DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
206     DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
207     DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
208   }
209
210   void Check(bool compareCalled, const std::string& location)
211   {
212     DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
213   }
214
215   Actor                              actor;
216   bool                               visible;
217   DevelActor::VisibilityChange::Type type;
218   bool                               called;
219 };
220
221 struct VisibilityChangedFunctor
222 {
223   VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
224   : data(dataVar)
225   {
226   }
227
228   void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
229   {
230     data.actor   = actor;
231     data.visible = visible;
232     data.type    = type;
233     data.called  = true;
234   }
235
236   VisibilityChangedFunctorData& data;
237 };
238
239 struct VisibilityChangedVoidFunctor
240 {
241   VisibilityChangedVoidFunctor(bool& signalCalled)
242   : mSignalCalled(signalCalled)
243   {
244   }
245
246   void operator()()
247   {
248     mSignalCalled = true;
249   }
250
251   bool& mSignalCalled;
252 };
253
254 struct ChildOrderChangedFunctor
255 {
256   ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
257   : mSignalCalled(signalCalled),
258     mActor(actor)
259   {
260   }
261
262   void operator()(Actor actor)
263   {
264     mSignalCalled = true;
265     mActor        = actor;
266   }
267
268   bool&  mSignalCalled;
269   Actor& mActor;
270 };
271
272 struct CulledPropertyNotificationFunctor
273 {
274   CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
275   : mSignalCalled(signalCalled),
276     mPropertyNotification(propertyNotification)
277   {
278   }
279
280   void operator()(PropertyNotification& source)
281   {
282     mSignalCalled         = true;
283     mPropertyNotification = source;
284   }
285
286   bool&                 mSignalCalled;
287   PropertyNotification& mPropertyNotification;
288 };
289
290 } // anonymous namespace
291
292 //& purpose: Testing New API
293 int UtcDaliActorNew(void)
294 {
295   TestApplication application;
296
297   Actor actor = Actor::New();
298
299   DALI_TEST_CHECK(actor);
300   END_TEST;
301 }
302
303 //& purpose: Testing Dali::Actor::DownCast()
304 int UtcDaliActorDownCastP(void)
305 {
306   TestApplication application;
307   tet_infoline("Testing Dali::Actor::DownCast()");
308
309   Actor      actor = Actor::New();
310   BaseHandle object(actor);
311   Actor      actor2 = Actor::DownCast(object);
312   DALI_TEST_CHECK(actor2);
313   END_TEST;
314 }
315
316 //& purpose: Testing Dali::Actor::DownCast()
317 int UtcDaliActorDownCastN(void)
318 {
319   TestApplication application;
320   tet_infoline("Testing Dali::Actor::DownCast()");
321
322   BaseHandle unInitializedObject;
323   Actor      actor = Actor::DownCast(unInitializedObject);
324   DALI_TEST_CHECK(!actor);
325   END_TEST;
326 }
327
328 int UtcDaliActorMoveConstructor(void)
329 {
330   TestApplication application;
331
332   Actor actor = Actor::New();
333   DALI_TEST_CHECK(actor);
334
335   int id = actor.GetProperty<int>(Actor::Property::ID);
336
337   Actor moved = std::move(actor);
338   DALI_TEST_CHECK(moved);
339   DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
340   DALI_TEST_CHECK(!actor);
341
342   END_TEST;
343 }
344
345 int UtcDaliActorMoveAssignment(void)
346 {
347   TestApplication application;
348
349   Actor actor = Actor::New();
350   DALI_TEST_CHECK(actor);
351
352   int id = actor.GetProperty<int>(Actor::Property::ID);
353
354   Actor moved;
355   moved = std::move(actor);
356   DALI_TEST_CHECK(moved);
357   DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
358   DALI_TEST_CHECK(!actor);
359
360   END_TEST;
361 }
362
363 //& purpose: Testing Dali::Actor::GetName()
364 int UtcDaliActorGetName(void)
365 {
366   TestApplication application;
367
368   Actor actor = Actor::New();
369
370   DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
371   END_TEST;
372 }
373
374 //& purpose: Testing Dali::Actor::SetName()
375 int UtcDaliActorSetName(void)
376 {
377   TestApplication application;
378
379   string str("ActorName");
380   Actor  actor = Actor::New();
381
382   actor.SetProperty(Actor::Property::NAME, str);
383   DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
384   END_TEST;
385 }
386
387 int UtcDaliActorGetId(void)
388 {
389   tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
390   TestApplication application;
391
392   Actor first  = Actor::New();
393   Actor second = Actor::New();
394   Actor third  = Actor::New();
395
396   DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
397   DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
398   END_TEST;
399 }
400
401 int UtcDaliActorIsRoot(void)
402 {
403   TestApplication application;
404
405   Actor actor = Actor::New();
406   DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
407
408   // get the root layer
409   actor = application.GetScene().GetLayer(0);
410   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
411   END_TEST;
412 }
413
414 int UtcDaliActorOnScene(void)
415 {
416   TestApplication application;
417
418   Actor actor = Actor::New();
419   DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
420
421   // get the root layer
422   actor = application.GetScene().GetLayer(0);
423   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
424   END_TEST;
425 }
426
427 int UtcDaliActorIsLayer(void)
428 {
429   TestApplication application;
430
431   Actor actor = Actor::New();
432   DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
433
434   // get the root layer
435   actor = application.GetScene().GetLayer(0);
436   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
437   END_TEST;
438 }
439
440 int UtcDaliActorGetLayer(void)
441 {
442   TestApplication application;
443
444   Actor actor = Actor::New();
445   application.GetScene().Add(actor);
446   Layer layer = actor.GetLayer();
447
448   DALI_TEST_CHECK(layer);
449
450   // get the root layers layer
451   actor = application.GetScene().GetLayer(0);
452   DALI_TEST_CHECK(actor.GetLayer());
453   END_TEST;
454 }
455
456 int UtcDaliActorAddP(void)
457 {
458   tet_infoline("Testing Actor::Add");
459   TestApplication application;
460
461   Actor parent = Actor::New();
462   Actor child  = Actor::New();
463
464   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
465
466   parent.Add(child);
467
468   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
469
470   Actor parent2 = Actor::New();
471   parent2.Add(child);
472
473   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
474   DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
475
476   // try Adding to same parent again, works
477   parent2.Add(child);
478   DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
479
480   // try reparenting an orphaned child
481   {
482     Actor temporaryParent = Actor::New();
483     temporaryParent.Add(child);
484     DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
485   }
486   // temporaryParent has now died, reparent the orphaned child
487   parent2.Add(child);
488   DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
489
490   END_TEST;
491 }
492
493 int UtcDaliActorAddN(void)
494 {
495   tet_infoline("Testing Actor::Add");
496   TestApplication application;
497
498   Actor child = Actor::New();
499
500   Actor parent2 = Actor::New();
501   parent2.Add(child);
502
503   // try illegal Add
504   try
505   {
506     parent2.Add(parent2);
507     tet_printf("Assertion test failed - no Exception\n");
508     tet_result(TET_FAIL);
509   }
510   catch(Dali::DaliException& e)
511   {
512     DALI_TEST_PRINT_ASSERT(e);
513     DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
514     DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
515   }
516   catch(...)
517   {
518     tet_printf("Assertion test failed - wrong Exception\n");
519     tet_result(TET_FAIL);
520   }
521
522   // try reparenting root
523   try
524   {
525     parent2.Add(application.GetScene().GetLayer(0));
526     tet_printf("Assertion test failed - no Exception\n");
527     tet_result(TET_FAIL);
528   }
529   catch(Dali::DaliException& e)
530   {
531     DALI_TEST_PRINT_ASSERT(e);
532     DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
533     DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
534   }
535   catch(...)
536   {
537     tet_printf("Assertion test failed - wrong Exception\n");
538     tet_result(TET_FAIL);
539   }
540
541   // try Add empty
542   try
543   {
544     Actor empty;
545     parent2.Add(empty);
546     tet_printf("Assertion test failed - no Exception\n");
547     tet_result(TET_FAIL);
548   }
549   catch(Dali::DaliException& e)
550   {
551     DALI_TEST_PRINT_ASSERT(e);
552     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
553     DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
554   }
555   catch(...)
556   {
557     tet_printf("Assertion test failed - wrong Exception\n");
558     tet_result(TET_FAIL);
559   }
560
561   END_TEST;
562 }
563
564 int UtcDaliActorRemoveN(void)
565 {
566   tet_infoline("Testing Actor::Remove");
567   TestApplication application;
568
569   Actor parent = Actor::New();
570   Actor child  = Actor::New();
571   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
572
573   parent.Add(child);
574   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
575
576   parent.Remove(child);
577   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
578
579   // remove again, no problem
580   parent.Remove(child);
581   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
582
583   // add child back
584   parent.Add(child);
585   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
586   // try Remove self, its a no-op
587   parent.Remove(parent);
588   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
589
590   // try Remove empty
591   try
592   {
593     Actor empty;
594     parent.Remove(empty);
595     tet_printf("Assertion test failed - no Exception\n");
596     tet_result(TET_FAIL);
597   }
598   catch(Dali::DaliException& e)
599   {
600     DALI_TEST_PRINT_ASSERT(e);
601     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
602     DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
603   }
604   catch(...)
605   {
606     tet_printf("Assertion test failed - wrong Exception\n");
607     tet_result(TET_FAIL);
608   }
609   END_TEST;
610 }
611
612 int UtcDaliActorRemoveP(void)
613 {
614   TestApplication application;
615
616   Actor parent = Actor::New();
617   Actor child  = Actor::New();
618   Actor random = Actor::New();
619
620   application.GetScene().Add(parent);
621
622   DALI_TEST_CHECK(parent.GetChildCount() == 0);
623
624   parent.Add(child);
625
626   DALI_TEST_CHECK(parent.GetChildCount() == 1);
627
628   parent.Remove(random);
629
630   DALI_TEST_CHECK(parent.GetChildCount() == 1);
631
632   application.GetScene().Remove(parent);
633
634   DALI_TEST_CHECK(parent.GetChildCount() == 1);
635   END_TEST;
636 }
637
638 int UtcDaliActorGetChildCount(void)
639 {
640   TestApplication application;
641
642   Actor parent = Actor::New();
643   Actor child  = Actor::New();
644
645   DALI_TEST_CHECK(parent.GetChildCount() == 0);
646
647   parent.Add(child);
648
649   DALI_TEST_CHECK(parent.GetChildCount() == 1);
650   END_TEST;
651 }
652
653 int UtcDaliActorGetChildren01(void)
654 {
655   TestApplication application;
656
657   Actor parent = Actor::New();
658   Actor first  = Actor::New();
659   Actor second = Actor::New();
660   Actor third  = Actor::New();
661
662   parent.Add(first);
663   parent.Add(second);
664   parent.Add(third);
665
666   DALI_TEST_CHECK(parent.GetChildAt(0) == first);
667   DALI_TEST_CHECK(parent.GetChildAt(1) == second);
668   DALI_TEST_CHECK(parent.GetChildAt(2) == third);
669   END_TEST;
670 }
671
672 int UtcDaliActorGetChildren02(void)
673 {
674   TestApplication application;
675
676   Actor parent = Actor::New();
677   Actor first  = Actor::New();
678   Actor second = Actor::New();
679   Actor third  = Actor::New();
680
681   parent.Add(first);
682   parent.Add(second);
683   parent.Add(third);
684
685   const Actor& constParent = parent;
686
687   DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
688   DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
689   DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
690   END_TEST;
691 }
692
693 int UtcDaliActorGetParent01(void)
694 {
695   TestApplication application;
696
697   Actor parent = Actor::New();
698   Actor child  = Actor::New();
699
700   parent.Add(child);
701
702   DALI_TEST_CHECK(child.GetParent() == parent);
703   END_TEST;
704 }
705
706 int UtcDaliActorGetParent02(void)
707 {
708   TestApplication application;
709
710   Actor actor = Actor::New();
711
712   DALI_TEST_CHECK(!actor.GetParent());
713   END_TEST;
714 }
715
716 int UtcDaliActorCustomProperty(void)
717 {
718   TestApplication application;
719
720   Actor actor = Actor::New();
721   application.GetScene().Add(actor);
722
723   float           startValue(1.0f);
724   Property::Index index = actor.RegisterProperty("testProperty", startValue);
725   DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
726
727   application.SendNotification();
728   application.Render(0);
729   DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
730
731   actor.SetProperty(index, 5.0f);
732
733   application.SendNotification();
734   application.Render(0);
735   DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
736   END_TEST;
737 }
738
739 int UtcDaliActorCustomPropertyIntToFloat(void)
740 {
741   TestApplication application;
742
743   Actor actor = Actor::New();
744   application.GetScene().Add(actor);
745
746   float           startValue(5.0f);
747   Property::Index index = actor.RegisterProperty("testProperty", startValue);
748   DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
749
750   application.SendNotification();
751   application.Render(0);
752   DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
753
754   actor.SetProperty(index, int(1));
755
756   application.SendNotification();
757   application.Render(0);
758   DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
759   END_TEST;
760 }
761
762 int UtcDaliActorCustomPropertyFloatToInt(void)
763 {
764   TestApplication application;
765
766   Actor actor = Actor::New();
767   application.GetScene().Add(actor);
768
769   int             startValue(5);
770   Property::Index index = actor.RegisterProperty("testProperty", startValue);
771   DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
772
773   application.SendNotification();
774   application.Render(0);
775   DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
776
777   actor.SetProperty(index, float(1.5));
778
779   application.SendNotification();
780   application.Render(0);
781   DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
782   END_TEST;
783 }
784
785 int UtcDaliActorSetParentOrigin(void)
786 {
787   TestApplication application;
788
789   Actor actor = Actor::New();
790
791   Vector3 vector(0.7f, 0.8f, 0.9f);
792   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
793
794   actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
795
796   // flush the queue and render once
797   application.SendNotification();
798   application.Render();
799
800   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
801
802   application.GetScene().Add(actor);
803
804   actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
805
806   // flush the queue and render once
807   application.SendNotification();
808   application.Render();
809
810   DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
811
812   application.GetScene().Remove(actor);
813   END_TEST;
814 }
815
816 int UtcDaliActorSetParentOriginIndividual(void)
817 {
818   TestApplication application;
819
820   Actor actor = Actor::New();
821
822   Vector3 vector(0.7f, 0.8f, 0.9f);
823   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
824
825   actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
826
827   // flush the queue and render once
828   application.SendNotification();
829   application.Render();
830
831   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
832
833   actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
834
835   // flush the queue and render once
836   application.SendNotification();
837   application.Render();
838
839   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
840
841   actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
842
843   // flush the queue and render once
844   application.SendNotification();
845   application.Render();
846
847   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
848
849   END_TEST;
850 }
851
852 int UtcDaliActorGetCurrentParentOrigin(void)
853 {
854   TestApplication application;
855
856   Actor actor = Actor::New();
857
858   Vector3 vector(0.7f, 0.8f, 0.9f);
859   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
860
861   actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
862
863   // flush the queue and render once
864   application.SendNotification();
865   application.Render();
866
867   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
868   END_TEST;
869 }
870
871 int UtcDaliActorSetAnchorPoint(void)
872 {
873   TestApplication application;
874
875   Actor actor = Actor::New();
876
877   Vector3 vector(0.7f, 0.8f, 0.9f);
878   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
879
880   actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
881
882   // flush the queue and render once
883   application.SendNotification();
884   application.Render();
885
886   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
887
888   application.GetScene().Add(actor);
889
890   actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
891   // flush the queue and render once
892   application.SendNotification();
893   application.Render();
894
895   DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
896
897   application.GetScene().Remove(actor);
898   END_TEST;
899 }
900
901 int UtcDaliActorSetAnchorPointIndividual(void)
902 {
903   TestApplication application;
904
905   Actor actor = Actor::New();
906
907   Vector3 vector(0.7f, 0.8f, 0.9f);
908   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
909
910   actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
911
912   // flush the queue and render once
913   application.SendNotification();
914   application.Render();
915
916   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
917
918   actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
919
920   // flush the queue and render once
921   application.SendNotification();
922   application.Render();
923
924   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
925
926   actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
927
928   // flush the queue and render once
929   application.SendNotification();
930   application.Render();
931
932   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
933
934   END_TEST;
935 }
936
937 int UtcDaliActorGetCurrentAnchorPoint(void)
938 {
939   TestApplication application;
940
941   Actor actor = Actor::New();
942
943   Vector3 vector(0.7f, 0.8f, 0.9f);
944   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
945
946   actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
947
948   // flush the queue and render once
949   application.SendNotification();
950   application.Render();
951
952   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
953   END_TEST;
954 }
955
956 int UtcDaliActorSetSize01(void)
957 {
958   TestApplication application;
959
960   Actor   actor = Actor::New();
961   Vector3 vector(100.0f, 100.0f, 0.0f);
962
963   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
964
965   actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
966
967   // Immediately retrieve the size after setting
968   Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
969   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
970   DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
971   DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
972   DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
973
974   // Flush the queue and render once
975   application.SendNotification();
976   application.Render();
977
978   // Check the size in the new frame
979   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
980
981   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
982   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
983   DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
984   DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
985   DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
986
987   // Check async behaviour
988   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
989   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
990   DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
991   DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
992   DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
993
994   // Change the resize policy and check whether the size stays the same
995   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
996
997   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
998   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
999
1000   // Set a new size after resize policy is changed and check the new size
1001   actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1002
1003   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1004   DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1005
1006   // Change the resize policy again and check whether the new size stays the same
1007   actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1008
1009   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1010   DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1011
1012   // Set another new size after resize policy is changed and check the new size
1013   actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1014
1015   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1016   DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1017
1018   END_TEST;
1019 }
1020
1021 int UtcDaliActorSetSize02(void)
1022 {
1023   TestApplication application;
1024
1025   Actor   actor = Actor::New();
1026   Vector3 vector(100.0f, 100.0f, 100.0f);
1027
1028   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1029
1030   actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1031
1032   // Immediately check the size after setting
1033   Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1034   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1035
1036   // flush the queue and render once
1037   application.SendNotification();
1038   application.Render();
1039
1040   // Check the size in the new frame
1041   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1042
1043   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1044   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1045
1046   END_TEST;
1047 }
1048
1049 // SetSize(Vector2 size)
1050 int UtcDaliActorSetSize03(void)
1051 {
1052   TestApplication application;
1053
1054   Actor   actor = Actor::New();
1055   Vector3 vector(100.0f, 100.0f, 0.0f);
1056
1057   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1058
1059   actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1060
1061   // Immediately check the size after setting
1062   Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1063   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1064
1065   // flush the queue and render once
1066   application.SendNotification();
1067   application.Render();
1068
1069   // Check the size in the new frame
1070   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1071
1072   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1073   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1074
1075   END_TEST;
1076 }
1077
1078 // SetSize(Vector3 size)
1079 int UtcDaliActorSetSize04(void)
1080 {
1081   TestApplication application;
1082
1083   Actor   actor = Actor::New();
1084   Vector3 vector(100.0f, 100.0f, 100.0f);
1085
1086   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1087
1088   actor.SetProperty(Actor::Property::SIZE, vector);
1089
1090   // Immediately check the size after setting
1091   Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1092   DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1093
1094   // flush the queue and render once
1095   application.SendNotification();
1096   application.Render();
1097
1098   // Check the size in the new frame
1099   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1100
1101   application.GetScene().Add(actor);
1102   actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1103
1104   // Immediately check the size after setting
1105   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1106   DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1107
1108   // flush the queue and render once
1109   application.SendNotification();
1110   application.Render();
1111
1112   // Check the size in the new frame
1113   DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1114
1115   currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1116   DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1117
1118   application.GetScene().Remove(actor);
1119   END_TEST;
1120 }
1121
1122 int UtcDaliActorSetSizeIndividual(void)
1123 {
1124   TestApplication application;
1125
1126   Actor actor = Actor::New();
1127
1128   Vector3 vector(0.7f, 0.8f, 0.9f);
1129   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1130
1131   actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1132
1133   // Immediately check the width after setting
1134   float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1135   DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1136
1137   // flush the queue and render once
1138   application.SendNotification();
1139   application.Render();
1140
1141   // Check the width in the new frame
1142   DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1143
1144   sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1145   DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1146
1147   actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1148
1149   // Immediately check the height after setting
1150   float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1151   DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1152
1153   // flush the queue and render once
1154   application.SendNotification();
1155   application.Render();
1156
1157   // Check the height in the new frame
1158   DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1159
1160   sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1161   DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1162
1163   actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1164
1165   // Immediately check the depth after setting
1166   float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1167   DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1168
1169   // flush the queue and render once
1170   application.SendNotification();
1171   application.Render();
1172
1173   // Check the depth in the new frame
1174   DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1175
1176   sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1177   DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1178
1179   // Change the resize policy and check whether the size stays the same
1180   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1181
1182   sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1183   DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1184
1185   sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1186   DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1187
1188   sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1189   DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1190
1191   // Change the resize policy again and check whether the size stays the same
1192   actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1193
1194   sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1195   DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1196
1197   sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1198   DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1199
1200   sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1201   DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1202
1203   END_TEST;
1204 }
1205
1206 int UtcDaliActorSetSizeIndividual02(void)
1207 {
1208   TestApplication application;
1209
1210   Actor actor = Actor::New();
1211   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1212   application.GetScene().Add(actor);
1213
1214   Vector3 vector(100.0f, 200.0f, 400.0f);
1215   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1216
1217   actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1218   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1219
1220   actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1221   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1222
1223   actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1224   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1225
1226   // flush the queue and render once
1227   application.SendNotification();
1228   application.Render();
1229
1230   // Check the width in the new frame
1231   DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1232   DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1233
1234   END_TEST;
1235 }
1236
1237 int UtcDaliActorGetCurrentSize(void)
1238 {
1239   TestApplication application;
1240
1241   Actor   actor = Actor::New();
1242   Vector3 vector(100.0f, 100.0f, 20.0f);
1243
1244   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1245
1246   actor.SetProperty(Actor::Property::SIZE, vector);
1247
1248   // flush the queue and render once
1249   application.SendNotification();
1250   application.Render();
1251
1252   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1253   END_TEST;
1254 }
1255
1256 int UtcDaliActorGetNaturalSize(void)
1257 {
1258   TestApplication application;
1259
1260   Actor   actor = Actor::New();
1261   Vector3 vector(0.0f, 0.0f, 0.0f);
1262
1263   DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1264
1265   END_TEST;
1266 }
1267
1268 int UtcDaliActorGetCurrentSizeImmediate(void)
1269 {
1270   TestApplication application;
1271
1272   Actor   actor = Actor::New();
1273   Vector3 vector(100.0f, 100.0f, 20.0f);
1274
1275   DALI_TEST_CHECK(vector != actor.GetTargetSize());
1276   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1277
1278   actor.SetProperty(Actor::Property::SIZE, vector);
1279
1280   DALI_TEST_CHECK(vector == actor.GetTargetSize());
1281   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1282
1283   // flush the queue and render once
1284   application.SendNotification();
1285   application.Render();
1286
1287   DALI_TEST_CHECK(vector == actor.GetTargetSize());
1288   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1289
1290   // Animation
1291   // Build the animation
1292   const float   durationSeconds = 2.0f;
1293   Animation     animation       = Animation::New(durationSeconds);
1294   const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1295   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1296
1297   DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1298
1299   // Start the animation
1300   animation.Play();
1301
1302   application.SendNotification();
1303   application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1304
1305   DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1306
1307   END_TEST;
1308 }
1309
1310 int UtcDaliActorCalculateScreenExtents(void)
1311 {
1312   TestApplication application;
1313
1314   Actor actor = Actor::New();
1315
1316   actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1317   actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1318
1319   application.SendNotification();
1320   application.Render();
1321
1322   auto expectedExtent = Rect<>{-0.5f, -0.5f, 1.0f, 1.0f};
1323   auto actualExtent   = DevelActor::CalculateScreenExtents(actor);
1324   DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1325   DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1326   DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1327   DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1328
1329   application.GetScene().Remove(actor);
1330   END_TEST;
1331 }
1332
1333 // SetPosition(float x, float y)
1334 int UtcDaliActorSetPosition01(void)
1335 {
1336   TestApplication application;
1337
1338   Actor actor = Actor::New();
1339
1340   // Set to random to start off with
1341   actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1342
1343   Vector3 vector(100.0f, 100.0f, 0.0f);
1344
1345   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1346
1347   actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1348   // flush the queue and render once
1349   application.SendNotification();
1350   application.Render();
1351   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1352
1353   application.GetScene().Add(actor);
1354   actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1355   // flush the queue and render once
1356   application.SendNotification();
1357   application.Render();
1358   DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1359
1360   actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1361   actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1362   actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1363   // flush the queue and render once
1364   application.SendNotification();
1365   application.Render();
1366   DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1367
1368   actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1369   // flush the queue and render once
1370   application.SendNotification();
1371   application.Render();
1372   DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1373
1374   application.GetScene().Remove(actor);
1375   END_TEST;
1376 }
1377
1378 // SetPosition(float x, float y, float z)
1379 int UtcDaliActorSetPosition02(void)
1380 {
1381   TestApplication application;
1382
1383   Actor actor = Actor::New();
1384
1385   // Set to random to start off with
1386   actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1387
1388   Vector3 vector(100.0f, 100.0f, 100.0f);
1389
1390   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1391
1392   actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1393
1394   // flush the queue and render once
1395   application.SendNotification();
1396   application.Render();
1397
1398   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1399   END_TEST;
1400 }
1401
1402 // SetPosition(Vector3 position)
1403 int UtcDaliActorSetPosition03(void)
1404 {
1405   TestApplication application;
1406
1407   Actor actor = Actor::New();
1408
1409   // Set to random to start off with
1410   actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1411
1412   Vector3 vector(100.0f, 100.0f, 100.0f);
1413
1414   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1415
1416   actor.SetProperty(Actor::Property::POSITION, vector);
1417
1418   // flush the queue and render once
1419   application.SendNotification();
1420   application.Render();
1421
1422   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1423   END_TEST;
1424 }
1425
1426 int UtcDaliActorSetX(void)
1427 {
1428   TestApplication application;
1429
1430   Actor actor = Actor::New();
1431
1432   Vector3 vector(100.0f, 0.0f, 0.0f);
1433
1434   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1435
1436   actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1437
1438   // flush the queue and render once
1439   application.SendNotification();
1440   application.Render();
1441
1442   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1443   END_TEST;
1444 }
1445
1446 int UtcDaliActorSetY(void)
1447 {
1448   TestApplication application;
1449
1450   Actor actor = Actor::New();
1451
1452   Vector3 vector(0.0f, 100.0f, 0.0f);
1453
1454   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1455
1456   actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1457
1458   // flush the queue and render once
1459   application.SendNotification();
1460   application.Render();
1461
1462   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1463   END_TEST;
1464 }
1465
1466 int UtcDaliActorSetZ(void)
1467 {
1468   TestApplication application;
1469
1470   Actor actor = Actor::New();
1471
1472   Vector3 vector(0.0f, 0.0f, 100.0f);
1473
1474   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1475
1476   actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1477
1478   // flush the queue and render once
1479   application.SendNotification();
1480   application.Render();
1481
1482   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1483   END_TEST;
1484 }
1485
1486 int UtcDaliActorSetPositionProperties(void)
1487 {
1488   TestApplication application;
1489
1490   Actor actor = Actor::New();
1491
1492   Vector3 vector(0.7f, 0.8f, 0.9f);
1493   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1494
1495   actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1496   DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1497   DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1498
1499   // flush the queue and render once
1500   application.SendNotification();
1501   application.Render();
1502
1503   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1504   DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1505   DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1506   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1507   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1508
1509   actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1510   DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1511   DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1512
1513   // flush the queue and render once
1514   application.SendNotification();
1515   application.Render();
1516
1517   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1518   DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1519   DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1520   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1521   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1522
1523   actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
1524   DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1525   DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1526
1527   // flush the queue and render once
1528   application.SendNotification();
1529   application.Render();
1530
1531   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1532   DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1533   DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1534   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1535   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1536
1537   END_TEST;
1538 }
1539
1540 int UtcDaliActorTranslateBy(void)
1541 {
1542   TestApplication application;
1543
1544   Actor   actor = Actor::New();
1545   Vector3 vector(100.0f, 100.0f, 100.0f);
1546
1547   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1548
1549   actor.SetProperty(Actor::Property::POSITION, vector);
1550
1551   // flush the queue and render once
1552   application.SendNotification();
1553   application.Render();
1554
1555   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1556
1557   actor.TranslateBy(vector);
1558
1559   // flush the queue and render once
1560   application.SendNotification();
1561   application.Render();
1562
1563   DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1564   END_TEST;
1565 }
1566
1567 int UtcDaliActorGetCurrentPosition(void)
1568 {
1569   TestApplication application;
1570
1571   Actor   actor = Actor::New();
1572   Vector3 setVector(100.0f, 100.0f, 0.0f);
1573   actor.SetProperty(Actor::Property::POSITION, setVector);
1574
1575   // flush the queue and render once
1576   application.SendNotification();
1577   application.Render();
1578
1579   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
1580   END_TEST;
1581 }
1582
1583 int UtcDaliActorGetCurrentWorldPosition(void)
1584 {
1585   TestApplication application;
1586
1587   Actor   parent = Actor::New();
1588   Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1589   parent.SetProperty(Actor::Property::POSITION, parentPosition);
1590   parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1591   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1592   application.GetScene().Add(parent);
1593
1594   Actor child = Actor::New();
1595   child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1596   child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1597   Vector3 childPosition(6.0f, 6.0f, 6.0f);
1598   child.SetProperty(Actor::Property::POSITION, childPosition);
1599   parent.Add(child);
1600
1601   // The actors should not have a world position yet
1602   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1603   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1604
1605   application.SendNotification();
1606   application.Render(0);
1607
1608   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1609   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1610
1611   // The actors should have a world position now
1612   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1613   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1614   END_TEST;
1615 }
1616
1617 int UtcDaliActorSetInheritPosition(void)
1618 {
1619   tet_infoline("Testing Actor::SetInheritPosition");
1620   TestApplication application;
1621
1622   Actor   parent = Actor::New();
1623   Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1624   parent.SetProperty(Actor::Property::POSITION, parentPosition);
1625   parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1626   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1627   application.GetScene().Add(parent);
1628
1629   Actor child = Actor::New();
1630   child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1631   child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1632   Vector3 childPosition(10.0f, 11.0f, 12.0f);
1633   child.SetProperty(Actor::Property::POSITION, childPosition);
1634   parent.Add(child);
1635
1636   // The actors should not have a world position yet
1637   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1638   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1639
1640   // first test default, which is to inherit position
1641   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1642   application.SendNotification();
1643   application.Render(0); // should only really call Update as Render is not required to update scene
1644   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1645   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1646   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1647   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1648
1649   //Change child position
1650   Vector3 childOffset(-1.0f, 1.0f, 0.0f);
1651   child.SetProperty(Actor::Property::POSITION, childOffset);
1652
1653   // Use local position as world postion
1654   child.SetProperty(Actor::Property::INHERIT_POSITION, false);
1655   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
1656   application.SendNotification();
1657   application.Render(0); // should only really call Update as Render is not required to update scene
1658   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1659   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1660   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1661   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
1662
1663   //Change back to inherit position from parent
1664   child.SetProperty(Actor::Property::INHERIT_POSITION, true);
1665   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1666   application.SendNotification();
1667   application.Render(0); // should only really call Update as Render is not required to update scene
1668   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1669   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1670   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1671   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
1672   END_TEST;
1673 }
1674
1675 int UtcDaliActorInheritOpacity(void)
1676 {
1677   tet_infoline("Testing Actor::Inherit Opacity");
1678   TestApplication application;
1679
1680   Actor parent = Actor::New();
1681   Actor child  = Actor::New();
1682   parent.Add(child);
1683   application.GetScene().Add(parent);
1684
1685   DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1686   DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1687
1688   // flush the queue and render once
1689   application.SendNotification();
1690   application.Render();
1691
1692   parent.SetProperty(Actor::Property::OPACITY, 0.1f);
1693
1694   DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1695   DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1696
1697   application.SendNotification();
1698   application.Render();
1699
1700   DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1701   DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1702   DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1703   DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1704   DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1705   DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
1706
1707   END_TEST;
1708 }
1709
1710 // SetOrientation(float angleRadians, Vector3 axis)
1711 int UtcDaliActorSetOrientation01(void)
1712 {
1713   TestApplication application;
1714
1715   Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1716   Actor      actor = Actor::New();
1717
1718   actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1719
1720   // flush the queue and render once
1721   application.SendNotification();
1722   application.Render();
1723
1724   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1725   END_TEST;
1726 }
1727
1728 int UtcDaliActorSetOrientation02(void)
1729 {
1730   TestApplication application;
1731
1732   Actor actor = Actor::New();
1733
1734   Radian  angle(0.785f);
1735   Vector3 axis(1.0f, 1.0f, 0.0f);
1736
1737   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1738   Quaternion rotation(angle, axis);
1739   // flush the queue and render once
1740   application.SendNotification();
1741   application.Render();
1742   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1743
1744   application.GetScene().Add(actor);
1745   actor.RotateBy(Degree(360), axis);
1746   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1747
1748   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
1749   Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
1750   // flush the queue and render once
1751   application.SendNotification();
1752   application.Render();
1753   DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1754
1755   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1756   // flush the queue and render once
1757   application.SendNotification();
1758   application.Render();
1759   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1760
1761   application.GetScene().Remove(actor);
1762   END_TEST;
1763 }
1764
1765 // SetOrientation(float angleRadians, Vector3 axis)
1766 int UtcDaliActorSetOrientationProperty(void)
1767 {
1768   TestApplication application;
1769
1770   Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1771   Actor      actor = Actor::New();
1772
1773   actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1774   DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1775
1776   // flush the queue and render once
1777   application.SendNotification();
1778   application.Render();
1779
1780   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1781   DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1782   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1783   END_TEST;
1784 }
1785
1786 // RotateBy(float angleRadians, Vector3 axis)
1787 int UtcDaliActorRotateBy01(void)
1788 {
1789   TestApplication application;
1790
1791   Actor actor = Actor::New();
1792
1793   Radian angle(M_PI * 0.25f);
1794   actor.RotateBy((angle), Vector3::ZAXIS);
1795   // flush the queue and render once
1796   application.SendNotification();
1797   application.Render();
1798   DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1799
1800   application.GetScene().Add(actor);
1801
1802   actor.RotateBy(angle, Vector3::ZAXIS);
1803   // flush the queue and render once
1804   application.SendNotification();
1805   application.Render();
1806   DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1807
1808   application.GetScene().Remove(actor);
1809   END_TEST;
1810 }
1811
1812 // RotateBy(Quaternion relativeRotation)
1813 int UtcDaliActorRotateBy02(void)
1814 {
1815   TestApplication application;
1816
1817   Actor actor = Actor::New();
1818
1819   Radian     angle(M_PI * 0.25f);
1820   Quaternion rotation(angle, Vector3::ZAXIS);
1821   actor.RotateBy(rotation);
1822   // flush the queue and render once
1823   application.SendNotification();
1824   application.Render();
1825   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1826
1827   actor.RotateBy(rotation);
1828   // flush the queue and render once
1829   application.SendNotification();
1830   application.Render();
1831   DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1832   END_TEST;
1833 }
1834
1835 int UtcDaliActorGetCurrentOrientation(void)
1836 {
1837   TestApplication application;
1838   Actor           actor = Actor::New();
1839
1840   Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1841   actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1842   // flush the queue and render once
1843   application.SendNotification();
1844   application.Render();
1845   DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1846   END_TEST;
1847 }
1848
1849 int UtcDaliActorGetCurrentWorldOrientation(void)
1850 {
1851   tet_infoline("Testing Actor::GetCurrentWorldRotation");
1852   TestApplication application;
1853
1854   Actor      parent = Actor::New();
1855   Radian     rotationAngle(Degree(90.0f));
1856   Quaternion rotation(rotationAngle, Vector3::YAXIS);
1857   parent.SetProperty(Actor::Property::ORIENTATION, rotation);
1858   application.GetScene().Add(parent);
1859
1860   Actor child = Actor::New();
1861   child.SetProperty(Actor::Property::ORIENTATION, rotation);
1862   parent.Add(child);
1863
1864   // The actors should not have a world rotation yet
1865   DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1866   DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1867
1868   application.SendNotification();
1869   application.Render(0);
1870
1871   DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1872   DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1873
1874   // The actors should have a world rotation now
1875   DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1876   DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
1877
1878   // turn off child rotation inheritance
1879   child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
1880   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
1881   application.SendNotification();
1882   application.Render(0);
1883
1884   // The actors should have a world rotation now
1885   DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1886   DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
1887   END_TEST;
1888 }
1889
1890 // SetScale(float scale)
1891 int UtcDaliActorSetScale01(void)
1892 {
1893   TestApplication application;
1894
1895   Actor actor = Actor::New();
1896
1897   // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1898   actor.SetProperty(Actor::Property::SCALE, 0.25f);
1899
1900   Vector3 scale(10.0f, 10.0f, 10.0f);
1901   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1902
1903   actor.SetProperty(Actor::Property::SCALE, scale.x);
1904
1905   // flush the queue and render once
1906   application.SendNotification();
1907   application.Render();
1908
1909   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1910   END_TEST;
1911 }
1912
1913 // SetScale(float scaleX, float scaleY, float scaleZ)
1914 int UtcDaliActorSetScale02(void)
1915 {
1916   TestApplication application;
1917   Vector3         scale(10.0f, 10.0f, 10.0f);
1918
1919   Actor actor = Actor::New();
1920
1921   // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1922   actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1923
1924   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1925
1926   actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
1927   // flush the queue and render once
1928   application.SendNotification();
1929   application.Render();
1930   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1931
1932   // add to stage and test
1933   application.GetScene().Add(actor);
1934   actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
1935   // flush the queue and render once
1936   application.SendNotification();
1937   application.Render();
1938   DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
1939
1940   application.GetScene().Remove(actor);
1941
1942   END_TEST;
1943 }
1944
1945 // SetScale(Vector3 scale)
1946 int UtcDaliActorSetScale03(void)
1947 {
1948   TestApplication application;
1949   Vector3         scale(10.0f, 10.0f, 10.0f);
1950
1951   Actor actor = Actor::New();
1952
1953   // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1954   actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1955
1956   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1957
1958   actor.SetProperty(Actor::Property::SCALE, scale);
1959
1960   // flush the queue and render once
1961   application.SendNotification();
1962   application.Render();
1963
1964   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1965   END_TEST;
1966 }
1967
1968 int UtcDaliActorSetScaleIndividual(void)
1969 {
1970   TestApplication application;
1971
1972   Actor actor = Actor::New();
1973
1974   Vector3 vector(0.7f, 0.8f, 0.9f);
1975   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
1976
1977   actor.SetProperty(Actor::Property::SCALE_X, vector.x);
1978   DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1979
1980   // flush the queue and render once
1981   application.SendNotification();
1982   application.Render();
1983
1984   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
1985   DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1986   DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1987
1988   actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
1989   DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
1990
1991   // flush the queue and render once
1992   application.SendNotification();
1993   application.Render();
1994
1995   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
1996   DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
1997   DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
1998
1999   actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2000   DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2001
2002   // flush the queue and render once
2003   application.SendNotification();
2004   application.Render();
2005
2006   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2007   DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2008   DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2009
2010   DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2011   DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2012
2013   END_TEST;
2014 }
2015
2016 int UtcDaliActorScaleBy(void)
2017 {
2018   TestApplication application;
2019   Actor           actor = Actor::New();
2020   Vector3         vector(100.0f, 100.0f, 100.0f);
2021
2022   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2023
2024   actor.SetProperty(Actor::Property::SCALE, vector);
2025
2026   // flush the queue and render once
2027   application.SendNotification();
2028   application.Render();
2029
2030   DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2031
2032   actor.ScaleBy(vector);
2033
2034   // flush the queue and render once
2035   application.SendNotification();
2036   application.Render();
2037
2038   DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2039   END_TEST;
2040 }
2041
2042 int UtcDaliActorGetCurrentScale(void)
2043 {
2044   TestApplication application;
2045   Vector3         scale(12.0f, 1.0f, 2.0f);
2046
2047   Actor actor = Actor::New();
2048
2049   actor.SetProperty(Actor::Property::SCALE, scale);
2050
2051   // flush the queue and render once
2052   application.SendNotification();
2053   application.Render();
2054
2055   DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2056   END_TEST;
2057 }
2058
2059 int UtcDaliActorGetCurrentWorldScale(void)
2060 {
2061   TestApplication application;
2062
2063   Actor   parent = Actor::New();
2064   Vector3 parentScale(1.0f, 2.0f, 3.0f);
2065   parent.SetProperty(Actor::Property::SCALE, parentScale);
2066   application.GetScene().Add(parent);
2067
2068   Actor   child = Actor::New();
2069   Vector3 childScale(2.0f, 2.0f, 2.0f);
2070   child.SetProperty(Actor::Property::SCALE, childScale);
2071   parent.Add(child);
2072
2073   // The actors should not have a scale yet
2074   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2075   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2076
2077   // The actors should not have a world scale yet
2078   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2079   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2080
2081   application.SendNotification();
2082   application.Render(0);
2083
2084   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2085   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2086
2087   // The actors should have a world scale now
2088   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2089   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2090   END_TEST;
2091 }
2092
2093 int UtcDaliActorInheritScale(void)
2094 {
2095   tet_infoline("Testing Actor::SetInheritScale");
2096   TestApplication application;
2097
2098   Actor   parent = Actor::New();
2099   Vector3 parentScale(1.0f, 2.0f, 3.0f);
2100   parent.SetProperty(Actor::Property::SCALE, parentScale);
2101   application.GetScene().Add(parent);
2102
2103   Actor   child = Actor::New();
2104   Vector3 childScale(2.0f, 2.0f, 2.0f);
2105   child.SetProperty(Actor::Property::SCALE, childScale);
2106   parent.Add(child);
2107
2108   application.SendNotification();
2109   application.Render(0);
2110
2111   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2112   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2113
2114   child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2115   DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2116
2117   application.SendNotification();
2118   application.Render(0);
2119
2120   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2121   END_TEST;
2122 }
2123
2124 int UtcDaliActorSetVisible(void)
2125 {
2126   TestApplication application;
2127
2128   Actor actor = Actor::New();
2129   actor.SetProperty(Actor::Property::VISIBLE, false);
2130   // flush the queue and render once
2131   application.SendNotification();
2132   application.Render();
2133   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2134
2135   actor.SetProperty(Actor::Property::VISIBLE, true);
2136   // flush the queue and render once
2137   application.SendNotification();
2138   application.Render();
2139   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2140
2141   // put actor on stage
2142   application.GetScene().Add(actor);
2143   actor.SetProperty(Actor::Property::VISIBLE, false);
2144   // flush the queue and render once
2145   application.SendNotification();
2146   application.Render();
2147   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2148   END_TEST;
2149 }
2150
2151 int UtcDaliActorIsVisible(void)
2152 {
2153   TestApplication application;
2154
2155   Actor actor = Actor::New();
2156
2157   DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2158   END_TEST;
2159 }
2160
2161 int UtcDaliActorSetOpacity(void)
2162 {
2163   TestApplication application;
2164
2165   Actor actor = Actor::New();
2166   // initial opacity is 1
2167   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2168
2169   actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2170   // flush the queue and render once
2171   application.SendNotification();
2172   application.Render();
2173   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2174
2175   // change opacity, actor is on stage to change is not immediate
2176   actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2177   // flush the queue and render once
2178   application.SendNotification();
2179   application.Render();
2180   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2181
2182   // put actor on stage
2183   application.GetScene().Add(actor);
2184
2185   // change opacity, actor is on stage to change is not immediate
2186   actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2187   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2188   // flush the queue and render once
2189   application.SendNotification();
2190   application.Render();
2191   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2192
2193   // change opacity, actor is on stage to change is not immediate
2194   actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2195   // flush the queue and render once
2196   application.SendNotification();
2197   application.Render();
2198   DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2199   END_TEST;
2200 }
2201
2202 int UtcDaliActorGetCurrentOpacity(void)
2203 {
2204   TestApplication application;
2205
2206   Actor actor = Actor::New();
2207   DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2208
2209   actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2210   // flush the queue and render once
2211   application.SendNotification();
2212   application.Render();
2213   DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2214   END_TEST;
2215 }
2216
2217 int UtcDaliActorSetSensitive(void)
2218 {
2219   TestApplication application;
2220   Actor           actor = Actor::New();
2221
2222   bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2223
2224   actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2225
2226   DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2227   END_TEST;
2228 }
2229
2230 int UtcDaliActorIsSensitive(void)
2231 {
2232   TestApplication application;
2233   Actor           actor = Actor::New();
2234   actor.SetProperty(Actor::Property::SENSITIVE, false);
2235
2236   DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2237   END_TEST;
2238 }
2239
2240 int UtcDaliActorSetColor(void)
2241 {
2242   TestApplication application;
2243   Actor           actor = Actor::New();
2244   Vector4         color(1.0f, 1.0f, 1.0f, 0.5f);
2245
2246   DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2247
2248   actor.SetProperty(Actor::Property::COLOR, color);
2249   // flush the queue and render once
2250   application.SendNotification();
2251   application.Render();
2252   DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2253
2254   actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2255   // flush the queue and render once
2256   application.SendNotification();
2257   application.Render();
2258   DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2259
2260   application.GetScene().Add(actor);
2261   actor.SetProperty(Actor::Property::COLOR, color);
2262   // flush the queue and render once
2263   application.SendNotification();
2264   application.Render();
2265   DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2266
2267   actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2268   // flush the queue and render once
2269   application.SendNotification();
2270   application.Render();
2271   // Actor color is not clamped
2272   DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2273   // world color is clamped
2274   DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2275
2276   actor.SetProperty(Actor::Property::COLOR, color);
2277   DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2278
2279   Vector3 newColor(1.0f, 0.0f, 0.0f);
2280   actor.SetProperty(Actor::Property::COLOR, newColor);
2281   DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2282
2283   application.GetScene().Remove(actor);
2284   END_TEST;
2285 }
2286
2287 int UtcDaliActorSetColorIndividual(void)
2288 {
2289   TestApplication application;
2290
2291   Actor actor = Actor::New();
2292
2293   Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2294   DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2295
2296   actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2297   DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2298
2299   // flush the queue and render once
2300   application.SendNotification();
2301   application.Render();
2302
2303   DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2304   DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2305   DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2306
2307   actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2308   DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2309
2310   // flush the queue and render once
2311   application.SendNotification();
2312   application.Render();
2313
2314   DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2315   DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2316   DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2317
2318   actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2319   DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2320
2321   // flush the queue and render once
2322   application.SendNotification();
2323   application.Render();
2324
2325   DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2326   DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2327   DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2328
2329   actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2330   DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2331
2332   // flush the queue and render once
2333   application.SendNotification();
2334   application.Render();
2335
2336   DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2337   DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2338   DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2339
2340   DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2341   DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2342
2343   actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2344
2345   // flush the queue and render once
2346   application.SendNotification();
2347   application.Render();
2348
2349   DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2350
2351   END_TEST;
2352 }
2353
2354 int UtcDaliActorGetCurrentColor(void)
2355 {
2356   TestApplication application;
2357   Actor           actor = Actor::New();
2358   Vector4         color(1.0f, 1.0f, 1.0f, 0.5f);
2359
2360   actor.SetProperty(Actor::Property::COLOR, color);
2361   // flush the queue and render once
2362   application.SendNotification();
2363   application.Render();
2364   DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2365   END_TEST;
2366 }
2367
2368 int UtcDaliActorGetCurrentWorldColor(void)
2369 {
2370   tet_infoline("Actor::GetCurrentWorldColor");
2371   TestApplication application;
2372
2373   Actor   parent = Actor::New();
2374   Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2375   parent.SetProperty(Actor::Property::COLOR, parentColor);
2376   application.GetScene().Add(parent);
2377
2378   Actor   child = Actor::New();
2379   Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2380   child.SetProperty(Actor::Property::COLOR, childColor);
2381   parent.Add(child);
2382
2383   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2384   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2385
2386   // verify the default color mode
2387   DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2388
2389   // The actors should not have a world color yet
2390   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2391   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2392
2393   application.SendNotification();
2394   application.Render(0);
2395
2396   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2397   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2398
2399   // The actors should have a world color now
2400   DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2401   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2402
2403   // use own color
2404   child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2405   application.SendNotification();
2406   application.Render(0);
2407   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2408
2409   // use parent color
2410   child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2411   application.SendNotification();
2412   application.Render(0);
2413   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2414   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2415
2416   // use parent alpha
2417   child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2418   application.SendNotification();
2419   application.Render(0);
2420   Vector4 expectedColor(childColor);
2421   expectedColor.a *= parentColor.a;
2422   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2423   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2424   END_TEST;
2425 }
2426
2427 int UtcDaliActorSetColorMode(void)
2428 {
2429   tet_infoline("Actor::SetColorMode");
2430   TestApplication application;
2431   Actor           actor = Actor::New();
2432   Actor           child = Actor::New();
2433   actor.Add(child);
2434
2435   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2436   DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2437
2438   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2439   DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2440
2441   actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2442   DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2443
2444   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2445   DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2446   END_TEST;
2447 }
2448
2449 int UtcDaliActorScreenToLocal(void)
2450 {
2451   TestApplication application;
2452   Actor           actor = Actor::New();
2453   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2454   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2455   actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2456   application.GetScene().Add(actor);
2457
2458   // flush the queue and render once
2459   application.SendNotification();
2460   application.Render();
2461
2462   float localX;
2463   float localY;
2464
2465   application.SendNotification();
2466   application.Render();
2467
2468   DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2469
2470   DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2471   DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2472   END_TEST;
2473 }
2474
2475 int UtcDaliActorSetLeaveRequired(void)
2476 {
2477   TestApplication application;
2478
2479   Actor actor = Actor::New();
2480
2481   actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2482   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2483
2484   actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2485   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2486   END_TEST;
2487 }
2488
2489 int UtcDaliActorGetLeaveRequired(void)
2490 {
2491   TestApplication application;
2492
2493   Actor actor = Actor::New();
2494
2495   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2496   END_TEST;
2497 }
2498
2499 int UtcDaliActorSetKeyboardFocusable(void)
2500 {
2501   TestApplication application;
2502
2503   Actor actor = Actor::New();
2504
2505   actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2506   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2507
2508   actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2509   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2510   END_TEST;
2511 }
2512
2513 int UtcDaliActorIsKeyboardFocusable(void)
2514 {
2515   TestApplication application;
2516
2517   Actor actor = Actor::New();
2518
2519   DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2520   END_TEST;
2521 }
2522
2523 int UtcDaliActorRemoveConstraints(void)
2524 {
2525   tet_infoline(" UtcDaliActorRemoveConstraints");
2526   TestApplication application;
2527
2528   gTestConstraintCalled = false;
2529
2530   Actor actor = Actor::New();
2531
2532   Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
2533   constraint.Apply();
2534   actor.RemoveConstraints();
2535
2536   DALI_TEST_CHECK(gTestConstraintCalled == false);
2537
2538   application.GetScene().Add(actor);
2539   constraint.Apply();
2540
2541   // flush the queue and render once
2542   application.SendNotification();
2543   application.Render();
2544
2545   actor.RemoveConstraints();
2546
2547   DALI_TEST_CHECK(gTestConstraintCalled == true);
2548   END_TEST;
2549 }
2550
2551 int UtcDaliActorRemoveConstraintTag(void)
2552 {
2553   tet_infoline(" UtcDaliActorRemoveConstraintTag");
2554   TestApplication application;
2555
2556   Actor actor = Actor::New();
2557
2558   // 1. Apply Constraint1 and Constraint2, and test...
2559   unsigned int result1 = 0u;
2560   unsigned int result2 = 0u;
2561
2562   unsigned   constraint1Tag = 1u;
2563   Constraint constraint1    = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
2564   constraint1.SetTag(constraint1Tag);
2565   constraint1.Apply();
2566
2567   unsigned   constraint2Tag = 2u;
2568   Constraint constraint2    = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
2569   constraint2.SetTag(constraint2Tag);
2570   constraint2.Apply();
2571
2572   application.GetScene().Add(actor);
2573   // flush the queue and render once
2574   application.SendNotification();
2575   application.Render();
2576
2577   DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2578   DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2579
2580   // 2. Remove Constraint1 and test...
2581   result1 = 0;
2582   result2 = 0;
2583   actor.RemoveConstraints(constraint1Tag);
2584   // make color property dirty, which will trigger constraints to be reapplied.
2585   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2586   // flush the queue and render once
2587   application.SendNotification();
2588   application.Render();
2589
2590   DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2591   DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2592
2593   // 3. Re-Apply Constraint1 and test...
2594   result1 = 0;
2595   result2 = 0;
2596   constraint1.Apply();
2597   // make color property dirty, which will trigger constraints to be reapplied.
2598   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2599   // flush the queue and render once
2600   application.SendNotification();
2601   application.Render();
2602
2603   DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2604   DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2605
2606   // 2. Remove Constraint2 and test...
2607   result1 = 0;
2608   result2 = 0;
2609   actor.RemoveConstraints(constraint2Tag);
2610   // make color property dirty, which will trigger constraints to be reapplied.
2611   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2612   // flush the queue and render once
2613   application.SendNotification();
2614   application.Render();
2615
2616   DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2617   DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2618
2619   // 2. Remove Constraint1 as well and test...
2620   result1 = 0;
2621   result2 = 0;
2622   actor.RemoveConstraints(constraint1Tag);
2623   // make color property dirty, which will trigger constraints to be reapplied.
2624   actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2625   // flush the queue and render once
2626   application.SendNotification();
2627   application.Render();
2628
2629   DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2630   DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2631   END_TEST;
2632 }
2633
2634 int UtcDaliActorTouchedSignal(void)
2635 {
2636   TestApplication application;
2637
2638   ResetTouchCallbacks();
2639
2640   // get the root layer
2641   Actor actor = application.GetScene().GetRootLayer();
2642   DALI_TEST_CHECK(gTouchCallBackCalled == false);
2643
2644   application.SendNotification();
2645   application.Render();
2646
2647   // connect to its touch signal
2648   actor.TouchedSignal().Connect(TestTouchCallback);
2649
2650   // simulate a touch event in the middle of the screen
2651   Vector2                  touchPoint(application.GetScene().GetSize() * 0.5);
2652   Dali::Integration::Point point;
2653   point.SetDeviceId(1);
2654   point.SetState(PointState::DOWN);
2655   point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2656   Dali::Integration::TouchEvent touchEvent;
2657   touchEvent.AddPoint(point);
2658   application.ProcessEvent(touchEvent);
2659
2660   DALI_TEST_CHECK(gTouchCallBackCalled == true);
2661   END_TEST;
2662 }
2663
2664 int UtcDaliActorHoveredSignal(void)
2665 {
2666   TestApplication application;
2667
2668   gHoverCallBackCalled = false;
2669
2670   // get the root layer
2671   Actor actor = application.GetScene().GetRootLayer();
2672   DALI_TEST_CHECK(gHoverCallBackCalled == false);
2673
2674   application.SendNotification();
2675   application.Render();
2676
2677   // connect to its hover signal
2678   actor.HoveredSignal().Connect(TestCallback3);
2679
2680   // simulate a hover event in the middle of the screen
2681   Vector2                  touchPoint(application.GetScene().GetSize() * 0.5);
2682   Dali::Integration::Point point;
2683   point.SetDeviceId(1);
2684   point.SetState(PointState::MOTION);
2685   point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2686   Dali::Integration::HoverEvent hoverEvent;
2687   hoverEvent.AddPoint(point);
2688   application.ProcessEvent(hoverEvent);
2689
2690   DALI_TEST_CHECK(gHoverCallBackCalled == true);
2691   END_TEST;
2692 }
2693
2694 int UtcDaliActorOnOffSceneSignal(void)
2695 {
2696   tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
2697
2698   TestApplication application;
2699
2700   // clean test data
2701   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2702   gActorNamesOnOffScene.clear();
2703
2704   Actor parent = Actor::New();
2705   parent.SetProperty(Actor::Property::NAME, "parent");
2706   parent.OnSceneSignal().Connect(OnSceneCallback);
2707   parent.OffSceneSignal().Connect(OffSceneCallback);
2708   // sanity check
2709   DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
2710   DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
2711
2712   // add parent to the scene
2713   application.GetScene().Add(parent);
2714   // onstage emitted, offstage not
2715   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2716   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2717   DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2718
2719   // test adding a child, should get onstage emitted
2720   // clean test data
2721   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2722   gActorNamesOnOffScene.clear();
2723
2724   Actor child = Actor::New();
2725   child.SetProperty(Actor::Property::NAME, "child");
2726   child.OnSceneSignal().Connect(OnSceneCallback);
2727   child.OffSceneSignal().Connect(OffSceneCallback);
2728   parent.Add(child); // add child
2729   // onscene emitted, offscene not
2730   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2731   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2732   DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2733
2734   // test removing parent from the scene
2735   // clean test data
2736   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2737   gActorNamesOnOffScene.clear();
2738
2739   application.GetScene().Remove(parent);
2740   // onscene not emitted, offscene is
2741   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2742   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
2743   DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2744   DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
2745
2746   // test adding parent back to the scene
2747   // clean test data
2748   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2749   gActorNamesOnOffScene.clear();
2750
2751   application.GetScene().Add(parent);
2752   // onscene emitted, offscene not
2753   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
2754   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2755   DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2756   DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
2757
2758   // test removing child
2759   // clean test data
2760   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2761   gActorNamesOnOffScene.clear();
2762
2763   parent.Remove(child);
2764   // onscene not emitted, offscene is
2765   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2766   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2767   DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2768
2769   // test removing parent
2770   // clean test data
2771   gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2772   gActorNamesOnOffScene.clear();
2773
2774   application.GetScene().Remove(parent);
2775   // onscene not emitted, offscene is
2776   DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2777   DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2778   DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2779   END_TEST;
2780 }
2781
2782 int UtcDaliActorFindChildByName(void)
2783 {
2784   tet_infoline("Testing Dali::Actor::FindChildByName()");
2785   TestApplication application;
2786
2787   Actor parent = Actor::New();
2788   parent.SetProperty(Actor::Property::NAME, "parent");
2789   Actor first = Actor::New();
2790   first.SetProperty(Actor::Property::NAME, "first");
2791   Actor second = Actor::New();
2792   second.SetProperty(Actor::Property::NAME, "second");
2793
2794   parent.Add(first);
2795   first.Add(second);
2796
2797   Actor found = parent.FindChildByName("foo");
2798   DALI_TEST_CHECK(!found);
2799
2800   found = parent.FindChildByName("parent");
2801   DALI_TEST_CHECK(found == parent);
2802
2803   found = parent.FindChildByName("first");
2804   DALI_TEST_CHECK(found == first);
2805
2806   found = parent.FindChildByName("second");
2807   DALI_TEST_CHECK(found == second);
2808   END_TEST;
2809 }
2810
2811 int UtcDaliActorFindChildById(void)
2812 {
2813   tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2814   TestApplication application;
2815
2816   Actor parent = Actor::New();
2817   Actor first  = Actor::New();
2818   Actor second = Actor::New();
2819
2820   parent.Add(first);
2821   first.Add(second);
2822
2823   Actor found = parent.FindChildById(100000);
2824   DALI_TEST_CHECK(!found);
2825
2826   found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
2827   DALI_TEST_CHECK(found == parent);
2828
2829   found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
2830   DALI_TEST_CHECK(found == first);
2831
2832   found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
2833   DALI_TEST_CHECK(found == second);
2834   END_TEST;
2835 }
2836
2837 int UtcDaliActorHitTest(void)
2838 {
2839   struct HitTestData
2840   {
2841   public:
2842     HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
2843     : mScale(scale),
2844       mTouchPoint(touchPoint),
2845       mResult(result)
2846     {
2847     }
2848
2849     Vector3 mScale;
2850     Vector2 mTouchPoint;
2851     bool    mResult;
2852   };
2853
2854   TestApplication application;
2855   tet_infoline(" UtcDaliActorHitTest");
2856
2857   // Fill a vector with different hit tests.
2858   struct HitTestData* hitTestData[] = {
2859     //                    scale                     touch point           result
2860     new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true),  // touch point close to the right edge (inside)
2861     new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
2862     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.
2863     new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
2864     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.
2865     NULL,
2866   };
2867
2868   // get the root layer
2869   Actor actor = Actor::New();
2870   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2871   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2872
2873   application.GetScene().Add(actor);
2874
2875   ResetTouchCallbacks();
2876
2877   unsigned int index = 0;
2878   while(NULL != hitTestData[index])
2879   {
2880     actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
2881     actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
2882
2883     // flush the queue and render once
2884     application.SendNotification();
2885     application.Render();
2886
2887     DALI_TEST_CHECK(!gTouchCallBackCalled);
2888
2889     // connect to its touch signal
2890     actor.TouchedSignal().Connect(TestTouchCallback);
2891
2892     Dali::Integration::Point point;
2893     point.SetState(PointState::DOWN);
2894     point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
2895     Dali::Integration::TouchEvent event;
2896     event.AddPoint(point);
2897
2898     // flush the queue and render once
2899     application.SendNotification();
2900     application.Render();
2901     application.ProcessEvent(event);
2902
2903     DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
2904
2905     if(gTouchCallBackCalled != hitTestData[index]->mResult)
2906       tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2907                  hitTestData[index]->mScale.x,
2908                  hitTestData[index]->mScale.y,
2909                  hitTestData[index]->mScale.z,
2910                  hitTestData[index]->mTouchPoint.x,
2911                  hitTestData[index]->mTouchPoint.y,
2912                  hitTestData[index]->mResult);
2913
2914     ResetTouchCallbacks();
2915     ++index;
2916   }
2917   END_TEST;
2918 }
2919
2920 int UtcDaliActorSetDrawMode(void)
2921 {
2922   TestApplication application;
2923   tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2924
2925   Actor a = Actor::New();
2926
2927   application.GetScene().Add(a);
2928   application.SendNotification();
2929   application.Render(0);
2930   application.SendNotification();
2931   application.Render(1);
2932
2933   DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
2934
2935   a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
2936   application.SendNotification();
2937   application.Render(1);
2938
2939   DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
2940
2941   a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
2942   application.SendNotification();
2943   application.Render(1);
2944
2945   DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
2946   END_TEST;
2947 }
2948
2949 int UtcDaliActorSetDrawModeOverlayRender(void)
2950 {
2951   TestApplication application;
2952   tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2953
2954   application.SendNotification();
2955   application.Render(1);
2956
2957   std::vector<GLuint> ids;
2958   ids.push_back(8);  // first rendered actor
2959   ids.push_back(9);  // second rendered actor
2960   ids.push_back(10); // third rendered actor
2961   application.GetGlAbstraction().SetNextTextureIds(ids);
2962
2963   Texture imageA = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2964   Texture imageB = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2965   Texture imageC = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2966   Actor   a      = CreateRenderableActor(imageA);
2967   Actor   b      = CreateRenderableActor(imageB);
2968   Actor   c      = CreateRenderableActor(imageC);
2969
2970   application.SendNotification();
2971   application.Render(1);
2972
2973   //Textures are bound when first created. Clear bound textures vector
2974   application.GetGlAbstraction().ClearBoundTextures();
2975
2976   // Render a,b,c as regular non-overlays. so order will be:
2977   // a (8)
2978   // b (9)
2979   // c (10)
2980   application.GetScene().Add(a);
2981   application.GetScene().Add(b);
2982   application.GetScene().Add(c);
2983
2984   application.SendNotification();
2985   application.Render(1);
2986
2987   // Should be 3 textures changes.
2988   const std::vector<GLuint>&             boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
2989   typedef std::vector<GLuint>::size_type TextureSize;
2990   DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
2991   if(boundTextures.size() == 3)
2992   {
2993     DALI_TEST_CHECK(boundTextures[0] == 8u);
2994     DALI_TEST_CHECK(boundTextures[1] == 9u);
2995     DALI_TEST_CHECK(boundTextures[2] == 10u);
2996   }
2997
2998   // Now texture ids have been set, we can monitor their render order.
2999   // render a as an overlay (last), so order will be:
3000   // b (9)
3001   // c (10)
3002   // a (8)
3003   a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3004   application.GetGlAbstraction().ClearBoundTextures();
3005
3006   application.SendNotification();
3007   application.Render(1);
3008
3009   // Should be 3 texture changes.
3010   DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3011   if(boundTextures.size() == 3)
3012   {
3013     DALI_TEST_CHECK(boundTextures[0] == 9u);
3014     DALI_TEST_CHECK(boundTextures[1] == 10u);
3015     DALI_TEST_CHECK(boundTextures[2] == 8u);
3016   }
3017   END_TEST;
3018 }
3019
3020 int UtcDaliActorGetCurrentWorldMatrix(void)
3021 {
3022   TestApplication application;
3023   tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3024
3025   Actor parent = Actor::New();
3026   parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3027   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3028   Vector3    parentPosition(10.0f, 20.0f, 30.0f);
3029   Radian     rotationAngle(Degree(85.0f));
3030   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3031   Vector3    parentScale(1.0f, 2.0f, 3.0f);
3032   parent.SetProperty(Actor::Property::POSITION, parentPosition);
3033   parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3034   parent.SetProperty(Actor::Property::SCALE, parentScale);
3035   application.GetScene().Add(parent);
3036
3037   Actor child = Actor::New();
3038   child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3039   Vector3    childPosition(0.0f, 0.0f, 100.0f);
3040   Radian     childRotationAngle(Degree(23.0f));
3041   Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3042   Vector3    childScale(2.0f, 2.0f, 2.0f);
3043   child.SetProperty(Actor::Property::POSITION, childPosition);
3044   child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3045   child.SetProperty(Actor::Property::SCALE, childScale);
3046   parent.Add(child);
3047
3048   application.SendNotification();
3049   application.Render(0);
3050   application.Render();
3051   application.SendNotification();
3052
3053   Matrix parentMatrix(false);
3054   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3055
3056   Matrix childMatrix(false);
3057   childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3058
3059   //Child matrix should be the composition of child and parent
3060   Matrix childWorldMatrix(false);
3061   Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3062
3063   DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3064   DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3065   END_TEST;
3066 }
3067
3068 int UtcDaliActorConstrainedToWorldMatrix(void)
3069 {
3070   TestApplication application;
3071   tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3072
3073   Actor parent = Actor::New();
3074   parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3075   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3076   Vector3    parentPosition(10.0f, 20.0f, 30.0f);
3077   Radian     rotationAngle(Degree(85.0f));
3078   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3079   Vector3    parentScale(1.0f, 2.0f, 3.0f);
3080   parent.SetProperty(Actor::Property::POSITION, parentPosition);
3081   parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3082   parent.SetProperty(Actor::Property::SCALE, parentScale);
3083   application.GetScene().Add(parent);
3084
3085   Actor child = Actor::New();
3086   child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3087   Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3088   posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3089   posConstraint.Apply();
3090
3091   application.GetScene().Add(child);
3092
3093   application.SendNotification();
3094   application.Render(0);
3095   application.Render();
3096   application.SendNotification();
3097
3098   Matrix parentMatrix(false);
3099   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3100
3101   DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3102   DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3103   END_TEST;
3104 }
3105
3106 int UtcDaliActorConstrainedToOrientation(void)
3107 {
3108   TestApplication application;
3109   tet_infoline(" UtcDaliActorConstrainedToOrientation");
3110
3111   Actor parent = Actor::New();
3112   parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3113   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3114   Vector3    parentPosition(10.0f, 20.0f, 30.0f);
3115   Radian     rotationAngle(Degree(85.0f));
3116   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3117   Vector3    parentScale(1.0f, 2.0f, 3.0f);
3118   parent.SetProperty(Actor::Property::POSITION, parentPosition);
3119   parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3120   parent.SetProperty(Actor::Property::SCALE, parentScale);
3121   application.GetScene().Add(parent);
3122
3123   Actor child = Actor::New();
3124   child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3125   Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3126   posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3127   posConstraint.Apply();
3128
3129   application.GetScene().Add(child);
3130
3131   application.SendNotification();
3132   application.Render(0);
3133   application.Render();
3134   application.SendNotification();
3135
3136   DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3137   END_TEST;
3138 }
3139
3140 int UtcDaliActorConstrainedToOpacity(void)
3141 {
3142   TestApplication application;
3143   tet_infoline(" UtcDaliActorConstrainedToOpacity");
3144
3145   Actor parent = Actor::New();
3146   parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3147   application.GetScene().Add(parent);
3148
3149   Actor      child             = Actor::New();
3150   Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3151   opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3152   opacityConstraint.Apply();
3153
3154   application.GetScene().Add(child);
3155
3156   application.SendNotification();
3157   application.Render(0);
3158   application.Render();
3159   application.SendNotification();
3160
3161   DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3162
3163   parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3164
3165   application.SendNotification();
3166   application.Render(0);
3167   application.Render();
3168   application.SendNotification();
3169
3170   DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3171
3172   END_TEST;
3173 }
3174
3175 int UtcDaliActorUnparent(void)
3176 {
3177   TestApplication application;
3178   tet_infoline(" UtcDaliActorUnparent");
3179
3180   Actor parent = Actor::New();
3181   application.GetScene().Add(parent);
3182
3183   Actor child = Actor::New();
3184
3185   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3186   DALI_TEST_CHECK(!child.GetParent());
3187
3188   // Test that calling Unparent with no parent is a NOOP
3189   child.Unparent();
3190
3191   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3192   DALI_TEST_CHECK(!child.GetParent());
3193
3194   // Test that Unparent works
3195   parent.Add(child);
3196
3197   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3198   DALI_TEST_CHECK(parent == child.GetParent());
3199
3200   child.Unparent();
3201
3202   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3203   DALI_TEST_CHECK(!child.GetParent());
3204
3205   // Test that UnparentAndReset works
3206   parent.Add(child);
3207
3208   DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3209   DALI_TEST_CHECK(parent == child.GetParent());
3210
3211   UnparentAndReset(child);
3212
3213   DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3214   DALI_TEST_CHECK(!child);
3215
3216   // Test that UnparentAndReset is a NOOP with empty handle
3217   UnparentAndReset(child);
3218
3219   DALI_TEST_CHECK(!child);
3220   END_TEST;
3221 }
3222
3223 int UtcDaliActorGetChildAt(void)
3224 {
3225   TestApplication application;
3226   tet_infoline(" UtcDaliActorGetChildAt");
3227
3228   Actor parent = Actor::New();
3229   application.GetScene().Add(parent);
3230
3231   Actor child0 = Actor::New();
3232   parent.Add(child0);
3233
3234   Actor child1 = Actor::New();
3235   parent.Add(child1);
3236
3237   Actor child2 = Actor::New();
3238   parent.Add(child2);
3239
3240   DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3241   DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3242   DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3243   END_TEST;
3244 }
3245
3246 int UtcDaliActorSetGetOverlay(void)
3247 {
3248   TestApplication application;
3249   tet_infoline(" UtcDaliActorSetGetOverlay");
3250
3251   Actor parent = Actor::New();
3252   parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3253   DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3254   END_TEST;
3255 }
3256
3257 int UtcDaliActorCreateDestroy(void)
3258 {
3259   Actor* actor = new Actor;
3260   DALI_TEST_CHECK(actor);
3261   delete actor;
3262   END_TEST;
3263 }
3264
3265 namespace
3266 {
3267 struct PropertyStringIndex
3268 {
3269   const char* const     name;
3270   const Property::Index index;
3271   const Property::Type  type;
3272 };
3273
3274 const PropertyStringIndex PROPERTY_TABLE[] =
3275   {
3276     {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3277     {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3278     {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3279     {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3280     {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3281     {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3282     {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3283     {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3284     {"size", Actor::Property::SIZE, Property::VECTOR3},
3285     {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3286     {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3287     {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3288     {"position", Actor::Property::POSITION, Property::VECTOR3},
3289     {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3290     {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3291     {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3292     {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3293     {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3294     {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
3295     {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
3296     {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
3297     {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
3298     {"scale", Actor::Property::SCALE, Property::VECTOR3},
3299     {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
3300     {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
3301     {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
3302     {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
3303     {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
3304     {"color", Actor::Property::COLOR, Property::VECTOR4},
3305     {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
3306     {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
3307     {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
3308     {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
3309     {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
3310     {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
3311     {"name", Actor::Property::NAME, Property::STRING},
3312     {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
3313     {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
3314     {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
3315     {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
3316     {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
3317     {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
3318     {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
3319     {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
3320     {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
3321     {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
3322     {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
3323     {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
3324     {"padding", Actor::Property::PADDING, Property::VECTOR4},
3325     {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
3326     {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
3327     {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
3328     {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
3329     {"opacity", Actor::Property::OPACITY, Property::FLOAT},
3330 };
3331 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
3332 } // unnamed namespace
3333
3334 int UtcDaliActorProperties(void)
3335 {
3336   TestApplication application;
3337
3338   Actor actor = Actor::New();
3339
3340   for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
3341   {
3342     tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
3343     DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
3344     DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
3345     DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
3346   }
3347   END_TEST;
3348 }
3349
3350 int UtcDaliRelayoutProperties_ResizePolicies(void)
3351 {
3352   TestApplication application;
3353
3354   Actor actor = Actor::New();
3355
3356   // Defaults
3357   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3358   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3359
3360   // Set resize policy for all dimensions
3361   actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
3362   for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3363   {
3364     DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
3365   }
3366
3367   // Set individual dimensions
3368   const char* const widthPolicy  = "FILL_TO_PARENT";
3369   const char* const heightPolicy = "FIXED";
3370
3371   actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
3372   actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
3373
3374   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
3375   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
3376
3377   // Set individual dimensions using enums
3378   ResizePolicy::Type widthPolicyEnum  = ResizePolicy::USE_ASSIGNED_SIZE;
3379   ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3380
3381   actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
3382   actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
3383
3384   DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
3385   DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
3386
3387   END_TEST;
3388 }
3389
3390 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3391 {
3392   TestApplication application;
3393
3394   Actor actor = Actor::New();
3395
3396   // Defaults
3397   DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
3398
3399   SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3400   actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
3401   DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
3402
3403   // Set
3404   const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
3405   const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3406
3407   actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
3408   DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
3409
3410   actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
3411   DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
3412
3413   END_TEST;
3414 }
3415
3416 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3417 {
3418   TestApplication application;
3419
3420   Actor actor = Actor::New();
3421
3422   // Defaults
3423   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3424   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3425
3426   Vector3 sizeMode(1.0f, 2.0f, 3.0f);
3427   actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
3428   DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
3429
3430   // Set
3431   Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
3432
3433   actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
3434   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
3435
3436   END_TEST;
3437 }
3438
3439 int UtcDaliRelayoutProperties_DimensionDependency(void)
3440 {
3441   TestApplication application;
3442
3443   Actor actor = Actor::New();
3444
3445   // Defaults
3446   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3447   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
3448
3449   // Set
3450   actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
3451   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
3452
3453   actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
3454   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
3455
3456   // Test setting another resize policy
3457   actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
3458   DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3459
3460   END_TEST;
3461 }
3462
3463 int UtcDaliRelayoutProperties_Padding(void)
3464 {
3465   TestApplication application;
3466
3467   Actor actor = Actor::New();
3468
3469   // Data
3470   Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
3471
3472   // PADDING
3473   actor.SetProperty(Actor::Property::PADDING, padding);
3474   Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
3475
3476   DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3477
3478   END_TEST;
3479 }
3480
3481 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3482 {
3483   TestApplication application;
3484
3485   Actor actor = Actor::New();
3486
3487   // Data
3488   Vector2 minSize(1.0f, 2.0f);
3489
3490   actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
3491   Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
3492
3493   DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3494
3495   Vector2 maxSize(3.0f, 4.0f);
3496
3497   actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
3498   Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
3499
3500   DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3501
3502   END_TEST;
3503 }
3504
3505 int UtcDaliActorGetHeightForWidth(void)
3506 {
3507   TestApplication application;
3508
3509   Actor actor = Actor::New();
3510
3511   DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
3512
3513   END_TEST;
3514 }
3515
3516 int UtcDaliActorGetWidthForHeight(void)
3517 {
3518   TestApplication application;
3519
3520   Actor actor = Actor::New();
3521
3522   DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
3523
3524   END_TEST;
3525 }
3526
3527 int UtcDaliActorGetRelayoutSize(void)
3528 {
3529   TestApplication application;
3530
3531   Actor actor = Actor::New();
3532
3533   // Add actor to stage
3534   application.GetScene().Add(actor);
3535
3536   DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
3537
3538   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
3539   actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
3540
3541   // Flush the queue and render once
3542   application.SendNotification();
3543   application.Render();
3544
3545   DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
3546
3547   END_TEST;
3548 }
3549
3550 int UtcDaliActorSetPadding(void)
3551 {
3552   TestApplication application;
3553
3554   Actor actor = Actor::New();
3555
3556   Padding padding;
3557   padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3558
3559   DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
3560   DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
3561   DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
3562   DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
3563
3564   Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
3565   actor.SetProperty(Actor::Property::PADDING, padding2);
3566
3567   padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3568
3569   DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
3570   DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
3571   DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
3572   DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
3573
3574   END_TEST;
3575 }
3576
3577 int UtcDaliActorSetMinimumSize(void)
3578 {
3579   TestApplication application;
3580
3581   Actor actor = Actor::New();
3582
3583   Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3584
3585   DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
3586   DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
3587
3588   Vector2 size2(1.0f, 2.0f);
3589   actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
3590
3591   size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3592
3593   DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3594   DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3595
3596   END_TEST;
3597 }
3598
3599 int UtcDaliActorSetMaximumSize(void)
3600 {
3601   TestApplication application;
3602
3603   Actor actor = Actor::New();
3604
3605   Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3606
3607   DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
3608   DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
3609
3610   Vector2 size2(1.0f, 2.0f);
3611   actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
3612
3613   size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3614
3615   DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3616   DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3617
3618   END_TEST;
3619 }
3620
3621 int UtcDaliActorOnRelayoutSignal(void)
3622 {
3623   tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3624
3625   TestApplication application;
3626
3627   // Clean test data
3628   gOnRelayoutCallBackCalled = false;
3629   gActorNamesRelayout.clear();
3630
3631   Actor actor = Actor::New();
3632   actor.SetProperty(Actor::Property::NAME, "actor");
3633   actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
3634
3635   // Sanity check
3636   DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
3637
3638   // Add actor to stage
3639   application.GetScene().Add(actor);
3640
3641   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
3642   actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
3643
3644   // Flush the queue and render once
3645   application.SendNotification();
3646   application.Render();
3647
3648   // OnRelayout emitted
3649   DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
3650   DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
3651
3652   END_TEST;
3653 }
3654
3655 int UtcDaliActorGetHierachyDepth(void)
3656 {
3657   TestApplication application;
3658   tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3659
3660   /* Build tree of actors:
3661    *
3662    *                      Depth
3663    *
3664    *       A (parent)       1
3665    *      / \
3666    *     B   C              2`
3667    *    / \   \
3668    *   D   E   F            3
3669    *
3670    * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3671    */
3672   Integration::Scene stage(application.GetScene());
3673
3674   Actor actorA = Actor::New();
3675   Actor actorB = Actor::New();
3676   Actor actorC = Actor::New();
3677   Actor actorD = Actor::New();
3678   Actor actorE = Actor::New();
3679   Actor actorF = Actor::New();
3680
3681   //Test that root actor has depth equal 0
3682   DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3683
3684   //Test actors return depth -1 when not connected to the tree
3685   DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3686   DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3687   DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3688   DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3689   DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3690   DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3691
3692   //Create the hierarchy
3693   stage.Add(actorA);
3694   actorA.Add(actorB);
3695   actorA.Add(actorC);
3696   actorB.Add(actorD);
3697   actorB.Add(actorE);
3698   actorC.Add(actorF);
3699
3700   //Test actors return correct depth
3701   DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3702   DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3703   DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3704   DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3705   DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3706   DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3707
3708   //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3709   actorA.Remove(actorB);
3710
3711   DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3712   DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3713   DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3714
3715   //Removing actorA from the stage. All actors should have depth equal -1
3716   stage.Remove(actorA);
3717
3718   DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3719   DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3720   DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3721   DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3722   DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3723   DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3724
3725   END_TEST;
3726 }
3727
3728 int UtcDaliActorAnchorPointPropertyAsString(void)
3729 {
3730   TestApplication application;
3731
3732   Actor actor = Actor::New();
3733
3734   actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
3735   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3736
3737   actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
3738   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3739
3740   actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
3741   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3742
3743   actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
3744   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3745
3746   actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
3747   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
3748
3749   actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
3750   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3751
3752   actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
3753   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3754
3755   actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
3756   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3757
3758   actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
3759   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3760
3761   // Invalid should not change anything
3762   actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
3763   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3764
3765   END_TEST;
3766 }
3767
3768 int UtcDaliActorParentOriginPropertyAsString(void)
3769 {
3770   TestApplication application;
3771
3772   Actor actor = Actor::New();
3773
3774   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
3775   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3776
3777   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
3778   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3779
3780   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
3781   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3782
3783   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
3784   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3785
3786   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
3787   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
3788
3789   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
3790   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3791
3792   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
3793   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3794
3795   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
3796   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3797
3798   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
3799   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3800
3801   // Invalid should not change anything
3802   actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
3803   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3804
3805   END_TEST;
3806 }
3807
3808 int UtcDaliActorColorModePropertyAsString(void)
3809 {
3810   TestApplication application;
3811
3812   Actor actor = Actor::New();
3813
3814   actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
3815   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3816
3817   actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
3818   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3819
3820   actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
3821   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3822
3823   actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
3824   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3825
3826   // Invalid should not change anything
3827   actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
3828   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3829
3830   END_TEST;
3831 }
3832
3833 int UtcDaliActorDrawModePropertyAsString(void)
3834 {
3835   TestApplication application;
3836
3837   Actor actor = Actor::New();
3838
3839   actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
3840   DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3841
3842   actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
3843   DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3844
3845   // Invalid should not change anything
3846   actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
3847   DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3848
3849   END_TEST;
3850 }
3851
3852 int UtcDaliActorColorModePropertyAsEnum(void)
3853 {
3854   TestApplication application;
3855
3856   Actor actor = Actor::New();
3857
3858   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
3859   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3860
3861   actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
3862   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3863
3864   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
3865   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3866
3867   actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
3868   DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3869
3870   END_TEST;
3871 }
3872
3873 int UtcDaliActorDrawModePropertyAsEnum(void)
3874 {
3875   TestApplication application;
3876
3877   Actor actor = Actor::New();
3878
3879   actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3880   DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3881
3882   actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3883   DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3884
3885   END_TEST;
3886 }
3887
3888 int UtcDaliActorAddRendererP(void)
3889 {
3890   tet_infoline("Testing Actor::AddRenderer");
3891   TestApplication application;
3892
3893   Actor actor = Actor::New();
3894
3895   DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3896
3897   Geometry geometry = CreateQuadGeometry();
3898   Shader   shader   = CreateShader();
3899   Renderer renderer = Renderer::New(geometry, shader);
3900
3901   actor.AddRenderer(renderer);
3902   DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
3903   DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
3904
3905   END_TEST;
3906 }
3907
3908 int UtcDaliActorAddRendererN01(void)
3909 {
3910   tet_infoline("Testing Actor::AddRenderer");
3911   TestApplication application;
3912
3913   Actor    actor = Actor::New();
3914   Renderer renderer;
3915
3916   // try illegal Add
3917   try
3918   {
3919     actor.AddRenderer(renderer);
3920     tet_printf("Assertion test failed - no Exception\n");
3921     tet_result(TET_FAIL);
3922   }
3923   catch(Dali::DaliException& e)
3924   {
3925     DALI_TEST_PRINT_ASSERT(e);
3926     DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3927     DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3928   }
3929   catch(...)
3930   {
3931     tet_printf("Assertion test failed - wrong Exception\n");
3932     tet_result(TET_FAIL);
3933   }
3934
3935   END_TEST;
3936 }
3937
3938 int UtcDaliActorAddRendererN02(void)
3939 {
3940   tet_infoline("UtcDaliActorAddRendererN02");
3941
3942   Actor    actor;
3943   Renderer renderer;
3944
3945   {
3946     TestApplication application;
3947
3948     Geometry geometry = CreateQuadGeometry();
3949     Shader   shader   = CreateShader();
3950     renderer          = Renderer::New(geometry, shader);
3951
3952     actor = Actor::New();
3953   }
3954
3955   // try illegal AddRenderer
3956   try
3957   {
3958     actor.AddRenderer(renderer);
3959     tet_printf("Assertion test failed - no Exception\n");
3960     tet_result(TET_FAIL);
3961   }
3962   catch(Dali::DaliException& e)
3963   {
3964     DALI_TEST_PRINT_ASSERT(e);
3965     DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
3966   }
3967   catch(...)
3968   {
3969     tet_printf("Assertion test failed - wrong Exception\n");
3970     tet_result(TET_FAIL);
3971   }
3972
3973   END_TEST;
3974 }
3975
3976 int UtcDaliActorAddRendererOnScene(void)
3977 {
3978   tet_infoline("Testing Actor::AddRenderer");
3979   TestApplication application;
3980
3981   Actor actor = Actor::New();
3982   application.GetScene().Add(actor);
3983
3984   application.SendNotification();
3985   application.Render(0);
3986
3987   Geometry geometry = CreateQuadGeometry();
3988   Shader   shader   = CreateShader();
3989   Renderer renderer = Renderer::New(geometry, shader);
3990
3991   application.SendNotification();
3992   application.Render(0);
3993
3994   try
3995   {
3996     actor.AddRenderer(renderer);
3997     tet_result(TET_PASS);
3998   }
3999   catch(...)
4000   {
4001     tet_result(TET_FAIL);
4002   }
4003
4004   END_TEST;
4005 }
4006
4007 int UtcDaliActorRemoveRendererP1(void)
4008 {
4009   tet_infoline("Testing Actor::RemoveRenderer");
4010   TestApplication application;
4011
4012   Actor actor = Actor::New();
4013
4014   DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4015
4016   {
4017     Geometry geometry = CreateQuadGeometry();
4018     Shader   shader   = CreateShader();
4019     Renderer renderer = Renderer::New(geometry, shader);
4020
4021     actor.AddRenderer(renderer);
4022     DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4023     DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4024
4025     application.SendNotification();
4026     application.Render();
4027   }
4028
4029   {
4030     Renderer renderer = actor.GetRendererAt(0);
4031     actor.RemoveRenderer(renderer);
4032     DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4033
4034     application.SendNotification();
4035     application.Render();
4036   }
4037
4038   // Call one final time to ensure that the renderer is actually removed after
4039   // the handle goes out of scope, and excercises the deletion code path in
4040   // scene graph and render.
4041   application.SendNotification();
4042   application.Render();
4043
4044   END_TEST;
4045 }
4046
4047 int UtcDaliActorRemoveRendererP2(void)
4048 {
4049   tet_infoline("Testing Actor::RemoveRenderer");
4050   TestApplication application;
4051
4052   Actor actor = Actor::New();
4053
4054   DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4055
4056   Geometry geometry = CreateQuadGeometry();
4057   Shader   shader   = CreateShader();
4058   Renderer renderer = Renderer::New(geometry, shader);
4059
4060   actor.AddRenderer(renderer);
4061   application.SendNotification();
4062   application.Render();
4063
4064   DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4065   DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4066
4067   actor.RemoveRenderer(0);
4068   application.SendNotification();
4069   application.Render();
4070
4071   DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4072
4073   // Shut down whilst holding onto the renderer handle.
4074   END_TEST;
4075 }
4076
4077 int UtcDaliActorRemoveRendererN(void)
4078 {
4079   tet_infoline("Testing Actor::RemoveRenderer");
4080   TestApplication application;
4081
4082   Actor actor = Actor::New();
4083
4084   DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4085
4086   Geometry geometry = CreateQuadGeometry();
4087   Shader   shader   = CreateShader();
4088   Renderer renderer = Renderer::New(geometry, shader);
4089
4090   actor.AddRenderer(renderer);
4091   DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4092   DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4093
4094   actor.RemoveRenderer(10);
4095   DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4096   DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4097
4098   END_TEST;
4099 }
4100
4101 // Clipping test helper functions:
4102 Actor CreateActorWithContent(uint32_t width, uint32_t height)
4103 {
4104   Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
4105   Actor   actor = CreateRenderableActor(image);
4106
4107   // Setup dimensions and position so actor is not skipped by culling.
4108   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4109   actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
4110   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4111   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4112
4113   return actor;
4114 }
4115
4116 Actor CreateActorWithContent16x16()
4117 {
4118   return CreateActorWithContent(16, 16);
4119 }
4120
4121 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
4122 {
4123   enabledDisableTrace.Reset();
4124   stencilTrace.Reset();
4125   enabledDisableTrace.Enable(true);
4126   stencilTrace.Enable(true);
4127
4128   application.SendNotification();
4129   application.Render();
4130
4131   enabledDisableTrace.Enable(false);
4132   stencilTrace.Enable(false);
4133 }
4134
4135 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
4136 {
4137   const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4138
4139   DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
4140   DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
4141   DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
4142   DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
4143 }
4144
4145 int UtcDaliActorPropertyClippingP(void)
4146 {
4147   // This test checks the clippingMode property.
4148   tet_infoline("Testing Actor::Property::ClippingMode: P");
4149   TestApplication application;
4150
4151   Actor actor = Actor::New();
4152
4153   // Check default clippingEnabled value.
4154   Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4155
4156   int  value          = 0;
4157   bool getValueResult = getValue.Get(value);
4158   DALI_TEST_CHECK(getValueResult);
4159
4160   if(getValueResult)
4161   {
4162     DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4163   }
4164
4165   // Check setting the property to the stencil mode.
4166   actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4167
4168   // Check the new value was set.
4169   getValue       = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4170   getValueResult = getValue.Get(value);
4171   DALI_TEST_CHECK(getValueResult);
4172
4173   if(getValueResult)
4174   {
4175     DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4176   }
4177
4178   // Check setting the property to the scissor mode.
4179   actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4180
4181   // Check the new value was set.
4182   getValue       = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4183   getValueResult = getValue.Get(value);
4184   DALI_TEST_CHECK(getValueResult);
4185
4186   if(getValueResult)
4187   {
4188     DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4189   }
4190   END_TEST;
4191 }
4192
4193 int UtcDaliActorPropertyClippingN(void)
4194 {
4195   // Negative test case for Clipping.
4196   tet_infoline("Testing Actor::Property::ClippingMode: N");
4197   TestApplication application;
4198
4199   Actor actor = Actor::New();
4200
4201   // Check default clippingEnabled value.
4202   Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4203
4204   int  value          = 0;
4205   bool getValueResult = getValue.Get(value);
4206   DALI_TEST_CHECK(getValueResult);
4207
4208   if(getValueResult)
4209   {
4210     DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4211   }
4212
4213   // Check setting an invalid property value won't change the current property value.
4214   actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4215
4216   getValue       = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4217   getValueResult = getValue.Get(value);
4218   DALI_TEST_CHECK(getValueResult);
4219
4220   if(getValueResult)
4221   {
4222     DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4223   }
4224
4225   END_TEST;
4226 }
4227
4228 int UtcDaliActorPropertyClippingActor(void)
4229 {
4230   // This test checks that an actor is correctly setup for clipping.
4231   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4232   TestApplication application;
4233
4234   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4235   TraceCallStack&    stencilTrace        = glAbstraction.GetStencilFunctionTrace();
4236   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4237   size_t             startIndex          = 0u;
4238
4239   // Create a clipping actor.
4240   Actor actorDepth1Clip = CreateActorWithContent16x16();
4241   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4242   application.GetScene().Add(actorDepth1Clip);
4243
4244   // Gather the call trace.
4245   GenerateTrace(application, enabledDisableTrace, stencilTrace);
4246
4247   // Check we are writing to the color buffer.
4248   CheckColorMask(glAbstraction, true);
4249
4250   // Check the stencil buffer was enabled.
4251   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4252
4253   // Check the stencil buffer was cleared.
4254   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4255
4256   // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4257   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4258   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4259   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4260
4261   END_TEST;
4262 }
4263
4264 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4265 {
4266   // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4267   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
4268   TestApplication application;
4269
4270   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4271   TraceCallStack&    stencilTrace        = glAbstraction.GetStencilFunctionTrace();
4272   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4273   size_t             startIndex          = 0u;
4274
4275   // Create a clipping actor.
4276   Actor actorDepth1Clip = CreateActorWithContent16x16();
4277   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4278   application.GetScene().Add(actorDepth1Clip);
4279
4280   // Gather the call trace.
4281   GenerateTrace(application, enabledDisableTrace, stencilTrace);
4282
4283   // Check we are writing to the color buffer.
4284   CheckColorMask(glAbstraction, true);
4285
4286   // Check the stencil buffer was enabled.
4287   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4288
4289   // Check the stencil buffer was cleared.
4290   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4291
4292   // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4293   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4294   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4295   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4296
4297   // Now disable the clipping
4298   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4299
4300   // Gather the call trace.
4301   GenerateTrace(application, enabledDisableTrace, stencilTrace);
4302
4303   // Check the stencil buffer was disabled.
4304   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", "2960")); // 2960 is GL_STENCIL_TEST
4305
4306   // Ensure all values in stencil-mask are set to 1.
4307   startIndex = 0u;
4308   DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
4309
4310   END_TEST;
4311 }
4312
4313 int UtcDaliActorPropertyClippingNestedChildren(void)
4314 {
4315   // This test checks that a hierarchy of actors are clipped correctly by
4316   // writing to and reading from the correct bit-planes of the stencil buffer.
4317   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
4318   TestApplication    application;
4319   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4320   TraceCallStack&    stencilTrace        = glAbstraction.GetStencilFunctionTrace();
4321   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4322
4323   // Create a clipping actor.
4324   Actor actorDepth1Clip = CreateActorWithContent16x16();
4325   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4326   application.GetScene().Add(actorDepth1Clip);
4327
4328   // Create a child actor.
4329   Actor childDepth2 = CreateActorWithContent16x16();
4330   actorDepth1Clip.Add(childDepth2);
4331
4332   // Create another clipping actor.
4333   Actor childDepth2Clip = CreateActorWithContent16x16();
4334   childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4335   childDepth2.Add(childDepth2Clip);
4336
4337   // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4338   // This tests the sort algorithm.
4339   Actor childDepth3 = CreateActorWithContent16x16();
4340   childDepth2Clip.Add(childDepth3);
4341   Actor childDepth4 = CreateActorWithContent16x16();
4342   childDepth3.Add(childDepth4);
4343
4344   // Gather the call trace.
4345   GenerateTrace(application, enabledDisableTrace, stencilTrace);
4346
4347   // Check we are writing to the color buffer.
4348   CheckColorMask(glAbstraction, true);
4349
4350   // Check the stencil buffer was enabled.
4351   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4352
4353   // Perform the test twice, once for 2D layer, and once for 3D.
4354   for(unsigned int i = 0u; i < 2u; ++i)
4355   {
4356     size_t startIndex = 0u;
4357
4358     // Check the stencil buffer was cleared.
4359     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4360
4361     // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4362     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex));      // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4363     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));              // Write to the first bit-plane
4364     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4365
4366     // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4367     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 255", startIndex));    // 514 is GL_EQUAL
4368     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4369
4370     // Check we are set up to write to the second bitplane of the stencil buffer (only).
4371     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex));      // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4372     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex));              // Write to second (and previous) bit-planes
4373     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4374
4375     // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4376     // (Both must be set to pass the check).
4377     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 255", startIndex));    // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4378     DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4379
4380     // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4381     if(i == 0u)
4382     {
4383       application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
4384       GenerateTrace(application, enabledDisableTrace, stencilTrace);
4385     }
4386   }
4387
4388   END_TEST;
4389 }
4390
4391 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4392 {
4393   // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4394   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
4395   TestApplication    application;
4396   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4397   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4398
4399   /* We create a small tree of actors as follows:
4400
4401                            A
4402                           / \
4403      Clipping enabled -> B   D
4404                          |   |
4405                          C   E
4406
4407      The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4408   */
4409   Actor actors[5];
4410   for(int i = 0; i < 5; ++i)
4411   {
4412     Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
4413     Actor   actor = CreateRenderableActor(image);
4414
4415     // Setup dimensions and position so actor is not skipped by culling.
4416     actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4417     actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
4418
4419     if(i == 0)
4420     {
4421       actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4422     }
4423     else
4424     {
4425       float b = i > 2 ? 1.0f : -1.0f;
4426       actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
4427     }
4428
4429     actors[i] = actor;
4430   }
4431
4432   // Enable clipping on the actor at the top of the left branch.
4433   actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4434
4435   // Build the scene graph.
4436   application.GetScene().Add(actors[0]);
4437
4438   // Left branch:
4439   actors[0].Add(actors[1]);
4440   actors[1].Add(actors[2]);
4441
4442   // Right branch:
4443   actors[0].Add(actors[3]);
4444   actors[3].Add(actors[4]);
4445
4446   // Gather the call trace.
4447   enabledDisableTrace.Reset();
4448   enabledDisableTrace.Enable(true);
4449   application.SendNotification();
4450   application.Render();
4451   enabledDisableTrace.Enable(false);
4452
4453   /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4454
4455      Note: Correct enable call trace:    StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960 StackTrace: Index:2, Function:Disable, ParamList:2960
4456            Incorrect enable call trace:  StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4457   */
4458   size_t startIndex = 0u;
4459   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "3042", startIndex));
4460   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex)); // 2960 is GL_STENCIL_TEST
4461   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
4462
4463   // Swap the clipping actor from top of left branch to top of right branch.
4464   actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4465   actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4466
4467   // Gather the call trace.
4468   enabledDisableTrace.Reset();
4469   enabledDisableTrace.Enable(true);
4470   application.SendNotification();
4471   application.Render();
4472   enabledDisableTrace.Enable(false);
4473
4474   // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4475   // This proves the draw order has remained the same.
4476   startIndex = 0u;
4477   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex));
4478   DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
4479
4480   END_TEST;
4481 }
4482
4483 int UtcDaliActorPropertyScissorClippingActor(void)
4484 {
4485   // This test checks that an actor is correctly setup for clipping.
4486   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
4487   TestApplication application;
4488
4489   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4490   TraceCallStack&    scissorTrace        = glAbstraction.GetScissorTrace();
4491   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4492
4493   const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4494   const Vector2 imageSize(16.0f, 16.0f);
4495
4496   // Create a clipping actor.
4497   Actor clippingActorA = CreateActorWithContent16x16();
4498   // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4499   // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4500   clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4501   clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4502   clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4503   application.GetScene().Add(clippingActorA);
4504
4505   // Gather the call trace.
4506   GenerateTrace(application, enabledDisableTrace, scissorTrace);
4507
4508   // Check we are writing to the color buffer.
4509   CheckColorMask(glAbstraction, true);
4510
4511   // Check scissor test was enabled.
4512   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4513
4514   // Check the scissor was set, and the coordinates are correct.
4515   std::stringstream compareParametersString;
4516   compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4517   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4518
4519   clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4520   clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4521
4522   // Gather the call trace.
4523   GenerateTrace(application, enabledDisableTrace, scissorTrace);
4524
4525   // Check the scissor was set, and the coordinates are correct.
4526   compareParametersString.str(std::string());
4527   compareParametersString.clear();
4528   compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
4529   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4530
4531   END_TEST;
4532 }
4533
4534 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4535 {
4536   // This test checks that an actor is correctly setup for clipping.
4537   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
4538   TestApplication application;
4539
4540   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4541   TraceCallStack&    scissorTrace        = glAbstraction.GetScissorTrace();
4542   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4543
4544   const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4545   const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4546   const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4547
4548   // Create a clipping actors.
4549   Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4550   Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4551
4552   clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4553   clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4554   clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4555
4556   clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4557   clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4558   clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4559
4560   clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4561   clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4562
4563   application.GetScene().Add(clippingActorA);
4564   application.GetScene().Add(clippingActorB);
4565
4566   // Gather the call trace.
4567   GenerateTrace(application, enabledDisableTrace, scissorTrace);
4568
4569   // Check we are writing to the color buffer.
4570   CheckColorMask(glAbstraction, true);
4571
4572   // Check scissor test was enabled.
4573   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4574
4575   // Check the scissor was set, and the coordinates are correct.
4576   std::stringstream compareParametersString;
4577
4578   std::string clipA("0, 500, 480, 200");
4579   std::string clipB("0, 380, 480, 40");
4580
4581   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4582   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4583
4584   END_TEST;
4585 }
4586
4587 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4588 {
4589   // This test checks that an actor is correctly setup for clipping.
4590   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4591   TestApplication application;
4592
4593   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4594   TraceCallStack&    scissorTrace        = glAbstraction.GetScissorTrace();
4595   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4596
4597   const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4598   const Vector2 imageSize(16.0f, 16.0f);
4599
4600   /* Create a nest of 2 scissors to test nesting (intersecting clips).
4601
4602      A is drawn first - with scissor clipping on
4603      B is drawn second - also with scissor clipping on
4604      C is the generated clipping region, the intersection ( A ∩ B )
4605
4606            ┏━━━━━━━┓                   ┌───────┐
4607            ┃     B ┃                   │     B │
4608        ┌───╂┄┄┄┐   ┃               ┌┄┄┄╆━━━┓   │
4609        │   ┃   ┊   ┃     ━━━━━>    ┊   ┃ C ┃   │
4610        │   ┗━━━┿━━━┛               ┊   ┗━━━╃───┘
4611        │ A     │                   ┊ A     ┊
4612        └───────┘                   └┄┄┄┄┄┄┄┘
4613
4614      We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4615   */
4616
4617   // Create a clipping actor.
4618   Actor clippingActorA = CreateActorWithContent16x16();
4619   // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4620   // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4621   clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4622   clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4623   clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4624   application.GetScene().Add(clippingActorA);
4625
4626   // Create a child clipping actor.
4627   Actor clippingActorB = CreateActorWithContent16x16();
4628   clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4629   clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4630   clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4631   clippingActorA.Add(clippingActorB);
4632
4633   // positionModifiers is an array of positions to position B around.
4634   // expect is an array of expected scissor clip coordinate results.
4635   const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
4636   const Vector4 expect[4]            = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
4637
4638   // Loop through each overlap combination.
4639   for(unsigned int test = 0u; test < 4u; ++test)
4640   {
4641     // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4642     const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
4643     clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
4644
4645     // Gather the call trace.
4646     GenerateTrace(application, enabledDisableTrace, scissorTrace);
4647
4648     // Check we are writing to the color buffer.
4649     CheckColorMask(glAbstraction, true);
4650
4651     // Check scissor test was enabled.
4652     DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4653
4654     // Check the scissor was set, and the coordinates are correct.
4655     const Vector4&    expectResults(expect[test]);
4656     std::stringstream compareParametersString;
4657     compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4658     DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
4659   }
4660
4661   END_TEST;
4662 }
4663
4664 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4665 {
4666   // This test checks that an actor is correctly setup for clipping.
4667   tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4668   TestApplication application;
4669
4670   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4671   TraceCallStack&    scissorTrace        = glAbstraction.GetScissorTrace();
4672   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4673
4674   /* Create a nest of 2 scissors and siblings of the parent.
4675
4676             stage
4677               |
4678         ┌─────┐─────┐
4679         A     C     D
4680         |           |
4681         B           E
4682   */
4683
4684   const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4685   const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4686   const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4687   const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
4688   const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
4689   const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
4690
4691   // Create a clipping actors.
4692   Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4693   Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4694   Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
4695   Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
4696   Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
4697
4698   clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4699   clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4700   clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4701
4702   clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4703   clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4704   clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4705
4706   clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4707   clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4708   clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4709
4710   clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4711   clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4712   clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4713
4714   clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4715   clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4716
4717   clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4718   clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4719   clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
4720   clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4721   clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4722
4723   application.GetScene().Add(clippingActorA);
4724   clippingActorA.Add(clippingActorB);
4725   application.GetScene().Add(clippingActorC);
4726   application.GetScene().Add(clippingActorD);
4727   clippingActorD.Add(clippingActorE);
4728
4729   // Gather the call trace.
4730   GenerateTrace(application, enabledDisableTrace, scissorTrace);
4731
4732   // Check we are writing to the color buffer.
4733   CheckColorMask(glAbstraction, true);
4734
4735   // Check scissor test was enabled.
4736   DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4737
4738   // Check the scissor was set, and the coordinates are correct.
4739   std::string clipA("0, 500, 480, 200");
4740   std::string clipB("0, 580, 480, 40");
4741   std::string clipC("0, 200, 480, 200");
4742   std::string clipD("0, 300, 480, 200");
4743
4744   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4745   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4746   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
4747   DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
4748   DALI_TEST_CHECK(scissorTrace.CountMethod("Scissor") == 4); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4749
4750   END_TEST;
4751 }
4752
4753 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4754 {
4755   // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4756   tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
4757   TestApplication application;
4758
4759   TestGlAbstraction& glAbstraction       = application.GetGlAbstraction();
4760   TraceCallStack&    stencilTrace        = glAbstraction.GetStencilFunctionTrace();
4761   TraceCallStack&    enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4762
4763   // Create a clipping actor.
4764   Actor actorDepth1Clip = CreateActorWithContent16x16();
4765   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4766   application.GetScene().Add(actorDepth1Clip);
4767
4768   // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4769   actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
4770
4771   // Gather the call trace.
4772   GenerateTrace(application, enabledDisableTrace, stencilTrace);
4773
4774   // Check we are writing to the color buffer.
4775   CheckColorMask(glAbstraction, true);
4776
4777   // Check the stencil buffer was not enabled.
4778   DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4779
4780   // Check stencil functions are not called.
4781   DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
4782   DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask"));
4783   DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
4784
4785   // Check that scissor clipping is overriden by the renderer properties.
4786   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4787
4788   actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4789
4790   // Gather the call trace.
4791   GenerateTrace(application, enabledDisableTrace, scissorTrace);
4792
4793   // Check the stencil buffer was not enabled.
4794   DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4795
4796   DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
4797
4798   END_TEST;
4799 }
4800
4801 int UtcDaliGetPropertyN(void)
4802 {
4803   tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
4804   TestApplication application;
4805
4806   Actor actor = Actor::New();
4807
4808   unsigned int propertyCount = actor.GetPropertyCount();
4809   DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
4810   END_TEST;
4811 }
4812
4813 int UtcDaliActorRaiseLower(void)
4814 {
4815   tet_infoline("UtcDaliActor Raise and Lower test\n");
4816
4817   TestApplication application;
4818
4819   Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
4820
4821   Integration::Scene stage(application.GetScene());
4822
4823   Actor actorA = Actor::New();
4824   Actor actorB = Actor::New();
4825   Actor actorC = Actor::New();
4826
4827   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4828   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4829
4830   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4831   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4832
4833   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4834   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4835
4836   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4837   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4838
4839   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4840   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4841
4842   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4843   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4844
4845   stage.Add(actorA);
4846   stage.Add(actorB);
4847   stage.Add(actorC);
4848
4849   ResetTouchCallbacks();
4850
4851   application.SendNotification();
4852   application.Render();
4853
4854   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4855   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4856   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
4857
4858   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4859   // Only top actor will get touched.
4860   actorA.TouchedSignal().Connect(TestTouchCallback);
4861   actorB.TouchedSignal().Connect(TestTouchCallback2);
4862   actorC.TouchedSignal().Connect(TestTouchCallback3);
4863
4864   // Connect ChildOrderChangedSignal
4865   bool                     orderChangedSignal(false);
4866   Actor                    orderChangedActor;
4867   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
4868   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
4869
4870   Dali::Integration::Point point;
4871   point.SetDeviceId(1);
4872   point.SetState(PointState::DOWN);
4873   point.SetScreenPosition(Vector2(10.f, 10.f));
4874   Dali::Integration::TouchEvent touchEvent;
4875   touchEvent.AddPoint(point);
4876
4877   application.ProcessEvent(touchEvent);
4878
4879   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4880   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4881   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
4882
4883   ResetTouchCallbacks();
4884
4885   tet_printf("Testing Raising of Actor\n");
4886
4887   int preActorOrder(0);
4888   int postActorOrder(0);
4889
4890   Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4891   value.Get(preActorOrder);
4892
4893   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
4894   actorB.Raise();
4895   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
4896   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
4897
4898   // Ensure sort order is calculated before next touch event
4899   application.SendNotification();
4900
4901   value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4902   value.Get(postActorOrder);
4903
4904   tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
4905
4906   application.ProcessEvent(touchEvent);
4907
4908   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4909   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
4910   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
4911
4912   ResetTouchCallbacks();
4913
4914   tet_printf("Testing Lowering of Actor\n");
4915
4916   value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4917   value.Get(preActorOrder);
4918
4919   orderChangedSignal = false;
4920
4921   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
4922   actorB.Lower();
4923   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
4924   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
4925
4926   application.SendNotification(); // ensure sort order calculated before next touch event
4927
4928   value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4929   value.Get(postActorOrder);
4930
4931   tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
4932
4933   application.ProcessEvent(touchEvent);
4934
4935   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4936   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4937   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
4938
4939   ResetTouchCallbacks();
4940
4941   Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
4942
4943   END_TEST;
4944 }
4945
4946 int UtcDaliActorRaiseToTopLowerToBottom(void)
4947 {
4948   tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
4949
4950   TestApplication application;
4951
4952   Integration::Scene stage(application.GetScene());
4953
4954   Actor actorA = Actor::New();
4955   Actor actorB = Actor::New();
4956   Actor actorC = Actor::New();
4957
4958   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
4959   // enables checking of which actor the uniform is assigned too
4960   Shader shaderA = CreateShader();
4961   shaderA.RegisterProperty("uRendererColor", 1.f);
4962
4963   Shader shaderB = CreateShader();
4964   shaderB.RegisterProperty("uRendererColor", 2.f);
4965
4966   Shader shaderC = CreateShader();
4967   shaderC.RegisterProperty("uRendererColor", 3.f);
4968
4969   Geometry geometry = CreateQuadGeometry();
4970
4971   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
4972   Renderer rendererA = Renderer::New(geometry, shaderA);
4973   actorA.AddRenderer(rendererA);
4974
4975   Renderer rendererB = Renderer::New(geometry, shaderB);
4976   actorB.AddRenderer(rendererB);
4977
4978   Renderer rendererC = Renderer::New(geometry, shaderC);
4979   actorC.AddRenderer(rendererC);
4980
4981   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4982   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4983
4984   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4985   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4986
4987   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4988   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4989
4990   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4991   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4992
4993   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4994   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4995
4996   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4997   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4998
4999   stage.Add(actorA);
5000   stage.Add(actorB);
5001   stage.Add(actorC);
5002
5003   ResetTouchCallbacks();
5004
5005   // Connect ChildOrderChangedSignal
5006   bool                     orderChangedSignal(false);
5007   Actor                    orderChangedActor;
5008   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5009   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5010
5011   // Set up gl abstraction trace so can query the set uniform order
5012   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5013   glAbstraction.EnableSetUniformCallTrace(true);
5014   glAbstraction.ResetSetUniformCallStack();
5015
5016   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5017
5018   application.SendNotification();
5019   application.Render();
5020
5021   tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
5022
5023   // Test order of uniforms in stack
5024   int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5025   int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5026   int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5027
5028   bool CBA = (indexC > indexB) && (indexB > indexA);
5029
5030   DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5031
5032   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5033   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5034   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5035
5036   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5037   // Only top actor will get touched.
5038   actorA.TouchedSignal().Connect(TestTouchCallback);
5039   actorB.TouchedSignal().Connect(TestTouchCallback2);
5040   actorC.TouchedSignal().Connect(TestTouchCallback3);
5041
5042   Dali::Integration::Point point;
5043   point.SetDeviceId(1);
5044   point.SetState(PointState::DOWN);
5045   point.SetScreenPosition(Vector2(10.f, 10.f));
5046   Dali::Integration::TouchEvent touchEvent;
5047   touchEvent.AddPoint(point);
5048
5049   application.ProcessEvent(touchEvent);
5050
5051   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5052   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5053   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5054
5055   ResetTouchCallbacks();
5056
5057   tet_printf("RaiseToTop ActorA\n");
5058
5059   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5060   actorA.RaiseToTop();
5061   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5062   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5063
5064   application.SendNotification(); // ensure sorting order is calculated before next touch event
5065
5066   application.ProcessEvent(touchEvent);
5067
5068   glAbstraction.ResetSetUniformCallStack();
5069   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5070
5071   application.SendNotification();
5072   application.Render();
5073
5074   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5075
5076   // Test order of uniforms in stack
5077   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5078   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5079   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5080
5081   tet_infoline("Testing A above C and B at bottom\n");
5082   bool ACB = (indexA > indexC) && (indexC > indexB);
5083
5084   DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
5085
5086   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5087   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5088   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5089
5090   ResetTouchCallbacks();
5091
5092   tet_printf("RaiseToTop ActorB\n");
5093
5094   orderChangedSignal = false;
5095
5096   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5097   actorB.RaiseToTop();
5098   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5099   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5100
5101   application.SendNotification(); // Ensure sort order is calculated before next touch event
5102
5103   application.ProcessEvent(touchEvent);
5104
5105   glAbstraction.ResetSetUniformCallStack();
5106   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5107
5108   application.SendNotification();
5109   application.Render();
5110
5111   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5112
5113   // Test order of uniforms in stack
5114   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5115   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5116   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5117
5118   tet_infoline("Testing B above A and C at bottom\n");
5119   bool BAC = (indexB > indexA) && (indexA > indexC);
5120
5121   DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
5122
5123   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5124   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5125   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5126
5127   ResetTouchCallbacks();
5128
5129   tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
5130
5131   orderChangedSignal = false;
5132
5133   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5134   actorA.LowerToBottom();
5135   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5136   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5137
5138   application.SendNotification();
5139   application.Render();
5140
5141   orderChangedSignal = false;
5142
5143   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5144   actorB.LowerToBottom();
5145   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5146   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5147
5148   application.SendNotification();
5149   application.Render();
5150
5151   application.ProcessEvent(touchEvent);
5152
5153   glAbstraction.ResetSetUniformCallStack();
5154   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5155
5156   application.SendNotification();
5157   application.Render();
5158
5159   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5160
5161   // Test order of uniforms in stack
5162   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5163   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5164   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5165
5166   tet_infoline("Testing C above A and B at bottom\n");
5167   bool CAB = (indexC > indexA) && (indexA > indexB);
5168
5169   DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
5170
5171   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5172   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5173   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5174
5175   ResetTouchCallbacks();
5176
5177   END_TEST;
5178 }
5179
5180 int UtcDaliActorRaiseAbove(void)
5181 {
5182   tet_infoline("UtcDaliActor RaiseToAbove test \n");
5183
5184   TestApplication application;
5185
5186   Integration::Scene stage(application.GetScene());
5187
5188   Actor actorA = Actor::New();
5189   Actor actorB = Actor::New();
5190   Actor actorC = Actor::New();
5191
5192   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5193   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5194
5195   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5196   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5197
5198   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5199   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5200
5201   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5202   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5203
5204   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5205   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5206
5207   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5208   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5209
5210   stage.Add(actorA);
5211   stage.Add(actorB);
5212   stage.Add(actorC);
5213
5214   ResetTouchCallbacks();
5215
5216   application.SendNotification();
5217   application.Render();
5218
5219   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5220   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5221   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5222
5223   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5224   // Only top actor will get touched.
5225   actorA.TouchedSignal().Connect(TestTouchCallback);
5226   actorB.TouchedSignal().Connect(TestTouchCallback2);
5227   actorC.TouchedSignal().Connect(TestTouchCallback3);
5228
5229   bool                     orderChangedSignal(false);
5230   Actor                    orderChangedActor;
5231   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5232   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5233
5234   Dali::Integration::Point point;
5235   point.SetDeviceId(1);
5236   point.SetState(PointState::DOWN);
5237   point.SetScreenPosition(Vector2(10.f, 10.f));
5238   Dali::Integration::TouchEvent touchEvent;
5239   touchEvent.AddPoint(point);
5240
5241   application.ProcessEvent(touchEvent);
5242
5243   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5244   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5245   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5246
5247   ResetTouchCallbacks();
5248
5249   tet_printf("Raise actor B Above Actor C\n");
5250
5251   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5252   actorB.RaiseAbove(actorC);
5253   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5254   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5255
5256   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5257   application.SendNotification();
5258   application.ProcessEvent(touchEvent);
5259
5260   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5261   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5262   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5263
5264   ResetTouchCallbacks();
5265
5266   tet_printf("Raise actor A Above Actor B\n");
5267
5268   orderChangedSignal = false;
5269
5270   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5271   actorA.RaiseAbove(actorB);
5272   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5273   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5274
5275   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5276   application.SendNotification();
5277
5278   application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5279
5280   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5281   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5282   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5283
5284   ResetTouchCallbacks();
5285
5286   END_TEST;
5287 }
5288
5289 int UtcDaliActorLowerBelow(void)
5290 {
5291   tet_infoline("UtcDaliActor LowerBelow test \n");
5292
5293   TestApplication application;
5294
5295   Integration::Scene stage(application.GetScene());
5296
5297   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5298   // enables checking of which actor the uniform is assigned too
5299   Shader shaderA = CreateShader();
5300   shaderA.RegisterProperty("uRendererColor", 1.f);
5301
5302   Shader shaderB = CreateShader();
5303   shaderB.RegisterProperty("uRendererColor", 2.f);
5304
5305   Shader shaderC = CreateShader();
5306   shaderC.RegisterProperty("uRendererColor", 3.f);
5307
5308   Actor actorA = Actor::New();
5309   Actor actorB = Actor::New();
5310   Actor actorC = Actor::New();
5311
5312   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5313   Geometry geometry = CreateQuadGeometry();
5314
5315   Renderer rendererA = Renderer::New(geometry, shaderA);
5316   actorA.AddRenderer(rendererA);
5317
5318   Renderer rendererB = Renderer::New(geometry, shaderB);
5319   actorB.AddRenderer(rendererB);
5320
5321   Renderer rendererC = Renderer::New(geometry, shaderC);
5322   actorC.AddRenderer(rendererC);
5323
5324   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5325   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5326
5327   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5328   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5329
5330   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5331   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5332
5333   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5334   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5335
5336   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5337   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5338
5339   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5340   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5341
5342   Actor container = Actor::New();
5343   container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5344   container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5345   stage.Add(container);
5346
5347   container.Add(actorA);
5348   container.Add(actorB);
5349   container.Add(actorC);
5350
5351   ResetTouchCallbacks();
5352
5353   // Connect ChildOrderChangedSignal
5354   bool                     orderChangedSignal(false);
5355   Actor                    orderChangedActor;
5356   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5357   DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5358
5359   // Set up gl abstraction trace so can query the set uniform order
5360   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5361   glAbstraction.EnableSetUniformCallTrace(true);
5362   glAbstraction.ResetSetUniformCallStack();
5363   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5364
5365   glAbstraction.ResetSetUniformCallStack();
5366
5367   application.SendNotification();
5368   application.Render();
5369
5370   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5371
5372   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5373
5374   // Test order of uniforms in stack
5375   int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5376   int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5377   int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5378
5379   tet_infoline("Testing C above B and A at bottom\n");
5380   bool CBA = (indexC > indexB) && (indexB > indexA);
5381
5382   DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5383
5384   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5385   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5386   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5387
5388   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5389   // Only top actor will get touched.
5390   actorA.TouchedSignal().Connect(TestTouchCallback);
5391   actorB.TouchedSignal().Connect(TestTouchCallback2);
5392   actorC.TouchedSignal().Connect(TestTouchCallback3);
5393
5394   Dali::Integration::Point point;
5395   point.SetDeviceId(1);
5396   point.SetState(PointState::DOWN);
5397   point.SetScreenPosition(Vector2(10.f, 10.f));
5398   Dali::Integration::TouchEvent touchEvent;
5399   touchEvent.AddPoint(point);
5400
5401   tet_infoline("UtcDaliActor Test Set up completed \n");
5402
5403   application.ProcessEvent(touchEvent);
5404
5405   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5406   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5407   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5408
5409   ResetTouchCallbacks();
5410
5411   tet_printf("Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n");
5412
5413   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5414   actorC.LowerBelow(actorB);
5415   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5416   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5417
5418   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5419   application.SendNotification();
5420   application.Render();
5421
5422   application.ProcessEvent(touchEvent); // touch event
5423
5424   glAbstraction.ResetSetUniformCallStack();
5425   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5426
5427   application.SendNotification();
5428   application.Render();
5429
5430   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5431
5432   // Test order of uniforms in stack
5433   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5434   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5435   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5436
5437   tet_infoline("Testing render order is A, C, B");
5438   DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5439   DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5440
5441   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5442   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5443   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5444
5445   ResetTouchCallbacks();
5446
5447   tet_printf("Lower actor C below Actor A leaving B on top\n");
5448
5449   orderChangedSignal = false;
5450
5451   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5452   actorC.LowerBelow(actorA);
5453   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5454   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5455
5456   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5457   application.SendNotification();
5458   application.Render();
5459
5460   application.ProcessEvent(touchEvent);
5461
5462   glAbstraction.ResetSetUniformCallStack();
5463   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5464
5465   application.Render();
5466   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5467
5468   // Test order of uniforms in stack
5469   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5470   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5471   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5472
5473   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5474   DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5475
5476   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5477   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5478   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5479
5480   ResetTouchCallbacks();
5481
5482   tet_printf("Lower actor B below Actor C leaving A on top\n");
5483
5484   orderChangedSignal = false;
5485
5486   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5487   actorB.LowerBelow(actorC);
5488   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5489   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5490
5491   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5492   application.SendNotification();
5493   application.Render();
5494
5495   application.ProcessEvent(touchEvent);
5496
5497   glAbstraction.ResetSetUniformCallStack();
5498   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5499
5500   application.Render();
5501   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5502
5503   // Test order of uniforms in stack
5504   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5505   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5506   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5507
5508   DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5509   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5510
5511   END_TEST;
5512 }
5513
5514 int UtcDaliActorRaiseAboveDifferentParentsN(void)
5515 {
5516   tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
5517
5518   TestApplication application;
5519
5520   Integration::Scene stage(application.GetScene());
5521
5522   Actor parentA = Actor::New();
5523   Actor parentB = Actor::New();
5524   parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5525   parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5526   parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5527   parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5528
5529   parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5530   parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5531
5532   parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5533   parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5534
5535   stage.Add(parentA);
5536   stage.Add(parentB);
5537
5538   Actor actorA = Actor::New();
5539   Actor actorB = Actor::New();
5540   Actor actorC = Actor::New();
5541
5542   parentA.Add(actorA);
5543   parentA.Add(actorB);
5544
5545   tet_printf("Actor C added to different parent from A and B \n");
5546   parentB.Add(actorC);
5547
5548   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5549   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5550
5551   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5552   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5553
5554   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5555   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5556
5557   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5558   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5559
5560   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5561   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5562
5563   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5564   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5565
5566   ResetTouchCallbacks();
5567
5568   // Connect ChildOrderChangedSignal
5569   bool                     orderChangedSignal(false);
5570   Actor                    orderChangedActor;
5571   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5572   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5573
5574   application.SendNotification();
5575   application.Render();
5576
5577   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5578   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5579   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5580
5581   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5582   // Only top actor will get touched.
5583   actorA.TouchedSignal().Connect(TestTouchCallback);
5584   actorB.TouchedSignal().Connect(TestTouchCallback2);
5585   actorC.TouchedSignal().Connect(TestTouchCallback3);
5586
5587   Dali::Integration::Point point;
5588   point.SetDeviceId(1);
5589   point.SetState(PointState::DOWN);
5590   point.SetScreenPosition(Vector2(10.f, 10.f));
5591   Dali::Integration::TouchEvent touchEvent;
5592   touchEvent.AddPoint(point);
5593
5594   application.ProcessEvent(touchEvent);
5595
5596   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5597   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5598   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5599
5600   ResetTouchCallbacks();
5601
5602   tet_printf("Raise actor A Above Actor C which have different parents\n");
5603
5604   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5605   actorA.RaiseAbove(actorC);
5606   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5607
5608   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5609   application.SendNotification();
5610
5611   application.ProcessEvent(touchEvent); // touch event
5612
5613   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5614   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5615   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5616
5617   ResetTouchCallbacks();
5618
5619   END_TEST;
5620 }
5621
5622 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
5623 {
5624   tet_infoline("UtcDaliActor Test  raiseAbove and lowerBelow api when target Actor has no parent \n");
5625
5626   TestApplication application;
5627
5628   Integration::Scene stage(application.GetScene());
5629
5630   Actor actorA = Actor::New();
5631   Actor actorB = Actor::New();
5632   Actor actorC = Actor::New();
5633
5634   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5635   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5636
5637   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5638   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5639
5640   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5641   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5642
5643   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5644   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5645
5646   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5647   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5648
5649   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5650   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5651
5652   ResetTouchCallbacks();
5653
5654   // Connect ChildOrderChangedSignal
5655   bool                     orderChangedSignal(false);
5656   Actor                    orderChangedActor;
5657   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5658   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5659
5660   application.SendNotification();
5661   application.Render();
5662
5663   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5664   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5665   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5666
5667   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5668   // Only top actor will get touched.
5669   actorA.TouchedSignal().Connect(TestTouchCallback);
5670   actorB.TouchedSignal().Connect(TestTouchCallback2);
5671   actorC.TouchedSignal().Connect(TestTouchCallback3);
5672
5673   Dali::Integration::Point point;
5674   point.SetDeviceId(1);
5675   point.SetState(PointState::DOWN);
5676   point.SetScreenPosition(Vector2(10.f, 10.f));
5677   Dali::Integration::TouchEvent touchEvent;
5678   touchEvent.AddPoint(point);
5679
5680   tet_printf("Raise actor A Above Actor C which have no parents\n");
5681
5682   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5683   actorA.RaiseAbove(actorC);
5684   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5685
5686   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5687   application.SendNotification();
5688
5689   application.ProcessEvent(touchEvent);
5690
5691   tet_printf("Not parented so RaiseAbove should show no effect\n");
5692
5693   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5694   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5695   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5696
5697   ResetTouchCallbacks();
5698
5699   orderChangedSignal = false;
5700
5701   stage.Add(actorB);
5702   tet_printf("Lower actor A below Actor C when only A is not on stage \n");
5703
5704   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5705   actorA.LowerBelow(actorC);
5706   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5707
5708   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5709   application.SendNotification();
5710   application.Render();
5711
5712   application.ProcessEvent(touchEvent);
5713
5714   tet_printf("Actor A not parented so LowerBelow should show no effect\n");
5715   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5716   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5717   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5718
5719   ResetTouchCallbacks();
5720
5721   orderChangedSignal = false;
5722
5723   tet_printf("Adding Actor A to stage, will be on top\n");
5724
5725   stage.Add(actorA);
5726   application.SendNotification();
5727   application.Render();
5728
5729   tet_printf("Raise actor B Above Actor C when only B has a parent\n");
5730
5731   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5732   actorB.RaiseAbove(actorC);
5733   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5734
5735   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5736   application.SendNotification();
5737
5738   application.ProcessEvent(touchEvent);
5739
5740   tet_printf("C not parented so RaiseAbove should show no effect\n");
5741   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5742   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5743   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5744
5745   ResetTouchCallbacks();
5746
5747   orderChangedSignal = false;
5748
5749   tet_printf("Lower actor A below Actor C when only A has a parent\n");
5750
5751   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5752   actorA.LowerBelow(actorC);
5753   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5754
5755   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5756   application.SendNotification();
5757
5758   application.ProcessEvent(touchEvent);
5759
5760   tet_printf("C not parented so LowerBelow should show no effect\n");
5761   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5762   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5763   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5764
5765   ResetTouchCallbacks();
5766
5767   orderChangedSignal = false;
5768
5769   stage.Add(actorC);
5770
5771   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5772   actorA.RaiseAbove(actorC);
5773   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5774   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5775
5776   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5777   application.SendNotification();
5778   application.Render();
5779
5780   application.ProcessEvent(touchEvent);
5781
5782   tet_printf("Raise actor A Above Actor C, now both have same parent \n");
5783   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5784   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5785   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5786
5787   END_TEST;
5788 }
5789
5790 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
5791 {
5792   tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
5793
5794   TestApplication application;
5795
5796   Integration::Scene stage(application.GetScene());
5797
5798   Actor actorA = Actor::New();
5799   Actor actorB = Actor::New();
5800   Actor actorC = Actor::New();
5801
5802   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5803   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5804
5805   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5806   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5807
5808   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5809   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5810
5811   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5812   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5813
5814   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5815   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5816
5817   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5818   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5819
5820   ResetTouchCallbacks();
5821
5822   // Connect ChildOrderChangedSignal
5823   bool                     orderChangedSignal(false);
5824   Actor                    orderChangedActor;
5825   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5826   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5827
5828   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5829   // Only top actor will get touched.
5830   actorA.TouchedSignal().Connect(TestTouchCallback);
5831   actorB.TouchedSignal().Connect(TestTouchCallback2);
5832   actorC.TouchedSignal().Connect(TestTouchCallback3);
5833
5834   Dali::Integration::Point point;
5835   point.SetDeviceId(1);
5836   point.SetState(PointState::DOWN);
5837   point.SetScreenPosition(Vector2(10.f, 10.f));
5838   Dali::Integration::TouchEvent touchEvent;
5839   touchEvent.AddPoint(point);
5840
5841   stage.Add(actorA);
5842   tet_printf("Raise actor B Above Actor C but B not parented\n");
5843
5844   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5845   actorB.Raise();
5846   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5847
5848   application.SendNotification();
5849   application.Render();
5850
5851   application.ProcessEvent(touchEvent);
5852
5853   tet_printf("Not parented so RaiseAbove should show no effect\n");
5854
5855   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5856   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5857   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5858
5859   tet_printf("Raise actor B Above Actor C but B not parented\n");
5860   ResetTouchCallbacks();
5861
5862   orderChangedSignal = false;
5863
5864   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5865   actorC.Lower();
5866   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5867
5868   // Sort actor tree before next touch event
5869   application.SendNotification();
5870   application.Render();
5871
5872   application.ProcessEvent(touchEvent);
5873
5874   tet_printf("Not parented so RaiseAbove should show no effect\n");
5875
5876   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5877   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5878   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5879   ResetTouchCallbacks();
5880
5881   orderChangedSignal = false;
5882
5883   tet_printf("Lower actor C below B but C not parented\n");
5884
5885   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5886   actorB.Lower();
5887   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5888
5889   // Sort actor tree before next touch event
5890   application.SendNotification();
5891   application.Render();
5892
5893   application.ProcessEvent(touchEvent);
5894
5895   tet_printf("Not parented so Lower should show no effect\n");
5896
5897   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5898   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5899   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5900   ResetTouchCallbacks();
5901
5902   orderChangedSignal = false;
5903
5904   tet_printf("Raise actor B to top\n");
5905
5906   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5907   actorB.RaiseToTop();
5908   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5909
5910   // Sort actor tree before next touch event
5911   application.SendNotification();
5912   application.Render();
5913
5914   application.ProcessEvent(touchEvent);
5915
5916   tet_printf("Not parented so RaiseToTop should show no effect\n");
5917
5918   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5919   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5920   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5921   ResetTouchCallbacks();
5922
5923   orderChangedSignal = false;
5924
5925   tet_printf("Add ActorB to stage so only Actor C not parented\n");
5926
5927   stage.Add(actorB);
5928
5929   tet_printf("Lower actor C to Bottom, B stays at top\n");
5930
5931   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5932   actorC.LowerToBottom();
5933   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5934
5935   application.SendNotification();
5936   application.Render();
5937
5938   application.ProcessEvent(touchEvent);
5939
5940   tet_printf("Not parented so LowerToBottom should show no effect\n");
5941
5942   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5943   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5944   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5945   ResetTouchCallbacks();
5946
5947   END_TEST;
5948 }
5949
5950 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
5951 {
5952   tet_infoline("UtcDaliActor RaiseToAbove and  test with actor provided as target resulting in a no operation \n");
5953
5954   TestApplication application;
5955
5956   Integration::Scene stage(application.GetScene());
5957
5958   Actor actorA = Actor::New();
5959   Actor actorB = Actor::New();
5960   Actor actorC = Actor::New();
5961
5962   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5963   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5964
5965   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5966   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5967
5968   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5969   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5970
5971   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5972   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5973
5974   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5975   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5976
5977   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5978   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5979
5980   stage.Add(actorA);
5981   stage.Add(actorB);
5982   stage.Add(actorC);
5983
5984   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5985   // Only top actor will get touched.
5986   actorA.TouchedSignal().Connect(TestTouchCallback);
5987   actorB.TouchedSignal().Connect(TestTouchCallback2);
5988   actorC.TouchedSignal().Connect(TestTouchCallback3);
5989
5990   ResetTouchCallbacks();
5991
5992   // Connect ChildOrderChangedSignal
5993   bool                     orderChangedSignal(false);
5994   Actor                    orderChangedActor;
5995   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5996   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5997
5998   application.SendNotification();
5999   application.Render();
6000
6001   Dali::Integration::Point point;
6002   point.SetDeviceId(1);
6003   point.SetState(PointState::DOWN);
6004   point.SetScreenPosition(Vector2(10.f, 10.f));
6005   Dali::Integration::TouchEvent touchEvent;
6006   touchEvent.AddPoint(point);
6007
6008   application.ProcessEvent(touchEvent);
6009
6010   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6011   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6012   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6013
6014   ResetTouchCallbacks();
6015
6016   tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
6017
6018   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6019   actorA.RaiseAbove(actorA);
6020   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6021   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6022
6023   application.SendNotification();
6024   application.Render();
6025
6026   application.ProcessEvent(touchEvent);
6027
6028   tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
6029
6030   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6031   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6032   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6033
6034   ResetTouchCallbacks();
6035
6036   orderChangedSignal = false;
6037
6038   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6039   actorA.RaiseAbove(actorC);
6040   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6041   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6042
6043   application.SendNotification();
6044   application.Render();
6045
6046   application.ProcessEvent(touchEvent);
6047
6048   tet_infoline("Raise actor A Above Actor C which will now be successful \n");
6049   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6050   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6051   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6052
6053   END_TEST;
6054 }
6055
6056 int UtcDaliActorGetScreenPosition(void)
6057 {
6058   tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
6059
6060   TestApplication application;
6061
6062   Integration::Scene stage(application.GetScene());
6063
6064   Actor actorA = Actor::New();
6065   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6066
6067   Vector2 size2(10.0f, 20.0f);
6068   actorA.SetProperty(Actor::Property::SIZE, size2);
6069
6070   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6071
6072   tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
6073
6074   stage.Add(actorA);
6075
6076   application.SendNotification();
6077   application.Render();
6078
6079   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6080   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6081
6082   tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6083   tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
6084
6085   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6086   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6087
6088   tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
6089
6090   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6091
6092   application.SendNotification();
6093   application.Render();
6094
6095   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6096   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6097
6098   tet_printf("Actor World Position  ( %f %f ) AnchorPoint::TOP_LEFT  \n", actorWorldPosition.x, actorWorldPosition.y);
6099   tet_printf("Actor Screen Position  ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
6100
6101   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6102   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6103
6104   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
6105
6106   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6107
6108   application.SendNotification();
6109   application.Render();
6110
6111   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6112   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6113
6114   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT   \n", actorWorldPosition.x, actorWorldPosition.y);
6115   tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT  \n", actorScreenPosition.x, actorScreenPosition.y);
6116
6117   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6118   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6119
6120   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
6121
6122   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
6123
6124   application.SendNotification();
6125   application.Render();
6126
6127   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6128   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6129
6130   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
6131   tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0   \n", actorScreenPosition.x, actorScreenPosition.y);
6132
6133   DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6134   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6135
6136   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
6137
6138   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
6139
6140   application.SendNotification();
6141   application.Render();
6142
6143   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6144   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6145
6146   DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6147   DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
6148
6149   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
6150   tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6151
6152   tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
6153
6154   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6155   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
6156
6157   Actor actorB = Actor::New();
6158   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6159   actorB.SetProperty(Actor::Property::SIZE, size2);
6160   actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
6161   actorA.Add(actorB);
6162
6163   actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6164
6165   application.SendNotification();
6166   application.Render();
6167
6168   actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6169
6170   DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
6171   DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
6172
6173   END_TEST;
6174 }
6175
6176 int UtcDaliActorGetScreenPositionAfterScaling(void)
6177 {
6178   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
6179
6180   TestApplication application;
6181
6182   Integration::Scene stage(application.GetScene());
6183
6184   Actor actorA = Actor::New();
6185   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6186
6187   Vector2 size2(10.0f, 20.0f);
6188   actorA.SetProperty(Actor::Property::SIZE, size2);
6189   actorA.SetProperty(Actor::Property::SCALE, 1.5f);
6190   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6191
6192   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
6193
6194   stage.Add(actorA);
6195
6196   application.SendNotification();
6197   application.Render();
6198
6199   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6200   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6201
6202   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6203   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6204
6205   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6206   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6207
6208   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
6209
6210   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6211
6212   application.SendNotification();
6213   application.Render();
6214
6215   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6216   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6217
6218   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6219   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6220
6221   DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
6222   DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6223
6224   END_TEST;
6225 }
6226
6227 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6228 {
6229   tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
6230
6231   TestApplication application;
6232
6233   Integration::Scene stage(application.GetScene());
6234
6235   Actor actorA = Actor::New();
6236   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6237   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6238   Vector2 size2(10.0f, 20.0f);
6239   actorA.SetProperty(Actor::Property::SIZE, size2);
6240   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6241
6242   tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6243
6244   stage.Add(actorA);
6245
6246   application.SendNotification();
6247   application.Render();
6248
6249   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6250   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6251
6252   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6253   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6254
6255   DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
6256   DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
6257
6258   tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
6259
6260   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
6261   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6262
6263   application.SendNotification();
6264   application.Render();
6265
6266   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6267   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6268
6269   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6270   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6271
6272   DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
6273   DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6274
6275   END_TEST;
6276   END_TEST;
6277 }
6278
6279 int UtcDaliActorGetScreenPositionWithChildActors(void)
6280 {
6281   tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
6282
6283   TestApplication application;
6284
6285   Integration::Scene stage(application.GetScene());
6286
6287   tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6288
6289   Actor actorA = Actor::New();
6290   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6291   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6292   Vector2 size1(10.0f, 20.0f);
6293   actorA.SetProperty(Actor::Property::SIZE, size1);
6294   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6295
6296   tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6297
6298   Actor parentActorA = Actor::New();
6299   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6300   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6301   Vector2 size2(30.0f, 60.0f);
6302   parentActorA.SetProperty(Actor::Property::SIZE, size2);
6303   parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6304
6305   tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6306
6307   stage.Add(parentActorA);
6308   parentActorA.Add(actorA);
6309
6310   application.SendNotification();
6311   application.Render();
6312
6313   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6314   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6315
6316   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6317   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6318
6319   DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
6320   DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
6321
6322   tet_infoline("Test 2\n");
6323
6324   tet_infoline("change parent anchor point and parent origin then check screen position \n");
6325
6326   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6327   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
6328
6329   application.SendNotification();
6330   application.Render();
6331
6332   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6333   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6334
6335   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT  \n", actorWorldPosition.x, actorWorldPosition.y);
6336   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6337
6338   DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
6339   DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
6340
6341   END_TEST;
6342 }
6343
6344 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6345 {
6346   tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
6347
6348   TestApplication application;
6349
6350   Integration::Scene stage(application.GetScene());
6351
6352   tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6353
6354   Actor actorA = Actor::New();
6355   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6356   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6357   Vector2 size1(10.0f, 20.0f);
6358   actorA.SetProperty(Actor::Property::SIZE, size1);
6359   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6360
6361   tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6362
6363   Actor parentActorA = Actor::New();
6364   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6365   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6366   Vector2 size2(30.0f, 60.0f);
6367   parentActorA.SetProperty(Actor::Property::SIZE, size2);
6368   parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6369
6370   tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
6371
6372   Actor grandParentActorA = Actor::New();
6373   grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6374   grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
6375   Vector2 size3(60.0f, 120.0f);
6376   grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
6377   grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6378
6379   tet_infoline("Add Parent 1 to Grand Parent 1 \n");
6380
6381   stage.Add(grandParentActorA);
6382   grandParentActorA.Add(parentActorA);
6383
6384   tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6385
6386   parentActorA.Add(actorA);
6387
6388   application.SendNotification();
6389   application.Render();
6390
6391   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6392   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6393
6394   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6395   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6396
6397   DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
6398   DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
6399
6400   END_TEST;
6401 }
6402
6403 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6404 {
6405   tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
6406
6407   TestApplication application;
6408
6409   Integration::Scene stage(application.GetScene());
6410
6411   tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6412
6413   Actor actorA = Actor::New();
6414   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6415   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6416   actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6417   actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
6418   stage.Add(actorA);
6419
6420   tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6421
6422   Actor actorB = Actor::New();
6423   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6424   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6425   actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6426   Vector2 actorBSize(30.0f, 60.0f);
6427   actorB.SetProperty(Actor::Property::SIZE, actorBSize);
6428   stage.Add(actorB);
6429
6430   tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6431
6432   Actor actorC = Actor::New();
6433   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6434   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6435   actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6436   Vector2 actorCSize(60.0f, 120.0f);
6437   actorC.SetProperty(Actor::Property::SIZE, actorCSize);
6438   stage.Add(actorC);
6439
6440   application.SendNotification();
6441   application.Render();
6442
6443   tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
6444
6445   Vector2 center(stage.GetSize() * 0.5f);
6446
6447   DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6448   DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6449   DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6450
6451   tet_infoline("Add scale to all actors");
6452
6453   actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6454   actorB.SetProperty(Actor::Property::SCALE, 2.0f);
6455   actorC.SetProperty(Actor::Property::SCALE, 2.0f);
6456
6457   application.SendNotification();
6458   application.Render();
6459
6460   DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
6461   DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
6462   DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
6463
6464   END_TEST;
6465 }
6466
6467 int utcDaliActorPositionUsesAnchorPoint(void)
6468 {
6469   TestApplication application;
6470   tet_infoline("Check default behaviour\n");
6471
6472   Actor actor = Actor::New();
6473   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6474   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6475   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6476   application.GetScene().Add(actor);
6477
6478   application.SendNotification();
6479   application.Render();
6480
6481   tet_infoline("Check that the world position is in the center\n");
6482   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6483
6484   tet_infoline("Set the position uses anchor point property to false\n");
6485   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6486
6487   application.SendNotification();
6488   application.Render();
6489
6490   tet_infoline("Check that the world position has changed appropriately\n");
6491   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6492
6493   END_TEST;
6494 }
6495
6496 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
6497 {
6498   TestApplication application;
6499   tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6500
6501   Actor actor = Actor::New();
6502   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6503   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6504   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6505   actor.SetProperty(Actor::Property::SCALE, 2.0f);
6506   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6507   application.GetScene().Add(actor);
6508
6509   application.SendNotification();
6510   application.Render();
6511
6512   tet_infoline("Check the world position is the same as it would be without a scale\n");
6513   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6514
6515   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6516   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6517   application.SendNotification();
6518   application.Render();
6519   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
6520
6521   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6522   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6523   application.SendNotification();
6524   application.Render();
6525   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6526
6527   END_TEST;
6528 }
6529
6530 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
6531 {
6532   TestApplication application;
6533   tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6534
6535   Actor actor = Actor::New();
6536   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6537   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6538   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6539   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6540   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6541   application.GetScene().Add(actor);
6542
6543   application.SendNotification();
6544   application.Render();
6545
6546   tet_infoline("Check the world position is the same as it would be without a rotation\n");
6547   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6548
6549   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6550   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6551   application.SendNotification();
6552   application.Render();
6553   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
6554
6555   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6556   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6557   application.SendNotification();
6558   application.Render();
6559   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
6560
6561   END_TEST;
6562 }
6563
6564 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
6565 {
6566   TestApplication application;
6567   tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6568
6569   Actor actor = Actor::New();
6570   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6571   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6572   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6573   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6574   actor.SetProperty(Actor::Property::SCALE, 2.0f);
6575   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6576   application.GetScene().Add(actor);
6577
6578   application.SendNotification();
6579   application.Render();
6580
6581   tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
6582   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6583
6584   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6585   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6586   application.SendNotification();
6587   application.Render();
6588   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
6589
6590   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6591   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6592   application.SendNotification();
6593   application.Render();
6594   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
6595
6596   END_TEST;
6597 }
6598
6599 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
6600 {
6601   TestApplication application;
6602   tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6603
6604   Actor parent = Actor::New();
6605
6606   application.GetScene().Add(parent);
6607   Vector2 stageSize(application.GetScene().GetSize());
6608
6609   Actor actor = Actor::New();
6610   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6611   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6612   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6613   actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
6614   actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
6615   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6616   parent.Add(actor);
6617
6618   application.SendNotification();
6619   application.Render();
6620
6621   const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
6622
6623   tet_infoline("Check the world position is in the right place\n");
6624   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6625
6626   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
6627   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6628   application.SendNotification();
6629   application.Render();
6630   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6631
6632   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
6633   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6634   application.SendNotification();
6635   application.Render();
6636   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6637
6638   END_TEST;
6639 }
6640
6641 int utcDaliActorVisibilityChangeSignalSelf(void)
6642 {
6643   TestApplication application;
6644   tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
6645
6646   Actor actor = Actor::New();
6647
6648   VisibilityChangedFunctorData data;
6649   DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
6650
6651   actor.SetProperty(Actor::Property::VISIBLE, false);
6652
6653   data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6654
6655   tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
6656   data.Reset();
6657
6658   actor.SetProperty(Actor::Property::VISIBLE, false);
6659   data.Check(false /* not called */, TEST_LOCATION);
6660
6661   tet_infoline("Change the visibility using properties, ensure called");
6662   data.Reset();
6663
6664   actor.SetProperty(Actor::Property::VISIBLE, true);
6665   data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6666
6667   tet_infoline("Set the visibility to current using properties, ensure not called");
6668   data.Reset();
6669
6670   actor.SetProperty(Actor::Property::VISIBLE, true);
6671   data.Check(false /* not called */, TEST_LOCATION);
6672
6673   END_TEST;
6674 }
6675
6676 int utcDaliActorVisibilityChangeSignalChildren(void)
6677 {
6678   TestApplication application;
6679   tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
6680
6681   Actor parent = Actor::New();
6682   Actor child  = Actor::New();
6683   parent.Add(child);
6684
6685   Actor grandChild = Actor::New();
6686   child.Add(grandChild);
6687
6688   VisibilityChangedFunctorData parentData;
6689   VisibilityChangedFunctorData childData;
6690   VisibilityChangedFunctorData grandChildData;
6691
6692   tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
6693   DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
6694   DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
6695
6696   parent.SetProperty(Actor::Property::VISIBLE, false);
6697   parentData.Check(false /* not called */, TEST_LOCATION);
6698   childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6699   grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6700
6701   tet_infoline("Connect to the parent's signal as well and ensure all three are called");
6702   parentData.Reset();
6703   childData.Reset();
6704   grandChildData.Reset();
6705
6706   DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
6707
6708   parent.SetProperty(Actor::Property::VISIBLE, true);
6709   parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6710   childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6711   grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6712
6713   tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
6714   parentData.Reset();
6715   childData.Reset();
6716   grandChildData.Reset();
6717
6718   parent.SetProperty(Actor::Property::VISIBLE, true);
6719   parentData.Check(false /* not called */, TEST_LOCATION);
6720   childData.Check(false /* not called */, TEST_LOCATION);
6721   grandChildData.Check(false /* not called */, TEST_LOCATION);
6722
6723   END_TEST;
6724 }
6725
6726 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
6727 {
6728   TestApplication application;
6729   tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
6730
6731   Actor actor = Actor::New();
6732   application.GetScene().Add(actor);
6733
6734   application.SendNotification();
6735   application.Render();
6736
6737   VisibilityChangedFunctorData data;
6738   DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
6739
6740   Animation animation = Animation::New(1.0f);
6741   animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
6742
6743   data.Check(false, TEST_LOCATION);
6744   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6745   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6746
6747   tet_infoline("Play the animation and check the property value");
6748   animation.Play();
6749
6750   data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6751   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
6752
6753   tet_infoline("Animation not currently finished, so the current visibility should still be true");
6754   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6755
6756   application.SendNotification();
6757   application.Render(1100); // After the animation
6758
6759   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
6760
6761   END_TEST;
6762 }
6763
6764 int utcDaliActorVisibilityChangeSignalByName(void)
6765 {
6766   TestApplication application;
6767   tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
6768
6769   Actor actor = Actor::New();
6770
6771   bool signalCalled = false;
6772   actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
6773   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6774   actor.SetProperty(Actor::Property::VISIBLE, false);
6775   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6776
6777   tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
6778   signalCalled = false;
6779   actor.SetProperty(Actor::Property::VISIBLE, false);
6780   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6781
6782   tet_infoline("Change the visibility using properties, ensure called");
6783   actor.SetProperty(Actor::Property::VISIBLE, true);
6784   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6785
6786   tet_infoline("Set the visibility to current using properties, ensure not called");
6787   signalCalled = false;
6788
6789   actor.SetProperty(Actor::Property::VISIBLE, true);
6790   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6791
6792   END_TEST;
6793 }
6794
6795 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
6796 {
6797   gLayoutDirectionType = type;
6798 }
6799
6800 int UtcDaliActorLayoutDirectionProperty(void)
6801 {
6802   TestApplication application;
6803   tet_infoline("Check layout direction property");
6804
6805   Actor actor0 = Actor::New();
6806   DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6807   application.GetScene().Add(actor0);
6808
6809   application.SendNotification();
6810   application.Render();
6811
6812   Actor actor1 = Actor::New();
6813   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6814   Actor actor2 = Actor::New();
6815   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6816   Actor actor3 = Actor::New();
6817   DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6818   Actor actor4 = Actor::New();
6819   DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6820   Actor actor5 = Actor::New();
6821   DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6822   Actor actor6 = Actor::New();
6823   DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6824   Actor actor7 = Actor::New();
6825   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6826   Actor actor8 = Actor::New();
6827   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6828   Actor actor9 = Actor::New();
6829   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6830
6831   actor1.Add(actor2);
6832   gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
6833   actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
6834
6835   DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
6836   actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6837   DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
6838
6839   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6840   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6841   DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
6842
6843   actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
6844   actor0.Add(actor1);
6845   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6846   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6847
6848   application.GetScene().Add(actor3);
6849   actor3.Add(actor4);
6850   actor4.Add(actor5);
6851   actor5.Add(actor6);
6852   actor5.Add(actor7);
6853   actor7.Add(actor8);
6854   actor8.Add(actor9);
6855   actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6856   actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6857
6858   DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
6859   actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
6860   DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
6861
6862   actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6863
6864   DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6865   DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6866   DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6867   DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6868   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6869   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6870   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6871
6872   actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6873   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6874   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6875
6876   actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6877   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6878   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6879   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6880
6881   actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
6882   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6883   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6884
6885   END_TEST;
6886 }
6887
6888 struct LayoutDirectionFunctor
6889 {
6890   LayoutDirectionFunctor(bool& signalCalled)
6891   : mSignalCalled(signalCalled)
6892   {
6893   }
6894
6895   LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
6896   : mSignalCalled(rhs.mSignalCalled)
6897   {
6898   }
6899
6900   void operator()()
6901   {
6902     mSignalCalled = true;
6903   }
6904
6905   bool& mSignalCalled;
6906 };
6907
6908 int UtcDaliActorLayoutDirectionSignal(void)
6909 {
6910   TestApplication application;
6911   tet_infoline("Check changing layout direction property sends a signal");
6912
6913   Actor actor = Actor::New();
6914   DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6915   application.GetScene().Add(actor);
6916   bool                   signalCalled = false;
6917   LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
6918
6919   actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
6920   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6921
6922   // Test that writing the same value doesn't send a signal
6923   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6924   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6925
6926   // Test that writing a different value sends the signal
6927   signalCalled = false;
6928   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6929   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6930
6931   signalCalled = false;
6932   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6933   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6934
6935   END_TEST;
6936 }
6937
6938 struct ChildAddedSignalCheck
6939 {
6940   ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
6941   : mSignalReceived(signalReceived),
6942     mChildHandle(childHandle)
6943   {
6944   }
6945
6946   void operator()(Actor childHandle)
6947   {
6948     mSignalReceived = true;
6949     mChildHandle    = childHandle;
6950   }
6951   void operator()()
6952   {
6953     mSignalReceived = true;
6954     mChildHandle    = Actor();
6955   }
6956
6957   bool&  mSignalReceived;
6958   Actor& mChildHandle;
6959 };
6960
6961 int UtcDaliChildAddedSignalP1(void)
6962 {
6963   TestApplication application;
6964   auto            stage = application.GetScene();
6965
6966   bool  signalReceived = false;
6967   Actor childActor;
6968
6969   ChildAddedSignalCheck signal(signalReceived, childActor);
6970   DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
6971   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
6972
6973   auto actorA = Actor::New();
6974   stage.Add(actorA);
6975   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
6976   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
6977   signalReceived = false;
6978
6979   auto actorB = Actor::New();
6980   stage.Add(actorB);
6981   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
6982   DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
6983
6984   END_TEST;
6985 }
6986
6987 int UtcDaliChildAddedSignalP2(void)
6988 {
6989   TestApplication application;
6990   auto            stage = application.GetScene();
6991
6992   bool  signalReceived = false;
6993   Actor childActor;
6994
6995   ChildAddedSignalCheck signal(signalReceived, childActor);
6996   tet_infoline("Connect to childAdded signal by name");
6997
6998   stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
6999   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7000
7001   auto actorA = Actor::New();
7002   stage.Add(actorA);
7003   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7004
7005   // Can't test which actor was added; signal signature is void() when connecting via name.
7006   signalReceived = false;
7007
7008   auto actorB = Actor::New();
7009   stage.Add(actorB);
7010   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7011
7012   END_TEST;
7013 }
7014
7015 int UtcDaliChildAddedSignalN(void)
7016 {
7017   TestApplication application;
7018   auto            stage = application.GetScene();
7019
7020   bool  signalReceived = false;
7021   Actor childActor;
7022
7023   ChildAddedSignalCheck signal(signalReceived, childActor);
7024   DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7025   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7026
7027   auto actorA = Actor::New();
7028   stage.Add(actorA);
7029   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7030   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7031   signalReceived = false;
7032
7033   auto actorB = Actor::New();
7034   actorA.Add(actorB);
7035   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7036   END_TEST;
7037 }
7038
7039 struct ChildRemovedSignalCheck
7040 {
7041   ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
7042   : mSignalReceived(signalReceived),
7043     mChildHandle(childHandle)
7044   {
7045   }
7046
7047   void operator()(Actor childHandle)
7048   {
7049     mSignalReceived = true;
7050     mChildHandle    = childHandle;
7051   }
7052
7053   void operator()()
7054   {
7055     mSignalReceived = true;
7056   }
7057
7058   bool&  mSignalReceived;
7059   Actor& mChildHandle;
7060 };
7061
7062 int UtcDaliChildRemovedSignalP1(void)
7063 {
7064   TestApplication application;
7065   auto            stage = application.GetScene();
7066
7067   bool  signalReceived = false;
7068   Actor childActor;
7069
7070   ChildRemovedSignalCheck signal(signalReceived, childActor);
7071   DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7072   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7073
7074   auto actorA = Actor::New();
7075   stage.Add(actorA);
7076   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7077   DALI_TEST_CHECK(!childActor);
7078
7079   stage.Remove(actorA);
7080   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7081   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7082
7083   signalReceived = false;
7084   auto actorB    = Actor::New();
7085   stage.Add(actorB);
7086   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7087
7088   stage.Remove(actorB);
7089   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7090   DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7091
7092   END_TEST;
7093 }
7094
7095 int UtcDaliChildRemovedSignalP2(void)
7096 {
7097   TestApplication application;
7098   auto            stage = application.GetScene();
7099
7100   bool  signalReceived = false;
7101   Actor childActor;
7102
7103   ChildAddedSignalCheck signal(signalReceived, childActor);
7104   tet_infoline("Connect to childRemoved signal by name");
7105
7106   stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
7107   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7108
7109   auto actorA = Actor::New();
7110   stage.Add(actorA);
7111   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7112
7113   stage.Remove(actorA);
7114   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7115
7116   signalReceived = false;
7117   auto actorB    = Actor::New();
7118   stage.Add(actorB);
7119   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7120
7121   stage.Remove(actorB);
7122   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7123
7124   END_TEST;
7125 }
7126
7127 int UtcDaliChildRemovedSignalN(void)
7128 {
7129   TestApplication application;
7130   auto            stage = application.GetScene();
7131
7132   bool  signalReceived = false;
7133   Actor childActor;
7134
7135   ChildRemovedSignalCheck signal(signalReceived, childActor);
7136   DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7137   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7138
7139   auto actorA = Actor::New();
7140   stage.Add(actorA);
7141
7142   auto actorB = Actor::New();
7143   actorA.Add(actorB);
7144
7145   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7146   DALI_TEST_CHECK(!childActor);
7147
7148   actorA.Remove(actorB);
7149   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7150   END_TEST;
7151 }
7152
7153 int UtcDaliChildMovedSignalP(void)
7154 {
7155   TestApplication application;
7156   auto            stage = application.GetScene();
7157
7158   bool  addedASignalReceived   = false;
7159   bool  removedASignalReceived = false;
7160   bool  addedBSignalReceived   = false;
7161   bool  removedBSignalReceived = false;
7162   Actor childActor;
7163
7164   auto actorA = Actor::New();
7165   auto actorB = Actor::New();
7166   stage.Add(actorA);
7167   stage.Add(actorB);
7168
7169   ChildAddedSignalCheck   addedSignalA(addedASignalReceived, childActor);
7170   ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
7171   ChildAddedSignalCheck   addedSignalB(addedBSignalReceived, childActor);
7172   ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
7173
7174   DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
7175   DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
7176   DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
7177   DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
7178
7179   DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7180   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7181   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7182   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7183
7184   // Create a child of A
7185
7186   auto child = Actor::New();
7187   actorA.Add(child);
7188
7189   DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7190   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7191   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7192   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7193   DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
7194
7195   // Move child to B:
7196   addedASignalReceived   = false;
7197   addedBSignalReceived   = false;
7198   removedASignalReceived = false;
7199   removedBSignalReceived = false;
7200
7201   actorB.Add(child); // Expect this child to be re-parented
7202   DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7203   DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
7204   DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
7205   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7206
7207   // Move child back to A:
7208   addedASignalReceived   = false;
7209   addedBSignalReceived   = false;
7210   removedASignalReceived = false;
7211   removedBSignalReceived = false;
7212
7213   actorA.Add(child); // Expect this child to be re-parented
7214   DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7215   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7216   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7217   DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
7218
7219   END_TEST;
7220 }
7221
7222 int utcDaliActorCulled(void)
7223 {
7224   TestApplication application;
7225   auto            stage = application.GetScene();
7226
7227   tet_infoline("Check that the actor is culled if the actor is out of the screen");
7228
7229   Actor actor = Actor::New();
7230   actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7231
7232   Geometry geometry = CreateQuadGeometry();
7233   Shader   shader   = CreateShader();
7234   Renderer renderer = Renderer::New(geometry, shader);
7235   actor.AddRenderer(renderer);
7236
7237   stage.Add(actor);
7238
7239   application.SendNotification();
7240   application.Render(0);
7241
7242   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
7243
7244   PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
7245   notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
7246
7247   // Connect NotifySignal
7248   bool                              propertyNotificationSignal(false);
7249   PropertyNotification              source;
7250   CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
7251   notification.NotifySignal().Connect(&application, f);
7252
7253   actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
7254
7255   application.SendNotification();
7256   application.Render();
7257
7258   application.SendNotification();
7259
7260   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
7261
7262   DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
7263   DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
7264   DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
7265
7266   END_TEST;
7267 }
7268
7269 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7270 {
7271   TestApplication application;
7272   auto            stage = application.GetScene();
7273
7274   tet_infoline("Ensure we clear the screen when the last actor is removed");
7275
7276   Actor actor = CreateRenderableActor();
7277   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7278   stage.Add(actor);
7279
7280   application.SendNotification();
7281   application.Render();
7282
7283   auto&      glAbstraction    = application.GetGlAbstraction();
7284   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7285
7286   actor.Unparent();
7287
7288   application.SendNotification();
7289   application.Render();
7290
7291   DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7292
7293   END_TEST;
7294 }
7295
7296 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7297 {
7298   TestApplication application;
7299   auto            stage = application.GetScene();
7300
7301   tet_infoline("Ensure we clear the screen when the last actor is made invisible");
7302
7303   Actor actor = CreateRenderableActor();
7304   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7305   stage.Add(actor);
7306
7307   application.SendNotification();
7308   application.Render();
7309
7310   auto&      glAbstraction    = application.GetGlAbstraction();
7311   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7312
7313   actor.SetProperty(Actor::Property::VISIBLE, false);
7314
7315   application.SendNotification();
7316   application.Render();
7317
7318   DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7319
7320   END_TEST;
7321 }
7322
7323 int utcDaliActorGetSizeAfterAnimation(void)
7324 {
7325   TestApplication application;
7326   tet_infoline("Check the actor size before / after an animation is finished");
7327
7328   Vector3 actorSize(100.0f, 100.0f, 0.0f);
7329
7330   Actor actor = Actor::New();
7331   actor.SetProperty(Actor::Property::SIZE, actorSize);
7332   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7333   application.GetScene().Add(actor);
7334
7335   // Size should be updated without rendering.
7336   Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7337   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7338
7339   application.SendNotification();
7340   application.Render();
7341
7342   // Size and current size should be updated.
7343   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7344   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7345   DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7346   DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7347   DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7348
7349   Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7350   DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7351   DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7352   DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7353   DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7354
7355   // Set size again
7356   actorSize = Vector3(200.0f, 200.0f, 0.0f);
7357   actor.SetProperty(Actor::Property::SIZE, actorSize);
7358
7359   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7360   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7361
7362   Vector3 targetValue(10.0f, 20.0f, 0.0f);
7363
7364   Animation animation = Animation::New(1.0f);
7365   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
7366   animation.Play();
7367
7368   // Size should be updated without rendering.
7369   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7370   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7371
7372   application.SendNotification();
7373   application.Render(1100); // After the animation
7374
7375   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7376   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7377   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7378   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7379   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7380
7381   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7382   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7383   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7384   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7385   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7386
7387   targetValue.width = 50.0f;
7388
7389   animation.Clear();
7390   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
7391   animation.Play();
7392
7393   application.SendNotification();
7394   application.Render(1100); // After the animation
7395
7396   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7397   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7398   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7399   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7400   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7401
7402   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7403   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7404   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7405   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7406   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7407
7408   targetValue.height = 70.0f;
7409
7410   animation.Clear();
7411   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
7412   animation.Play();
7413
7414   application.SendNotification();
7415   application.Render(1100); // After the animation
7416
7417   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7418   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7419   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7420   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7421   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7422
7423   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7424   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7425   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7426   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7427   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7428
7429   Vector3 offset(10.0f, 20.0f, 0.0f);
7430
7431   animation.Clear();
7432   animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
7433   animation.Play();
7434
7435   application.SendNotification();
7436   application.Render(1100); // After the animation
7437
7438   targetValue += offset;
7439
7440   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7441   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7442   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7443   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7444   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7445
7446   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7447   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7448   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7449   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7450   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7451
7452   offset.width = 20.0f;
7453
7454   animation.Clear();
7455   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
7456   animation.Play();
7457
7458   application.SendNotification();
7459   application.Render(1100); // After the animation
7460
7461   targetValue.width += offset.width;
7462
7463   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7464   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7465   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7466   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7467   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7468
7469   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7470   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7471   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7472   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7473   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7474
7475   offset.height = 10.0f;
7476
7477   animation.Clear();
7478   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
7479   animation.Play();
7480
7481   application.SendNotification();
7482   application.Render(1100); // After the animation
7483
7484   targetValue.height += offset.height;
7485
7486   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7487   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7488   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7489   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7490   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7491
7492   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7493   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7494   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7495   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7496   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7497
7498   // Set size again
7499   actorSize = Vector3(300.0f, 300.0f, 0.0f);
7500
7501   actor.SetProperty(Actor::Property::SIZE, actorSize);
7502
7503   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7504   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7505
7506   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7507   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7508
7509   application.SendNotification();
7510   application.Render();
7511
7512   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7513   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7514
7515   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7516   DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7517
7518   END_TEST;
7519 }
7520
7521 int utcDaliActorPartialUpdate(void)
7522 {
7523   TestApplication application(
7524     TestApplication::DEFAULT_SURFACE_WIDTH,
7525     TestApplication::DEFAULT_SURFACE_HEIGHT,
7526     TestApplication::DEFAULT_HORIZONTAL_DPI,
7527     TestApplication::DEFAULT_VERTICAL_DPI,
7528     true,
7529     true);
7530
7531   tet_infoline("Check the damaged area");
7532
7533   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7534
7535   std::vector<Rect<int>> damagedRects;
7536   Rect<int>              clippingRect;
7537   application.SendNotification();
7538   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7539
7540   // First render pass, nothing to render, adaptor would just do swap buffer.
7541   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7542   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7543
7544   Actor actor = CreateRenderableActor();
7545   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7546   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7547   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7548   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7549   application.GetScene().Add(actor);
7550
7551   application.SendNotification();
7552
7553   // 1. Actor added, damaged rect is added size of actor
7554   damagedRects.clear();
7555   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7556   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7557
7558   // Aligned by 16
7559   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7560   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7561   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7562   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7563   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7564   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7565   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7566
7567   // 2. Set new size
7568   actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
7569   application.SendNotification();
7570
7571   damagedRects.clear();
7572   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7573   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7574
7575   // Aligned by 16
7576   clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
7577   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7578   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7579   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7580   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7581   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7582   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7583
7584   // 3. Set new position
7585   actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
7586   application.SendNotification();
7587
7588   damagedRects.clear();
7589   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7590   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7591
7592   // Aligned by 16
7593   clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
7594   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7595   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7596   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7597   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7598   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7599   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7600
7601   application.GetScene().Remove(actor);
7602   application.SendNotification();
7603
7604   // Actor removed, last 3 dirty rects are reported. Adaptor would merge them together.
7605   damagedRects.clear();
7606   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7607   DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
7608
7609   clippingRect = damagedRects[0];
7610   clippingRect.Merge(damagedRects[1]);
7611   clippingRect.Merge(damagedRects[2]);
7612
7613   DALI_TEST_EQUALS(clippingRect.IsEmpty(), false, TEST_LOCATION);
7614   DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
7615   DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(16, 736, 64, 64), TEST_LOCATION);
7616
7617   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7618   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7619   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7620   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7621   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7622
7623   END_TEST;
7624 }
7625
7626 int utcDaliActorPartialUpdateSetColor(void)
7627 {
7628   TestApplication application(
7629     TestApplication::DEFAULT_SURFACE_WIDTH,
7630     TestApplication::DEFAULT_SURFACE_HEIGHT,
7631     TestApplication::DEFAULT_HORIZONTAL_DPI,
7632     TestApplication::DEFAULT_VERTICAL_DPI,
7633     true,
7634     true);
7635
7636   tet_infoline("Check uniform update");
7637
7638   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7639
7640   std::vector<Rect<int>> damagedRects;
7641   Rect<int>              clippingRect;
7642   application.SendNotification();
7643   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7644
7645   // First render pass, nothing to render, adaptor would just do swap buffer.
7646   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7647   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7648
7649   Actor actor = CreateRenderableActor();
7650   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7651   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7652   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7653   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7654   application.GetScene().Add(actor);
7655
7656   application.SendNotification();
7657
7658   // 1. Actor added, damaged rect is added size of actor
7659   damagedRects.clear();
7660   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7661   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7662
7663   // Aligned by 16
7664   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7665   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7666   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7667   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7668   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7669   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7670   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7671
7672   damagedRects.clear();
7673   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7674
7675   damagedRects.clear();
7676   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7677
7678   // 2. Set new color
7679   actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
7680   application.SendNotification();
7681
7682   damagedRects.clear();
7683   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7684   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7685
7686   // Aligned by 16
7687   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7688   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7689   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7690   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7691   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7692   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7693   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7694
7695   END_TEST;
7696 }
7697
7698 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
7699 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
7700 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
7701 const char* const RENDER_SHADOW_VERTEX_SOURCE =
7702   " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
7703   " uniform mediump mat4 uLightCameraViewMatrix;\n"
7704   "\n"
7705   "void main()\n"
7706   "{\n"
7707   "  gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
7708   "  vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix  * vec4(aPosition,1.0);\n"
7709   "  vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
7710   "}\n";
7711
7712 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
7713   "uniform lowp vec4 uShadowColor;\n"
7714   "void main()\n"
7715   "{\n"
7716   "  lowp float alpha;\n"
7717   "  alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
7718   "  gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
7719   "}\n";
7720
7721 int utcDaliActorPartialUpdateSetProperty(void)
7722 {
7723   TestApplication application(
7724     TestApplication::DEFAULT_SURFACE_WIDTH,
7725     TestApplication::DEFAULT_SURFACE_HEIGHT,
7726     TestApplication::DEFAULT_HORIZONTAL_DPI,
7727     TestApplication::DEFAULT_VERTICAL_DPI,
7728     true,
7729     true);
7730
7731   tet_infoline("Set/Update property with partial update");
7732
7733   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7734
7735   std::vector<Rect<int>> damagedRects;
7736   Rect<int>              clippingRect;
7737   application.SendNotification();
7738   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7739
7740   // First render pass, nothing to render, adaptor would just do swap buffer.
7741   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7742   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7743
7744   Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
7745   Actor   actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
7746   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7747   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7748   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7749   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7750   application.GetScene().Add(actor);
7751
7752   actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
7753
7754   damagedRects.clear();
7755   application.SendNotification();
7756   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7757   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7758
7759   // Aligned by 16
7760   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7761   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7762   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7763   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7764   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7765   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7766   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7767
7768   Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
7769   actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
7770
7771   damagedRects.clear();
7772   application.SendNotification();
7773   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7774   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7775
7776   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7777   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7778   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7779   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7780   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7781   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7782
7783   damagedRects.clear();
7784   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7785   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7786
7787   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7788   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7789   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7790   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7791   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7792   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7793
7794   damagedRects.clear();
7795   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7796   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7797
7798   END_TEST;
7799 }
7800
7801 int utcDaliActorPartialUpdateTwoActors(void)
7802 {
7803   TestApplication application(
7804     TestApplication::DEFAULT_SURFACE_WIDTH,
7805     TestApplication::DEFAULT_SURFACE_HEIGHT,
7806     TestApplication::DEFAULT_HORIZONTAL_DPI,
7807     TestApplication::DEFAULT_VERTICAL_DPI,
7808     true,
7809     true);
7810
7811   tet_infoline("Check the damaged rects with partial update and two actors");
7812
7813   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7814
7815   Actor actor = CreateRenderableActor();
7816   actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
7817   actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
7818   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7819   application.GetScene().Add(actor);
7820
7821   Actor actor2 = CreateRenderableActor();
7822   actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
7823   actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
7824   actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7825   application.GetScene().Add(actor2);
7826
7827   application.SendNotification();
7828   std::vector<Rect<int>> damagedRects;
7829   application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
7830
7831   DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
7832   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
7833   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
7834
7835   // in screen coordinates, adaptor would calculate it using previous frames information
7836   Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
7837   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7838
7839   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7840   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7841   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7842   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7843
7844   END_TEST;
7845 }
7846
7847 int utcDaliActorPartialUpdateActorsWithSizeHint(void)
7848 {
7849   TestApplication application(
7850     TestApplication::DEFAULT_SURFACE_WIDTH,
7851     TestApplication::DEFAULT_SURFACE_HEIGHT,
7852     TestApplication::DEFAULT_HORIZONTAL_DPI,
7853     TestApplication::DEFAULT_VERTICAL_DPI,
7854     true,
7855     true);
7856
7857   tet_infoline("Check the damaged rect with partial update and actor size hint");
7858
7859   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7860
7861   Actor actor = CreateRenderableActor();
7862   actor.SetProperty(Actor::Property::POSITION, Vector3(75.0f, 150.0f, 0.0f));
7863   actor.SetProperty(Actor::Property::SIZE, Vector3(75.0f, 150.0f, 0.0f));
7864   actor.SetProperty(DevelActor::Property::UPDATE_SIZE_HINT, Vector3(150, 300, 0));
7865   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7866   application.GetScene().Add(actor);
7867
7868   application.SendNotification();
7869   std::vector<Rect<int>> damagedRects;
7870   application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
7871
7872   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7873
7874   Rect<int> clippingRect = Rect<int>(0, 496, 160, 320);
7875   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7876
7877   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7878
7879   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7880   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7881   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7882   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7883
7884   END_TEST;
7885 }
7886
7887 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
7888 {
7889   TestApplication application;
7890
7891   Actor actor = Actor::New();
7892   DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
7893   actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
7894   DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
7895   DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
7896   DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
7897   DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
7898   DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
7899   DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
7900   END_TEST;
7901 }
7902
7903 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
7904 {
7905   TestApplication application;
7906
7907   Actor actor = Actor::New();
7908
7909   // Make sure setting invalid types does not cause a crash
7910   try
7911   {
7912     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
7913     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
7914     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
7915     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
7916     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
7917     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
7918     tet_result(TET_PASS);
7919   }
7920   catch(...)
7921   {
7922     tet_result(TET_FAIL);
7923   }
7924   END_TEST;
7925 }
7926
7927 int UtcDaliActorLowerBelowNegative(void)
7928 {
7929   TestApplication application;
7930   Dali::Actor     instance;
7931   try
7932   {
7933     Dali::Actor arg1;
7934     instance.LowerBelow(arg1);
7935     DALI_TEST_CHECK(false); // Should not get here
7936   }
7937   catch(...)
7938   {
7939     DALI_TEST_CHECK(true); // We expect an assert
7940   }
7941   END_TEST;
7942 }
7943
7944 int UtcDaliActorRaiseAboveNegative(void)
7945 {
7946   TestApplication application;
7947   Dali::Actor     instance;
7948   try
7949   {
7950     Dali::Actor arg1;
7951     instance.RaiseAbove(arg1);
7952     DALI_TEST_CHECK(false); // Should not get here
7953   }
7954   catch(...)
7955   {
7956     DALI_TEST_CHECK(true); // We expect an assert
7957   }
7958   END_TEST;
7959 }
7960
7961 int UtcDaliActorRaiseToTopNegative(void)
7962 {
7963   TestApplication application;
7964   Dali::Actor     instance;
7965   try
7966   {
7967     instance.RaiseToTop();
7968     DALI_TEST_CHECK(false); // Should not get here
7969   }
7970   catch(...)
7971   {
7972     DALI_TEST_CHECK(true); // We expect an assert
7973   }
7974   END_TEST;
7975 }
7976
7977 int UtcDaliActorAddRendererNegative(void)
7978 {
7979   TestApplication application;
7980   Dali::Actor     instance;
7981   try
7982   {
7983     Dali::Renderer arg1;
7984     instance.AddRenderer(arg1);
7985     DALI_TEST_CHECK(false); // Should not get here
7986   }
7987   catch(...)
7988   {
7989     DALI_TEST_CHECK(true); // We expect an assert
7990   }
7991   END_TEST;
7992 }
7993
7994 int UtcDaliActorTouchedSignalNegative(void)
7995 {
7996   TestApplication application;
7997   Dali::Actor     instance;
7998   try
7999   {
8000     instance.TouchedSignal();
8001     DALI_TEST_CHECK(false); // Should not get here
8002   }
8003   catch(...)
8004   {
8005     DALI_TEST_CHECK(true); // We expect an assert
8006   }
8007   END_TEST;
8008 }
8009
8010 int UtcDaliActorTranslateByNegative(void)
8011 {
8012   TestApplication application;
8013   Dali::Actor     instance;
8014   try
8015   {
8016     Dali::Vector3 arg1;
8017     instance.TranslateBy(arg1);
8018     DALI_TEST_CHECK(false); // Should not get here
8019   }
8020   catch(...)
8021   {
8022     DALI_TEST_CHECK(true); // We expect an assert
8023   }
8024   END_TEST;
8025 }
8026
8027 int UtcDaliActorFindChildByIdNegative(void)
8028 {
8029   TestApplication application;
8030   Dali::Actor     instance;
8031   try
8032   {
8033     unsigned int arg1 = 0u;
8034     instance.FindChildById(arg1);
8035     DALI_TEST_CHECK(false); // Should not get here
8036   }
8037   catch(...)
8038   {
8039     DALI_TEST_CHECK(true); // We expect an assert
8040   }
8041   END_TEST;
8042 }
8043
8044 int UtcDaliActorGetRendererAtNegative(void)
8045 {
8046   TestApplication application;
8047   Dali::Actor     instance;
8048   try
8049   {
8050     unsigned int arg1 = 0u;
8051     instance.GetRendererAt(arg1);
8052     DALI_TEST_CHECK(false); // Should not get here
8053   }
8054   catch(...)
8055   {
8056     DALI_TEST_CHECK(true); // We expect an assert
8057   }
8058   END_TEST;
8059 }
8060
8061 int UtcDaliActorHoveredSignalNegative(void)
8062 {
8063   TestApplication application;
8064   Dali::Actor     instance;
8065   try
8066   {
8067     instance.HoveredSignal();
8068     DALI_TEST_CHECK(false); // Should not get here
8069   }
8070   catch(...)
8071   {
8072     DALI_TEST_CHECK(true); // We expect an assert
8073   }
8074   END_TEST;
8075 }
8076
8077 int UtcDaliActorLowerToBottomNegative(void)
8078 {
8079   TestApplication application;
8080   Dali::Actor     instance;
8081   try
8082   {
8083     instance.LowerToBottom();
8084     DALI_TEST_CHECK(false); // Should not get here
8085   }
8086   catch(...)
8087   {
8088     DALI_TEST_CHECK(true); // We expect an assert
8089   }
8090   END_TEST;
8091 }
8092
8093 int UtcDaliActorOnSceneSignalNegative(void)
8094 {
8095   TestApplication application;
8096   Dali::Actor     instance;
8097   try
8098   {
8099     instance.OnSceneSignal();
8100     DALI_TEST_CHECK(false); // Should not get here
8101   }
8102   catch(...)
8103   {
8104     DALI_TEST_CHECK(true); // We expect an assert
8105   }
8106   END_TEST;
8107 }
8108
8109 int UtcDaliActorOffSceneSignalNegative(void)
8110 {
8111   TestApplication application;
8112   Dali::Actor     instance;
8113   try
8114   {
8115     instance.OffSceneSignal();
8116     DALI_TEST_CHECK(false); // Should not get here
8117   }
8118   catch(...)
8119   {
8120     DALI_TEST_CHECK(true); // We expect an assert
8121   }
8122   END_TEST;
8123 }
8124
8125 int UtcDaliActorRemoveRendererNegative01(void)
8126 {
8127   TestApplication application;
8128   Dali::Actor     instance;
8129   try
8130   {
8131     unsigned int arg1 = 0u;
8132     instance.RemoveRenderer(arg1);
8133     DALI_TEST_CHECK(false); // Should not get here
8134   }
8135   catch(...)
8136   {
8137     DALI_TEST_CHECK(true); // We expect an assert
8138   }
8139   END_TEST;
8140 }
8141
8142 int UtcDaliActorRemoveRendererNegative02(void)
8143 {
8144   TestApplication application;
8145   Dali::Actor     instance;
8146   try
8147   {
8148     Dali::Renderer arg1;
8149     instance.RemoveRenderer(arg1);
8150     DALI_TEST_CHECK(false); // Should not get here
8151   }
8152   catch(...)
8153   {
8154     DALI_TEST_CHECK(true); // We expect an assert
8155   }
8156   END_TEST;
8157 }
8158
8159 int UtcDaliActorFindChildByNameNegative(void)
8160 {
8161   TestApplication application;
8162   Dali::Actor     instance;
8163   try
8164   {
8165     std::string arg1;
8166     instance.FindChildByName(arg1);
8167     DALI_TEST_CHECK(false); // Should not get here
8168   }
8169   catch(...)
8170   {
8171     DALI_TEST_CHECK(true); // We expect an assert
8172   }
8173   END_TEST;
8174 }
8175
8176 int UtcDaliActorSetResizePolicyNegative(void)
8177 {
8178   TestApplication application;
8179   Dali::Actor     instance;
8180   try
8181   {
8182     Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
8183     Dali::Dimension::Type    arg2 = Dimension::ALL_DIMENSIONS;
8184     instance.SetResizePolicy(arg1, arg2);
8185     DALI_TEST_CHECK(false); // Should not get here
8186   }
8187   catch(...)
8188   {
8189     DALI_TEST_CHECK(true); // We expect an assert
8190   }
8191   END_TEST;
8192 }
8193
8194 int UtcDaliActorOnRelayoutSignalNegative(void)
8195 {
8196   TestApplication application;
8197   Dali::Actor     instance;
8198   try
8199   {
8200     instance.OnRelayoutSignal();
8201     DALI_TEST_CHECK(false); // Should not get here
8202   }
8203   catch(...)
8204   {
8205     DALI_TEST_CHECK(true); // We expect an assert
8206   }
8207   END_TEST;
8208 }
8209
8210 int UtcDaliActorWheelEventSignalNegative(void)
8211 {
8212   TestApplication application;
8213   Dali::Actor     instance;
8214   try
8215   {
8216     instance.WheelEventSignal();
8217     DALI_TEST_CHECK(false); // Should not get here
8218   }
8219   catch(...)
8220   {
8221     DALI_TEST_CHECK(true); // We expect an assert
8222   }
8223   END_TEST;
8224 }
8225
8226 int UtcDaliActorGetHeightForWidthNegative(void)
8227 {
8228   TestApplication application;
8229   Dali::Actor     instance;
8230   try
8231   {
8232     float arg1 = 0.0f;
8233     instance.GetHeightForWidth(arg1);
8234     DALI_TEST_CHECK(false); // Should not get here
8235   }
8236   catch(...)
8237   {
8238     DALI_TEST_CHECK(true); // We expect an assert
8239   }
8240   END_TEST;
8241 }
8242
8243 int UtcDaliActorGetWidthForHeightNegative(void)
8244 {
8245   TestApplication application;
8246   Dali::Actor     instance;
8247   try
8248   {
8249     float arg1 = 0.0f;
8250     instance.GetWidthForHeight(arg1);
8251     DALI_TEST_CHECK(false); // Should not get here
8252   }
8253   catch(...)
8254   {
8255     DALI_TEST_CHECK(true); // We expect an assert
8256   }
8257   END_TEST;
8258 }
8259
8260 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
8261 {
8262   TestApplication application;
8263   Dali::Actor     instance;
8264   try
8265   {
8266     instance.LayoutDirectionChangedSignal();
8267     DALI_TEST_CHECK(false); // Should not get here
8268   }
8269   catch(...)
8270   {
8271     DALI_TEST_CHECK(true); // We expect an assert
8272   }
8273   END_TEST;
8274 }
8275
8276 int UtcDaliActorAddNegative(void)
8277 {
8278   TestApplication application;
8279   Dali::Actor     instance;
8280   try
8281   {
8282     Dali::Actor arg1;
8283     instance.Add(arg1);
8284     DALI_TEST_CHECK(false); // Should not get here
8285   }
8286   catch(...)
8287   {
8288     DALI_TEST_CHECK(true); // We expect an assert
8289   }
8290   END_TEST;
8291 }
8292
8293 int UtcDaliActorLowerNegative(void)
8294 {
8295   TestApplication application;
8296   Dali::Actor     instance;
8297   try
8298   {
8299     instance.Lower();
8300     DALI_TEST_CHECK(false); // Should not get here
8301   }
8302   catch(...)
8303   {
8304     DALI_TEST_CHECK(true); // We expect an assert
8305   }
8306   END_TEST;
8307 }
8308
8309 int UtcDaliActorRaiseNegative(void)
8310 {
8311   TestApplication application;
8312   Dali::Actor     instance;
8313   try
8314   {
8315     instance.Raise();
8316     DALI_TEST_CHECK(false); // Should not get here
8317   }
8318   catch(...)
8319   {
8320     DALI_TEST_CHECK(true); // We expect an assert
8321   }
8322   END_TEST;
8323 }
8324
8325 int UtcDaliActorRemoveNegative(void)
8326 {
8327   TestApplication application;
8328   Dali::Actor     instance;
8329   try
8330   {
8331     Dali::Actor arg1;
8332     instance.Remove(arg1);
8333     DALI_TEST_CHECK(false); // Should not get here
8334   }
8335   catch(...)
8336   {
8337     DALI_TEST_CHECK(true); // We expect an assert
8338   }
8339   END_TEST;
8340 }
8341
8342 int UtcDaliActorScaleByNegative(void)
8343 {
8344   TestApplication application;
8345   Dali::Actor     instance;
8346   try
8347   {
8348     Dali::Vector3 arg1;
8349     instance.ScaleBy(arg1);
8350     DALI_TEST_CHECK(false); // Should not get here
8351   }
8352   catch(...)
8353   {
8354     DALI_TEST_CHECK(true); // We expect an assert
8355   }
8356   END_TEST;
8357 }
8358
8359 int UtcDaliActorGetLayerNegative(void)
8360 {
8361   TestApplication application;
8362   Dali::Actor     instance;
8363   try
8364   {
8365     instance.GetLayer();
8366     DALI_TEST_CHECK(false); // Should not get here
8367   }
8368   catch(...)
8369   {
8370     DALI_TEST_CHECK(true); // We expect an assert
8371   }
8372   END_TEST;
8373 }
8374
8375 int UtcDaliActorRotateByNegative01(void)
8376 {
8377   TestApplication application;
8378   Dali::Actor     instance;
8379   try
8380   {
8381     Dali::Quaternion arg1;
8382     instance.RotateBy(arg1);
8383     DALI_TEST_CHECK(false); // Should not get here
8384   }
8385   catch(...)
8386   {
8387     DALI_TEST_CHECK(true); // We expect an assert
8388   }
8389   END_TEST;
8390 }
8391
8392 int UtcDaliActorRotateByNegative02(void)
8393 {
8394   TestApplication application;
8395   Dali::Actor     instance;
8396   try
8397   {
8398     Dali::Radian  arg1;
8399     Dali::Vector3 arg2;
8400     instance.RotateBy(arg1, arg2);
8401     DALI_TEST_CHECK(false); // Should not get here
8402   }
8403   catch(...)
8404   {
8405     DALI_TEST_CHECK(true); // We expect an assert
8406   }
8407   END_TEST;
8408 }
8409
8410 int UtcDaliActorUnparentNegative(void)
8411 {
8412   TestApplication application;
8413   Dali::Actor     instance;
8414   try
8415   {
8416     instance.Unparent();
8417     DALI_TEST_CHECK(false); // Should not get here
8418   }
8419   catch(...)
8420   {
8421     DALI_TEST_CHECK(true); // We expect an assert
8422   }
8423   END_TEST;
8424 }
8425
8426 int UtcDaliActorGetChildAtNegative(void)
8427 {
8428   TestApplication application;
8429   Dali::Actor     instance;
8430   try
8431   {
8432     unsigned int arg1 = 0u;
8433     instance.GetChildAt(arg1);
8434     DALI_TEST_CHECK(false); // Should not get here
8435   }
8436   catch(...)
8437   {
8438     DALI_TEST_CHECK(true); // We expect an assert
8439   }
8440   END_TEST;
8441 }
8442
8443 int UtcDaliActorGetChildCountNegative(void)
8444 {
8445   TestApplication application;
8446   Dali::Actor     instance;
8447   try
8448   {
8449     instance.GetChildCount();
8450     DALI_TEST_CHECK(false); // Should not get here
8451   }
8452   catch(...)
8453   {
8454     DALI_TEST_CHECK(true); // We expect an assert
8455   }
8456   END_TEST;
8457 }
8458
8459 int UtcDaliActorGetTargetSizeNegative(void)
8460 {
8461   TestApplication application;
8462   Dali::Actor     instance;
8463   try
8464   {
8465     instance.GetTargetSize();
8466     DALI_TEST_CHECK(false); // Should not get here
8467   }
8468   catch(...)
8469   {
8470     DALI_TEST_CHECK(true); // We expect an assert
8471   }
8472   END_TEST;
8473 }
8474
8475 int UtcDaliActorScreenToLocalNegative(void)
8476 {
8477   TestApplication application;
8478   Dali::Actor     instance;
8479   try
8480   {
8481     float arg1 = 0.0f;
8482     float arg2 = 0.0f;
8483     float arg3 = 0.0f;
8484     float arg4 = 0.0f;
8485     instance.ScreenToLocal(arg1, arg2, arg3, arg4);
8486     DALI_TEST_CHECK(false); // Should not get here
8487   }
8488   catch(...)
8489   {
8490     DALI_TEST_CHECK(true); // We expect an assert
8491   }
8492   END_TEST;
8493 }
8494
8495 int UtcDaliActorGetNaturalSizeNegative(void)
8496 {
8497   TestApplication application;
8498   Dali::Actor     instance;
8499   try
8500   {
8501     instance.GetNaturalSize();
8502     DALI_TEST_CHECK(false); // Should not get here
8503   }
8504   catch(...)
8505   {
8506     DALI_TEST_CHECK(true); // We expect an assert
8507   }
8508   END_TEST;
8509 }
8510
8511 int UtcDaliActorGetRelayoutSizeNegative(void)
8512 {
8513   TestApplication application;
8514   Dali::Actor     instance;
8515   try
8516   {
8517     Dali::Dimension::Type arg1 = Dimension::HEIGHT;
8518     instance.GetRelayoutSize(arg1);
8519     DALI_TEST_CHECK(false); // Should not get here
8520   }
8521   catch(...)
8522   {
8523     DALI_TEST_CHECK(true); // We expect an assert
8524   }
8525   END_TEST;
8526 }
8527
8528 int UtcDaliActorGetResizePolicyNegative(void)
8529 {
8530   TestApplication application;
8531   Dali::Actor     instance;
8532   try
8533   {
8534     Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
8535     instance.GetResizePolicy(arg1);
8536     DALI_TEST_CHECK(false); // Should not get here
8537   }
8538   catch(...)
8539   {
8540     DALI_TEST_CHECK(true); // We expect an assert
8541   }
8542   END_TEST;
8543 }
8544
8545 int UtcDaliActorGetRendererCountNegative(void)
8546 {
8547   TestApplication application;
8548   Dali::Actor     instance;
8549   try
8550   {
8551     instance.GetRendererCount();
8552     DALI_TEST_CHECK(false); // Should not get here
8553   }
8554   catch(...)
8555   {
8556     DALI_TEST_CHECK(true); // We expect an assert
8557   }
8558   END_TEST;
8559 }
8560
8561 int UtcDaliActorGetParentNegative(void)
8562 {
8563   TestApplication application;
8564   Dali::Actor     instance;
8565   try
8566   {
8567     instance.GetParent();
8568     DALI_TEST_CHECK(false); // Should not get here
8569   }
8570   catch(...)
8571   {
8572     DALI_TEST_CHECK(true); // We expect an assert
8573   }
8574   END_TEST;
8575 }