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