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