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