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