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.SetOrientation(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.SetOrientation( 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.SetOrientation( 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.SetOrientation( 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.SetOrientation(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.SetOrientation( rotation );
1824   Stage::GetCurrent().Add( parent );
1825
1826   Actor child = Actor::New();
1827   child.SetOrientation( 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.GetColorMode(), 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.SetColorMode( 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.SetColorMode( 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.SetColorMode( 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.SetColorMode( USE_OWN_COLOR );
2405   DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetColorMode(), TEST_LOCATION );
2406
2407   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
2408   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
2409
2410   actor.SetColorMode( USE_PARENT_COLOR );
2411   DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
2412
2413   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
2414   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetColorMode(), 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.GetDrawMode() ); // Ensure overlay is off by default
2899
2900   a.SetDrawMode( DrawMode::OVERLAY_2D );
2901   app.SendNotification();
2902   app.Render(1);
2903
2904   DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetDrawMode() ); // Check Actor is overlay
2905
2906   a.SetDrawMode( DrawMode::NORMAL );
2907   app.SendNotification();
2908   app.Render(1);
2909
2910   DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // 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.SetDrawMode( 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.SetOrientation( 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.SetOrientation( 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.SetOrientation( 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.SetOrientation( 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.SetDrawMode(DrawMode::OVERLAY_2D );
3220   DALI_TEST_CHECK( parent.GetDrawMode() == 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::STRING      },
3285   { "drawMode",                 Actor::Property::DRAW_MODE,                Property::STRING      },
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::STRING      },
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( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), "USE_SIZE_SET", TEST_LOCATION );
3366   DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
3367
3368   SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3369   actor.SetSizeScalePolicy( policy );
3370   DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), policy, TEST_LOCATION );
3371
3372   // Set
3373   const char* const policy1 = "FIT_WITH_ASPECT_RATIO";
3374   const char* const policy2 = "FILL_WITH_ASPECT_RATIO";
3375
3376   actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
3377   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy1, TEST_LOCATION );
3378
3379   actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
3380   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy2, TEST_LOCATION );
3381
3382   END_TEST;
3383 }
3384
3385 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3386 {
3387   TestApplication app;
3388
3389   Actor actor = Actor::New();
3390
3391   // Defaults
3392   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
3393   DALI_TEST_EQUALS( actor.GetSizeModeFactor(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
3394
3395   Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
3396   actor.SetSizeModeFactor( sizeMode );
3397   DALI_TEST_EQUALS( actor.GetSizeModeFactor(), sizeMode, TEST_LOCATION );
3398
3399   // Set
3400   Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
3401
3402   actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
3403   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
3404
3405   END_TEST;
3406 }
3407
3408 int UtcDaliRelayoutProperties_DimensionDependency(void)
3409 {
3410   TestApplication app;
3411
3412   Actor actor = Actor::New();
3413
3414   // Defaults
3415   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
3416   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
3417
3418   // Set
3419   actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
3420   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
3421
3422   actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
3423   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
3424
3425   // Test setting another resize policy
3426   actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
3427   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
3428
3429   END_TEST;
3430 }
3431
3432 int UtcDaliRelayoutProperties_Padding(void)
3433 {
3434   TestApplication app;
3435
3436   Actor actor = Actor::New();
3437
3438   // Data
3439   Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
3440
3441   // PADDING
3442   actor.SetProperty( Actor::Property::PADDING, padding );
3443   Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
3444
3445   DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3446
3447   END_TEST;
3448 }
3449
3450 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3451 {
3452   TestApplication app;
3453
3454   Actor actor = Actor::New();
3455
3456   // Data
3457   Vector2 minSize( 1.0f, 2.0f );
3458
3459   actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
3460   Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
3461
3462   DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3463
3464   Vector2 maxSize( 3.0f, 4.0f );
3465
3466   actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
3467   Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
3468
3469   DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3470
3471   END_TEST;
3472 }
3473
3474 int UtcDaliActorGetHeightForWidth(void)
3475 {
3476   TestApplication app;
3477
3478   Actor actor = Actor::New();
3479
3480   DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
3481
3482   END_TEST;
3483 }
3484
3485 int UtcDaliActorGetWidthForHeight(void)
3486 {
3487   TestApplication app;
3488
3489   Actor actor = Actor::New();
3490
3491   DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
3492
3493   END_TEST;
3494 }
3495
3496 int UtcDaliActorGetRelayoutSize(void)
3497 {
3498   TestApplication app;
3499
3500   Actor actor = Actor::New();
3501
3502   // Add actor to stage
3503   Stage::GetCurrent().Add( actor );
3504
3505   DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
3506
3507   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
3508   actor.SetSize( Vector2( 1.0f, 0.0f ) );
3509
3510   // Flush the queue and render once
3511   app.SendNotification();
3512   app.Render();
3513
3514   DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
3515
3516   END_TEST;
3517 }
3518
3519 int UtcDaliActorSetPadding(void)
3520 {
3521   TestApplication app;
3522
3523   Actor actor = Actor::New();
3524
3525   Padding padding;
3526   actor.GetPadding( padding );
3527
3528   DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
3529   DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
3530   DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
3531   DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
3532
3533   Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
3534   actor.SetPadding( padding2 );
3535
3536   actor.GetPadding( padding );
3537
3538   DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
3539   DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
3540   DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
3541   DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
3542
3543   END_TEST;
3544 }
3545
3546 int UtcDaliActorSetMinimumSize(void)
3547 {
3548   TestApplication app;
3549
3550   Actor actor = Actor::New();
3551
3552   Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
3553
3554   DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
3555   DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
3556
3557   Vector2 size2( 1.0f, 2.0f );
3558   actor.SetProperty( Actor::Property::MINIMUM_SIZE, size2 );
3559
3560   size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
3561
3562   DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3563   DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3564
3565   END_TEST;
3566 }
3567
3568 int UtcDaliActorSetMaximumSize(void)
3569 {
3570   TestApplication app;
3571
3572   Actor actor = Actor::New();
3573
3574   Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
3575
3576   DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
3577   DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
3578
3579   Vector2 size2( 1.0f, 2.0f );
3580   actor.SetProperty( Actor::Property::MAXIMUM_SIZE, size2 );
3581
3582   size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
3583
3584   DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3585   DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3586
3587   END_TEST;
3588 }
3589
3590 int UtcDaliActorOnRelayoutSignal(void)
3591 {
3592   tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3593
3594   TestApplication application;
3595
3596   // Clean test data
3597   gOnRelayoutCallBackCalled = false;
3598   gActorNamesRelayout.clear();
3599
3600   Actor actor = Actor::New();
3601   actor.SetProperty( Actor::Property::NAME, "actor" );
3602   actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
3603
3604   // Sanity check
3605   DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
3606
3607   // Add actor to stage
3608   Stage::GetCurrent().Add( actor );
3609
3610   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3611   actor.SetSize( Vector2( 1.0f, 2.0 ) );
3612
3613   // Flush the queue and render once
3614   application.SendNotification();
3615   application.Render();
3616
3617   // OnRelayout emitted
3618   DALI_TEST_EQUALS(  gOnRelayoutCallBackCalled, true, TEST_LOCATION );
3619   DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
3620
3621   END_TEST;
3622 }
3623
3624 int UtcDaliActorGetHierachyDepth(void)
3625 {
3626   TestApplication application;
3627   tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3628
3629
3630   /* Build tree of actors:
3631    *
3632    *                      Depth
3633    *
3634    *       A (parent)       1
3635    *      / \
3636    *     B   C              2`
3637    *    / \   \
3638    *   D   E   F            3
3639    *
3640    * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3641    */
3642   Stage stage( Stage::GetCurrent() );
3643
3644   Actor actorA = Actor::New();
3645   Actor actorB = Actor::New();
3646   Actor actorC = Actor::New();
3647   Actor actorD = Actor::New();
3648   Actor actorE = Actor::New();
3649   Actor actorF = Actor::New();
3650
3651   //Test that root actor has depth equal 0
3652   DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetHierarchyDepth(), TEST_LOCATION );
3653
3654   //Test actors return depth -1 when not connected to the tree
3655   DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3656   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3657   DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3658   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3659   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3660   DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3661
3662   //Create the hierarchy
3663   stage.Add( actorA );
3664   actorA.Add( actorB );
3665   actorA.Add( actorC );
3666   actorB.Add( actorD );
3667   actorB.Add( actorE );
3668   actorC.Add( actorF );
3669
3670   //Test actors return correct depth
3671   DALI_TEST_EQUALS( 1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3672   DALI_TEST_EQUALS( 2, actorB.GetHierarchyDepth(), TEST_LOCATION );
3673   DALI_TEST_EQUALS( 2, actorC.GetHierarchyDepth(), TEST_LOCATION );
3674   DALI_TEST_EQUALS( 3, actorD.GetHierarchyDepth(), TEST_LOCATION );
3675   DALI_TEST_EQUALS( 3, actorE.GetHierarchyDepth(), TEST_LOCATION );
3676   DALI_TEST_EQUALS( 3, actorF.GetHierarchyDepth(), TEST_LOCATION );
3677
3678   //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3679   actorA.Remove( actorB );
3680
3681   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3682   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3683   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3684
3685   //Removing actorA from the stage. All actors should have depth equal -1
3686   stage.Remove( actorA );
3687
3688   DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3689   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3690   DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3691   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3692   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3693   DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3694
3695   END_TEST;
3696 }
3697
3698 int UtcDaliActorAnchorPointPropertyAsString(void)
3699 {
3700   TestApplication application;
3701
3702   Actor actor = Actor::New();
3703
3704   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
3705   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3706
3707   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
3708   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3709
3710   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
3711   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3712
3713   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
3714   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3715
3716   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
3717   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER, TEST_LOCATION );
3718
3719   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
3720   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3721
3722   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
3723   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3724
3725   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
3726   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3727
3728   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
3729   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3730
3731   // Invalid should not change anything
3732   actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
3733   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3734
3735   END_TEST;
3736 }
3737
3738 int UtcDaliActorParentOriginPropertyAsString(void)
3739 {
3740   TestApplication application;
3741
3742   Actor actor = Actor::New();
3743
3744   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
3745   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3746
3747   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
3748   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3749
3750   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
3751   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3752
3753   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
3754   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3755
3756   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
3757   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER, TEST_LOCATION );
3758
3759   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
3760   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3761
3762   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
3763   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3764
3765   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
3766   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3767
3768   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
3769   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3770
3771   // Invalid should not change anything
3772   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
3773   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3774
3775   END_TEST;
3776 }
3777
3778 int UtcDaliActorColorModePropertyAsString(void)
3779 {
3780   TestApplication application;
3781
3782   Actor actor = Actor::New();
3783
3784   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
3785   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3786
3787   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
3788   DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3789
3790   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
3791   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3792
3793   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
3794   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3795
3796   // Invalid should not change anything
3797   actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
3798   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3799
3800   END_TEST;
3801 }
3802
3803 int UtcDaliActorDrawModePropertyAsString(void)
3804 {
3805   TestApplication application;
3806
3807   Actor actor = Actor::New();
3808
3809   actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
3810   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3811
3812   actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
3813   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3814
3815   // Invalid should not change anything
3816   actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
3817   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3818
3819   END_TEST;
3820 }
3821
3822 int UtcDaliActorColorModePropertyAsEnum(void)
3823 {
3824   TestApplication application;
3825
3826   Actor actor = Actor::New();
3827
3828   actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
3829   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3830
3831   actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
3832   DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3833
3834   actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
3835   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3836
3837   actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
3838   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3839
3840   END_TEST;
3841 }
3842
3843 int UtcDaliActorDrawModePropertyAsEnum(void)
3844 {
3845   TestApplication application;
3846
3847   Actor actor = Actor::New();
3848
3849   actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
3850   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3851
3852   actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
3853   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3854
3855   END_TEST;
3856 }
3857
3858 int UtcDaliActorAddRendererP(void)
3859 {
3860   tet_infoline("Testing Actor::AddRenderer");
3861   TestApplication application;
3862
3863   Actor actor = Actor::New();
3864
3865   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3866
3867   Geometry geometry = CreateQuadGeometry();
3868   Shader shader = CreateShader();
3869   Renderer renderer = Renderer::New(geometry, shader);
3870
3871   actor.AddRenderer( renderer );
3872   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3873   DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3874
3875   END_TEST;
3876 }
3877
3878 int UtcDaliActorAddRendererN(void)
3879 {
3880   tet_infoline("Testing Actor::AddRenderer");
3881   TestApplication application;
3882
3883   Actor actor = Actor::New();
3884   Renderer renderer;
3885
3886   // try illegal Add
3887   try
3888   {
3889     actor.AddRenderer( renderer );
3890     tet_printf("Assertion test failed - no Exception\n" );
3891     tet_result(TET_FAIL);
3892   }
3893   catch(Dali::DaliException& e)
3894   {
3895     DALI_TEST_PRINT_ASSERT( e );
3896     DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3897     DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3898   }
3899   catch(...)
3900   {
3901     tet_printf("Assertion test failed - wrong Exception\n" );
3902     tet_result(TET_FAIL);
3903   }
3904
3905   END_TEST;
3906 }
3907
3908 int UtcDaliActorAddRendererOnStage(void)
3909 {
3910   tet_infoline("Testing Actor::AddRenderer");
3911   TestApplication application;
3912
3913   Actor actor = Actor::New();
3914   Stage::GetCurrent().Add(actor);
3915
3916   application.SendNotification();
3917   application.Render(0);
3918
3919   Geometry geometry = CreateQuadGeometry();
3920   Shader shader = CreateShader();
3921   Renderer renderer = Renderer::New(geometry, shader);
3922
3923   application.SendNotification();
3924   application.Render(0);
3925
3926   try
3927   {
3928     actor.AddRenderer( renderer );
3929     tet_result(TET_PASS);
3930   }
3931   catch(...)
3932   {
3933     tet_result(TET_FAIL);
3934   }
3935
3936   END_TEST;
3937 }
3938
3939 int UtcDaliActorRemoveRendererP1(void)
3940 {
3941   tet_infoline("Testing Actor::RemoveRenderer");
3942   TestApplication application;
3943
3944   Actor actor = Actor::New();
3945
3946   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3947
3948   {
3949     Geometry geometry = CreateQuadGeometry();
3950     Shader shader = CreateShader();
3951     Renderer renderer = Renderer::New(geometry, shader);
3952
3953     actor.AddRenderer( renderer );
3954     DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3955     DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3956
3957     application.SendNotification();
3958     application.Render();
3959   }
3960
3961   {
3962     Renderer renderer = actor.GetRendererAt(0);
3963     actor.RemoveRenderer(renderer);
3964     DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3965
3966     application.SendNotification();
3967     application.Render();
3968   }
3969
3970   // Call one final time to ensure that the renderer is actually removed after
3971   // the handle goes out of scope, and excercises the deletion code path in
3972   // scene graph and render.
3973   application.SendNotification();
3974   application.Render();
3975
3976   END_TEST;
3977 }
3978
3979 int UtcDaliActorRemoveRendererP2(void)
3980 {
3981   tet_infoline("Testing Actor::RemoveRenderer");
3982   TestApplication application;
3983
3984   Actor actor = Actor::New();
3985
3986   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3987
3988   Geometry geometry = CreateQuadGeometry();
3989   Shader shader = CreateShader();
3990   Renderer renderer = Renderer::New(geometry, shader);
3991
3992   actor.AddRenderer( renderer );
3993   application.SendNotification();
3994   application.Render();
3995
3996   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3997   DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3998
3999   actor.RemoveRenderer(0);
4000   application.SendNotification();
4001   application.Render();
4002
4003   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
4004
4005   // Shut down whilst holding onto the renderer handle.
4006   END_TEST;
4007 }
4008
4009
4010 int UtcDaliActorRemoveRendererN(void)
4011 {
4012   tet_infoline("Testing Actor::RemoveRenderer");
4013   TestApplication application;
4014
4015   Actor actor = Actor::New();
4016
4017   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
4018
4019   Geometry geometry = CreateQuadGeometry();
4020   Shader shader = CreateShader();
4021   Renderer renderer = Renderer::New(geometry, shader);
4022
4023   actor.AddRenderer( renderer );
4024   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
4025   DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
4026
4027   actor.RemoveRenderer(10);
4028   DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
4029   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
4030
4031   END_TEST;
4032 }
4033
4034 // Clipping test helper functions:
4035 Actor CreateActorWithContent( uint32_t width, uint32_t height)
4036 {
4037   BufferImage image = BufferImage::New( width, height );
4038   Actor actor = CreateRenderableActor( image );
4039
4040   // Setup dimensions and position so actor is not skipped by culling.
4041   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
4042   actor.SetSize( width, height );
4043   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4044   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4045
4046   return actor;
4047 }
4048
4049 Actor CreateActorWithContent16x16()
4050 {
4051   return CreateActorWithContent( 16, 16 );
4052 }
4053
4054 void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace )
4055 {
4056   enabledDisableTrace.Reset();
4057   stencilTrace.Reset();
4058   enabledDisableTrace.Enable( true );
4059   stencilTrace.Enable( true );
4060
4061   application.SendNotification();
4062   application.Render();
4063
4064   enabledDisableTrace.Enable( false );
4065   stencilTrace.Enable( false );
4066 }
4067
4068 void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue )
4069 {
4070   const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4071
4072   DALI_TEST_EQUALS<bool>( colorMaskParams.red,   maskValue, TEST_LOCATION );
4073   DALI_TEST_EQUALS<bool>( colorMaskParams.green, maskValue, TEST_LOCATION );
4074   DALI_TEST_EQUALS<bool>( colorMaskParams.blue,  maskValue, TEST_LOCATION );
4075   DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, maskValue, TEST_LOCATION );
4076 }
4077
4078 int UtcDaliActorPropertyClippingP(void)
4079 {
4080   // This test checks the clippingMode property.
4081   tet_infoline( "Testing Actor::Property::ClippingMode: P" );
4082   TestApplication application;
4083
4084   Actor actor = Actor::New();
4085
4086   // Check default clippingEnabled value.
4087   Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
4088
4089   int value = 0;
4090   bool getValueResult = getValue.Get( value );
4091   DALI_TEST_CHECK( getValueResult );
4092
4093   if( getValueResult )
4094   {
4095     DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4096   }
4097
4098   // Check setting the property to the stencil mode.
4099   actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4100
4101   // Check the new value was set.
4102   getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4103   getValueResult = getValue.Get( value );
4104   DALI_TEST_CHECK( getValueResult );
4105
4106   if( getValueResult )
4107   {
4108     DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION );
4109   }
4110
4111   // Check setting the property to the scissor mode.
4112   actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4113
4114   // Check the new value was set.
4115   getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4116   getValueResult = getValue.Get( value );
4117   DALI_TEST_CHECK( getValueResult );
4118
4119   if( getValueResult )
4120   {
4121     DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION );
4122   }
4123   END_TEST;
4124 }
4125
4126 int UtcDaliActorPropertyClippingN(void)
4127 {
4128   // Negative test case for Clipping.
4129   tet_infoline( "Testing Actor::Property::ClippingMode: N" );
4130   TestApplication application;
4131
4132   Actor actor = Actor::New();
4133
4134   // Check default clippingEnabled value.
4135   Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
4136
4137   int value = 0;
4138   bool getValueResult = getValue.Get( value );
4139   DALI_TEST_CHECK( getValueResult );
4140
4141   if( getValueResult )
4142   {
4143     DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4144   }
4145
4146   // Check setting an invalid property value won't change the current property value.
4147   actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" );
4148
4149   getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4150   getValueResult = getValue.Get( value );
4151   DALI_TEST_CHECK( getValueResult );
4152
4153   if( getValueResult )
4154   {
4155     DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4156   }
4157
4158   END_TEST;
4159 }
4160
4161 int UtcDaliActorPropertyClippingActor(void)
4162 {
4163   // This test checks that an actor is correctly setup for clipping.
4164   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor" );
4165   TestApplication application;
4166
4167   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4168   TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4169   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4170   size_t startIndex = 0u;
4171
4172   // Create a clipping actor.
4173   Actor actorDepth1Clip = CreateActorWithContent16x16();
4174   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4175   Stage::GetCurrent().Add( actorDepth1Clip );
4176
4177   // Gather the call trace.
4178   GenerateTrace( application, enabledDisableTrace, stencilTrace );
4179
4180   // Check we are writing to the color buffer.
4181   CheckColorMask( glAbstraction, true );
4182
4183   // Check the stencil buffer was enabled.
4184   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) );                                   // 2960 is GL_STENCIL_TEST
4185
4186   // Check the stencil buffer was cleared.
4187   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4188
4189   // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4190   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 1, 0", startIndex ) );     // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4191   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
4192   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4193
4194   END_TEST;
4195 }
4196
4197 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4198 {
4199   // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4200   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable" );
4201   TestApplication application;
4202
4203   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4204   TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4205   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4206   size_t startIndex = 0u;
4207
4208   // Create a clipping actor.
4209   Actor actorDepth1Clip = CreateActorWithContent16x16();
4210   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4211   Stage::GetCurrent().Add( actorDepth1Clip );
4212
4213   // Gather the call trace.
4214   GenerateTrace( application, enabledDisableTrace, stencilTrace );
4215
4216   // Check we are writing to the color buffer.
4217   CheckColorMask( glAbstraction, true );
4218
4219   // Check the stencil buffer was enabled.
4220   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) );                                   // 2960 is GL_STENCIL_TEST
4221
4222   // Check the stencil buffer was cleared.
4223   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4224
4225   // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4226   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 1, 0", startIndex ) );     // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4227   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
4228   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4229
4230   // Now disable the clipping
4231   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
4232
4233   // Gather the call trace.
4234   GenerateTrace( application, enabledDisableTrace, stencilTrace );
4235
4236   // Check the stencil buffer was disabled.
4237   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) );                                   // 2960 is GL_STENCIL_TEST
4238
4239   // Ensure all values in stencil-mask are set to 1.
4240   startIndex = 0u;
4241   DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
4242
4243   END_TEST;
4244 }
4245
4246 int UtcDaliActorPropertyClippingNestedChildren(void)
4247 {
4248   // This test checks that a hierarchy of actors are clipped correctly by
4249   // writing to and reading from the correct bit-planes of the stencil buffer.
4250   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children" );
4251   TestApplication application;
4252   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4253   TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4254   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4255
4256   // Create a clipping actor.
4257   Actor actorDepth1Clip = CreateActorWithContent16x16();
4258   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4259   Stage::GetCurrent().Add( actorDepth1Clip );
4260
4261   // Create a child actor.
4262   Actor childDepth2 = CreateActorWithContent16x16();
4263   actorDepth1Clip.Add( childDepth2 );
4264
4265   // Create another clipping actor.
4266   Actor childDepth2Clip = CreateActorWithContent16x16();
4267   childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4268   childDepth2.Add( childDepth2Clip );
4269
4270   // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4271   // This tests the sort algorithm.
4272   Actor childDepth3 = CreateActorWithContent16x16();
4273   childDepth2Clip.Add( childDepth3 );
4274   Actor childDepth4 = CreateActorWithContent16x16();
4275   childDepth3.Add( childDepth4 );
4276
4277   // Gather the call trace.
4278   GenerateTrace( application, enabledDisableTrace, stencilTrace );
4279
4280   // Check we are writing to the color buffer.
4281   CheckColorMask( glAbstraction, true );
4282
4283   // Check the stencil buffer was enabled.
4284   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) );                                        // 2960 is GL_STENCIL_TEST
4285
4286   // Perform the test twice, once for 2D layer, and once for 3D.
4287   for( unsigned int i = 0u ; i < 2u; ++i )
4288   {
4289     size_t startIndex = 0u;
4290
4291     // Check the stencil buffer was cleared.
4292     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4293
4294     // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4295     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 1, 0", startIndex ) );        // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4296     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask",  "1", startIndex ) );                // Write to the first bit-plane
4297     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp",    "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4298
4299     // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4300     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 1, 255", startIndex ) );      // 514 is GL_EQUAL
4301     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp",    "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
4302
4303     // Check we are set up to write to the second bitplane of the stencil buffer (only).
4304     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 3, 1", startIndex ) );        // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4305     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask",  "3", startIndex ) );                // Write to second (and previous) bit-planes
4306     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp",    "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4307
4308     // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4309     // (Both must be set to pass the check).
4310     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc",  "514, 3, 255", startIndex ) );      // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4311     DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp",    "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
4312
4313     // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4314     if( i == 0u )
4315     {
4316       Stage::GetCurrent().GetRootLayer().SetBehavior( Layer::LAYER_3D );
4317       GenerateTrace( application, enabledDisableTrace, stencilTrace );
4318     }
4319   }
4320
4321   END_TEST;
4322 }
4323
4324 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4325 {
4326   // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4327   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order" );
4328   TestApplication application;
4329   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4330   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4331
4332   /* We create a small tree of actors as follows:
4333
4334                            A
4335                           / \
4336      Clipping enabled -> B   D
4337                          |   |
4338                          C   E
4339
4340      The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4341   */
4342   Actor actors[5];
4343   for( int i = 0; i < 5; ++i )
4344   {
4345     BufferImage image = BufferImage::New( 16u, 16u );
4346     Actor actor = CreateRenderableActor( image );
4347
4348     // Setup dimensions and position so actor is not skipped by culling.
4349     actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
4350     actor.SetSize( 16.0f, 16.0f );
4351
4352     if( i == 0 )
4353     {
4354       actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4355     }
4356     else
4357     {
4358       float b = i > 2 ? 1.0f : -1.0f;
4359       actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5 + ( 0.2f * b ), 0.8f, 0.8f ) );
4360     }
4361
4362     actors[i] = actor;
4363   }
4364
4365   // Enable clipping on the actor at the top of the left branch.
4366   actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4367
4368   // Build the scene graph.
4369   Stage::GetCurrent().Add( actors[0] );
4370
4371   // Left branch:
4372   actors[0].Add( actors[1] );
4373   actors[1].Add( actors[2] );
4374
4375   // Right branch:
4376   actors[0].Add( actors[3] );
4377   actors[3].Add( actors[4] );
4378
4379   // Gather the call trace.
4380   enabledDisableTrace.Reset();
4381   enabledDisableTrace.Enable( true );
4382   application.SendNotification();
4383   application.Render();
4384   enabledDisableTrace.Enable( false );
4385
4386   /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4387
4388      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
4389            Incorrect enable call trace:  StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4390   */
4391   size_t startIndex = 0u;
4392   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable",  "3042", startIndex ) );
4393   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable",  "2960", startIndex ) ); // 2960 is GL_STENCIL_TEST
4394   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
4395
4396   // Swap the clipping actor from top of left branch to top of right branch.
4397   actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
4398   actors[3].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4399
4400   // Gather the call trace.
4401   enabledDisableTrace.Reset();
4402   enabledDisableTrace.Enable( true );
4403   application.SendNotification();
4404   application.Render();
4405   enabledDisableTrace.Enable( false );
4406
4407   // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4408   // This proves the draw order has remained the same.
4409   startIndex = 0u;
4410   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex(  "Enable",  "2960", startIndex ) );
4411   DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
4412
4413   END_TEST;
4414 }
4415
4416 int UtcDaliActorPropertyScissorClippingActor(void)
4417 {
4418   // This test checks that an actor is correctly setup for clipping.
4419   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor" );
4420   TestApplication application;
4421
4422   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4423   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4424   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4425
4426   const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4427   const Vector2 imageSize( 16.0f, 16.0f );
4428
4429   // Create a clipping actor.
4430   Actor clippingActorA = CreateActorWithContent16x16();
4431   // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4432   // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4433   clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
4434   clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
4435   clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4436   Stage::GetCurrent().Add( clippingActorA );
4437
4438   // Gather the call trace.
4439   GenerateTrace( application, enabledDisableTrace, scissorTrace );
4440
4441   // Check we are writing to the color buffer.
4442   CheckColorMask( glAbstraction, true );
4443
4444   // Check scissor test was enabled.
4445   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) );                                   // 3089 = 0xC11 (GL_SCISSOR_TEST)
4446
4447   // Check the scissor was set, and the coordinates are correct.
4448   std::stringstream compareParametersString;
4449   compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4450   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) );                  // Compare with 0, 0, 16, 16
4451
4452   clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
4453   clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
4454
4455   // Gather the call trace.
4456   GenerateTrace( application, enabledDisableTrace, scissorTrace );
4457
4458   // Check the scissor was set, and the coordinates are correct.
4459   compareParametersString.str( std::string() );
4460   compareParametersString.clear();
4461   compareParametersString << ( stageSize.x - imageSize.x ) << ", " << ( stageSize.y - imageSize.y ) << ", " << imageSize.x << ", " << imageSize.y;
4462   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) );                  // Compare with 464, 784, 16, 16
4463
4464   END_TEST;
4465 }
4466
4467 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4468 {
4469   // This test checks that an actor is correctly setup for clipping.
4470   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings" );
4471   TestApplication application;
4472
4473
4474   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4475   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4476   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4477
4478   const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4479   const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
4480   const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
4481
4482   // Create a clipping actors.
4483   Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
4484   Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
4485
4486   clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4487   clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4488   clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4489
4490   clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4491   clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4492   clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4493
4494   clippingActorA.SetPosition( 0.0f, -200.0f, 0.0f );
4495   clippingActorB.SetPosition( 0.0f, 0.0f, 0.0f );
4496
4497   Stage::GetCurrent().Add( clippingActorA );
4498   Stage::GetCurrent().Add( clippingActorB );
4499
4500   // Gather the call trace.
4501   GenerateTrace( application, enabledDisableTrace, scissorTrace );
4502
4503   // Check we are writing to the color buffer.
4504   CheckColorMask( glAbstraction, true );
4505
4506   // Check scissor test was enabled.
4507   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) );                                   // 3089 = 0xC11 (GL_SCISSOR_TEST)
4508
4509   // Check the scissor was set, and the coordinates are correct.
4510   std::stringstream compareParametersString;
4511
4512   std::string clipA( "0, 500, 480, 200" );
4513   std::string clipB( "0, 380, 480, 40" );
4514
4515   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
4516   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
4517
4518   END_TEST;
4519 }
4520
4521 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4522 {
4523   // This test checks that an actor is correctly setup for clipping.
4524   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
4525   TestApplication application;
4526
4527   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4528   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4529   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4530
4531   const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4532   const Vector2 imageSize( 16.0f, 16.0f );
4533
4534   /* Create a nest of 2 scissors to test nesting (intersecting clips).
4535
4536      A is drawn first - with scissor clipping on
4537      B is drawn second - also with scissor clipping on
4538      C is the generated clipping region, the intersection ( A ∩ B )
4539
4540            ┏━━━━━━━┓                   ┌───────┐
4541            ┃     B ┃                   │     B │
4542        ┌───╂┄┄┄┐   ┃               ┌┄┄┄╆━━━┓   │
4543        │   ┃   ┊   ┃     ━━━━━>    ┊   ┃ C ┃   │
4544        │   ┗━━━┿━━━┛               ┊   ┗━━━╃───┘
4545        │ A     │                   ┊ A     ┊
4546        └───────┘                   └┄┄┄┄┄┄┄┘
4547
4548      We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4549   */
4550
4551   // Create a clipping actor.
4552   Actor clippingActorA = CreateActorWithContent16x16();
4553   // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4554   // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4555   clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4556   clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4557   clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4558   Stage::GetCurrent().Add( clippingActorA );
4559
4560   // Create a child clipping actor.
4561   Actor clippingActorB = CreateActorWithContent16x16();
4562   clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4563   clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4564   clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4565   clippingActorA.Add( clippingActorB );
4566
4567   // positionModifiers is an array of positions to position B around.
4568   // expect is an array of expected scissor clip coordinate results.
4569   const Vector2 positionModifiers[4] = { Vector2( 1.0f, 1.0f ),     Vector2( -1.0f, 1.0f ),    Vector2( -1.0f, -1.0f ),   Vector2( 1.0f, -1.0f )    };
4570   const Vector4 expect[4] =            { Vector4( 240, 392, 8, 8 ), Vector4( 232, 392, 8, 8 ), Vector4( 232, 400, 8, 8 ), Vector4( 240, 400, 8, 8 ) };
4571
4572   // Loop through each overlap combination.
4573   for( unsigned int test = 0u; test < 4u; ++test )
4574   {
4575     // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4576     const Vector2 position = ( imageSize / 2.0f ) * positionModifiers[test];
4577     clippingActorB.SetPosition( position.x, position.y );
4578
4579     // Gather the call trace.
4580     GenerateTrace( application, enabledDisableTrace, scissorTrace );
4581
4582     // Check we are writing to the color buffer.
4583     CheckColorMask( glAbstraction, true );
4584
4585     // Check scissor test was enabled.
4586     DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) );                                   // 3089 = 0xC11 (GL_SCISSOR_TEST)
4587
4588     // Check the scissor was set, and the coordinates are correct.
4589     const Vector4& expectResults( expect[test] );
4590     std::stringstream compareParametersString;
4591     compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4592     DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) );                  // Compare with the expected result
4593   }
4594
4595   END_TEST;
4596 }
4597
4598 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4599 {
4600   // This test checks that an actor is correctly setup for clipping.
4601   tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
4602   TestApplication application;
4603
4604   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4605   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4606   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4607
4608   /* Create a nest of 2 scissors and siblings of the parent.
4609
4610             stage
4611               |
4612         ┌─────┐─────┐
4613         A     C     D
4614         |           |
4615         B           E
4616   */
4617
4618   const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4619   const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
4620   const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
4621   const Vector2 sizeC{ stageSize.width, stageSize.height * 0.25f };
4622   const Vector2 sizeD{ stageSize.width, stageSize.height * 0.25f };
4623   const Vector2 sizeE{ stageSize.width, stageSize.height * 0.05f };
4624
4625   // Create a clipping actors.
4626   Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
4627   Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
4628   Actor clippingActorC = CreateActorWithContent( sizeC.width, sizeC.height );
4629   Actor clippingActorD = CreateActorWithContent( sizeD.width, sizeD.height );
4630   Actor clippingActorE = CreateActorWithContent( sizeE.width, sizeE.height );
4631
4632   clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4633   clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4634   clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4635
4636   clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4637   clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4638   clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4639
4640   clippingActorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4641   clippingActorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4642   clippingActorC.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4643
4644   clippingActorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4645   clippingActorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4646   clippingActorD.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4647
4648   clippingActorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4649   clippingActorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4650
4651   clippingActorA.SetPosition( 0.0f, -200.0f, 0.0f );
4652   clippingActorB.SetPosition( 0.0f, 0.0f, 0.0f );
4653   clippingActorC.SetPosition( 0.0f, 100.0f, 0.0f );
4654   clippingActorD.SetPosition( 0.0f, 0.0f, 0.0f );
4655   clippingActorE.SetPosition( 0.0f, 0.0f, 0.0f );
4656
4657   Stage::GetCurrent().Add( clippingActorA );
4658   clippingActorA.Add( clippingActorB );
4659   Stage::GetCurrent().Add( clippingActorC );
4660   Stage::GetCurrent().Add( clippingActorD );
4661   clippingActorD.Add( clippingActorE );
4662
4663   // Gather the call trace.
4664   GenerateTrace( application, enabledDisableTrace, scissorTrace );
4665
4666   // Check we are writing to the color buffer.
4667   CheckColorMask( glAbstraction, true );
4668
4669   // Check scissor test was enabled.
4670   DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) );                                   // 3089 = 0xC11 (GL_SCISSOR_TEST)
4671
4672   // Check the scissor was set, and the coordinates are correct.
4673   std::string clipA( "0, 500, 480, 200" );
4674   std::string clipB( "0, 580, 480, 40" );
4675   std::string clipC( "0, 200, 480, 200" );
4676   std::string clipD( "0, 300, 480, 200" );
4677
4678   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
4679   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
4680   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipC ) );
4681   DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipD ) );
4682   DALI_TEST_CHECK( scissorTrace.CountMethod( "Scissor" ) == 4 );    // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4683
4684   END_TEST;
4685 }
4686
4687 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4688 {
4689   // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4690   tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" );
4691   TestApplication application;
4692
4693   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4694   TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4695   TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4696
4697   // Create a clipping actor.
4698   Actor actorDepth1Clip = CreateActorWithContent16x16();
4699   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4700   Stage::GetCurrent().Add( actorDepth1Clip );
4701
4702   // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4703   actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
4704
4705   // Gather the call trace.
4706   GenerateTrace( application, enabledDisableTrace, stencilTrace );
4707
4708   // Check we are writing to the color buffer.
4709   CheckColorMask( glAbstraction, true );
4710
4711   // Check the stencil buffer was not enabled.
4712   DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) );    // 2960 is GL_STENCIL_TEST
4713
4714   // Check stencil functions are not called.
4715   DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) );
4716   DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) );
4717   DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) );
4718
4719   // Check that scissor clipping is overriden by the renderer properties.
4720   TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4721
4722   actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4723
4724   // Gather the call trace.
4725   GenerateTrace( application, enabledDisableTrace, scissorTrace );
4726
4727   // Check the stencil buffer was not enabled.
4728   DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) );    // 3089 = 0xC11 (GL_SCISSOR_TEST)
4729
4730   DALI_TEST_CHECK( !scissorTrace.FindMethod( "StencilFunc" ) );
4731
4732   END_TEST;
4733 }
4734
4735 int UtcDaliGetPropertyN(void)
4736 {
4737   tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" );
4738   TestApplication app;
4739
4740   Actor actor = Actor::New();
4741
4742   unsigned int propertyCount = actor.GetPropertyCount();
4743   DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );
4744   END_TEST;
4745 }
4746
4747 int UtcDaliActorRaiseLower(void)
4748 {
4749   tet_infoline( "UtcDaliActor Raise and Lower test\n" );
4750
4751   TestApplication application;
4752
4753   Debug::Filter::SetGlobalLogLevel( Debug::Verbose );
4754
4755   Stage stage( Stage::GetCurrent() );
4756
4757   Actor actorA = Actor::New();
4758   Actor actorB = Actor::New();
4759   Actor actorC = Actor::New();
4760
4761   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4762   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4763
4764   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4765   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4766
4767   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4768   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4769
4770   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4771   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4772
4773   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4774   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4775
4776   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4777   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4778
4779   stage.Add( actorA );
4780   stage.Add( actorB );
4781   stage.Add( actorC );
4782
4783   ResetTouchCallbacks();
4784
4785   application.SendNotification();
4786   application.Render();
4787
4788   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4789   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4790   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
4791
4792   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4793   // Only top actor will get touched.
4794   actorA.TouchSignal().Connect( TestTouchCallback );
4795   actorB.TouchSignal().Connect( TestTouchCallback2 );
4796   actorC.TouchSignal().Connect( TestTouchCallback3 );
4797
4798   // Connect ChildOrderChangedSignal
4799   bool orderChangedSignal( false );
4800   Actor orderChangedActor;
4801   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
4802   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
4803
4804   Dali::Integration::Point point;
4805   point.SetDeviceId( 1 );
4806   point.SetState( PointState::DOWN );
4807   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
4808   Dali::Integration::TouchEvent touchEvent;
4809   touchEvent.AddPoint( point );
4810
4811   application.ProcessEvent( touchEvent );
4812
4813   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
4814   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
4815   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
4816
4817   ResetTouchCallbacks();
4818
4819   tet_printf( "Testing Raising of Actor\n" );
4820
4821   int preActorOrder( 0 );
4822   int postActorOrder( 0 );
4823
4824   Property::Value value  = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4825   value.Get( preActorOrder );
4826
4827   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4828   actorB.Raise();
4829   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4830   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
4831
4832   // Ensure sort order is calculated before next touch event
4833   application.SendNotification();
4834
4835   value  = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4836   value.Get( postActorOrder );
4837
4838   tet_printf( "Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
4839
4840   application.ProcessEvent( touchEvent );
4841
4842   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
4843   DALI_TEST_EQUALS( gTouchCallBackCalled2,  true , TEST_LOCATION );
4844   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false, TEST_LOCATION );
4845
4846   ResetTouchCallbacks();
4847
4848   tet_printf( "Testing Lowering of Actor\n" );
4849
4850   value  = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4851   value.Get( preActorOrder );
4852
4853   orderChangedSignal = false;
4854
4855   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4856   actorB.Lower();
4857   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4858   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
4859
4860   application.SendNotification(); // ensure sort order calculated before next touch event
4861
4862   value  = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4863   value.Get( postActorOrder );
4864
4865   tet_printf( "Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
4866
4867   application.ProcessEvent( touchEvent );
4868
4869   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
4870   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false , TEST_LOCATION );
4871   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true, TEST_LOCATION );
4872
4873   ResetTouchCallbacks();
4874
4875   Debug::Filter::SetGlobalLogLevel( Debug::NoLogging );
4876
4877   END_TEST;
4878 }
4879
4880 int UtcDaliActorRaiseToTopLowerToBottom(void)
4881 {
4882   tet_infoline( "UtcDaliActorRaiseToTop and LowerToBottom test \n" );
4883
4884   TestApplication application;
4885
4886   Stage stage( Stage::GetCurrent() );
4887
4888   Actor actorA = Actor::New();
4889   Actor actorB = Actor::New();
4890   Actor actorC = Actor::New();
4891
4892   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
4893   // enables checking of which actor the uniform is assigned too
4894   Shader shaderA = CreateShader();
4895   shaderA.RegisterProperty( "uRendererColor",1.f);
4896
4897   Shader shaderB = CreateShader();
4898   shaderB.RegisterProperty( "uRendererColor", 2.f );
4899
4900   Shader shaderC = CreateShader();
4901   shaderC.RegisterProperty( "uRendererColor", 3.f );
4902
4903   Geometry geometry = CreateQuadGeometry();
4904
4905   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
4906   Renderer rendererA = Renderer::New(geometry, shaderA);
4907   actorA.AddRenderer(rendererA);
4908
4909   Renderer rendererB = Renderer::New(geometry, shaderB);
4910   actorB.AddRenderer(rendererB);
4911
4912   Renderer rendererC = Renderer::New(geometry, shaderC);
4913   actorC.AddRenderer(rendererC);
4914
4915   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4916   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4917
4918   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4919   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4920
4921   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4922   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4923
4924   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4925   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4926
4927   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4928   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4929
4930   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4931   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4932
4933   stage.Add( actorA );
4934   stage.Add( actorB );
4935   stage.Add( actorC );
4936
4937   ResetTouchCallbacks();
4938
4939   // Connect ChildOrderChangedSignal
4940   bool orderChangedSignal( false );
4941   Actor orderChangedActor;
4942   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
4943   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
4944
4945   // Set up gl abstraction trace so can query the set uniform order
4946   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4947   glAbstraction.EnableSetUniformCallTrace(true);
4948   glAbstraction.ResetSetUniformCallStack();
4949
4950   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
4951
4952   application.SendNotification();
4953   application.Render();
4954
4955   tet_printf( "Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str() );
4956
4957
4958   // Test order of uniforms in stack
4959   int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
4960   int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
4961   int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
4962
4963   bool CBA = ( indexC > indexB) &&  ( indexB > indexA );
4964
4965   DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
4966
4967   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4968   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4969   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
4970
4971   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4972   // Only top actor will get touched.
4973   actorA.TouchSignal().Connect( TestTouchCallback );
4974   actorB.TouchSignal().Connect( TestTouchCallback2 );
4975   actorC.TouchSignal().Connect( TestTouchCallback3 );
4976
4977   Dali::Integration::Point point;
4978   point.SetDeviceId( 1 );
4979   point.SetState( PointState::DOWN );
4980   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
4981   Dali::Integration::TouchEvent touchEvent;
4982   touchEvent.AddPoint( point );
4983
4984   application.ProcessEvent( touchEvent );
4985
4986   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
4987   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
4988   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
4989
4990   ResetTouchCallbacks();
4991
4992   tet_printf( "RaiseToTop ActorA\n" );
4993
4994   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4995   actorA.RaiseToTop();
4996   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4997   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
4998
4999   application.SendNotification(); // ensure sorting order is calculated before next touch event
5000
5001   application.ProcessEvent( touchEvent );
5002
5003   glAbstraction.ResetSetUniformCallStack();
5004   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5005
5006   application.SendNotification();
5007   application.Render();
5008
5009   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5010
5011   // Test order of uniforms in stack
5012   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5013   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5014   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5015
5016   tet_infoline( "Testing A above C and B at bottom\n" );
5017   bool ACB = ( indexA > indexC) && ( indexC > indexB );
5018
5019   DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
5020
5021   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5022   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5023   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5024
5025   ResetTouchCallbacks();
5026
5027   tet_printf( "RaiseToTop ActorB\n" );
5028
5029   orderChangedSignal = false;
5030
5031   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5032   actorB.RaiseToTop();
5033   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5034   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5035
5036   application.SendNotification(); // Ensure sort order is calculated before next touch event
5037
5038   application.ProcessEvent( touchEvent );
5039
5040   glAbstraction.ResetSetUniformCallStack();
5041   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5042
5043   application.SendNotification();
5044   application.Render();
5045
5046   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5047
5048   // Test order of uniforms in stack
5049   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5050   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5051   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5052
5053   tet_infoline( "Testing B above A and C at bottom\n" );
5054   bool BAC = ( indexB > indexA ) && ( indexA > indexC );
5055
5056   DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
5057
5058   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5059   DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
5060   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5061
5062   ResetTouchCallbacks();
5063
5064   tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" );
5065
5066   orderChangedSignal = false;
5067
5068   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5069   actorA.LowerToBottom();
5070   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5071   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5072
5073   application.SendNotification();
5074   application.Render();
5075
5076   orderChangedSignal = false;
5077
5078   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5079   actorB.LowerToBottom();
5080   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5081   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5082
5083   application.SendNotification();
5084   application.Render();
5085
5086   application.ProcessEvent( touchEvent );
5087
5088   glAbstraction.ResetSetUniformCallStack();
5089   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5090
5091   application.SendNotification();
5092   application.Render();
5093
5094   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5095
5096   // Test order of uniforms in stack
5097   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5098   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5099   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5100
5101   tet_infoline( "Testing C above A and B at bottom\n" );
5102   bool CAB = ( indexC > indexA ) && ( indexA > indexB );
5103
5104   DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
5105
5106   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5107   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5108   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
5109
5110   ResetTouchCallbacks();
5111
5112   END_TEST;
5113 }
5114
5115 int UtcDaliActorRaiseAbove(void)
5116 {
5117   tet_infoline( "UtcDaliActor RaiseToAbove test \n" );
5118
5119   TestApplication application;
5120
5121   Stage stage( Stage::GetCurrent() );
5122
5123   Actor actorA = Actor::New();
5124   Actor actorB = Actor::New();
5125   Actor actorC = Actor::New();
5126
5127   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5128   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5129
5130   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5131   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5132
5133   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5134   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5135
5136   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5137   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5138
5139   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5140   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5141
5142   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5143   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5144
5145   stage.Add( actorA );
5146   stage.Add( actorB );
5147   stage.Add( actorC );
5148
5149   ResetTouchCallbacks();
5150
5151   application.SendNotification();
5152   application.Render();
5153
5154   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5155   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5156   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5157
5158   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5159   // Only top actor will get touched.
5160   actorA.TouchSignal().Connect( TestTouchCallback );
5161   actorB.TouchSignal().Connect( TestTouchCallback2 );
5162   actorC.TouchSignal().Connect( TestTouchCallback3 );
5163
5164   bool orderChangedSignal( false );
5165   Actor orderChangedActor;
5166   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5167   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5168
5169   Dali::Integration::Point point;
5170   point.SetDeviceId( 1 );
5171   point.SetState( PointState::DOWN );
5172   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5173   Dali::Integration::TouchEvent touchEvent;
5174   touchEvent.AddPoint( point );
5175
5176   application.ProcessEvent( touchEvent );
5177
5178   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5179   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5180   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
5181
5182   ResetTouchCallbacks();
5183
5184   tet_printf( "Raise actor B Above Actor C\n" );
5185
5186   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5187   actorB.RaiseAbove( actorC );
5188   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5189   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5190
5191   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5192   application.SendNotification();
5193   application.ProcessEvent( touchEvent );
5194
5195   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5196   DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
5197   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5198
5199   ResetTouchCallbacks();
5200
5201   tet_printf( "Raise actor A Above Actor B\n" );
5202
5203   orderChangedSignal = false;
5204
5205   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5206   actorA.RaiseAbove( actorB );
5207   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5208   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5209
5210   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5211   application.SendNotification();
5212
5213   application.ProcessEvent( touchEvent ); // process a touch event on ordered actors.
5214
5215   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5216   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5217   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5218
5219   ResetTouchCallbacks();
5220
5221   END_TEST;
5222 }
5223
5224 int UtcDaliActorLowerBelow(void)
5225 {
5226   tet_infoline( "UtcDaliActor LowerBelow test \n" );
5227
5228   TestApplication application;
5229
5230   Stage stage( Stage::GetCurrent() );
5231
5232   // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5233   // enables checking of which actor the uniform is assigned too
5234   Shader shaderA = CreateShader();
5235   shaderA.RegisterProperty( "uRendererColor",1.f);
5236
5237   Shader shaderB = CreateShader();
5238   shaderB.RegisterProperty( "uRendererColor", 2.f );
5239
5240   Shader shaderC = CreateShader();
5241   shaderC.RegisterProperty( "uRendererColor", 3.f );
5242
5243   Actor actorA = Actor::New();
5244   Actor actorB = Actor::New();
5245   Actor actorC = Actor::New();
5246
5247   // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5248   Geometry geometry = CreateQuadGeometry();
5249
5250   Renderer rendererA = Renderer::New(geometry, shaderA);
5251   actorA.AddRenderer(rendererA);
5252
5253   Renderer rendererB = Renderer::New(geometry, shaderB);
5254   actorB.AddRenderer(rendererB);
5255
5256   Renderer rendererC = Renderer::New(geometry, shaderC);
5257   actorC.AddRenderer(rendererC);
5258
5259   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5260   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5261
5262   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5263   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5264
5265   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5266   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5267
5268   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5269   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5270
5271   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5272   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5273
5274   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5275   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5276
5277   Actor container = Actor::New();
5278   container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5279   container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
5280   stage.Add( container );
5281
5282   container.Add( actorA );
5283   container.Add( actorB );
5284   container.Add( actorC );
5285
5286   ResetTouchCallbacks();
5287
5288   // Connect ChildOrderChangedSignal
5289   bool orderChangedSignal( false );
5290   Actor orderChangedActor;
5291   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5292   DevelActor::ChildOrderChangedSignal( container ).Connect( &application, f ) ;
5293
5294   // Set up gl abstraction trace so can query the set uniform order
5295   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5296   glAbstraction.EnableSetUniformCallTrace(true);
5297   glAbstraction.ResetSetUniformCallStack();
5298   TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5299
5300   glAbstraction.ResetSetUniformCallStack();
5301
5302   application.SendNotification();
5303   application.Render();
5304
5305   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5306
5307   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5308
5309   // Test order of uniforms in stack
5310   int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5311   int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5312   int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5313
5314   tet_infoline( "Testing C above B and A at bottom\n" );
5315   bool CBA = ( indexC > indexB) &&  ( indexB > indexA );
5316
5317   DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
5318
5319   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5320   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5321   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5322
5323   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5324   // Only top actor will get touched.
5325   actorA.TouchSignal().Connect( TestTouchCallback );
5326   actorB.TouchSignal().Connect( TestTouchCallback2 );
5327   actorC.TouchSignal().Connect( TestTouchCallback3 );
5328
5329   Dali::Integration::Point point;
5330   point.SetDeviceId( 1 );
5331   point.SetState( PointState::DOWN );
5332   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5333   Dali::Integration::TouchEvent touchEvent;
5334   touchEvent.AddPoint( point );
5335
5336   tet_infoline( "UtcDaliActor Test Set up completed \n" );
5337
5338   application.ProcessEvent( touchEvent );
5339
5340   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5341   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5342   DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5343
5344   ResetTouchCallbacks();
5345
5346   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" );
5347
5348   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5349   actorC.LowerBelow( actorB );
5350   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5351   DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
5352
5353   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5354   application.SendNotification();
5355   application.Render();
5356
5357   application.ProcessEvent( touchEvent ); // touch event
5358
5359   glAbstraction.ResetSetUniformCallStack();
5360   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5361
5362   application.SendNotification();
5363   application.Render();
5364
5365   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5366
5367   // Test order of uniforms in stack
5368   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5369   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5370   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5371
5372   tet_infoline( "Testing render order is A, C, B" );
5373   DALI_TEST_EQUALS( indexC > indexA, true, TEST_LOCATION );
5374   DALI_TEST_EQUALS( indexB > indexC, true, TEST_LOCATION );
5375
5376   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5377   DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5378   DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5379
5380   ResetTouchCallbacks();
5381
5382   tet_printf( "Lower actor C below Actor A leaving B on top\n" );
5383
5384   orderChangedSignal = false;
5385
5386   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5387   actorC.LowerBelow( actorA );
5388   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5389   DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
5390
5391   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5392   application.SendNotification();
5393   application.Render();
5394
5395   application.ProcessEvent( touchEvent );
5396
5397   glAbstraction.ResetSetUniformCallStack();
5398   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5399
5400   application.Render();
5401   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5402
5403   // Test order of uniforms in stack
5404   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5405   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5406   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5407
5408   DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
5409   DALI_TEST_EQUALS( indexB > indexA, true, TEST_LOCATION );
5410
5411   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5412   DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5413   DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5414
5415   ResetTouchCallbacks();
5416
5417   tet_printf( "Lower actor B below Actor C leaving A on top\n" );
5418
5419   orderChangedSignal = false;
5420
5421   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5422   actorB.LowerBelow( actorC );
5423   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5424   DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5425
5426   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5427   application.SendNotification();
5428   application.Render();
5429
5430   application.ProcessEvent( touchEvent );
5431
5432   glAbstraction.ResetSetUniformCallStack();
5433   glSetUniformStack = glAbstraction.GetSetUniformTrace();
5434
5435   application.Render();
5436   tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5437
5438   // Test order of uniforms in stack
5439   indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "3" );
5440   indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "2" );
5441   indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor",  "1" );
5442
5443   DALI_TEST_EQUALS( indexC > indexB, true, TEST_LOCATION );
5444   DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
5445
5446   END_TEST;
5447 }
5448
5449
5450 int UtcDaliActorRaiseAboveDifferentParentsN(void)
5451 {
5452   tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" );
5453
5454   TestApplication application;
5455
5456   Stage stage( Stage::GetCurrent() );
5457
5458   Actor parentA = Actor::New();
5459   Actor parentB = Actor::New();
5460   parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5461   parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5462   parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5463   parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5464
5465   parentA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5466   parentA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5467
5468   parentB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5469   parentB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5470
5471   stage.Add( parentA );
5472   stage.Add( parentB );
5473
5474   Actor actorA = Actor::New();
5475   Actor actorB = Actor::New();
5476   Actor actorC = Actor::New();
5477
5478   parentA.Add( actorA );
5479   parentA.Add( actorB );
5480
5481   tet_printf( "Actor C added to different parent from A and B \n" );
5482   parentB.Add( actorC );
5483
5484   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5485   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5486
5487   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5488   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5489
5490   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5491   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5492
5493   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5494   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5495
5496   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5497   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5498
5499   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5500   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5501
5502   ResetTouchCallbacks();
5503
5504   // Connect ChildOrderChangedSignal
5505   bool orderChangedSignal( false );
5506   Actor orderChangedActor;
5507   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5508   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5509
5510   application.SendNotification();
5511   application.Render();
5512
5513   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5514   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5515   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5516
5517   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5518   // Only top actor will get touched.
5519   actorA.TouchSignal().Connect( TestTouchCallback );
5520   actorB.TouchSignal().Connect( TestTouchCallback2 );
5521   actorC.TouchSignal().Connect( TestTouchCallback3 );
5522
5523   Dali::Integration::Point point;
5524   point.SetDeviceId( 1 );
5525   point.SetState( PointState::DOWN );
5526   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5527   Dali::Integration::TouchEvent touchEvent;
5528   touchEvent.AddPoint( point );
5529
5530   application.ProcessEvent( touchEvent );
5531
5532   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5533   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5534   DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5535
5536   ResetTouchCallbacks();
5537
5538   tet_printf( "Raise actor A Above Actor C which have different parents\n" );
5539
5540   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5541   actorA.RaiseAbove( actorC );
5542   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5543
5544   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5545   application.SendNotification();
5546
5547   application.ProcessEvent( touchEvent ); // touch event
5548
5549   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5550   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5551   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
5552
5553   ResetTouchCallbacks();
5554
5555   END_TEST;
5556 }
5557
5558 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
5559 {
5560   tet_infoline( "UtcDaliActor Test  raiseAbove and lowerBelow api when target Actor has no parent \n" );
5561
5562   TestApplication application;
5563
5564   Stage stage( Stage::GetCurrent() );
5565
5566   Actor actorA = Actor::New();
5567   Actor actorB = Actor::New();
5568   Actor actorC = Actor::New();
5569
5570   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5571   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5572
5573   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5574   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5575
5576   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5577   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5578
5579   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5580   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5581
5582   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5583   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5584
5585   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5586   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5587
5588   ResetTouchCallbacks();
5589
5590   // Connect ChildOrderChangedSignal
5591   bool orderChangedSignal( false );
5592   Actor orderChangedActor;
5593   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5594   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5595
5596   application.SendNotification();
5597   application.Render();
5598
5599   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5600   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5601   DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5602
5603   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5604   // Only top actor will get touched.
5605   actorA.TouchSignal().Connect( TestTouchCallback );
5606   actorB.TouchSignal().Connect( TestTouchCallback2 );
5607   actorC.TouchSignal().Connect( TestTouchCallback3 );
5608
5609   Dali::Integration::Point point;
5610   point.SetDeviceId( 1 );
5611   point.SetState( PointState::DOWN );
5612   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5613   Dali::Integration::TouchEvent touchEvent;
5614   touchEvent.AddPoint( point );
5615
5616   tet_printf( "Raise actor A Above Actor C which have no parents\n" );
5617
5618   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5619   actorA.RaiseAbove( actorC );
5620   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5621
5622   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5623   application.SendNotification();
5624
5625   application.ProcessEvent( touchEvent );
5626
5627   tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5628
5629   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5630   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5631   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5632
5633   ResetTouchCallbacks();
5634
5635   orderChangedSignal = false;
5636
5637   stage.Add ( actorB );
5638   tet_printf( "Lower actor A below Actor C when only A is not on stage \n" );
5639
5640   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5641   actorA.LowerBelow( actorC );
5642   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5643
5644   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5645   application.SendNotification();
5646   application.Render();
5647
5648   application.ProcessEvent( touchEvent );
5649
5650   tet_printf( "Actor A not parented so LowerBelow should show no effect\n" );
5651   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5652   DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
5653   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5654
5655   ResetTouchCallbacks();
5656
5657   orderChangedSignal = false;
5658
5659   tet_printf( "Adding Actor A to stage, will be on top\n" );
5660
5661   stage.Add ( actorA );
5662   application.SendNotification();
5663   application.Render();
5664
5665   tet_printf( "Raise actor B Above Actor C when only B has a parent\n" );
5666
5667   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5668   actorB.RaiseAbove( actorC );
5669   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5670
5671   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5672   application.SendNotification();
5673
5674   application.ProcessEvent( touchEvent );
5675
5676   tet_printf( "C not parented so RaiseAbove should show no effect\n" );
5677   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5678   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5679   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5680
5681   ResetTouchCallbacks();
5682
5683   orderChangedSignal = false;
5684
5685   tet_printf( "Lower actor A below Actor C when only A has a parent\n" );
5686
5687   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5688   actorA.LowerBelow( actorC );
5689   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5690
5691   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5692   application.SendNotification();
5693
5694   application.ProcessEvent( touchEvent );
5695
5696   tet_printf( "C not parented so LowerBelow should show no effect\n" );
5697   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5698   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5699   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5700
5701   ResetTouchCallbacks();
5702
5703   orderChangedSignal = false;
5704
5705   stage.Add ( actorC );
5706
5707   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5708   actorA.RaiseAbove( actorC );
5709   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5710   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5711
5712   // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5713   application.SendNotification();
5714   application.Render();
5715
5716   application.ProcessEvent( touchEvent );
5717
5718   tet_printf( "Raise actor A Above Actor C, now both have same parent \n" );
5719   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5720   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5721   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5722
5723   END_TEST;
5724 }
5725
5726 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
5727 {
5728   tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" );
5729
5730   TestApplication application;
5731
5732   Stage stage( Stage::GetCurrent() );
5733
5734   Actor actorA = Actor::New();
5735   Actor actorB = Actor::New();
5736   Actor actorC = Actor::New();
5737
5738   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5739   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5740
5741   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5742   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5743
5744   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5745   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5746
5747   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5748   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5749
5750   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5751   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5752
5753   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5754   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5755
5756   ResetTouchCallbacks();
5757
5758   // Connect ChildOrderChangedSignal
5759   bool orderChangedSignal( false );
5760   Actor orderChangedActor;
5761   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5762   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5763
5764   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5765   // Only top actor will get touched.
5766   actorA.TouchSignal().Connect( TestTouchCallback );
5767   actorB.TouchSignal().Connect( TestTouchCallback2 );
5768   actorC.TouchSignal().Connect( TestTouchCallback3 );
5769
5770   Dali::Integration::Point point;
5771   point.SetDeviceId( 1 );
5772   point.SetState( PointState::DOWN );
5773   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5774   Dali::Integration::TouchEvent touchEvent;
5775   touchEvent.AddPoint( point );
5776
5777   stage.Add ( actorA );
5778   tet_printf( "Raise actor B Above Actor C but B not parented\n" );
5779
5780   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5781   actorB.Raise();
5782   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5783
5784   application.SendNotification();
5785   application.Render();
5786
5787   application.ProcessEvent( touchEvent );
5788
5789   tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5790
5791   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5792   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5793   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5794
5795   tet_printf( "Raise actor B Above Actor C but B not parented\n" );
5796   ResetTouchCallbacks();
5797
5798   orderChangedSignal = false;
5799
5800   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5801   actorC.Lower();
5802   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5803
5804   // Sort actor tree before next touch event
5805   application.SendNotification();
5806   application.Render();
5807
5808   application.ProcessEvent( touchEvent );
5809
5810   tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5811
5812   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5813   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5814   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5815   ResetTouchCallbacks();
5816
5817   orderChangedSignal = false;
5818
5819   tet_printf( "Lower actor C below B but C not parented\n" );
5820
5821   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5822   actorB.Lower();
5823   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5824
5825   // Sort actor tree before next touch event
5826   application.SendNotification();
5827   application.Render();
5828
5829   application.ProcessEvent( touchEvent );
5830
5831   tet_printf( "Not parented so Lower should show no effect\n" );
5832
5833   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5834   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5835   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5836   ResetTouchCallbacks();
5837
5838   orderChangedSignal = false;
5839
5840   tet_printf( "Raise actor B to top\n" );
5841
5842   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5843   actorB.RaiseToTop();
5844   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5845
5846   // Sort actor tree before next touch event
5847   application.SendNotification();
5848   application.Render();
5849
5850   application.ProcessEvent( touchEvent );
5851
5852   tet_printf( "Not parented so RaiseToTop should show no effect\n" );
5853
5854   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5855   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5856   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5857   ResetTouchCallbacks();
5858
5859   orderChangedSignal = false;
5860
5861   tet_printf( "Add ActorB to stage so only Actor C not parented\n" );
5862
5863   stage.Add ( actorB );
5864
5865   tet_printf( "Lower actor C to Bottom, B stays at top\n" );
5866
5867   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5868   actorC.LowerToBottom();
5869   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5870
5871   application.SendNotification();
5872   application.Render();
5873
5874   application.ProcessEvent( touchEvent );
5875
5876   tet_printf( "Not parented so LowerToBottom should show no effect\n" );
5877
5878   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5879   DALI_TEST_EQUALS( gTouchCallBackCalled2,  true, TEST_LOCATION );
5880   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5881   ResetTouchCallbacks();
5882
5883   END_TEST;
5884 }
5885
5886
5887 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
5888 {
5889   tet_infoline( "UtcDaliActor RaiseToAbove and  test with actor provided as target resulting in a no operation \n" );
5890
5891   TestApplication application;
5892
5893   Stage stage( Stage::GetCurrent() );
5894
5895   Actor actorA = Actor::New();
5896   Actor actorB = Actor::New();
5897   Actor actorC = Actor::New();
5898
5899   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5900   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5901
5902   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5903   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5904
5905   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5906   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5907
5908   actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5909   actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5910
5911   actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5912   actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5913
5914   actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5915   actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5916
5917   stage.Add( actorA );
5918   stage.Add( actorB );
5919   stage.Add( actorC );
5920
5921   // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5922   // Only top actor will get touched.
5923   actorA.TouchSignal().Connect( TestTouchCallback );
5924   actorB.TouchSignal().Connect( TestTouchCallback2 );
5925   actorC.TouchSignal().Connect( TestTouchCallback3 );
5926
5927   ResetTouchCallbacks();
5928
5929   // Connect ChildOrderChangedSignal
5930   bool orderChangedSignal( false );
5931   Actor orderChangedActor;
5932   ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5933   DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5934
5935   application.SendNotification();
5936   application.Render();
5937
5938   Dali::Integration::Point point;
5939   point.SetDeviceId( 1 );
5940   point.SetState( PointState::DOWN );
5941   point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5942   Dali::Integration::TouchEvent touchEvent;
5943   touchEvent.AddPoint( point );
5944
5945   application.ProcessEvent( touchEvent );
5946
5947   DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5948   DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5949   DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
5950
5951   ResetTouchCallbacks();
5952
5953   tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" );
5954
5955   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5956   actorA.RaiseAbove( actorA );
5957   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5958   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5959
5960   application.SendNotification();
5961   application.Render();
5962
5963   application.ProcessEvent( touchEvent );
5964
5965   tet_infoline( "No target is source Actor so RaiseAbove should show no effect\n" );
5966
5967   DALI_TEST_EQUALS( gTouchCallBackCalled,  false, TEST_LOCATION );
5968   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5969   DALI_TEST_EQUALS( gTouchCallBackCalled3,  true , TEST_LOCATION );
5970
5971   ResetTouchCallbacks();
5972
5973   orderChangedSignal = false;
5974
5975   DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5976   actorA.RaiseAbove( actorC );
5977   DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5978   DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5979
5980   application.SendNotification();
5981   application.Render();
5982
5983   application.ProcessEvent( touchEvent );
5984
5985   tet_infoline( "Raise actor A Above Actor C which will now be successful \n" );
5986   DALI_TEST_EQUALS( gTouchCallBackCalled,  true, TEST_LOCATION );
5987   DALI_TEST_EQUALS( gTouchCallBackCalled2,  false, TEST_LOCATION );
5988   DALI_TEST_EQUALS( gTouchCallBackCalled3,  false , TEST_LOCATION );
5989
5990   END_TEST;
5991 }
5992
5993 int UtcDaliActorGetScreenPosition(void)
5994 {
5995   tet_infoline( "UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n" );
5996
5997   TestApplication application;
5998
5999   Stage stage( Stage::GetCurrent() );
6000
6001   Actor actorA = Actor::New();
6002   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6003
6004   Vector2 size2( 10.0f, 20.0f );
6005   actorA.SetSize( size2 );
6006
6007   actorA.SetPosition( 0.f, 0.f );
6008
6009   tet_infoline( "UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n" );
6010
6011   stage.Add( actorA );
6012
6013   application.SendNotification();
6014   application.Render();
6015
6016   Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6017   Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6018
6019   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::CENTER \n",  actorWorldPosition.x, actorWorldPosition.y  );
6020   tet_printf( "Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y );
6021
6022   DALI_TEST_EQUALS( actorScreenPosition.x,  0lu , TEST_LOCATION );
6023   DALI_TEST_EQUALS( actorScreenPosition.y,  0lu , TEST_LOCATION );
6024
6025   tet_infoline( "UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n" );
6026
6027   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6028
6029   application.SendNotification();
6030   application.Render();
6031
6032   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6033   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6034
6035   tet_printf( "Actor World Position  ( %f %f ) AnchorPoint::TOP_LEFT  \n",  actorWorldPosition.x, actorWorldPosition.y );
6036   tet_printf( "Actor Screen Position  ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y );
6037
6038   DALI_TEST_EQUALS( actorScreenPosition.x,  0lu , TEST_LOCATION );
6039   DALI_TEST_EQUALS( actorScreenPosition.y,  0lu , TEST_LOCATION );
6040
6041   tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n" );
6042
6043   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6044
6045   application.SendNotification();
6046   application.Render();
6047
6048   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6049   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6050
6051   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT   \n",  actorWorldPosition.x, actorWorldPosition.y );
6052   tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT  \n", actorScreenPosition.x, actorScreenPosition.y );
6053
6054   DALI_TEST_EQUALS( actorScreenPosition.x,  0lu , TEST_LOCATION );
6055   DALI_TEST_EQUALS( actorScreenPosition.y,  0lu , TEST_LOCATION );
6056
6057   tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n" );
6058
6059   actorA.SetPosition( 30.0, 0.0 );
6060
6061   application.SendNotification();
6062   application.Render();
6063
6064   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6065   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6066
6067   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n",  actorWorldPosition.x, actorWorldPosition.y );
6068   tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0   \n", actorScreenPosition.x, actorScreenPosition.y );
6069
6070   DALI_TEST_EQUALS( actorScreenPosition.x,  30lu , TEST_LOCATION );
6071   DALI_TEST_EQUALS( actorScreenPosition.y,  0lu , TEST_LOCATION );
6072
6073   tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n" );
6074
6075   actorA.SetPosition( 30.0, 420.0 );
6076
6077   application.SendNotification();
6078   application.Render();
6079
6080   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6081   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6082
6083   DALI_TEST_EQUALS( actorScreenPosition.x,  30lu , TEST_LOCATION );
6084   DALI_TEST_EQUALS( actorScreenPosition.y,  420lu , TEST_LOCATION );
6085
6086   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n",  actorWorldPosition.x, actorWorldPosition.y );
6087   tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y );
6088
6089   tet_infoline( "UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n" );
6090
6091   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6092   actorA.SetPosition( 30.0, 30.0 );
6093
6094   Actor actorB = Actor::New();
6095   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6096   actorB.SetSize( size2 );
6097   actorB.SetPosition( 10.f, 10.f );
6098   actorA.Add( actorB );
6099
6100   actorA.SetScale( 2.0f );
6101
6102   application.SendNotification();
6103   application.Render();
6104
6105   actorScreenPosition = actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6106
6107   DALI_TEST_EQUALS( actorScreenPosition.x,  50lu , TEST_LOCATION );
6108   DALI_TEST_EQUALS( actorScreenPosition.y,  50lu , TEST_LOCATION );
6109
6110   END_TEST;
6111 }
6112
6113 int UtcDaliActorGetScreenPositionAfterScaling(void)
6114 {
6115   tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n" );
6116
6117   TestApplication application;
6118
6119   Stage stage( Stage::GetCurrent() );
6120
6121   Actor actorA = Actor::New();
6122   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6123
6124   Vector2 size2( 10.0f, 20.0f );
6125   actorA.SetSize( size2 );
6126   actorA.SetScale( 1.5f );
6127   actorA.SetPosition( 0.f, 0.f );
6128
6129   tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n" );
6130
6131   stage.Add( actorA );
6132
6133   application.SendNotification();
6134   application.Render();
6135
6136   Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6137   Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6138
6139   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n",  actorWorldPosition.x, actorWorldPosition.y  );
6140   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6141
6142   DALI_TEST_EQUALS( actorScreenPosition.x,  0lu , TEST_LOCATION );
6143   DALI_TEST_EQUALS( actorScreenPosition.y,  0lu , TEST_LOCATION );
6144
6145   tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n" );
6146
6147   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6148
6149   application.SendNotification();
6150   application.Render();
6151
6152   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6153   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6154
6155   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n",  actorWorldPosition.x, actorWorldPosition.y  );
6156   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6157
6158   DALI_TEST_EQUALS( actorScreenPosition.x , 0.0f  , TEST_LOCATION );
6159   DALI_TEST_EQUALS( actorScreenPosition.y,  0.0f , TEST_LOCATION );
6160
6161   END_TEST;
6162 }
6163
6164 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6165 {
6166   tet_infoline( "UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n" );
6167
6168   TestApplication application;
6169
6170   Stage stage( Stage::GetCurrent() );
6171
6172   Actor actorA = Actor::New();
6173   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6174   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6175   Vector2 size2( 10.0f, 20.0f );
6176   actorA.SetSize( size2 );
6177   actorA.SetPosition( 0.f, 0.f );
6178
6179   tet_infoline( " TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6180
6181   stage.Add( actorA );
6182
6183   application.SendNotification();
6184   application.Render();
6185
6186   Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6187   Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6188
6189   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n",  actorWorldPosition.x, actorWorldPosition.y  );
6190   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6191
6192   DALI_TEST_EQUALS( actorScreenPosition.x,  240.0f , TEST_LOCATION );
6193   DALI_TEST_EQUALS( actorScreenPosition.y,  400.0f , TEST_LOCATION );
6194
6195   tet_infoline( " BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n" );
6196
6197   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
6198   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6199
6200   application.SendNotification();
6201   application.Render();
6202
6203   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6204   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6205
6206   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n",  actorWorldPosition.x, actorWorldPosition.y  );
6207   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6208
6209   DALI_TEST_EQUALS( actorScreenPosition.x , 480.0f , TEST_LOCATION );
6210   DALI_TEST_EQUALS( actorScreenPosition.y,  0.0f , TEST_LOCATION );
6211
6212   END_TEST;
6213   END_TEST;
6214 }
6215
6216 int UtcDaliActorGetScreenPositionWithChildActors(void)
6217 {
6218   tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n" );
6219
6220   TestApplication application;
6221
6222   Stage stage( Stage::GetCurrent() );
6223
6224   tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6225
6226   Actor actorA = Actor::New();
6227   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6228   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6229   Vector2 size1( 10.0f, 20.0f );
6230   actorA.SetSize( size1 );
6231   actorA.SetPosition( 0.f, 0.f );
6232
6233   tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6234
6235   Actor parentActorA = Actor::New();
6236   parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6237   parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6238   Vector2 size2( 30.0f, 60.0f );
6239   parentActorA.SetSize( size2 );
6240   parentActorA.SetPosition( 0.f, 0.f );
6241
6242   tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
6243
6244   stage.Add( parentActorA );
6245   parentActorA.Add ( actorA );
6246
6247   application.SendNotification();
6248   application.Render();
6249
6250   Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6251   Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6252
6253   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n",  actorWorldPosition.x, actorWorldPosition.y  );
6254   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6255
6256   DALI_TEST_EQUALS( actorScreenPosition.x,  255.0f , TEST_LOCATION );
6257   DALI_TEST_EQUALS( actorScreenPosition.y,  430.0f , TEST_LOCATION );
6258
6259   tet_infoline( "Test 2\n");
6260
6261   tet_infoline( "change parent anchor point and parent origin then check screen position \n" );
6262
6263   parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
6264   parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
6265
6266   application.SendNotification();
6267   application.Render();
6268
6269   actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6270   actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6271
6272   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT  \n",  actorWorldPosition.x, actorWorldPosition.y  );
6273   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6274
6275   DALI_TEST_EQUALS( actorScreenPosition.x,  15.0f , TEST_LOCATION );
6276   DALI_TEST_EQUALS( actorScreenPosition.y,  -30.0f , TEST_LOCATION );
6277
6278   END_TEST;
6279 }
6280
6281 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6282 {
6283   tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n" );
6284
6285   TestApplication application;
6286
6287   Stage stage( Stage::GetCurrent() );
6288
6289   tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6290
6291   Actor actorA = Actor::New();
6292   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6293   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6294   Vector2 size1( 10.0f, 20.0f );
6295   actorA.SetSize( size1 );
6296   actorA.SetPosition( 0.f, 0.f );
6297
6298   tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6299
6300   Actor parentActorA = Actor::New();
6301   parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6302   parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6303   Vector2 size2( 30.0f, 60.0f );
6304   parentActorA.SetSize( size2 );
6305   parentActorA.SetPosition( 0.f, 0.f );
6306
6307   tet_infoline( "Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n" );
6308
6309   Actor grandParentActorA = Actor::New();
6310   grandParentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
6311   grandParentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
6312   Vector2 size3( 60.0f, 120.0f );
6313   grandParentActorA.SetSize( size3 );
6314   grandParentActorA.SetPosition( 0.f, 0.f );
6315
6316   tet_infoline( "Add Parent 1 to Grand Parent 1 \n" );
6317
6318   stage.Add( grandParentActorA );
6319   grandParentActorA.Add ( parentActorA );
6320
6321   tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
6322
6323   parentActorA.Add ( actorA );
6324
6325   application.SendNotification();
6326   application.Render();
6327
6328   Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6329   Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6330
6331   tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER  \n",  actorWorldPosition.x, actorWorldPosition.y  );
6332   tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6333
6334   DALI_TEST_EQUALS( actorScreenPosition.x,  45.0f , TEST_LOCATION );
6335   DALI_TEST_EQUALS( actorScreenPosition.y,  770.0f , TEST_LOCATION );
6336
6337   END_TEST;
6338 }
6339
6340 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6341 {
6342   tet_infoline( "UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point" );
6343
6344   TestApplication application;
6345
6346   Stage stage( Stage::GetCurrent() );
6347
6348   tet_infoline( "Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6349
6350   Actor actorA = Actor::New();
6351   actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6352   actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6353   actorA.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6354   actorA.SetSize( 10.0f, 20.0f );
6355   stage.Add( actorA );
6356
6357   tet_infoline( "Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6358
6359   Actor actorB = Actor::New();
6360   actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6361   actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6362   actorB.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6363   Vector2 actorBSize( 30.0f, 60.0f );
6364   actorB.SetSize( actorBSize );
6365   stage.Add( actorB );
6366
6367   tet_infoline( "Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6368
6369   Actor actorC = Actor::New();
6370   actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6371   actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6372   actorC.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6373   Vector2 actorCSize( 60.0f, 120.0f );
6374   actorC.SetSize( actorCSize );
6375   stage.Add( actorC );
6376
6377   application.SendNotification();
6378   application.Render();
6379
6380   tet_infoline( "Despite differing sizes and anchor-points, the screen position for all actors is the same");
6381
6382   Vector2 center( stage.GetSize() * 0.5f );
6383
6384   DALI_TEST_EQUALS( actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6385   DALI_TEST_EQUALS( actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6386   DALI_TEST_EQUALS( actorC.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6387
6388   tet_infoline( "Add scale to all actors" );
6389
6390   actorA.SetScale( 2.0f );
6391   actorB.SetScale( 2.0f );
6392   actorC.SetScale( 2.0f );
6393
6394   application.SendNotification();
6395   application.Render();
6396
6397   DALI_TEST_EQUALS( actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center /* TOP_LEFT Anchor */, TEST_LOCATION );
6398   DALI_TEST_EQUALS( actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION );
6399   DALI_TEST_EQUALS( actorC.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION );
6400
6401   END_TEST;
6402 }
6403
6404 int utcDaliActorPositionUsesAnchorPoint(void)
6405 {
6406   TestApplication application;
6407   tet_infoline( "Check default behaviour\n" );
6408
6409   Actor actor = Actor::New();
6410   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6411   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6412   actor.SetSize( 100.0f, 100.0f );
6413   Stage::GetCurrent().Add( actor );
6414
6415   application.SendNotification();
6416   application.Render();
6417
6418   tet_infoline( "Check that the world position is in the center\n" );
6419   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
6420
6421   tet_infoline( "Set the position uses anchor point property to false\n" );
6422   actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6423
6424   application.SendNotification();
6425   application.Render();
6426
6427   tet_infoline( "Check that the world position has changed appropriately\n" );
6428   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6429
6430   END_TEST;
6431 }
6432
6433 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
6434 {
6435   TestApplication application;
6436   tet_infoline( "Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6437
6438   Actor actor = Actor::New();
6439   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6440   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6441   actor.SetSize( 100.0f, 100.0f );
6442   actor.SetScale( 2.0f );
6443   actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6444   Stage::GetCurrent().Add( actor );
6445
6446   application.SendNotification();
6447   application.Render();
6448
6449   tet_infoline( "Check the world position is the same as it would be without a scale\n" );
6450   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6451
6452   tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6453   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6454   application.SendNotification();
6455   application.Render();
6456   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), TEST_LOCATION );
6457
6458   tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6459   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6460   application.SendNotification();
6461   application.Render();
6462   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
6463
6464   END_TEST;
6465 }
6466
6467 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
6468 {
6469   TestApplication application;
6470   tet_infoline( "Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6471
6472   Actor actor = Actor::New();
6473   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6474   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6475   actor.SetSize( 100.0f, 100.0f );
6476   actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
6477   actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6478   Stage::GetCurrent().Add( actor );
6479
6480   application.SendNotification();
6481   application.Render();
6482
6483   tet_infoline( "Check the world position is the same as it would be without a rotation\n" );
6484   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6485
6486   tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6487   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6488   application.SendNotification();
6489   application.Render();
6490   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6491
6492   tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6493   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6494   application.SendNotification();
6495   application.Render();
6496   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 150.0f, 50.0f, 0.0f ), TEST_LOCATION );
6497
6498   END_TEST;
6499 }
6500
6501 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
6502 {
6503   TestApplication application;
6504   tet_infoline( "Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6505
6506   Actor actor = Actor::New();
6507   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6508   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6509   actor.SetSize( 100.0f, 100.0f );
6510   actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
6511   actor.SetScale( 2.0f );
6512   actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6513   Stage::GetCurrent().Add( actor );
6514
6515   application.SendNotification();
6516   application.Render();
6517
6518   tet_infoline( "Check the world position is the same as it would be without a scale and rotation\n" );
6519   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6520
6521   tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6522   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6523   application.SendNotification();
6524   application.Render();
6525   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -100.0f, 100.0f, 0.0f ), TEST_LOCATION );
6526
6527   tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6528   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6529   application.SendNotification();
6530   application.Render();
6531   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), TEST_LOCATION );
6532
6533   END_TEST;
6534 }
6535
6536 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
6537 {
6538   TestApplication application;
6539   tet_infoline( "Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6540
6541   Actor parent = Actor::New();
6542
6543   Stage::GetCurrent().Add( parent );
6544   Vector2 stageSize( Stage::GetCurrent().GetSize() );
6545
6546   Actor actor = Actor::New();
6547   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6548   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6549   actor.SetSize( 100.0f, 100.0f );
6550   actor.SetProperty( Actor::Property::INHERIT_SCALE, false );
6551   actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
6552   actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6553   parent.Add( actor );
6554
6555   application.SendNotification();
6556   application.Render();
6557
6558   const Vector3 expectedWorldPosition( -stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f );
6559
6560   tet_infoline( "Check the world position is in the right place\n" );
6561   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6562
6563   tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed" );
6564   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6565   application.SendNotification();
6566   application.Render();
6567   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6568
6569   tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed" );
6570   actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6571   application.SendNotification();
6572   application.Render();
6573   DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6574
6575   END_TEST;
6576 }
6577
6578 int utcDaliActorVisibilityChangeSignalSelf(void)
6579 {
6580   TestApplication application;
6581   tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
6582
6583   Actor actor = Actor::New();
6584
6585   VisibilityChangedFunctorData data;
6586   DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
6587
6588   actor.SetProperty( Actor::Property::VISIBLE, false );
6589
6590   data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6591
6592   tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
6593   data.Reset();
6594
6595   actor.SetProperty( Actor::Property::VISIBLE, false );
6596   data.Check( false /* not called */, TEST_LOCATION );
6597
6598   tet_infoline( "Change the visibility using properties, ensure called" );
6599   data.Reset();
6600
6601   actor.SetProperty( Actor::Property::VISIBLE, true );
6602   data.Check( true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6603
6604   tet_infoline( "Set the visibility to current using properties, ensure not called" );
6605   data.Reset();
6606
6607   actor.SetProperty( Actor::Property::VISIBLE, true );
6608   data.Check( false /* not called */, TEST_LOCATION );
6609
6610   END_TEST;
6611 }
6612
6613 int utcDaliActorVisibilityChangeSignalChildren(void)
6614 {
6615   TestApplication application;
6616   tet_infoline( "Check that the visibility change signal is called for the children when the visibility changes for the parent" );
6617
6618   Actor parent = Actor::New();
6619   Actor child = Actor::New();
6620   parent.Add( child );
6621
6622   Actor grandChild = Actor::New();
6623   child.Add( grandChild );
6624
6625   VisibilityChangedFunctorData parentData;
6626   VisibilityChangedFunctorData childData;
6627   VisibilityChangedFunctorData grandChildData;
6628
6629   tet_infoline( "Only connect the child and grandchild, ensure they are called and not the parent" );
6630   DevelActor::VisibilityChangedSignal( child ).Connect( &application, VisibilityChangedFunctor( childData ) );
6631   DevelActor::VisibilityChangedSignal( grandChild ).Connect( &application, VisibilityChangedFunctor( grandChildData ) );
6632
6633   parent.SetProperty( Actor::Property::VISIBLE, false );
6634   parentData.Check( false /* not called */, TEST_LOCATION );
6635   childData.Check( true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6636   grandChildData.Check( true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6637
6638   tet_infoline( "Connect to the parent's signal as well and ensure all three are called" );
6639   parentData.Reset();
6640   childData.Reset();
6641   grandChildData.Reset();
6642
6643   DevelActor::VisibilityChangedSignal( parent ).Connect( &application, VisibilityChangedFunctor( parentData ) );
6644
6645   parent.SetProperty( Actor::Property::VISIBLE, true );
6646   parentData.Check( true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6647   childData.Check( true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6648   grandChildData.Check( true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6649
6650   tet_infoline( "Ensure none of the functors are called if we attempt to change the visibility to what it already is at" );
6651   parentData.Reset();
6652   childData.Reset();
6653   grandChildData.Reset();
6654
6655   parent.SetProperty( Actor::Property::VISIBLE, true );
6656   parentData.Check( false /* not called */, TEST_LOCATION );
6657   childData.Check( false /* not called */, TEST_LOCATION );
6658   grandChildData.Check( false /* not called */, TEST_LOCATION );
6659
6660   END_TEST;
6661 }
6662
6663 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
6664 {
6665   TestApplication application;
6666   tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" );
6667
6668   Actor actor = Actor::New();
6669   Stage::GetCurrent().Add( actor );
6670
6671   application.SendNotification();
6672   application.Render();
6673
6674   VisibilityChangedFunctorData data;
6675   DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
6676
6677   Animation animation = Animation::New( 1.0f );
6678   animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false );
6679
6680   data.Check( false, TEST_LOCATION );
6681   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6682   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6683
6684   tet_infoline( "Play the animation and check the property value" );
6685   animation.Play();
6686
6687   data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6688   DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
6689
6690   tet_infoline( "Animation not currently finished, so the current visibility should still be true" );
6691   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6692
6693   application.SendNotification();
6694   application.Render( 1100 ); // After the animation
6695
6696   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
6697
6698   END_TEST;
6699 }
6700
6701
6702 int utcDaliActorVisibilityChangeSignalByName(void)
6703 {
6704   TestApplication application;
6705   tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
6706
6707   Actor actor = Actor::New();
6708
6709   bool signalCalled=false;
6710   actor.ConnectSignal( &application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled) );
6711   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6712   actor.SetProperty( Actor::Property::VISIBLE, false );
6713   DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6714
6715   tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
6716   signalCalled = false;
6717   actor.SetProperty( Actor::Property::VISIBLE, false );
6718   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6719
6720   tet_infoline( "Change the visibility using properties, ensure called" );
6721   actor.SetProperty( Actor::Property::VISIBLE, true );
6722   DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6723
6724   tet_infoline( "Set the visibility to current using properties, ensure not called" );
6725   signalCalled = false;
6726
6727   actor.SetProperty( Actor::Property::VISIBLE, true );
6728   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6729
6730   END_TEST;
6731 }
6732
6733
6734 static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type )
6735 {
6736   gLayoutDirectionType = type;
6737 }
6738
6739 int UtcDaliActorLayoutDirectionProperty(void)
6740 {
6741   TestApplication application;
6742   tet_infoline( "Check layout direction property" );
6743
6744   Actor actor0 = Actor::New();
6745   DALI_TEST_EQUALS( actor0.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6746   Stage::GetCurrent().Add( actor0 );
6747
6748   application.SendNotification();
6749   application.Render();
6750
6751   Actor actor1 = Actor::New();
6752   DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6753   Actor actor2 = Actor::New();
6754   DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6755   Actor actor3 = Actor::New();
6756   DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6757   Actor actor4 = Actor::New();
6758   DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6759   Actor actor5 = Actor::New();
6760   DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6761   Actor actor6 = Actor::New();
6762   DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6763   Actor actor7 = Actor::New();
6764   DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6765   Actor actor8 = Actor::New();
6766   DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6767   Actor actor9 = Actor::New();
6768   DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6769
6770   actor1.Add( actor2 );
6771   gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
6772   actor2.LayoutDirectionChangedSignal().Connect( LayoutDirectionChanged );
6773
6774   DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
6775   actor1.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6776   DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
6777
6778   DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6779   DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6780   DALI_TEST_EQUALS( gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION );
6781
6782   actor1.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
6783   actor0.Add( actor1 );
6784   DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6785   DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6786
6787   Stage::GetCurrent().Add( actor3 );
6788   actor3.Add( actor4 );
6789   actor4.Add( actor5 );
6790   actor5.Add( actor6 );
6791   actor5.Add( actor7 );
6792   actor7.Add( actor8 );
6793   actor8.Add( actor9 );
6794   actor3.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6795   actor5.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6796
6797   DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
6798   actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, false );
6799   DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
6800
6801   actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6802
6803   DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6804   DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6805   DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6806   DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6807   DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6808   DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6809   DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6810
6811   actor8.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6812   DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6813   DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6814
6815   actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6816   DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6817   DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6818   DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6819
6820   actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
6821   DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6822   DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6823
6824   END_TEST;
6825 }
6826
6827
6828 struct LayoutDirectionFunctor
6829 {
6830   LayoutDirectionFunctor(bool& signalCalled)
6831   : mSignalCalled( signalCalled )
6832   {
6833   }
6834
6835   LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
6836   : mSignalCalled( rhs.mSignalCalled )
6837   {
6838   }
6839
6840   void operator()()
6841   {
6842     mSignalCalled = true;
6843   }
6844
6845   bool& mSignalCalled;
6846 };
6847
6848 int UtcDaliActorLayoutDirectionSignal(void)
6849 {
6850   TestApplication application;
6851   tet_infoline( "Check changing layout direction property sends a signal" );
6852
6853   Actor actor = Actor::New();
6854   DALI_TEST_EQUALS( actor.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6855   Stage::GetCurrent().Add( actor );
6856   bool signalCalled = false;
6857   LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
6858
6859   actor.ConnectSignal( &application, "layoutDirectionChanged", layoutDirectionFunctor );
6860   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6861
6862   // Test that writing the same value doesn't send a signal
6863   actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6864   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6865
6866   // Test that writing a different value sends the signal
6867   signalCalled = false;
6868   actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6869   DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6870
6871   signalCalled = false;
6872   actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6873   DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6874
6875   END_TEST;
6876 }
6877
6878 struct ChildAddedSignalCheck
6879 {
6880   ChildAddedSignalCheck( bool& signalReceived, Actor& childHandle )
6881   : mSignalReceived( signalReceived ),
6882     mChildHandle( childHandle )
6883   {
6884   }
6885
6886   void operator() ( Actor childHandle )
6887   {
6888     mSignalReceived = true;
6889     mChildHandle = childHandle;
6890   }
6891   void operator() ()
6892   {
6893     mSignalReceived = true;
6894     mChildHandle = Actor();
6895   }
6896
6897   bool& mSignalReceived;
6898   Actor& mChildHandle;
6899 };
6900
6901 int UtcDaliChildAddedSignalP1(void)
6902 {
6903   TestApplication application;
6904   auto stage = Stage::GetCurrent();
6905
6906   bool signalReceived=false;
6907   Actor childActor;
6908
6909   ChildAddedSignalCheck signal( signalReceived, childActor );
6910   DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
6911   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6912
6913   auto actorA = Actor::New();
6914   stage.Add( actorA );
6915   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6916   DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
6917   signalReceived = false;
6918
6919   auto actorB = Actor::New();
6920   stage.Add( actorB );
6921   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6922   DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
6923
6924   END_TEST;
6925 }
6926
6927
6928 int UtcDaliChildAddedSignalP2(void)
6929 {
6930   TestApplication application;
6931   auto stage = Stage::GetCurrent();
6932
6933   bool signalReceived=false;
6934   Actor childActor;
6935
6936   ChildAddedSignalCheck signal( signalReceived, childActor );
6937   tet_infoline( "Connect to childAdded signal by name" );
6938
6939   stage.GetRootLayer().ConnectSignal( &application, "childAdded", signal );
6940   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6941
6942   auto actorA = Actor::New();
6943   stage.Add( actorA );
6944   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6945
6946   // Can't test which actor was added; signal signature is void() when connecting via name.
6947   signalReceived = false;
6948
6949   auto actorB = Actor::New();
6950   stage.Add( actorB );
6951   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6952
6953   END_TEST;
6954 }
6955
6956 int UtcDaliChildAddedSignalN(void)
6957 {
6958   TestApplication application;
6959   auto stage = Stage::GetCurrent();
6960
6961   bool signalReceived=false;
6962   Actor childActor;
6963
6964   ChildAddedSignalCheck signal( signalReceived, childActor );
6965   DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
6966   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6967
6968   auto actorA = Actor::New();
6969   stage.Add( actorA );
6970   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6971   DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
6972   signalReceived = false;
6973
6974   auto actorB = Actor::New();
6975   actorA.Add( actorB );
6976   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6977   END_TEST;
6978 }
6979
6980
6981 struct ChildRemovedSignalCheck
6982 {
6983   ChildRemovedSignalCheck( bool& signalReceived, Actor& childHandle )
6984   : mSignalReceived( signalReceived ),
6985     mChildHandle( childHandle )
6986   {
6987   }
6988
6989   void operator() ( Actor childHandle )
6990   {
6991     mSignalReceived = true;
6992     mChildHandle = childHandle;
6993   }
6994
6995   void operator() ()
6996   {
6997     mSignalReceived = true;
6998   }
6999
7000   bool& mSignalReceived;
7001   Actor& mChildHandle;
7002 };
7003
7004 int UtcDaliChildRemovedSignalP1(void)
7005 {
7006   TestApplication application;
7007   auto stage = Stage::GetCurrent();
7008
7009   bool signalReceived=false;
7010   Actor childActor;
7011
7012   ChildRemovedSignalCheck signal( signalReceived, childActor );
7013   DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
7014   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7015
7016   auto actorA = Actor::New();
7017   stage.Add( actorA );
7018   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7019   DALI_TEST_CHECK( !childActor );
7020
7021   stage.Remove( actorA );
7022   DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
7023   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7024
7025   signalReceived = false;
7026   auto actorB = Actor::New();
7027   stage.Add( actorB );
7028   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7029
7030   stage.Remove( actorB );
7031   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7032   DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
7033
7034   END_TEST;
7035 }
7036
7037 int UtcDaliChildRemovedSignalP2(void)
7038 {
7039   TestApplication application;
7040   auto stage = Stage::GetCurrent();
7041
7042   bool signalReceived=false;
7043   Actor childActor;
7044
7045   ChildAddedSignalCheck signal( signalReceived, childActor );
7046   tet_infoline( "Connect to childRemoved signal by name" );
7047
7048   stage.GetRootLayer().ConnectSignal( &application, "childRemoved", signal );
7049   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7050
7051   auto actorA = Actor::New();
7052   stage.Add( actorA );
7053   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7054
7055   stage.Remove( actorA );
7056   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7057
7058   signalReceived = false;
7059   auto actorB = Actor::New();
7060   stage.Add( actorB );
7061   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7062
7063   stage.Remove( actorB );
7064   DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7065
7066   END_TEST;
7067 }
7068
7069
7070 int UtcDaliChildRemovedSignalN(void)
7071 {
7072   TestApplication application;
7073   auto stage = Stage::GetCurrent();
7074
7075   bool signalReceived=false;
7076   Actor childActor;
7077
7078   ChildRemovedSignalCheck signal( signalReceived, childActor );
7079   DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
7080   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7081
7082   auto actorA = Actor::New();
7083   stage.Add( actorA );
7084
7085   auto actorB = Actor::New();
7086   actorA.Add( actorB );
7087
7088   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7089   DALI_TEST_CHECK( ! childActor );
7090
7091   actorA.Remove( actorB );
7092   DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7093   END_TEST;
7094 }
7095
7096
7097 int UtcDaliChildMovedSignalP(void)
7098 {
7099   TestApplication application;
7100   auto stage = Stage::GetCurrent();
7101
7102   bool addedASignalReceived   = false;
7103   bool removedASignalReceived = false;
7104   bool addedBSignalReceived   = false;
7105   bool removedBSignalReceived = false;
7106   Actor childActor;
7107
7108   auto actorA = Actor::New();
7109   auto actorB = Actor::New();
7110   stage.Add( actorA );
7111   stage.Add( actorB );
7112
7113   ChildAddedSignalCheck addedSignalA( addedASignalReceived, childActor );
7114   ChildRemovedSignalCheck removedSignalA( removedASignalReceived, childActor );
7115   ChildAddedSignalCheck addedSignalB( addedBSignalReceived, childActor );
7116   ChildRemovedSignalCheck removedSignalB( removedBSignalReceived, childActor );
7117
7118   DevelActor::ChildAddedSignal( actorA ).Connect( &application, addedSignalA );
7119   DevelActor::ChildRemovedSignal( actorA ).Connect( &application, removedSignalA );
7120   DevelActor::ChildAddedSignal( actorB ).Connect( &application, addedSignalB );
7121   DevelActor::ChildRemovedSignal( actorB ).Connect( &application, removedSignalB );
7122
7123   DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
7124   DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7125   DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7126   DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7127
7128   // Create a child of A
7129
7130   auto child = Actor::New();
7131   actorA.Add( child );
7132
7133   DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
7134   DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7135   DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7136   DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7137   DALI_TEST_EQUALS( childActor, child, TEST_LOCATION );
7138
7139   // Move child to B:
7140   addedASignalReceived   = false;
7141   addedBSignalReceived   = false;
7142   removedASignalReceived = false;
7143   removedBSignalReceived = false;
7144
7145   actorB.Add( child ); // Expect this child to be re-parented
7146   DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
7147   DALI_TEST_EQUALS( removedASignalReceived, true, TEST_LOCATION );
7148   DALI_TEST_EQUALS( addedBSignalReceived, true, TEST_LOCATION );
7149   DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7150
7151   // Move child back to A:
7152   addedASignalReceived   = false;
7153   addedBSignalReceived   = false;
7154   removedASignalReceived = false;
7155   removedBSignalReceived = false;
7156
7157   actorA.Add( child ); // Expect this child to be re-parented
7158   DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
7159   DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7160   DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7161   DALI_TEST_EQUALS( removedBSignalReceived, true, TEST_LOCATION );
7162
7163
7164   END_TEST;
7165 }
7166
7167 int utcDaliActorCulled(void)
7168 {
7169   TestApplication application;
7170   auto stage = Stage::GetCurrent();
7171
7172   tet_infoline( "Check that the actor is culled if the actor is out of the screen" );
7173
7174   Actor actor = Actor::New();
7175   actor.SetSize( 10.0f, 10.0f );
7176
7177   Geometry geometry = CreateQuadGeometry();
7178   Shader shader = CreateShader();
7179   Renderer renderer = Renderer::New(geometry, shader);
7180   actor.AddRenderer( renderer );
7181
7182   stage.Add( actor );
7183
7184   application.SendNotification();
7185   application.Render( 0 );
7186
7187   DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), false, TEST_LOCATION );
7188
7189   PropertyNotification notification = actor.AddPropertyNotification( DevelActor::Property::CULLED, LessThanCondition( 0.5f ) );
7190   notification.SetNotifyMode( PropertyNotification::NotifyOnChanged );
7191
7192   // Connect NotifySignal
7193   bool propertyNotificationSignal( false );
7194   PropertyNotification source;
7195   CulledPropertyNotificationFunctor f( propertyNotificationSignal, source );
7196   notification.NotifySignal().Connect( &application, f ) ;
7197
7198   actor.SetPosition( 1000.0f, 1000.0f );
7199
7200   application.SendNotification();
7201   application.Render();
7202
7203   application.SendNotification();
7204
7205   DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), true, TEST_LOCATION );
7206
7207   DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION );
7208   DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( DevelActor::Property::CULLED ), TEST_LOCATION );
7209   DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION );
7210
7211   END_TEST;
7212 }
7213
7214 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7215 {
7216   TestApplication application;
7217   auto stage = Stage::GetCurrent();
7218
7219   tet_infoline( "Ensure we clear the screen when the last actor is removed" );
7220
7221   Actor actor = CreateRenderableActor();
7222   actor.SetSize( 100.0f, 100.0f );
7223   stage.Add( actor );
7224
7225   application.SendNotification();
7226   application.Render();
7227
7228   auto& glAbstraction = application.GetGlAbstraction();
7229   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7230
7231   actor.Unparent();
7232
7233   application.SendNotification();
7234   application.Render();
7235
7236   DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
7237
7238   END_TEST;
7239 }
7240
7241 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7242 {
7243   TestApplication application;
7244   auto stage = Stage::GetCurrent();
7245
7246   tet_infoline( "Ensure we clear the screen when the last actor is made invisible" );
7247
7248   Actor actor = CreateRenderableActor();
7249   actor.SetSize( 100.0f, 100.0f );
7250   stage.Add( actor );
7251
7252   application.SendNotification();
7253   application.Render();
7254
7255   auto& glAbstraction = application.GetGlAbstraction();
7256   const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7257
7258   actor.SetProperty( Actor::Property::VISIBLE, false );
7259
7260   application.SendNotification();
7261   application.Render();
7262
7263   DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
7264
7265   END_TEST;
7266 }
7267
7268 int utcDaliActorGetSizeAfterAnimation(void)
7269 {
7270   TestApplication application;
7271   tet_infoline( "Check the actor size when an animation is finished" );
7272
7273   Vector3 vector( 100.0f, 100.0f, 0.0f );
7274
7275   Actor actor = Actor::New();
7276   actor.SetSize( vector.x, vector.y );
7277   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
7278   Stage::GetCurrent().Add( actor );
7279
7280   application.SendNotification();
7281   application.Render();
7282
7283   Vector3 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7284   DALI_TEST_EQUALS( size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7285   DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7286   DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7287   DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7288
7289   Vector3 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7290   DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7291   DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7292   DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7293   DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7294
7295   Vector3 targetValue( 10.0f, 20.0f, 30.0f );
7296
7297   Animation animation = Animation::New( 1.0f );
7298   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
7299   animation.Play();
7300
7301   application.SendNotification();
7302   application.Render( 1100 ); // After the animation
7303
7304   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7305   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7306   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7307   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7308   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7309
7310   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7311   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7312   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7313   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7314   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7315
7316   targetValue.width = 50.0f;
7317
7318   animation.Clear();
7319   animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetValue.width );
7320   animation.Play();
7321
7322   application.SendNotification();
7323   application.Render( 1100 ); // After the animation
7324
7325   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7326   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7327   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7328   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7329   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7330
7331   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7332   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7333   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7334   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7335   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7336
7337   targetValue.height = 70.0f;
7338
7339   animation.Clear();
7340   animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetValue.height );
7341   animation.Play();
7342
7343   application.SendNotification();
7344   application.Render( 1100 ); // After the animation
7345
7346   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7347   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7348   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7349   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7350   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7351
7352   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7353   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7354   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7355   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7356   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7357
7358   Vector3 offset( 10.0f, 20.0f, 30.0f );
7359
7360   animation.Clear();
7361   animation.AnimateBy( Property( actor, Actor::Property::SIZE ), offset );
7362   animation.Play();
7363
7364   application.SendNotification();
7365   application.Render( 1100 ); // After the animation
7366
7367   targetValue += offset;
7368
7369   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7370   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7371   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7372   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7373   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7374
7375   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7376   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7377   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7378   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7379   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7380
7381   offset.width = 20.0f;
7382
7383   animation.Clear();
7384   animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), offset.width );
7385   animation.Play();
7386
7387   application.SendNotification();
7388   application.Render( 1100 ); // After the animation
7389
7390   targetValue.width += offset.width;
7391
7392   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7393   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7394   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7395   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7396   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7397
7398   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7399   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7400   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7401   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7402   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7403
7404   offset.height = 10.0f;
7405
7406   animation.Clear();
7407   animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), offset.height );
7408   animation.Play();
7409
7410   application.SendNotification();
7411   application.Render( 1100 ); // After the animation
7412
7413   targetValue.height += offset.height;
7414
7415   size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7416   DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7417   DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7418   DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7419   DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7420
7421   currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7422   DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7423   DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7424   DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7425   DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7426
7427   END_TEST;
7428 }