[dali_2.0.4] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Actor.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // Enable debug log for test coverage
19 #define DEBUG_ENABLED 1
20
21 #include <dali-test-suite-utils.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali/integration-api/events/touch-event-integ.h>
26 #include <dali/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 UtcDaliActorRaiseAbove2(void)
5293 {
5294   tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
5295
5296   TestApplication application;
5297
5298   Integration::Scene stage(application.GetScene());
5299
5300   Actor actorA = Actor::New();
5301   Actor actorB = Actor::New();
5302   Actor actorC = Actor::New();
5303
5304   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5305   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5306
5307   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5308   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5309
5310   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5311   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5312
5313   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5314   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5315
5316   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5317   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5318
5319   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5320   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5321
5322   stage.Add(actorA);
5323   stage.Add(actorB);
5324   stage.Add(actorC);
5325
5326   ResetTouchCallbacks();
5327
5328   application.SendNotification();
5329   application.Render();
5330
5331   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5332   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5333   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5334
5335   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5336   // Only top actor will get touched.
5337   actorA.TouchedSignal().Connect(TestTouchCallback);
5338   actorB.TouchedSignal().Connect(TestTouchCallback2);
5339   actorC.TouchedSignal().Connect(TestTouchCallback3);
5340
5341   bool                     orderChangedSignal(false);
5342   Actor                    orderChangedActor;
5343   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5344   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5345
5346   Dali::Integration::Point point;
5347   point.SetDeviceId(1);
5348   point.SetState(PointState::DOWN);
5349   point.SetScreenPosition(Vector2(10.f, 10.f));
5350   Dali::Integration::TouchEvent touchEvent;
5351   touchEvent.AddPoint(point);
5352
5353   application.ProcessEvent(touchEvent);
5354
5355   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5356   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5357   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5358
5359   ResetTouchCallbacks();
5360
5361   tet_printf("Raise actor B Above Actor C\n");
5362
5363   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5364   int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
5365   actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
5366   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5367   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5368
5369   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5370   application.SendNotification();
5371   application.ProcessEvent(touchEvent);
5372
5373   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5374   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5375   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5376
5377   ResetTouchCallbacks();
5378
5379   tet_printf("Raise actor A Above Actor B\n");
5380
5381   orderChangedSignal = false;
5382
5383   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5384   newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
5385   actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
5386   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5387   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5388
5389   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5390   application.SendNotification();
5391
5392   application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5393
5394   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5395   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5396   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5397
5398   ResetTouchCallbacks();
5399
5400   END_TEST;
5401 }
5402
5403 int UtcDaliActorLowerBelow(void)
5404 {
5405   tet_infoline("UtcDaliActor LowerBelow test \n");
5406
5407   TestApplication application;
5408
5409   Integration::Scene stage(application.GetScene());
5410
5411   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5412   // enables checking of which actor the uniform is assigned too
5413   Shader shaderA = CreateShader();
5414   shaderA.RegisterProperty("uRendererColor", 1.f);
5415
5416   Shader shaderB = CreateShader();
5417   shaderB.RegisterProperty("uRendererColor", 2.f);
5418
5419   Shader shaderC = CreateShader();
5420   shaderC.RegisterProperty("uRendererColor", 3.f);
5421
5422   Actor actorA = Actor::New();
5423   Actor actorB = Actor::New();
5424   Actor actorC = Actor::New();
5425
5426   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5427   Geometry geometry = CreateQuadGeometry();
5428
5429   Renderer rendererA = Renderer::New(geometry, shaderA);
5430   actorA.AddRenderer(rendererA);
5431
5432   Renderer rendererB = Renderer::New(geometry, shaderB);
5433   actorB.AddRenderer(rendererB);
5434
5435   Renderer rendererC = Renderer::New(geometry, shaderC);
5436   actorC.AddRenderer(rendererC);
5437
5438   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5439   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5440
5441   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5442   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5443
5444   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5445   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5446
5447   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5448   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5449
5450   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5451   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5452
5453   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5454   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5455
5456   Actor container = Actor::New();
5457   container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5458   container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5459   stage.Add(container);
5460
5461   container.Add(actorA);
5462   container.Add(actorB);
5463   container.Add(actorC);
5464
5465   ResetTouchCallbacks();
5466
5467   // Connect ChildOrderChangedSignal
5468   bool                     orderChangedSignal(false);
5469   Actor                    orderChangedActor;
5470   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5471   DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5472
5473   // Set up gl abstraction trace so can query the set uniform order
5474   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5475   glAbstraction.EnableSetUniformCallTrace(true);
5476   glAbstraction.ResetSetUniformCallStack();
5477   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5478
5479   glAbstraction.ResetSetUniformCallStack();
5480
5481   application.SendNotification();
5482   application.Render();
5483
5484   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5485
5486   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5487
5488   // Test order of uniforms in stack
5489   int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5490   int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5491   int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5492
5493   tet_infoline("Testing C above B and A at bottom\n");
5494   bool CBA = (indexC > indexB) && (indexB > indexA);
5495
5496   DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5497
5498   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5499   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5500   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5501
5502   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5503   // Only top actor will get touched.
5504   actorA.TouchedSignal().Connect(TestTouchCallback);
5505   actorB.TouchedSignal().Connect(TestTouchCallback2);
5506   actorC.TouchedSignal().Connect(TestTouchCallback3);
5507
5508   Dali::Integration::Point point;
5509   point.SetDeviceId(1);
5510   point.SetState(PointState::DOWN);
5511   point.SetScreenPosition(Vector2(10.f, 10.f));
5512   Dali::Integration::TouchEvent touchEvent;
5513   touchEvent.AddPoint(point);
5514
5515   tet_infoline("UtcDaliActor Test Set up completed \n");
5516
5517   application.ProcessEvent(touchEvent);
5518
5519   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5520   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5521   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5522
5523   ResetTouchCallbacks();
5524
5525   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");
5526
5527   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5528   actorC.LowerBelow(actorB);
5529   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5530   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5531
5532   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5533   application.SendNotification();
5534   application.Render();
5535
5536   application.ProcessEvent(touchEvent); // touch event
5537
5538   glAbstraction.ResetSetUniformCallStack();
5539   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5540
5541   application.SendNotification();
5542   application.Render();
5543
5544   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5545
5546   // Test order of uniforms in stack
5547   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5548   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5549   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5550
5551   tet_infoline("Testing render order is A, C, B");
5552   DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5553   DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5554
5555   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5556   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5557   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5558
5559   ResetTouchCallbacks();
5560
5561   tet_printf("Lower actor C below Actor A leaving B on top\n");
5562
5563   orderChangedSignal = false;
5564
5565   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5566   actorC.LowerBelow(actorA);
5567   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5568   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5569
5570   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5571   application.SendNotification();
5572   application.Render();
5573
5574   application.ProcessEvent(touchEvent);
5575
5576   glAbstraction.ResetSetUniformCallStack();
5577   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5578
5579   application.Render();
5580   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5581
5582   // Test order of uniforms in stack
5583   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5584   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5585   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5586
5587   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5588   DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5589
5590   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5591   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5592   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5593
5594   ResetTouchCallbacks();
5595
5596   tet_printf("Lower actor B below Actor C leaving A on top\n");
5597
5598   orderChangedSignal = false;
5599
5600   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5601   actorB.LowerBelow(actorC);
5602   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5603   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5604
5605   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5606   application.SendNotification();
5607   application.Render();
5608
5609   application.ProcessEvent(touchEvent);
5610
5611   glAbstraction.ResetSetUniformCallStack();
5612   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5613
5614   application.Render();
5615   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5616
5617   // Test order of uniforms in stack
5618   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5619   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5620   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5621
5622   DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5623   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5624
5625   END_TEST;
5626 }
5627
5628
5629 int UtcDaliActorLowerBelow2(void)
5630 {
5631   tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
5632
5633   TestApplication application;
5634
5635   Integration::Scene stage(application.GetScene());
5636
5637   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5638   // enables checking of which actor the uniform is assigned too
5639   Shader shaderA = CreateShader();
5640   shaderA.RegisterProperty("uRendererColor", 1.f);
5641
5642   Shader shaderB = CreateShader();
5643   shaderB.RegisterProperty("uRendererColor", 2.f);
5644
5645   Shader shaderC = CreateShader();
5646   shaderC.RegisterProperty("uRendererColor", 3.f);
5647
5648   Actor actorA = Actor::New();
5649   Actor actorB = Actor::New();
5650   Actor actorC = Actor::New();
5651
5652   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5653   Geometry geometry = CreateQuadGeometry();
5654
5655   Renderer rendererA = Renderer::New(geometry, shaderA);
5656   actorA.AddRenderer(rendererA);
5657
5658   Renderer rendererB = Renderer::New(geometry, shaderB);
5659   actorB.AddRenderer(rendererB);
5660
5661   Renderer rendererC = Renderer::New(geometry, shaderC);
5662   actorC.AddRenderer(rendererC);
5663
5664   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5665   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5666
5667   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5668   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5669
5670   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5671   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5672
5673   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5674   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5675
5676   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5677   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5678
5679   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5680   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5681
5682   Actor container = Actor::New();
5683   container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5684   container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5685   stage.Add(container);
5686
5687   container.Add(actorA);
5688   container.Add(actorB);
5689   container.Add(actorC);
5690
5691   ResetTouchCallbacks();
5692
5693   // Connect ChildOrderChangedSignal
5694   bool                     orderChangedSignal(false);
5695   Actor                    orderChangedActor;
5696   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5697   DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5698
5699   // Set up gl abstraction trace so can query the set uniform order
5700   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5701   glAbstraction.EnableSetUniformCallTrace(true);
5702   glAbstraction.ResetSetUniformCallStack();
5703   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5704
5705   glAbstraction.ResetSetUniformCallStack();
5706
5707   application.SendNotification();
5708   application.Render();
5709
5710   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5711
5712   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5713
5714   // Test order of uniforms in stack
5715   int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5716   int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5717   int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5718
5719   tet_infoline("Testing C above B and A at bottom\n");
5720   bool CBA = (indexC > indexB) && (indexB > indexA);
5721
5722   DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5723
5724   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5725   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5726   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5727
5728   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5729   // Only top actor will get touched.
5730   actorA.TouchedSignal().Connect(TestTouchCallback);
5731   actorB.TouchedSignal().Connect(TestTouchCallback2);
5732   actorC.TouchedSignal().Connect(TestTouchCallback3);
5733
5734   Dali::Integration::Point point;
5735   point.SetDeviceId(1);
5736   point.SetState(PointState::DOWN);
5737   point.SetScreenPosition(Vector2(10.f, 10.f));
5738   Dali::Integration::TouchEvent touchEvent;
5739   touchEvent.AddPoint(point);
5740
5741   tet_infoline("UtcDaliActor Test Set up completed \n");
5742
5743   application.ProcessEvent(touchEvent);
5744
5745   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5746   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5747   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5748
5749   ResetTouchCallbacks();
5750
5751   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");
5752
5753   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5754   actorC[DevelActor::Property::SIBLING_ORDER] = 1;
5755   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5756   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5757
5758   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5759   application.SendNotification();
5760   application.Render();
5761
5762   application.ProcessEvent(touchEvent); // touch event
5763
5764   glAbstraction.ResetSetUniformCallStack();
5765   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5766
5767   application.SendNotification();
5768   application.Render();
5769
5770   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5771
5772   // Test order of uniforms in stack
5773   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5774   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5775   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5776
5777   tet_infoline("Testing render order is A, C, B");
5778   DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5779   DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5780
5781   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5782   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5783   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5784
5785   ResetTouchCallbacks();
5786
5787   tet_printf("Lower actor C below Actor A leaving B on top\n");
5788
5789   orderChangedSignal = false;
5790
5791   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5792   actorC[DevelActor::Property::SIBLING_ORDER] = 0;
5793   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5794   DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5795
5796   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5797   application.SendNotification();
5798   application.Render();
5799
5800   application.ProcessEvent(touchEvent);
5801
5802   glAbstraction.ResetSetUniformCallStack();
5803   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5804
5805   application.Render();
5806   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5807
5808   // Test order of uniforms in stack
5809   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5810   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5811   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5812
5813   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5814   DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5815
5816   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5817   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5818   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5819
5820   ResetTouchCallbacks();
5821
5822   tet_printf("Lower actor B below Actor C leaving A on top\n");
5823
5824   orderChangedSignal = false;
5825
5826   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5827   actorB[DevelActor::Property::SIBLING_ORDER] = 0;
5828   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5829   DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5830
5831   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5832   application.SendNotification();
5833   application.Render();
5834
5835   application.ProcessEvent(touchEvent);
5836
5837   glAbstraction.ResetSetUniformCallStack();
5838   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5839
5840   application.Render();
5841   tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5842
5843   // Test order of uniforms in stack
5844   indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5845   indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5846   indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5847
5848   DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5849   DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5850
5851   END_TEST;
5852 }
5853
5854 int UtcDaliActorRaiseAboveDifferentParentsN(void)
5855 {
5856   tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
5857
5858   TestApplication application;
5859
5860   Integration::Scene stage(application.GetScene());
5861
5862   Actor parentA = Actor::New();
5863   Actor parentB = Actor::New();
5864   parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5865   parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5866   parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5867   parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5868
5869   parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5870   parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5871
5872   parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5873   parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5874
5875   stage.Add(parentA);
5876   stage.Add(parentB);
5877
5878   Actor actorA = Actor::New();
5879   Actor actorB = Actor::New();
5880   Actor actorC = Actor::New();
5881
5882   parentA.Add(actorA);
5883   parentA.Add(actorB);
5884
5885   tet_printf("Actor C added to different parent from A and B \n");
5886   parentB.Add(actorC);
5887
5888   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5889   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5890
5891   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5892   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5893
5894   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5895   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5896
5897   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5898   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5899
5900   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5901   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5902
5903   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5904   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5905
5906   ResetTouchCallbacks();
5907
5908   // Connect ChildOrderChangedSignal
5909   bool                     orderChangedSignal(false);
5910   Actor                    orderChangedActor;
5911   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5912   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5913
5914   application.SendNotification();
5915   application.Render();
5916
5917   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5918   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5919   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5920
5921   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5922   // Only top actor will get touched.
5923   actorA.TouchedSignal().Connect(TestTouchCallback);
5924   actorB.TouchedSignal().Connect(TestTouchCallback2);
5925   actorC.TouchedSignal().Connect(TestTouchCallback3);
5926
5927   Dali::Integration::Point point;
5928   point.SetDeviceId(1);
5929   point.SetState(PointState::DOWN);
5930   point.SetScreenPosition(Vector2(10.f, 10.f));
5931   Dali::Integration::TouchEvent touchEvent;
5932   touchEvent.AddPoint(point);
5933
5934   application.ProcessEvent(touchEvent);
5935
5936   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5937   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5938   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5939
5940   ResetTouchCallbacks();
5941
5942   tet_printf("Raise actor A Above Actor C which have different parents\n");
5943
5944   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5945   actorA.RaiseAbove(actorC);
5946   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5947
5948   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5949   application.SendNotification();
5950
5951   application.ProcessEvent(touchEvent); // touch event
5952
5953   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5954   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5955   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5956
5957   ResetTouchCallbacks();
5958
5959   END_TEST;
5960 }
5961
5962 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
5963 {
5964   tet_infoline("UtcDaliActor Test  raiseAbove and lowerBelow api when target Actor has no parent \n");
5965
5966   TestApplication application;
5967
5968   Integration::Scene stage(application.GetScene());
5969
5970   Actor actorA = Actor::New();
5971   Actor actorB = Actor::New();
5972   Actor actorC = Actor::New();
5973
5974   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5975   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5976
5977   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5978   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5979
5980   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5981   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5982
5983   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5984   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5985
5986   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5987   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5988
5989   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5990   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5991
5992   ResetTouchCallbacks();
5993
5994   // Connect ChildOrderChangedSignal
5995   bool                     orderChangedSignal(false);
5996   Actor                    orderChangedActor;
5997   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5998   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5999
6000   application.SendNotification();
6001   application.Render();
6002
6003   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6004   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6005   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6006
6007   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6008   // Only top actor will get touched.
6009   actorA.TouchedSignal().Connect(TestTouchCallback);
6010   actorB.TouchedSignal().Connect(TestTouchCallback2);
6011   actorC.TouchedSignal().Connect(TestTouchCallback3);
6012
6013   Dali::Integration::Point point;
6014   point.SetDeviceId(1);
6015   point.SetState(PointState::DOWN);
6016   point.SetScreenPosition(Vector2(10.f, 10.f));
6017   Dali::Integration::TouchEvent touchEvent;
6018   touchEvent.AddPoint(point);
6019
6020   tet_printf("Raise actor A Above Actor C which have no parents\n");
6021
6022   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6023   actorA.RaiseAbove(actorC);
6024   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6025
6026   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6027   application.SendNotification();
6028
6029   application.ProcessEvent(touchEvent);
6030
6031   tet_printf("Not parented 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, false, TEST_LOCATION);
6036
6037   ResetTouchCallbacks();
6038
6039   orderChangedSignal = false;
6040
6041   stage.Add(actorB);
6042   tet_printf("Lower actor A below Actor C when only A is not on stage \n");
6043
6044   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6045   actorA.LowerBelow(actorC);
6046   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6047
6048   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6049   application.SendNotification();
6050   application.Render();
6051
6052   application.ProcessEvent(touchEvent);
6053
6054   tet_printf("Actor A not parented so LowerBelow should show no effect\n");
6055   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6056   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6057   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6058
6059   ResetTouchCallbacks();
6060
6061   orderChangedSignal = false;
6062
6063   tet_printf("Adding Actor A to stage, will be on top\n");
6064
6065   stage.Add(actorA);
6066   application.SendNotification();
6067   application.Render();
6068
6069   tet_printf("Raise actor B Above Actor C when only B has a parent\n");
6070
6071   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6072   actorB.RaiseAbove(actorC);
6073   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6074
6075   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6076   application.SendNotification();
6077
6078   application.ProcessEvent(touchEvent);
6079
6080   tet_printf("C not parented so RaiseAbove should show no effect\n");
6081   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6082   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6083   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6084
6085   ResetTouchCallbacks();
6086
6087   orderChangedSignal = false;
6088
6089   tet_printf("Lower actor A below Actor C when only A has a parent\n");
6090
6091   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6092   actorA.LowerBelow(actorC);
6093   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6094
6095   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6096   application.SendNotification();
6097
6098   application.ProcessEvent(touchEvent);
6099
6100   tet_printf("C not parented so LowerBelow should show no effect\n");
6101   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6102   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6103   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6104
6105   ResetTouchCallbacks();
6106
6107   orderChangedSignal = false;
6108
6109   stage.Add(actorC);
6110
6111   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6112   actorA.RaiseAbove(actorC);
6113   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6114   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6115
6116   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6117   application.SendNotification();
6118   application.Render();
6119
6120   application.ProcessEvent(touchEvent);
6121
6122   tet_printf("Raise actor A Above Actor C, now both have same parent \n");
6123   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6124   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6125   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6126
6127   END_TEST;
6128 }
6129
6130 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
6131 {
6132   tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
6133
6134   TestApplication application;
6135
6136   Integration::Scene stage(application.GetScene());
6137
6138   Actor actorA = Actor::New();
6139   Actor actorB = Actor::New();
6140   Actor actorC = Actor::New();
6141
6142   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6143   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6144
6145   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6146   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6147
6148   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6149   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6150
6151   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6152   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6153
6154   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6155   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6156
6157   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6158   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6159
6160   ResetTouchCallbacks();
6161
6162   // Connect ChildOrderChangedSignal
6163   bool                     orderChangedSignal(false);
6164   Actor                    orderChangedActor;
6165   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6166   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6167
6168   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6169   // Only top actor will get touched.
6170   actorA.TouchedSignal().Connect(TestTouchCallback);
6171   actorB.TouchedSignal().Connect(TestTouchCallback2);
6172   actorC.TouchedSignal().Connect(TestTouchCallback3);
6173
6174   Dali::Integration::Point point;
6175   point.SetDeviceId(1);
6176   point.SetState(PointState::DOWN);
6177   point.SetScreenPosition(Vector2(10.f, 10.f));
6178   Dali::Integration::TouchEvent touchEvent;
6179   touchEvent.AddPoint(point);
6180
6181   stage.Add(actorA);
6182   tet_printf("Raise actor B Above Actor C but B not parented\n");
6183
6184   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6185   actorB.Raise();
6186   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6187
6188   application.SendNotification();
6189   application.Render();
6190
6191   application.ProcessEvent(touchEvent);
6192
6193   tet_printf("Not parented so RaiseAbove should show no effect\n");
6194
6195   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6196   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6197   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6198
6199   tet_printf("Raise actor B Above Actor C but B not parented\n");
6200   ResetTouchCallbacks();
6201
6202   orderChangedSignal = false;
6203
6204   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6205   actorC.Lower();
6206   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6207
6208   // Sort actor tree before next touch event
6209   application.SendNotification();
6210   application.Render();
6211
6212   application.ProcessEvent(touchEvent);
6213
6214   tet_printf("Not parented so RaiseAbove should show no effect\n");
6215
6216   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6217   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6218   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6219   ResetTouchCallbacks();
6220
6221   orderChangedSignal = false;
6222
6223   tet_printf("Lower actor C below B but C not parented\n");
6224
6225   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6226   actorB.Lower();
6227   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6228
6229   // Sort actor tree before next touch event
6230   application.SendNotification();
6231   application.Render();
6232
6233   application.ProcessEvent(touchEvent);
6234
6235   tet_printf("Not parented so Lower should show no effect\n");
6236
6237   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6238   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6239   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6240   ResetTouchCallbacks();
6241
6242   orderChangedSignal = false;
6243
6244   tet_printf("Raise actor B to top\n");
6245
6246   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6247   actorB.RaiseToTop();
6248   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6249
6250   // Sort actor tree before next touch event
6251   application.SendNotification();
6252   application.Render();
6253
6254   application.ProcessEvent(touchEvent);
6255
6256   tet_printf("Not parented so RaiseToTop should show no effect\n");
6257
6258   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6259   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6260   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6261   ResetTouchCallbacks();
6262
6263   orderChangedSignal = false;
6264
6265   tet_printf("Add ActorB to stage so only Actor C not parented\n");
6266
6267   stage.Add(actorB);
6268
6269   tet_printf("Lower actor C to Bottom, B stays at top\n");
6270
6271   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6272   actorC.LowerToBottom();
6273   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6274
6275   application.SendNotification();
6276   application.Render();
6277
6278   application.ProcessEvent(touchEvent);
6279
6280   tet_printf("Not parented so LowerToBottom should show no effect\n");
6281
6282   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6283   DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6284   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6285   ResetTouchCallbacks();
6286
6287   END_TEST;
6288 }
6289
6290 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
6291 {
6292   tet_infoline("UtcDaliActor RaiseToAbove and  test with actor provided as target resulting in a no operation \n");
6293
6294   TestApplication application;
6295
6296   Integration::Scene stage(application.GetScene());
6297
6298   Actor actorA = Actor::New();
6299   Actor actorB = Actor::New();
6300   Actor actorC = Actor::New();
6301
6302   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6303   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6304
6305   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6306   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6307
6308   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6309   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6310
6311   actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6312   actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6313
6314   actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6315   actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6316
6317   actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6318   actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6319
6320   stage.Add(actorA);
6321   stage.Add(actorB);
6322   stage.Add(actorC);
6323
6324   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6325   // Only top actor will get touched.
6326   actorA.TouchedSignal().Connect(TestTouchCallback);
6327   actorB.TouchedSignal().Connect(TestTouchCallback2);
6328   actorC.TouchedSignal().Connect(TestTouchCallback3);
6329
6330   ResetTouchCallbacks();
6331
6332   // Connect ChildOrderChangedSignal
6333   bool                     orderChangedSignal(false);
6334   Actor                    orderChangedActor;
6335   ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6336   DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6337
6338   application.SendNotification();
6339   application.Render();
6340
6341   Dali::Integration::Point point;
6342   point.SetDeviceId(1);
6343   point.SetState(PointState::DOWN);
6344   point.SetScreenPosition(Vector2(10.f, 10.f));
6345   Dali::Integration::TouchEvent touchEvent;
6346   touchEvent.AddPoint(point);
6347
6348   application.ProcessEvent(touchEvent);
6349
6350   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6351   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6352   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6353
6354   ResetTouchCallbacks();
6355
6356   tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
6357
6358   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6359   actorA.RaiseAbove(actorA);
6360   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6361   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6362
6363   application.SendNotification();
6364   application.Render();
6365
6366   application.ProcessEvent(touchEvent);
6367
6368   tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
6369
6370   DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6371   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6372   DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6373
6374   ResetTouchCallbacks();
6375
6376   orderChangedSignal = false;
6377
6378   DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6379   actorA.RaiseAbove(actorC);
6380   DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6381   DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6382
6383   application.SendNotification();
6384   application.Render();
6385
6386   application.ProcessEvent(touchEvent);
6387
6388   tet_infoline("Raise actor A Above Actor C which will now be successful \n");
6389   DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6390   DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6391   DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6392
6393   END_TEST;
6394 }
6395
6396 int UtcDaliActorGetScreenPosition(void)
6397 {
6398   tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
6399
6400   TestApplication application;
6401
6402   Integration::Scene stage(application.GetScene());
6403
6404   Actor actorA = Actor::New();
6405   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6406
6407   Vector2 size2(10.0f, 20.0f);
6408   actorA.SetProperty(Actor::Property::SIZE, size2);
6409
6410   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6411
6412   tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
6413
6414   stage.Add(actorA);
6415
6416   application.SendNotification();
6417   application.Render();
6418
6419   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6420   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6421
6422   tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6423   tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
6424
6425   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6426   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6427
6428   tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
6429
6430   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6431
6432   application.SendNotification();
6433   application.Render();
6434
6435   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6436   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6437
6438   tet_printf("Actor World Position  ( %f %f ) AnchorPoint::TOP_LEFT  \n", actorWorldPosition.x, actorWorldPosition.y);
6439   tet_printf("Actor Screen Position  ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
6440
6441   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6442   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6443
6444   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
6445
6446   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6447
6448   application.SendNotification();
6449   application.Render();
6450
6451   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6452   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6453
6454   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT   \n", actorWorldPosition.x, actorWorldPosition.y);
6455   tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT  \n", actorScreenPosition.x, actorScreenPosition.y);
6456
6457   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6458   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6459
6460   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
6461
6462   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
6463
6464   application.SendNotification();
6465   application.Render();
6466
6467   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6468   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6469
6470   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
6471   tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0   \n", actorScreenPosition.x, actorScreenPosition.y);
6472
6473   DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6474   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6475
6476   tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
6477
6478   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
6479
6480   application.SendNotification();
6481   application.Render();
6482
6483   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6484   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6485
6486   DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6487   DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
6488
6489   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
6490   tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6491
6492   tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
6493
6494   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6495   actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
6496
6497   Actor actorB = Actor::New();
6498   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6499   actorB.SetProperty(Actor::Property::SIZE, size2);
6500   actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
6501   actorA.Add(actorB);
6502
6503   actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6504
6505   application.SendNotification();
6506   application.Render();
6507
6508   actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6509
6510   DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
6511   DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
6512
6513   END_TEST;
6514 }
6515
6516 int UtcDaliActorGetScreenPositionAfterScaling(void)
6517 {
6518   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
6519
6520   TestApplication application;
6521
6522   Integration::Scene stage(application.GetScene());
6523
6524   Actor actorA = Actor::New();
6525   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6526
6527   Vector2 size2(10.0f, 20.0f);
6528   actorA.SetProperty(Actor::Property::SIZE, size2);
6529   actorA.SetProperty(Actor::Property::SCALE, 1.5f);
6530   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6531
6532   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
6533
6534   stage.Add(actorA);
6535
6536   application.SendNotification();
6537   application.Render();
6538
6539   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6540   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6541
6542   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6543   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6544
6545   DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6546   DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6547
6548   tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
6549
6550   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6551
6552   application.SendNotification();
6553   application.Render();
6554
6555   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6556   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6557
6558   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6559   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6560
6561   DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
6562   DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6563
6564   END_TEST;
6565 }
6566
6567 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6568 {
6569   tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
6570
6571   TestApplication application;
6572
6573   Integration::Scene stage(application.GetScene());
6574
6575   Actor actorA = Actor::New();
6576   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6577   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6578   Vector2 size2(10.0f, 20.0f);
6579   actorA.SetProperty(Actor::Property::SIZE, size2);
6580   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6581
6582   tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6583
6584   stage.Add(actorA);
6585
6586   application.SendNotification();
6587   application.Render();
6588
6589   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6590   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6591
6592   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6593   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6594
6595   DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
6596   DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
6597
6598   tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
6599
6600   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
6601   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6602
6603   application.SendNotification();
6604   application.Render();
6605
6606   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6607   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6608
6609   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6610   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6611
6612   DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
6613   DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6614
6615   END_TEST;
6616   END_TEST;
6617 }
6618
6619 int UtcDaliActorGetScreenPositionWithChildActors(void)
6620 {
6621   tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
6622
6623   TestApplication application;
6624
6625   Integration::Scene stage(application.GetScene());
6626
6627   tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6628
6629   Actor actorA = Actor::New();
6630   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6631   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6632   Vector2 size1(10.0f, 20.0f);
6633   actorA.SetProperty(Actor::Property::SIZE, size1);
6634   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6635
6636   tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6637
6638   Actor parentActorA = Actor::New();
6639   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6640   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6641   Vector2 size2(30.0f, 60.0f);
6642   parentActorA.SetProperty(Actor::Property::SIZE, size2);
6643   parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6644
6645   tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6646
6647   stage.Add(parentActorA);
6648   parentActorA.Add(actorA);
6649
6650   application.SendNotification();
6651   application.Render();
6652
6653   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6654   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6655
6656   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6657   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6658
6659   DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
6660   DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
6661
6662   tet_infoline("Test 2\n");
6663
6664   tet_infoline("change parent anchor point and parent origin then check screen position \n");
6665
6666   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6667   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
6668
6669   application.SendNotification();
6670   application.Render();
6671
6672   actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6673   actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6674
6675   tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT  \n", actorWorldPosition.x, actorWorldPosition.y);
6676   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6677
6678   DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
6679   DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
6680
6681   END_TEST;
6682 }
6683
6684 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6685 {
6686   tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
6687
6688   TestApplication application;
6689
6690   Integration::Scene stage(application.GetScene());
6691
6692   tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6693
6694   Actor actorA = Actor::New();
6695   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6696   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6697   Vector2 size1(10.0f, 20.0f);
6698   actorA.SetProperty(Actor::Property::SIZE, size1);
6699   actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6700
6701   tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6702
6703   Actor parentActorA = Actor::New();
6704   parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6705   parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6706   Vector2 size2(30.0f, 60.0f);
6707   parentActorA.SetProperty(Actor::Property::SIZE, size2);
6708   parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6709
6710   tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
6711
6712   Actor grandParentActorA = Actor::New();
6713   grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6714   grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
6715   Vector2 size3(60.0f, 120.0f);
6716   grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
6717   grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6718
6719   tet_infoline("Add Parent 1 to Grand Parent 1 \n");
6720
6721   stage.Add(grandParentActorA);
6722   grandParentActorA.Add(parentActorA);
6723
6724   tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6725
6726   parentActorA.Add(actorA);
6727
6728   application.SendNotification();
6729   application.Render();
6730
6731   Vector3 actorWorldPosition  = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6732   Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6733
6734   tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n", actorWorldPosition.x, actorWorldPosition.y);
6735   tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6736
6737   DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
6738   DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
6739
6740   END_TEST;
6741 }
6742
6743 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6744 {
6745   tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
6746
6747   TestApplication application;
6748
6749   Integration::Scene stage(application.GetScene());
6750
6751   tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6752
6753   Actor actorA = Actor::New();
6754   actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6755   actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6756   actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6757   actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
6758   stage.Add(actorA);
6759
6760   tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6761
6762   Actor actorB = Actor::New();
6763   actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6764   actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6765   actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6766   Vector2 actorBSize(30.0f, 60.0f);
6767   actorB.SetProperty(Actor::Property::SIZE, actorBSize);
6768   stage.Add(actorB);
6769
6770   tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6771
6772   Actor actorC = Actor::New();
6773   actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6774   actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6775   actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6776   Vector2 actorCSize(60.0f, 120.0f);
6777   actorC.SetProperty(Actor::Property::SIZE, actorCSize);
6778   stage.Add(actorC);
6779
6780   application.SendNotification();
6781   application.Render();
6782
6783   tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
6784
6785   Vector2 center(stage.GetSize() * 0.5f);
6786
6787   DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6788   DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6789   DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6790
6791   tet_infoline("Add scale to all actors");
6792
6793   actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6794   actorB.SetProperty(Actor::Property::SCALE, 2.0f);
6795   actorC.SetProperty(Actor::Property::SCALE, 2.0f);
6796
6797   application.SendNotification();
6798   application.Render();
6799
6800   DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
6801   DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
6802   DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
6803
6804   END_TEST;
6805 }
6806
6807 int utcDaliActorPositionUsesAnchorPoint(void)
6808 {
6809   TestApplication application;
6810   tet_infoline("Check default behaviour\n");
6811
6812   Actor actor = Actor::New();
6813   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6814   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6815   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6816   application.GetScene().Add(actor);
6817
6818   application.SendNotification();
6819   application.Render();
6820
6821   tet_infoline("Check that the world position is in the center\n");
6822   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6823
6824   tet_infoline("Set the position uses anchor point property to false\n");
6825   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6826
6827   application.SendNotification();
6828   application.Render();
6829
6830   tet_infoline("Check that the world position has changed appropriately\n");
6831   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6832
6833   END_TEST;
6834 }
6835
6836 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
6837 {
6838   TestApplication application;
6839   tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6840
6841   Actor actor = Actor::New();
6842   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6843   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6844   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6845   actor.SetProperty(Actor::Property::SCALE, 2.0f);
6846   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6847   application.GetScene().Add(actor);
6848
6849   application.SendNotification();
6850   application.Render();
6851
6852   tet_infoline("Check the world position is the same as it would be without a scale\n");
6853   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6854
6855   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6856   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6857   application.SendNotification();
6858   application.Render();
6859   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
6860
6861   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6862   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6863   application.SendNotification();
6864   application.Render();
6865   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6866
6867   END_TEST;
6868 }
6869
6870 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
6871 {
6872   TestApplication application;
6873   tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6874
6875   Actor actor = Actor::New();
6876   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6877   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6878   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6879   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6880   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6881   application.GetScene().Add(actor);
6882
6883   application.SendNotification();
6884   application.Render();
6885
6886   tet_infoline("Check the world position is the same as it would be without a rotation\n");
6887   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6888
6889   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6890   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6891   application.SendNotification();
6892   application.Render();
6893   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
6894
6895   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6896   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6897   application.SendNotification();
6898   application.Render();
6899   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
6900
6901   END_TEST;
6902 }
6903
6904 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
6905 {
6906   TestApplication application;
6907   tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6908
6909   Actor actor = Actor::New();
6910   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6911   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6912   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6913   actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6914   actor.SetProperty(Actor::Property::SCALE, 2.0f);
6915   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6916   application.GetScene().Add(actor);
6917
6918   application.SendNotification();
6919   application.Render();
6920
6921   tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
6922   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6923
6924   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6925   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6926   application.SendNotification();
6927   application.Render();
6928   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
6929
6930   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6931   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6932   application.SendNotification();
6933   application.Render();
6934   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
6935
6936   END_TEST;
6937 }
6938
6939 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
6940 {
6941   TestApplication application;
6942   tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6943
6944   Actor parent = Actor::New();
6945
6946   application.GetScene().Add(parent);
6947   Vector2 stageSize(application.GetScene().GetSize());
6948
6949   Actor actor = Actor::New();
6950   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6951   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6952   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6953   actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
6954   actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
6955   actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6956   parent.Add(actor);
6957
6958   application.SendNotification();
6959   application.Render();
6960
6961   const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
6962
6963   tet_infoline("Check the world position is in the right place\n");
6964   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6965
6966   tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
6967   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6968   application.SendNotification();
6969   application.Render();
6970   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6971
6972   tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
6973   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6974   application.SendNotification();
6975   application.Render();
6976   DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6977
6978   END_TEST;
6979 }
6980
6981 int utcDaliActorVisibilityChangeSignalSelf(void)
6982 {
6983   TestApplication application;
6984   tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
6985
6986   Actor actor = Actor::New();
6987
6988   VisibilityChangedFunctorData data;
6989   DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
6990
6991   actor.SetProperty(Actor::Property::VISIBLE, false);
6992
6993   data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6994
6995   tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
6996   data.Reset();
6997
6998   actor.SetProperty(Actor::Property::VISIBLE, false);
6999   data.Check(false /* not called */, TEST_LOCATION);
7000
7001   tet_infoline("Change the visibility using properties, ensure called");
7002   data.Reset();
7003
7004   actor.SetProperty(Actor::Property::VISIBLE, true);
7005   data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7006
7007   tet_infoline("Set the visibility to current using properties, ensure not called");
7008   data.Reset();
7009
7010   actor.SetProperty(Actor::Property::VISIBLE, true);
7011   data.Check(false /* not called */, TEST_LOCATION);
7012
7013   END_TEST;
7014 }
7015
7016 int utcDaliActorVisibilityChangeSignalChildren(void)
7017 {
7018   TestApplication application;
7019   tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
7020
7021   Actor parent = Actor::New();
7022   Actor child  = Actor::New();
7023   parent.Add(child);
7024
7025   Actor grandChild = Actor::New();
7026   child.Add(grandChild);
7027
7028   VisibilityChangedFunctorData parentData;
7029   VisibilityChangedFunctorData childData;
7030   VisibilityChangedFunctorData grandChildData;
7031
7032   tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
7033   DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
7034   DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
7035
7036   parent.SetProperty(Actor::Property::VISIBLE, false);
7037   parentData.Check(false /* not called */, TEST_LOCATION);
7038   childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7039   grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7040
7041   tet_infoline("Connect to the parent's signal as well and ensure all three are called");
7042   parentData.Reset();
7043   childData.Reset();
7044   grandChildData.Reset();
7045
7046   DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
7047
7048   parent.SetProperty(Actor::Property::VISIBLE, true);
7049   parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7050   childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7051   grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7052
7053   tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
7054   parentData.Reset();
7055   childData.Reset();
7056   grandChildData.Reset();
7057
7058   parent.SetProperty(Actor::Property::VISIBLE, true);
7059   parentData.Check(false /* not called */, TEST_LOCATION);
7060   childData.Check(false /* not called */, TEST_LOCATION);
7061   grandChildData.Check(false /* not called */, TEST_LOCATION);
7062
7063   END_TEST;
7064 }
7065
7066 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
7067 {
7068   TestApplication application;
7069   tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
7070
7071   Actor actor = Actor::New();
7072   application.GetScene().Add(actor);
7073
7074   application.SendNotification();
7075   application.Render();
7076
7077   VisibilityChangedFunctorData data;
7078   DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7079
7080   Animation animation = Animation::New(1.0f);
7081   animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
7082
7083   data.Check(false, TEST_LOCATION);
7084   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7085   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7086
7087   tet_infoline("Play the animation and check the property value");
7088   animation.Play();
7089
7090   data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7091   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7092
7093   tet_infoline("Animation not currently finished, so the current visibility should still be true");
7094   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7095
7096   application.SendNotification();
7097   application.Render(1100); // After the animation
7098
7099   DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7100
7101   END_TEST;
7102 }
7103
7104 int utcDaliActorVisibilityChangeSignalByName(void)
7105 {
7106   TestApplication application;
7107   tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7108
7109   Actor actor = Actor::New();
7110
7111   bool signalCalled = false;
7112   actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
7113   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7114   actor.SetProperty(Actor::Property::VISIBLE, false);
7115   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7116
7117   tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7118   signalCalled = false;
7119   actor.SetProperty(Actor::Property::VISIBLE, false);
7120   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7121
7122   tet_infoline("Change the visibility using properties, ensure called");
7123   actor.SetProperty(Actor::Property::VISIBLE, true);
7124   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7125
7126   tet_infoline("Set the visibility to current using properties, ensure not called");
7127   signalCalled = false;
7128
7129   actor.SetProperty(Actor::Property::VISIBLE, true);
7130   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7131
7132   END_TEST;
7133 }
7134
7135 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
7136 {
7137   gLayoutDirectionType = type;
7138 }
7139
7140 int UtcDaliActorLayoutDirectionProperty(void)
7141 {
7142   TestApplication application;
7143   tet_infoline("Check layout direction property");
7144
7145   Actor actor0 = Actor::New();
7146   DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7147   application.GetScene().Add(actor0);
7148
7149   application.SendNotification();
7150   application.Render();
7151
7152   Actor actor1 = Actor::New();
7153   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7154   Actor actor2 = Actor::New();
7155   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7156   Actor actor3 = Actor::New();
7157   DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7158   Actor actor4 = Actor::New();
7159   DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7160   Actor actor5 = Actor::New();
7161   DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7162   Actor actor6 = Actor::New();
7163   DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7164   Actor actor7 = Actor::New();
7165   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7166   Actor actor8 = Actor::New();
7167   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7168   Actor actor9 = Actor::New();
7169   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7170
7171   actor1.Add(actor2);
7172   gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
7173   actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
7174
7175   DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7176   actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7177   DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7178
7179   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7180   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7181   DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
7182
7183   actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7184   actor0.Add(actor1);
7185   DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7186   DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7187
7188   application.GetScene().Add(actor3);
7189   actor3.Add(actor4);
7190   actor4.Add(actor5);
7191   actor5.Add(actor6);
7192   actor5.Add(actor7);
7193   actor7.Add(actor8);
7194   actor8.Add(actor9);
7195   actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7196   actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7197
7198   DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7199   actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
7200   DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7201
7202   actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7203
7204   DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7205   DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7206   DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7207   DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7208   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7209   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7210   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7211
7212   actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7213   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7214   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7215
7216   actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7217   DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7218   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7219   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7220
7221   actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7222   DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7223   DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7224
7225   END_TEST;
7226 }
7227
7228 struct LayoutDirectionFunctor
7229 {
7230   LayoutDirectionFunctor(bool& signalCalled)
7231   : mSignalCalled(signalCalled)
7232   {
7233   }
7234
7235   LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
7236   : mSignalCalled(rhs.mSignalCalled)
7237   {
7238   }
7239
7240   void operator()()
7241   {
7242     mSignalCalled = true;
7243   }
7244
7245   bool& mSignalCalled;
7246 };
7247
7248 int UtcDaliActorLayoutDirectionSignal(void)
7249 {
7250   TestApplication application;
7251   tet_infoline("Check changing layout direction property sends a signal");
7252
7253   Actor actor = Actor::New();
7254   DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7255   application.GetScene().Add(actor);
7256   bool                   signalCalled = false;
7257   LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
7258
7259   actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
7260   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7261
7262   // Test that writing the same value doesn't send a signal
7263   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7264   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7265
7266   // Test that writing a different value sends the signal
7267   signalCalled = false;
7268   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7269   DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7270
7271   signalCalled = false;
7272   actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7273   DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7274
7275   END_TEST;
7276 }
7277
7278 struct ChildAddedSignalCheck
7279 {
7280   ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
7281   : mSignalReceived(signalReceived),
7282     mChildHandle(childHandle)
7283   {
7284   }
7285
7286   void operator()(Actor childHandle)
7287   {
7288     mSignalReceived = true;
7289     mChildHandle    = childHandle;
7290   }
7291   void operator()()
7292   {
7293     mSignalReceived = true;
7294     mChildHandle    = Actor();
7295   }
7296
7297   bool&  mSignalReceived;
7298   Actor& mChildHandle;
7299 };
7300
7301 int UtcDaliChildAddedSignalP1(void)
7302 {
7303   TestApplication application;
7304   auto            stage = application.GetScene();
7305
7306   bool  signalReceived = false;
7307   Actor childActor;
7308
7309   ChildAddedSignalCheck signal(signalReceived, childActor);
7310   DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7311   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7312
7313   auto actorA = Actor::New();
7314   stage.Add(actorA);
7315   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7316   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7317   signalReceived = false;
7318
7319   auto actorB = Actor::New();
7320   stage.Add(actorB);
7321   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7322   DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7323
7324   END_TEST;
7325 }
7326
7327 int UtcDaliChildAddedSignalP2(void)
7328 {
7329   TestApplication application;
7330   auto            stage = application.GetScene();
7331
7332   bool  signalReceived = false;
7333   Actor childActor;
7334
7335   ChildAddedSignalCheck signal(signalReceived, childActor);
7336   tet_infoline("Connect to childAdded signal by name");
7337
7338   stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
7339   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7340
7341   auto actorA = Actor::New();
7342   stage.Add(actorA);
7343   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7344
7345   // Can't test which actor was added; signal signature is void() when connecting via name.
7346   signalReceived = false;
7347
7348   auto actorB = Actor::New();
7349   stage.Add(actorB);
7350   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7351
7352   END_TEST;
7353 }
7354
7355 int UtcDaliChildAddedSignalN(void)
7356 {
7357   TestApplication application;
7358   auto            stage = application.GetScene();
7359
7360   bool  signalReceived = false;
7361   Actor childActor;
7362
7363   ChildAddedSignalCheck signal(signalReceived, childActor);
7364   DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7365   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7366
7367   auto actorA = Actor::New();
7368   stage.Add(actorA);
7369   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7370   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7371   signalReceived = false;
7372
7373   auto actorB = Actor::New();
7374   actorA.Add(actorB);
7375   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7376   END_TEST;
7377 }
7378
7379 struct ChildRemovedSignalCheck
7380 {
7381   ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
7382   : mSignalReceived(signalReceived),
7383     mChildHandle(childHandle)
7384   {
7385   }
7386
7387   void operator()(Actor childHandle)
7388   {
7389     mSignalReceived = true;
7390     mChildHandle    = childHandle;
7391   }
7392
7393   void operator()()
7394   {
7395     mSignalReceived = true;
7396   }
7397
7398   bool&  mSignalReceived;
7399   Actor& mChildHandle;
7400 };
7401
7402 int UtcDaliChildRemovedSignalP1(void)
7403 {
7404   TestApplication application;
7405   auto            stage = application.GetScene();
7406
7407   bool  signalReceived = false;
7408   Actor childActor;
7409
7410   ChildRemovedSignalCheck signal(signalReceived, childActor);
7411   DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7412   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7413
7414   auto actorA = Actor::New();
7415   stage.Add(actorA);
7416   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7417   DALI_TEST_CHECK(!childActor);
7418
7419   stage.Remove(actorA);
7420   DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7421   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7422
7423   signalReceived = false;
7424   auto actorB    = Actor::New();
7425   stage.Add(actorB);
7426   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7427
7428   stage.Remove(actorB);
7429   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7430   DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7431
7432   END_TEST;
7433 }
7434
7435 int UtcDaliChildRemovedSignalP2(void)
7436 {
7437   TestApplication application;
7438   auto            stage = application.GetScene();
7439
7440   bool  signalReceived = false;
7441   Actor childActor;
7442
7443   ChildAddedSignalCheck signal(signalReceived, childActor);
7444   tet_infoline("Connect to childRemoved signal by name");
7445
7446   stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
7447   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7448
7449   auto actorA = Actor::New();
7450   stage.Add(actorA);
7451   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7452
7453   stage.Remove(actorA);
7454   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7455
7456   signalReceived = false;
7457   auto actorB    = Actor::New();
7458   stage.Add(actorB);
7459   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7460
7461   stage.Remove(actorB);
7462   DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7463
7464   END_TEST;
7465 }
7466
7467 int UtcDaliChildRemovedSignalN(void)
7468 {
7469   TestApplication application;
7470   auto            stage = application.GetScene();
7471
7472   bool  signalReceived = false;
7473   Actor childActor;
7474
7475   ChildRemovedSignalCheck signal(signalReceived, childActor);
7476   DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7477   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7478
7479   auto actorA = Actor::New();
7480   stage.Add(actorA);
7481
7482   auto actorB = Actor::New();
7483   actorA.Add(actorB);
7484
7485   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7486   DALI_TEST_CHECK(!childActor);
7487
7488   actorA.Remove(actorB);
7489   DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7490   END_TEST;
7491 }
7492
7493 int UtcDaliChildMovedSignalP(void)
7494 {
7495   TestApplication application;
7496   auto            stage = application.GetScene();
7497
7498   bool  addedASignalReceived   = false;
7499   bool  removedASignalReceived = false;
7500   bool  addedBSignalReceived   = false;
7501   bool  removedBSignalReceived = false;
7502   Actor childActor;
7503
7504   auto actorA = Actor::New();
7505   auto actorB = Actor::New();
7506   stage.Add(actorA);
7507   stage.Add(actorB);
7508
7509   ChildAddedSignalCheck   addedSignalA(addedASignalReceived, childActor);
7510   ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
7511   ChildAddedSignalCheck   addedSignalB(addedBSignalReceived, childActor);
7512   ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
7513
7514   DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
7515   DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
7516   DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
7517   DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
7518
7519   DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7520   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7521   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7522   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7523
7524   // Create a child of A
7525
7526   auto child = Actor::New();
7527   actorA.Add(child);
7528
7529   DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7530   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7531   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7532   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7533   DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
7534
7535   // Move child to B:
7536   addedASignalReceived   = false;
7537   addedBSignalReceived   = false;
7538   removedASignalReceived = false;
7539   removedBSignalReceived = false;
7540
7541   actorB.Add(child); // Expect this child to be re-parented
7542   DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7543   DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
7544   DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
7545   DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7546
7547   // Move child back to A:
7548   addedASignalReceived   = false;
7549   addedBSignalReceived   = false;
7550   removedASignalReceived = false;
7551   removedBSignalReceived = false;
7552
7553   actorA.Add(child); // Expect this child to be re-parented
7554   DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7555   DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7556   DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7557   DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
7558
7559   END_TEST;
7560 }
7561
7562 int utcDaliActorCulled(void)
7563 {
7564   TestApplication application;
7565   auto            stage = application.GetScene();
7566
7567   tet_infoline("Check that the actor is culled if the actor is out of the screen");
7568
7569   Actor actor = Actor::New();
7570   actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7571
7572   Geometry geometry = CreateQuadGeometry();
7573   Shader   shader   = CreateShader();
7574   Renderer renderer = Renderer::New(geometry, shader);
7575   actor.AddRenderer(renderer);
7576
7577   stage.Add(actor);
7578
7579   application.SendNotification();
7580   application.Render(0);
7581
7582   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
7583
7584   PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
7585   notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
7586
7587   // Connect NotifySignal
7588   bool                              propertyNotificationSignal(false);
7589   PropertyNotification              source;
7590   CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
7591   notification.NotifySignal().Connect(&application, f);
7592
7593   actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
7594
7595   application.SendNotification();
7596   application.Render();
7597
7598   application.SendNotification();
7599
7600   DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
7601
7602   DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
7603   DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
7604   DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
7605
7606   END_TEST;
7607 }
7608
7609 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7610 {
7611   TestApplication application;
7612   auto            stage = application.GetScene();
7613
7614   tet_infoline("Ensure we clear the screen when the last actor is removed");
7615
7616   Actor actor = CreateRenderableActor();
7617   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7618   stage.Add(actor);
7619
7620   application.SendNotification();
7621   application.Render();
7622
7623   auto&      glAbstraction    = application.GetGlAbstraction();
7624   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7625
7626   actor.Unparent();
7627
7628   application.SendNotification();
7629   application.Render();
7630
7631   DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7632
7633   END_TEST;
7634 }
7635
7636 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7637 {
7638   TestApplication application;
7639   auto            stage = application.GetScene();
7640
7641   tet_infoline("Ensure we clear the screen when the last actor is made invisible");
7642
7643   Actor actor = CreateRenderableActor();
7644   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7645   stage.Add(actor);
7646
7647   application.SendNotification();
7648   application.Render();
7649
7650   auto&      glAbstraction    = application.GetGlAbstraction();
7651   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7652
7653   actor.SetProperty(Actor::Property::VISIBLE, false);
7654
7655   application.SendNotification();
7656   application.Render();
7657
7658   DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7659
7660   END_TEST;
7661 }
7662
7663 int utcDaliActorGetSizeAfterAnimation(void)
7664 {
7665   TestApplication application;
7666   tet_infoline("Check the actor size before / after an animation is finished");
7667
7668   Vector3 actorSize(100.0f, 100.0f, 0.0f);
7669
7670   Actor actor = Actor::New();
7671   actor.SetProperty(Actor::Property::SIZE, actorSize);
7672   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7673   application.GetScene().Add(actor);
7674
7675   // Size should be updated without rendering.
7676   Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7677   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7678
7679   application.SendNotification();
7680   application.Render();
7681
7682   // Size and current size should be updated.
7683   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7684   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7685   DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7686   DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7687   DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7688
7689   Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7690   DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7691   DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7692   DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7693   DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7694
7695   // Set size again
7696   actorSize = Vector3(200.0f, 200.0f, 0.0f);
7697   actor.SetProperty(Actor::Property::SIZE, actorSize);
7698
7699   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7700   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7701
7702   Vector3 targetValue(10.0f, 20.0f, 0.0f);
7703
7704   Animation animation = Animation::New(1.0f);
7705   animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
7706   animation.Play();
7707
7708   // Size should be updated without rendering.
7709   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7710   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7711
7712   application.SendNotification();
7713   application.Render(1100); // After the animation
7714
7715   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7716   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7717   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7718   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7719   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7720
7721   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7722   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7723   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7724   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7725   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7726
7727   targetValue.width = 50.0f;
7728
7729   animation.Clear();
7730   animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
7731   animation.Play();
7732
7733   application.SendNotification();
7734   application.Render(1100); // After the animation
7735
7736   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7737   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7738   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7739   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7740   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7741
7742   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7743   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7744   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7745   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7746   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7747
7748   targetValue.height = 70.0f;
7749
7750   animation.Clear();
7751   animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
7752   animation.Play();
7753
7754   application.SendNotification();
7755   application.Render(1100); // After the animation
7756
7757   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7758   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7759   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7760   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7761   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7762
7763   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7764   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7765   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7766   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7767   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7768
7769   Vector3 offset(10.0f, 20.0f, 0.0f);
7770
7771   animation.Clear();
7772   animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
7773   animation.Play();
7774
7775   application.SendNotification();
7776   application.Render(1100); // After the animation
7777
7778   targetValue += offset;
7779
7780   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7781   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7782   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7783   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7784   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7785
7786   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7787   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7788   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7789   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7790   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7791
7792   offset.width = 20.0f;
7793
7794   animation.Clear();
7795   animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
7796   animation.Play();
7797
7798   application.SendNotification();
7799   application.Render(1100); // After the animation
7800
7801   targetValue.width += offset.width;
7802
7803   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7804   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7805   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7806   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7807   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7808
7809   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7810   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7811   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7812   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7813   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7814
7815   offset.height = 10.0f;
7816
7817   animation.Clear();
7818   animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
7819   animation.Play();
7820
7821   application.SendNotification();
7822   application.Render(1100); // After the animation
7823
7824   targetValue.height += offset.height;
7825
7826   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7827   DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7828   DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7829   DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7830   DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7831
7832   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7833   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7834   DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7835   DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7836   DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7837
7838   // Set size again
7839   actorSize = Vector3(300.0f, 300.0f, 0.0f);
7840
7841   actor.SetProperty(Actor::Property::SIZE, actorSize);
7842
7843   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7844   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7845
7846   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7847   DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7848
7849   application.SendNotification();
7850   application.Render();
7851
7852   size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7853   DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7854
7855   currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7856   DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7857
7858   END_TEST;
7859 }
7860
7861 int utcDaliActorPartialUpdate(void)
7862 {
7863   TestApplication application(
7864     TestApplication::DEFAULT_SURFACE_WIDTH,
7865     TestApplication::DEFAULT_SURFACE_HEIGHT,
7866     TestApplication::DEFAULT_HORIZONTAL_DPI,
7867     TestApplication::DEFAULT_VERTICAL_DPI,
7868     true,
7869     true);
7870
7871   tet_infoline("Check the damaged area");
7872
7873   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7874
7875   std::vector<Rect<int>> damagedRects;
7876   Rect<int>              clippingRect;
7877   application.SendNotification();
7878   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7879
7880   // First render pass, nothing to render, adaptor would just do swap buffer.
7881   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7882   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7883
7884   Actor actor = CreateRenderableActor();
7885   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7886   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7887   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7888   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7889   application.GetScene().Add(actor);
7890
7891   application.SendNotification();
7892
7893   // 1. Actor added, damaged rect is added size of actor
7894   damagedRects.clear();
7895   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7896   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7897
7898   // Aligned by 16
7899   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7900   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7901   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7902   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7903   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7904   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7905   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7906
7907   // 2. Set new size
7908   actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
7909   application.SendNotification();
7910
7911   damagedRects.clear();
7912   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7913   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7914
7915   // Aligned by 16
7916   clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
7917   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7918   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7919   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7920   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7921   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7922   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7923
7924   // 3. Set new position
7925   actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
7926   application.SendNotification();
7927
7928   damagedRects.clear();
7929   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7930   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7931
7932   // Aligned by 16
7933   clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
7934   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7935   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7936   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7937   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7938   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7939   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7940
7941   application.GetScene().Remove(actor);
7942   application.SendNotification();
7943
7944   // Actor removed, last 3 dirty rects are reported. Adaptor would merge them together.
7945   damagedRects.clear();
7946   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7947   DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
7948
7949   clippingRect = damagedRects[0];
7950   clippingRect.Merge(damagedRects[1]);
7951   clippingRect.Merge(damagedRects[2]);
7952
7953   DALI_TEST_EQUALS(clippingRect.IsEmpty(), false, TEST_LOCATION);
7954   DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
7955   DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(16, 736, 64, 64), TEST_LOCATION);
7956
7957   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7958   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7959   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7960   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7961   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7962
7963   END_TEST;
7964 }
7965
7966 int utcDaliActorPartialUpdateSetColor(void)
7967 {
7968   TestApplication application(
7969     TestApplication::DEFAULT_SURFACE_WIDTH,
7970     TestApplication::DEFAULT_SURFACE_HEIGHT,
7971     TestApplication::DEFAULT_HORIZONTAL_DPI,
7972     TestApplication::DEFAULT_VERTICAL_DPI,
7973     true,
7974     true);
7975
7976   tet_infoline("Check uniform update");
7977
7978   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7979
7980   std::vector<Rect<int>> damagedRects;
7981   Rect<int>              clippingRect;
7982   application.SendNotification();
7983   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7984
7985   // First render pass, nothing to render, adaptor would just do swap buffer.
7986   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7987   application.RenderWithPartialUpdate(damagedRects, clippingRect);
7988
7989   Actor actor = CreateRenderableActor();
7990   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7991   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7992   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7993   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7994   application.GetScene().Add(actor);
7995
7996   application.SendNotification();
7997
7998   // 1. Actor added, damaged rect is added size of actor
7999   damagedRects.clear();
8000   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8001   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8002
8003   // Aligned by 16
8004   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8005   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8006   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8007   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8008   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8009   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8010   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8011
8012   damagedRects.clear();
8013   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8014
8015   damagedRects.clear();
8016   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8017
8018   // 2. Set new color
8019   actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
8020   application.SendNotification();
8021
8022   damagedRects.clear();
8023   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8024   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8025
8026   // Aligned by 16
8027   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8028   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8029   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8030   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8031   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8032   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8033   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8034
8035   END_TEST;
8036 }
8037
8038 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
8039 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
8040 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
8041 const char* const RENDER_SHADOW_VERTEX_SOURCE =
8042   " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
8043   " uniform mediump mat4 uLightCameraViewMatrix;\n"
8044   "\n"
8045   "void main()\n"
8046   "{\n"
8047   "  gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
8048   "  vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix  * vec4(aPosition,1.0);\n"
8049   "  vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
8050   "}\n";
8051
8052 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
8053   "uniform lowp vec4 uShadowColor;\n"
8054   "void main()\n"
8055   "{\n"
8056   "  lowp float alpha;\n"
8057   "  alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
8058   "  gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
8059   "}\n";
8060
8061 int utcDaliActorPartialUpdateSetProperty(void)
8062 {
8063   TestApplication application(
8064     TestApplication::DEFAULT_SURFACE_WIDTH,
8065     TestApplication::DEFAULT_SURFACE_HEIGHT,
8066     TestApplication::DEFAULT_HORIZONTAL_DPI,
8067     TestApplication::DEFAULT_VERTICAL_DPI,
8068     true,
8069     true);
8070
8071   tet_infoline("Set/Update property with partial update");
8072
8073   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8074
8075   std::vector<Rect<int>> damagedRects;
8076   Rect<int>              clippingRect;
8077   application.SendNotification();
8078   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8079
8080   // First render pass, nothing to render, adaptor would just do swap buffer.
8081   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8082   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8083
8084   Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
8085   Actor   actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
8086   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8087   actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8088   actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8089   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8090   application.GetScene().Add(actor);
8091
8092   actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
8093
8094   damagedRects.clear();
8095   application.SendNotification();
8096   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8097   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8098
8099   // Aligned by 16
8100   clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8101   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8102   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8103   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8104   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8105   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8106   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8107
8108   Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
8109   actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
8110
8111   damagedRects.clear();
8112   application.SendNotification();
8113   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8114   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8115
8116   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8117   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8118   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8119   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8120   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8121   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8122
8123   damagedRects.clear();
8124   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8125   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8126
8127   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8128   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8129   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8130   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8131   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8132   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8133
8134   damagedRects.clear();
8135   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8136   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8137
8138   END_TEST;
8139 }
8140
8141 int utcDaliActorPartialUpdateTwoActors(void)
8142 {
8143   TestApplication application(
8144     TestApplication::DEFAULT_SURFACE_WIDTH,
8145     TestApplication::DEFAULT_SURFACE_HEIGHT,
8146     TestApplication::DEFAULT_HORIZONTAL_DPI,
8147     TestApplication::DEFAULT_VERTICAL_DPI,
8148     true,
8149     true);
8150
8151   tet_infoline("Check the damaged rects with partial update and two actors");
8152
8153   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8154
8155   Actor actor = CreateRenderableActor();
8156   actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
8157   actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
8158   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8159   application.GetScene().Add(actor);
8160
8161   Actor actor2 = CreateRenderableActor();
8162   actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
8163   actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
8164   actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8165   application.GetScene().Add(actor2);
8166
8167   application.SendNotification();
8168   std::vector<Rect<int>> damagedRects;
8169   application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8170
8171   DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
8172   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
8173   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
8174
8175   // in screen coordinates, adaptor would calculate it using previous frames information
8176   Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
8177   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8178
8179   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8180   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8181   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8182   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8183
8184   END_TEST;
8185 }
8186
8187 int utcDaliActorPartialUpdateActorsWithSizeHint(void)
8188 {
8189   TestApplication application(
8190     TestApplication::DEFAULT_SURFACE_WIDTH,
8191     TestApplication::DEFAULT_SURFACE_HEIGHT,
8192     TestApplication::DEFAULT_HORIZONTAL_DPI,
8193     TestApplication::DEFAULT_VERTICAL_DPI,
8194     true,
8195     true);
8196
8197   tet_infoline("Check the damaged rect with partial update and actor size hint");
8198
8199   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8200
8201   Actor actor = CreateRenderableActor();
8202   actor.SetProperty(Actor::Property::POSITION, Vector3(75.0f, 150.0f, 0.0f));
8203   actor.SetProperty(Actor::Property::SIZE, Vector3(75.0f, 150.0f, 0.0f));
8204   actor.SetProperty(DevelActor::Property::UPDATE_SIZE_HINT, Vector3(150, 300, 0));
8205   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8206   application.GetScene().Add(actor);
8207
8208   application.SendNotification();
8209   std::vector<Rect<int>> damagedRects;
8210   application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8211
8212   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8213
8214   Rect<int> clippingRect = Rect<int>(0, 496, 160, 320);
8215   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8216
8217   application.RenderWithPartialUpdate(damagedRects, clippingRect);
8218
8219   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8220   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8221   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8222   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8223
8224   END_TEST;
8225 }
8226
8227 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
8228 {
8229   TestApplication application;
8230
8231   Actor actor = Actor::New();
8232   DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
8233   actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
8234   DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
8235   DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
8236   DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
8237   DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
8238   DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
8239   DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
8240   END_TEST;
8241 }
8242
8243 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
8244 {
8245   TestApplication application;
8246
8247   Actor actor = Actor::New();
8248
8249   // Make sure setting invalid types does not cause a crash
8250   try
8251   {
8252     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
8253     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
8254     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
8255     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
8256     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
8257     actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
8258     tet_result(TET_PASS);
8259   }
8260   catch(...)
8261   {
8262     tet_result(TET_FAIL);
8263   }
8264   END_TEST;
8265 }
8266
8267 int UtcDaliActorTouchAreaPropertyP(void)
8268 {
8269   TestApplication application;
8270
8271   Actor actor = Actor::New();
8272   Vector2 touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get<Vector2>();
8273   DALI_TEST_EQUALS(touchArea, Vector2::ZERO, TEST_LOCATION);
8274   actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(10.f, 10.f));
8275   touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get<Vector2>();
8276   DALI_TEST_EQUALS(touchArea, Vector2(10.f, 10.f), TEST_LOCATION);
8277   END_TEST;
8278 }
8279
8280 int UtcDaliActorTouchAreaPropertyN(void)
8281 {
8282   TestApplication application;
8283
8284   Actor actor = Actor::New();
8285
8286   // Make sure setting invalid types does not cause a crash
8287   try
8288   {
8289     actor.SetProperty(DevelActor::Property::TOUCH_AREA, 1.0f);
8290     actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2::ONE);
8291     actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector3::ONE);
8292     actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector4::ONE);
8293     actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Map());
8294     actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Array());
8295     tet_result(TET_PASS);
8296   }
8297   catch(...)
8298   {
8299     tet_result(TET_FAIL);
8300   }
8301   END_TEST;
8302 }
8303
8304 int UtcDaliActorLowerBelowNegative(void)
8305 {
8306   TestApplication application;
8307   Dali::Actor     instance;
8308   try
8309   {
8310     Dali::Actor arg1;
8311     instance.LowerBelow(arg1);
8312     DALI_TEST_CHECK(false); // Should not get here
8313   }
8314   catch(...)
8315   {
8316     DALI_TEST_CHECK(true); // We expect an assert
8317   }
8318   END_TEST;
8319 }
8320
8321 int UtcDaliActorRaiseAboveNegative(void)
8322 {
8323   TestApplication application;
8324   Dali::Actor     instance;
8325   try
8326   {
8327     Dali::Actor arg1;
8328     instance.RaiseAbove(arg1);
8329     DALI_TEST_CHECK(false); // Should not get here
8330   }
8331   catch(...)
8332   {
8333     DALI_TEST_CHECK(true); // We expect an assert
8334   }
8335   END_TEST;
8336 }
8337
8338 int UtcDaliActorRaiseToTopNegative(void)
8339 {
8340   TestApplication application;
8341   Dali::Actor     instance;
8342   try
8343   {
8344     instance.RaiseToTop();
8345     DALI_TEST_CHECK(false); // Should not get here
8346   }
8347   catch(...)
8348   {
8349     DALI_TEST_CHECK(true); // We expect an assert
8350   }
8351   END_TEST;
8352 }
8353
8354 int UtcDaliActorAddRendererNegative(void)
8355 {
8356   TestApplication application;
8357   Dali::Actor     instance;
8358   try
8359   {
8360     Dali::Renderer arg1;
8361     instance.AddRenderer(arg1);
8362     DALI_TEST_CHECK(false); // Should not get here
8363   }
8364   catch(...)
8365   {
8366     DALI_TEST_CHECK(true); // We expect an assert
8367   }
8368   END_TEST;
8369 }
8370
8371 int UtcDaliActorTouchedSignalNegative(void)
8372 {
8373   TestApplication application;
8374   Dali::Actor     instance;
8375   try
8376   {
8377     instance.TouchedSignal();
8378     DALI_TEST_CHECK(false); // Should not get here
8379   }
8380   catch(...)
8381   {
8382     DALI_TEST_CHECK(true); // We expect an assert
8383   }
8384   END_TEST;
8385 }
8386
8387 int UtcDaliActorTranslateByNegative(void)
8388 {
8389   TestApplication application;
8390   Dali::Actor     instance;
8391   try
8392   {
8393     Dali::Vector3 arg1;
8394     instance.TranslateBy(arg1);
8395     DALI_TEST_CHECK(false); // Should not get here
8396   }
8397   catch(...)
8398   {
8399     DALI_TEST_CHECK(true); // We expect an assert
8400   }
8401   END_TEST;
8402 }
8403
8404 int UtcDaliActorFindChildByIdNegative(void)
8405 {
8406   TestApplication application;
8407   Dali::Actor     instance;
8408   try
8409   {
8410     unsigned int arg1 = 0u;
8411     instance.FindChildById(arg1);
8412     DALI_TEST_CHECK(false); // Should not get here
8413   }
8414   catch(...)
8415   {
8416     DALI_TEST_CHECK(true); // We expect an assert
8417   }
8418   END_TEST;
8419 }
8420
8421 int UtcDaliActorGetRendererAtNegative(void)
8422 {
8423   TestApplication application;
8424   Dali::Actor     instance;
8425   try
8426   {
8427     unsigned int arg1 = 0u;
8428     instance.GetRendererAt(arg1);
8429     DALI_TEST_CHECK(false); // Should not get here
8430   }
8431   catch(...)
8432   {
8433     DALI_TEST_CHECK(true); // We expect an assert
8434   }
8435   END_TEST;
8436 }
8437
8438 int UtcDaliActorHoveredSignalNegative(void)
8439 {
8440   TestApplication application;
8441   Dali::Actor     instance;
8442   try
8443   {
8444     instance.HoveredSignal();
8445     DALI_TEST_CHECK(false); // Should not get here
8446   }
8447   catch(...)
8448   {
8449     DALI_TEST_CHECK(true); // We expect an assert
8450   }
8451   END_TEST;
8452 }
8453
8454 int UtcDaliActorLowerToBottomNegative(void)
8455 {
8456   TestApplication application;
8457   Dali::Actor     instance;
8458   try
8459   {
8460     instance.LowerToBottom();
8461     DALI_TEST_CHECK(false); // Should not get here
8462   }
8463   catch(...)
8464   {
8465     DALI_TEST_CHECK(true); // We expect an assert
8466   }
8467   END_TEST;
8468 }
8469
8470 int UtcDaliActorOnSceneSignalNegative(void)
8471 {
8472   TestApplication application;
8473   Dali::Actor     instance;
8474   try
8475   {
8476     instance.OnSceneSignal();
8477     DALI_TEST_CHECK(false); // Should not get here
8478   }
8479   catch(...)
8480   {
8481     DALI_TEST_CHECK(true); // We expect an assert
8482   }
8483   END_TEST;
8484 }
8485
8486 int UtcDaliActorOffSceneSignalNegative(void)
8487 {
8488   TestApplication application;
8489   Dali::Actor     instance;
8490   try
8491   {
8492     instance.OffSceneSignal();
8493     DALI_TEST_CHECK(false); // Should not get here
8494   }
8495   catch(...)
8496   {
8497     DALI_TEST_CHECK(true); // We expect an assert
8498   }
8499   END_TEST;
8500 }
8501
8502 int UtcDaliActorRemoveRendererNegative01(void)
8503 {
8504   TestApplication application;
8505   Dali::Actor     instance;
8506   try
8507   {
8508     unsigned int arg1 = 0u;
8509     instance.RemoveRenderer(arg1);
8510     DALI_TEST_CHECK(false); // Should not get here
8511   }
8512   catch(...)
8513   {
8514     DALI_TEST_CHECK(true); // We expect an assert
8515   }
8516   END_TEST;
8517 }
8518
8519 int UtcDaliActorRemoveRendererNegative02(void)
8520 {
8521   TestApplication application;
8522   Dali::Actor     instance;
8523   try
8524   {
8525     Dali::Renderer arg1;
8526     instance.RemoveRenderer(arg1);
8527     DALI_TEST_CHECK(false); // Should not get here
8528   }
8529   catch(...)
8530   {
8531     DALI_TEST_CHECK(true); // We expect an assert
8532   }
8533   END_TEST;
8534 }
8535
8536 int UtcDaliActorFindChildByNameNegative(void)
8537 {
8538   TestApplication application;
8539   Dali::Actor     instance;
8540   try
8541   {
8542     std::string arg1;
8543     instance.FindChildByName(arg1);
8544     DALI_TEST_CHECK(false); // Should not get here
8545   }
8546   catch(...)
8547   {
8548     DALI_TEST_CHECK(true); // We expect an assert
8549   }
8550   END_TEST;
8551 }
8552
8553 int UtcDaliActorSetResizePolicyNegative(void)
8554 {
8555   TestApplication application;
8556   Dali::Actor     instance;
8557   try
8558   {
8559     Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
8560     Dali::Dimension::Type    arg2 = Dimension::ALL_DIMENSIONS;
8561     instance.SetResizePolicy(arg1, arg2);
8562     DALI_TEST_CHECK(false); // Should not get here
8563   }
8564   catch(...)
8565   {
8566     DALI_TEST_CHECK(true); // We expect an assert
8567   }
8568   END_TEST;
8569 }
8570
8571 int UtcDaliActorOnRelayoutSignalNegative(void)
8572 {
8573   TestApplication application;
8574   Dali::Actor     instance;
8575   try
8576   {
8577     instance.OnRelayoutSignal();
8578     DALI_TEST_CHECK(false); // Should not get here
8579   }
8580   catch(...)
8581   {
8582     DALI_TEST_CHECK(true); // We expect an assert
8583   }
8584   END_TEST;
8585 }
8586
8587 int UtcDaliActorWheelEventSignalNegative(void)
8588 {
8589   TestApplication application;
8590   Dali::Actor     instance;
8591   try
8592   {
8593     instance.WheelEventSignal();
8594     DALI_TEST_CHECK(false); // Should not get here
8595   }
8596   catch(...)
8597   {
8598     DALI_TEST_CHECK(true); // We expect an assert
8599   }
8600   END_TEST;
8601 }
8602
8603 int UtcDaliActorGetHeightForWidthNegative(void)
8604 {
8605   TestApplication application;
8606   Dali::Actor     instance;
8607   try
8608   {
8609     float arg1 = 0.0f;
8610     instance.GetHeightForWidth(arg1);
8611     DALI_TEST_CHECK(false); // Should not get here
8612   }
8613   catch(...)
8614   {
8615     DALI_TEST_CHECK(true); // We expect an assert
8616   }
8617   END_TEST;
8618 }
8619
8620 int UtcDaliActorGetWidthForHeightNegative(void)
8621 {
8622   TestApplication application;
8623   Dali::Actor     instance;
8624   try
8625   {
8626     float arg1 = 0.0f;
8627     instance.GetWidthForHeight(arg1);
8628     DALI_TEST_CHECK(false); // Should not get here
8629   }
8630   catch(...)
8631   {
8632     DALI_TEST_CHECK(true); // We expect an assert
8633   }
8634   END_TEST;
8635 }
8636
8637 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
8638 {
8639   TestApplication application;
8640   Dali::Actor     instance;
8641   try
8642   {
8643     instance.LayoutDirectionChangedSignal();
8644     DALI_TEST_CHECK(false); // Should not get here
8645   }
8646   catch(...)
8647   {
8648     DALI_TEST_CHECK(true); // We expect an assert
8649   }
8650   END_TEST;
8651 }
8652
8653 int UtcDaliActorAddNegative(void)
8654 {
8655   TestApplication application;
8656   Dali::Actor     instance;
8657   try
8658   {
8659     Dali::Actor arg1;
8660     instance.Add(arg1);
8661     DALI_TEST_CHECK(false); // Should not get here
8662   }
8663   catch(...)
8664   {
8665     DALI_TEST_CHECK(true); // We expect an assert
8666   }
8667   END_TEST;
8668 }
8669
8670 int UtcDaliActorLowerNegative(void)
8671 {
8672   TestApplication application;
8673   Dali::Actor     instance;
8674   try
8675   {
8676     instance.Lower();
8677     DALI_TEST_CHECK(false); // Should not get here
8678   }
8679   catch(...)
8680   {
8681     DALI_TEST_CHECK(true); // We expect an assert
8682   }
8683   END_TEST;
8684 }
8685
8686 int UtcDaliActorRaiseNegative(void)
8687 {
8688   TestApplication application;
8689   Dali::Actor     instance;
8690   try
8691   {
8692     instance.Raise();
8693     DALI_TEST_CHECK(false); // Should not get here
8694   }
8695   catch(...)
8696   {
8697     DALI_TEST_CHECK(true); // We expect an assert
8698   }
8699   END_TEST;
8700 }
8701
8702 int UtcDaliActorRemoveNegative(void)
8703 {
8704   TestApplication application;
8705   Dali::Actor     instance;
8706   try
8707   {
8708     Dali::Actor arg1;
8709     instance.Remove(arg1);
8710     DALI_TEST_CHECK(false); // Should not get here
8711   }
8712   catch(...)
8713   {
8714     DALI_TEST_CHECK(true); // We expect an assert
8715   }
8716   END_TEST;
8717 }
8718
8719 int UtcDaliActorScaleByNegative(void)
8720 {
8721   TestApplication application;
8722   Dali::Actor     instance;
8723   try
8724   {
8725     Dali::Vector3 arg1;
8726     instance.ScaleBy(arg1);
8727     DALI_TEST_CHECK(false); // Should not get here
8728   }
8729   catch(...)
8730   {
8731     DALI_TEST_CHECK(true); // We expect an assert
8732   }
8733   END_TEST;
8734 }
8735
8736 int UtcDaliActorGetLayerNegative(void)
8737 {
8738   TestApplication application;
8739   Dali::Actor     instance;
8740   try
8741   {
8742     instance.GetLayer();
8743     DALI_TEST_CHECK(false); // Should not get here
8744   }
8745   catch(...)
8746   {
8747     DALI_TEST_CHECK(true); // We expect an assert
8748   }
8749   END_TEST;
8750 }
8751
8752 int UtcDaliActorRotateByNegative01(void)
8753 {
8754   TestApplication application;
8755   Dali::Actor     instance;
8756   try
8757   {
8758     Dali::Quaternion arg1;
8759     instance.RotateBy(arg1);
8760     DALI_TEST_CHECK(false); // Should not get here
8761   }
8762   catch(...)
8763   {
8764     DALI_TEST_CHECK(true); // We expect an assert
8765   }
8766   END_TEST;
8767 }
8768
8769 int UtcDaliActorRotateByNegative02(void)
8770 {
8771   TestApplication application;
8772   Dali::Actor     instance;
8773   try
8774   {
8775     Dali::Radian  arg1;
8776     Dali::Vector3 arg2;
8777     instance.RotateBy(arg1, arg2);
8778     DALI_TEST_CHECK(false); // Should not get here
8779   }
8780   catch(...)
8781   {
8782     DALI_TEST_CHECK(true); // We expect an assert
8783   }
8784   END_TEST;
8785 }
8786
8787 int UtcDaliActorUnparentNegative(void)
8788 {
8789   TestApplication application;
8790   Dali::Actor     instance;
8791   try
8792   {
8793     instance.Unparent();
8794     DALI_TEST_CHECK(false); // Should not get here
8795   }
8796   catch(...)
8797   {
8798     DALI_TEST_CHECK(true); // We expect an assert
8799   }
8800   END_TEST;
8801 }
8802
8803 int UtcDaliActorGetChildAtNegative(void)
8804 {
8805   TestApplication application;
8806   Dali::Actor     instance;
8807   try
8808   {
8809     unsigned int arg1 = 0u;
8810     instance.GetChildAt(arg1);
8811     DALI_TEST_CHECK(false); // Should not get here
8812   }
8813   catch(...)
8814   {
8815     DALI_TEST_CHECK(true); // We expect an assert
8816   }
8817   END_TEST;
8818 }
8819
8820 int UtcDaliActorGetChildCountNegative(void)
8821 {
8822   TestApplication application;
8823   Dali::Actor     instance;
8824   try
8825   {
8826     instance.GetChildCount();
8827     DALI_TEST_CHECK(false); // Should not get here
8828   }
8829   catch(...)
8830   {
8831     DALI_TEST_CHECK(true); // We expect an assert
8832   }
8833   END_TEST;
8834 }
8835
8836 int UtcDaliActorGetTargetSizeNegative(void)
8837 {
8838   TestApplication application;
8839   Dali::Actor     instance;
8840   try
8841   {
8842     instance.GetTargetSize();
8843     DALI_TEST_CHECK(false); // Should not get here
8844   }
8845   catch(...)
8846   {
8847     DALI_TEST_CHECK(true); // We expect an assert
8848   }
8849   END_TEST;
8850 }
8851
8852 int UtcDaliActorScreenToLocalNegative(void)
8853 {
8854   TestApplication application;
8855   Dali::Actor     instance;
8856   try
8857   {
8858     float arg1 = 0.0f;
8859     float arg2 = 0.0f;
8860     float arg3 = 0.0f;
8861     float arg4 = 0.0f;
8862     instance.ScreenToLocal(arg1, arg2, arg3, arg4);
8863     DALI_TEST_CHECK(false); // Should not get here
8864   }
8865   catch(...)
8866   {
8867     DALI_TEST_CHECK(true); // We expect an assert
8868   }
8869   END_TEST;
8870 }
8871
8872 int UtcDaliActorGetNaturalSizeNegative(void)
8873 {
8874   TestApplication application;
8875   Dali::Actor     instance;
8876   try
8877   {
8878     instance.GetNaturalSize();
8879     DALI_TEST_CHECK(false); // Should not get here
8880   }
8881   catch(...)
8882   {
8883     DALI_TEST_CHECK(true); // We expect an assert
8884   }
8885   END_TEST;
8886 }
8887
8888 int UtcDaliActorGetRelayoutSizeNegative(void)
8889 {
8890   TestApplication application;
8891   Dali::Actor     instance;
8892   try
8893   {
8894     Dali::Dimension::Type arg1 = Dimension::HEIGHT;
8895     instance.GetRelayoutSize(arg1);
8896     DALI_TEST_CHECK(false); // Should not get here
8897   }
8898   catch(...)
8899   {
8900     DALI_TEST_CHECK(true); // We expect an assert
8901   }
8902   END_TEST;
8903 }
8904
8905 int UtcDaliActorGetResizePolicyNegative(void)
8906 {
8907   TestApplication application;
8908   Dali::Actor     instance;
8909   try
8910   {
8911     Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
8912     instance.GetResizePolicy(arg1);
8913     DALI_TEST_CHECK(false); // Should not get here
8914   }
8915   catch(...)
8916   {
8917     DALI_TEST_CHECK(true); // We expect an assert
8918   }
8919   END_TEST;
8920 }
8921
8922 int UtcDaliActorGetRendererCountNegative(void)
8923 {
8924   TestApplication application;
8925   Dali::Actor     instance;
8926   try
8927   {
8928     instance.GetRendererCount();
8929     DALI_TEST_CHECK(false); // Should not get here
8930   }
8931   catch(...)
8932   {
8933     DALI_TEST_CHECK(true); // We expect an assert
8934   }
8935   END_TEST;
8936 }
8937
8938 int UtcDaliActorGetParentNegative(void)
8939 {
8940   TestApplication application;
8941   Dali::Actor     instance;
8942   try
8943   {
8944     instance.GetParent();
8945     DALI_TEST_CHECK(false); // Should not get here
8946   }
8947   catch(...)
8948   {
8949     DALI_TEST_CHECK(true); // We expect an assert
8950   }
8951   END_TEST;
8952 }
8953
8954 int UtcDaliActorPropertyBlendEquation(void)
8955 {
8956   TestApplication application;
8957
8958   tet_infoline("Test SetProperty AdvancedBlendEquation");
8959
8960   Geometry geometry = CreateQuadGeometry();
8961   Shader shader = CreateShader();
8962   Renderer renderer1 = Renderer::New( geometry, shader );
8963
8964   Actor actor = Actor::New();
8965   actor.SetProperty(Actor::Property::OPACITY, 0.1f);
8966
8967   actor.AddRenderer(renderer1);
8968   actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
8969   application.GetScene().Add(actor);
8970
8971   if( !Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
8972   {
8973     actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
8974     int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
8975     DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), false, TEST_LOCATION );
8976   }
8977
8978   if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
8979   {
8980     actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
8981     int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
8982     DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), true, TEST_LOCATION );
8983   }
8984
8985   Renderer renderer2 = Renderer::New( geometry, shader );
8986   actor.AddRenderer(renderer2);
8987
8988   END_TEST;
8989 }