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