Merge "Remove unnecessary functions from Scripting, support strings in actor properti...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Actor.cpp
1 /*
2  * Copyright (c) 2015 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 #include "assert.h"
19 #include <dali/public-api/dali-core.h>
20 #include <string>
21 #include <cfloat>   // For FLT_MAX
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali/integration-api/events/hover-event-integ.h>
24 #include <dali-test-suite-utils.h>
25
26 //& set: DaliActor
27
28 using std::string;
29 using namespace Dali;
30
31
32 void utc_dali_actor_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void utc_dali_actor_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 namespace
43 {
44 bool gTouchCallBackCalled=false;
45 bool gHoverCallBackCalled=false;
46
47 /**
48  * Simulates a Down Touch at 25.0, 25.0.
49  * @param[in] app Test Application instance.
50  */
51 int SimulateTouchForSetOverlayHitTest(TestApplication& app)
52 {
53   app.SendNotification();
54   app.Render(1);
55   app.SendNotification();
56   app.Render(1);
57
58   gTouchCallBackCalled = false;
59
60   // simulate a touch event
61   Dali::TouchPoint point( 0, TouchPoint::Down, 25.0f, 25.0f );
62   Dali::Integration::TouchEvent event;
63   event.AddPoint( point );
64   app.ProcessEvent( event );
65
66   app.SendNotification();
67   app.Render(1);
68   app.SendNotification();
69   app.Render(1);
70   END_TEST;
71 }
72
73
74 static bool gTestConstraintCalled;
75
76 struct TestConstraint
77 {
78   void operator()( Vector4& color, const PropertyInputContainer& /* inputs */ )
79   {
80     gTestConstraintCalled = true;
81   }
82 };
83
84 /**
85  * TestConstraint reference.
86  * When constraint is called, the resultRef is updated
87  * with the value supplied.
88  */
89 template<typename T>
90 struct TestConstraintRef
91 {
92   TestConstraintRef(unsigned int& resultRef, unsigned int value)
93   : mResultRef(resultRef),
94     mValue(value)
95   {
96   }
97
98   void operator()( T& current, const PropertyInputContainer& /* inputs */ )
99   {
100     mResultRef = mValue;
101   }
102
103   unsigned int& mResultRef;
104   unsigned int mValue;
105 };
106
107 static bool TestCallback(Actor actor, const TouchEvent& event)
108 {
109   gTouchCallBackCalled = true;
110   return false;
111   END_TEST;
112 }
113
114 static bool TestCallback3(Actor actor, const HoverEvent& event)
115 {
116   gHoverCallBackCalled = true;
117   return false;
118   END_TEST;
119 }
120
121 static Vector3 gSetSize;
122 static bool gSetSizeCallBackCalled;
123 void SetSizeCallback( Actor actor, const Vector3& size )
124 {
125   gSetSizeCallBackCalled = true;
126   gSetSize = size;
127 }
128 // validation stuff for onstage & offstage signals
129 static std::vector< std::string > gActorNamesOnOffStage;
130 static int gOnStageCallBackCalled;
131 void OnStageCallback( Actor actor )
132 {
133   ++gOnStageCallBackCalled;
134   gActorNamesOnOffStage.push_back( actor.GetName() );
135   DALI_TEST_CHECK( actor.OnStage() == true );
136 }
137 static int gOffStageCallBackCalled;
138 void OffStageCallback( Actor actor )
139 {
140   ++gOffStageCallBackCalled;
141   gActorNamesOnOffStage.push_back( actor.GetName() );
142   DALI_TEST_CHECK( actor.OnStage() == false );
143 }
144
145 struct PositionComponentConstraint
146 {
147   PositionComponentConstraint(){}
148
149   void operator()( Vector3& pos, const PropertyInputContainer& inputs )
150   {
151     const Matrix& m = inputs[0]->GetMatrix();
152     Vector3 scale;
153     Quaternion rot;
154     m.GetTransformComponents(pos, rot, scale);
155   }
156 };
157
158 struct OrientationComponentConstraint
159 {
160   OrientationComponentConstraint(){}
161
162   void operator()( Quaternion& orientation, const PropertyInputContainer& inputs )
163   {
164     const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
165     Vector3 pos, scale;
166     Quaternion rot;
167     orientation = parentOrientation;
168   }
169 };
170 // OnRelayout
171
172 static bool gOnRelayoutCallBackCalled = false;
173 static std::vector< std::string > gActorNamesRelayout;
174
175 void OnRelayoutCallback( Actor actor )
176 {
177   gOnRelayoutCallBackCalled = true;
178   gActorNamesRelayout.push_back( actor.GetName() );
179 }
180
181 } // anonymous namespace
182
183
184 //& purpose: Testing New API
185 int UtcDaliActorNew(void)
186 {
187   TestApplication application;
188
189   Actor actor = Actor::New();
190
191   DALI_TEST_CHECK(actor);
192   END_TEST;
193 }
194
195 //& purpose: Testing Dali::Actor::DownCast()
196 int UtcDaliActorDownCastP(void)
197 {
198   TestApplication application;
199   tet_infoline("Testing Dali::Actor::DownCast()");
200
201   Actor actor = Actor::New();
202   BaseHandle object(actor);
203   Actor actor2 = Actor::DownCast(object);
204   DALI_TEST_CHECK(actor2);
205   END_TEST;
206 }
207
208 //& purpose: Testing Dali::Actor::DownCast()
209 int UtcDaliActorDownCastN(void)
210 {
211   TestApplication application;
212   tet_infoline("Testing Dali::Actor::DownCast()");
213
214   BaseHandle unInitializedObject;
215   Actor actor = Actor::DownCast(unInitializedObject);
216   DALI_TEST_CHECK(!actor);
217   END_TEST;
218 }
219
220 //& purpose: Testing Dali::Actor::GetName()
221 int UtcDaliActorGetName(void)
222 {
223   TestApplication application;
224
225   Actor actor = Actor::New();
226
227   DALI_TEST_CHECK(actor.GetName().empty());
228   END_TEST;
229 }
230
231 //& purpose: Testing Dali::Actor::SetName()
232 int UtcDaliActorSetName(void)
233 {
234   TestApplication application;
235
236   string str("ActorName");
237   Actor actor = Actor::New();
238
239   actor.SetName(str);
240   DALI_TEST_CHECK(actor.GetName() == str);
241   END_TEST;
242 }
243
244 int UtcDaliActorGetId(void)
245 {
246   tet_infoline("Testing Dali::Actor::UtcDaliActorGetId()");
247   TestApplication application;
248
249   Actor first = Actor::New();
250   Actor second = Actor::New();
251   Actor third = Actor::New();
252
253   DALI_TEST_CHECK(first.GetId() != second.GetId());
254   DALI_TEST_CHECK(second.GetId() != third.GetId());
255   END_TEST;
256 }
257
258 int UtcDaliActorIsRoot(void)
259 {
260   TestApplication application;
261
262   Actor actor = Actor::New();
263   DALI_TEST_CHECK(!actor.IsRoot());
264
265   // get the root layer
266   actor = Stage::GetCurrent().GetLayer( 0 );
267   DALI_TEST_CHECK( actor.IsRoot() );
268   END_TEST;
269 }
270
271 int UtcDaliActorOnStage(void)
272 {
273   TestApplication application;
274
275   Actor actor = Actor::New();
276   DALI_TEST_CHECK( !actor.OnStage() );
277
278   // get the root layer
279   actor = Stage::GetCurrent().GetLayer( 0 );
280   DALI_TEST_CHECK( actor.OnStage() );
281   END_TEST;
282 }
283
284 int UtcDaliActorIsLayer(void)
285 {
286   TestApplication application;
287
288   Actor actor = Actor::New();
289   DALI_TEST_CHECK( !actor.IsLayer() );
290
291   // get the root layer
292   actor = Stage::GetCurrent().GetLayer( 0 );
293   DALI_TEST_CHECK( actor.IsLayer() );
294   END_TEST;
295 }
296
297 int UtcDaliActorGetLayer(void)
298 {
299   TestApplication application;
300
301   Actor actor = Actor::New();
302   Stage::GetCurrent().Add(actor);
303   Layer layer = actor.GetLayer();
304
305   DALI_TEST_CHECK(layer);
306
307   // get the root layers layer
308   actor = Stage::GetCurrent().GetLayer( 0 );
309   DALI_TEST_CHECK( actor.GetLayer() );
310   END_TEST;
311 }
312
313 int UtcDaliActorAddP(void)
314 {
315   tet_infoline("Testing Actor::Add");
316   TestApplication application;
317
318   Actor parent = Actor::New();
319   Actor child = Actor::New();
320
321   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
322
323   parent.Add(child);
324
325   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
326
327   Actor parent2 = Actor::New();
328   parent2.Add( child );
329
330   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
331   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
332
333   // try Adding to same parent again, works
334   parent2.Add( child );
335   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
336
337   // try reparenting an orphaned child
338   {
339     Actor temporaryParent = Actor::New();
340     temporaryParent.Add( child );
341     DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION );
342   }
343   // temporaryParent has now died, reparent the orphaned child
344   parent2.Add( child );
345   DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
346
347   END_TEST;
348 }
349
350 int UtcDaliActorAddN(void)
351 {
352   tet_infoline("Testing Actor::Add");
353   TestApplication application;
354
355   Actor child = Actor::New();
356
357   Actor parent2 = Actor::New();
358   parent2.Add( child );
359
360   // try illegal Add
361   try
362   {
363     parent2.Add( parent2 );
364     tet_printf("Assertion test failed - no Exception\n" );
365     tet_result(TET_FAIL);
366   }
367   catch(Dali::DaliException& e)
368   {
369     DALI_TEST_PRINT_ASSERT( e );
370     DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
371     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
372   }
373   catch(...)
374   {
375     tet_printf("Assertion test failed - wrong Exception\n" );
376     tet_result(TET_FAIL);
377   }
378
379   // try reparenting root
380   try
381   {
382     parent2.Add( Stage::GetCurrent().GetLayer( 0 ) );
383     tet_printf("Assertion test failed - no Exception\n" );
384     tet_result(TET_FAIL);
385   }
386   catch(Dali::DaliException& e)
387   {
388     DALI_TEST_PRINT_ASSERT( e );
389     DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
390     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
391   }
392   catch(...)
393   {
394     tet_printf("Assertion test failed - wrong Exception\n" );
395     tet_result(TET_FAIL);
396   }
397
398   // try Add empty
399   try
400   {
401     Actor empty;
402     parent2.Add( empty );
403     tet_printf("Assertion test failed - no Exception\n" );
404     tet_result(TET_FAIL);
405   }
406   catch(Dali::DaliException& e)
407   {
408     DALI_TEST_PRINT_ASSERT( e );
409     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
410     DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
411   }
412   catch(...)
413   {
414     tet_printf("Assertion test failed - wrong Exception\n" );
415     tet_result(TET_FAIL);
416   }
417
418   END_TEST;
419 }
420
421 int UtcDaliActorRemoveN(void)
422 {
423   tet_infoline("Testing Actor::Remove");
424   TestApplication application;
425
426   Actor parent = Actor::New();
427   Actor child = Actor::New();
428   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
429
430   parent.Add(child);
431   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
432
433   parent.Remove(child);
434   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
435
436   // remove again, no problem
437   parent.Remove(child);
438   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
439
440   // add child back
441   parent.Add(child);
442   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
443   // try Remove self, its a no-op
444   parent.Remove( parent );
445   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
446
447   // try Remove empty
448   try
449   {
450     Actor empty;
451     parent.Remove( empty );
452     tet_printf("Assertion test failed - no Exception\n" );
453     tet_result(TET_FAIL);
454   }
455   catch(Dali::DaliException& e)
456   {
457     DALI_TEST_PRINT_ASSERT( e );
458     DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
459     DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
460   }
461   catch(...)
462   {
463     tet_printf("Assertion test failed - wrong Exception\n" );
464     tet_result(TET_FAIL);
465   }
466   END_TEST;
467 }
468
469 int UtcDaliActorRemoveP(void)
470 {
471   TestApplication application;
472
473   Actor parent = Actor::New();
474   Actor child = Actor::New();
475   Actor random = Actor::New();
476
477   Stage::GetCurrent().Add( parent );
478
479   DALI_TEST_CHECK(parent.GetChildCount() == 0);
480
481   parent.Add(child);
482
483   DALI_TEST_CHECK(parent.GetChildCount() == 1);
484
485   parent.Remove(random);
486
487   DALI_TEST_CHECK(parent.GetChildCount() == 1);
488
489   Stage::GetCurrent().Remove( parent );
490
491   DALI_TEST_CHECK(parent.GetChildCount() == 1);
492   END_TEST;
493 }
494
495 int UtcDaliActorGetChildCount(void)
496 {
497   TestApplication application;
498
499   Actor parent = Actor::New();
500   Actor child = Actor::New();
501
502   DALI_TEST_CHECK(parent.GetChildCount() == 0);
503
504   parent.Add(child);
505
506   DALI_TEST_CHECK(parent.GetChildCount() == 1);
507   END_TEST;
508 }
509
510 int UtcDaliActorGetChildren01(void)
511 {
512   TestApplication application;
513
514   Actor parent = Actor::New();
515   Actor first  = Actor::New();
516   Actor second = Actor::New();
517   Actor third  = Actor::New();
518
519   parent.Add(first);
520   parent.Add(second);
521   parent.Add(third);
522
523   DALI_TEST_CHECK(parent.GetChildAt(0) == first);
524   DALI_TEST_CHECK(parent.GetChildAt(1) == second);
525   DALI_TEST_CHECK(parent.GetChildAt(2) == third);
526   END_TEST;
527 }
528
529 int UtcDaliActorGetChildren02(void)
530 {
531   TestApplication application;
532
533   Actor parent = Actor::New();
534   Actor first  = Actor::New();
535   Actor second = Actor::New();
536   Actor third  = Actor::New();
537
538   parent.Add(first);
539   parent.Add(second);
540   parent.Add(third);
541
542   const Actor& constParent = parent;
543
544   DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
545   DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
546   DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
547   END_TEST;
548 }
549
550 int UtcDaliActorGetParent01(void)
551 {
552   TestApplication application;
553
554   Actor parent = Actor::New();
555   Actor child = Actor::New();
556
557   parent.Add(child);
558
559   DALI_TEST_CHECK(child.GetParent() == parent);
560   END_TEST;
561 }
562
563 int UtcDaliActorGetParent02(void)
564 {
565   TestApplication application;
566
567   Actor actor = Actor::New();
568
569   DALI_TEST_CHECK(!actor.GetParent());
570   END_TEST;
571 }
572
573 int UtcDaliActorSetParentOrigin(void)
574 {
575   TestApplication application;
576
577   Actor actor = Actor::New();
578
579   Vector3 vector(0.7f, 0.8f, 0.9f);
580   DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
581
582   actor.SetParentOrigin(vector);
583
584   // flush the queue and render once
585   application.SendNotification();
586   application.Render();
587
588   DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
589
590   Stage::GetCurrent().Add( actor );
591
592   actor.SetParentOrigin( Vector3( 0.1f, 0.2f, 0.3f ) );
593
594   // flush the queue and render once
595   application.SendNotification();
596   application.Render();
597
598   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentParentOrigin(), TEST_LOCATION );
599
600   Stage::GetCurrent().Remove( actor );
601   END_TEST;
602 }
603
604 int UtcDaliActorGetCurrentParentOrigin(void)
605 {
606   TestApplication application;
607
608   Actor actor = Actor::New();
609
610   Vector3 vector(0.7f, 0.8f, 0.9f);
611   DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
612
613   actor.SetParentOrigin(vector);
614
615   // flush the queue and render once
616   application.SendNotification();
617   application.Render();
618
619   DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
620   END_TEST;
621 }
622
623 int UtcDaliActorSetAnchorPoint(void)
624 {
625   TestApplication application;
626
627   Actor actor = Actor::New();
628
629   Vector3 vector(0.7f, 0.8f, 0.9f);
630   DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
631
632   actor.SetAnchorPoint(vector);
633
634   // flush the queue and render once
635   application.SendNotification();
636   application.Render();
637
638   DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
639
640   Stage::GetCurrent().Add( actor );
641
642   actor.SetAnchorPoint( Vector3( 0.1f, 0.2f, 0.3f ) );
643   // flush the queue and render once
644   application.SendNotification();
645   application.Render();
646
647   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentAnchorPoint(), TEST_LOCATION );
648
649   Stage::GetCurrent().Remove( actor );
650   END_TEST;
651 }
652
653 int UtcDaliActorGetCurrentAnchorPoint(void)
654 {
655   TestApplication application;
656
657   Actor actor = Actor::New();
658
659   Vector3 vector(0.7f, 0.8f, 0.9f);
660   DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
661
662   actor.SetAnchorPoint(vector);
663
664   // flush the queue and render once
665   application.SendNotification();
666   application.Render();
667
668   DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
669   END_TEST;
670 }
671
672 // SetSize(float width, float height)
673 int UtcDaliActorSetSize01(void)
674 {
675   TestApplication application;
676
677   Actor actor = Actor::New();
678   Vector3 vector(100.0f, 100.0f, 0.0f);
679
680   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
681
682   actor.SetSize(vector.x, vector.y);
683
684   // flush the queue and render once
685   application.SendNotification();
686   application.Render();
687
688   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
689   END_TEST;
690 }
691
692 // SetSize(float width, float height, float depth)
693 int UtcDaliActorSetSize02(void)
694 {
695   TestApplication application;
696
697   Actor actor = Actor::New();
698   Vector3 vector(100.0f, 100.0f, 100.0f);
699
700   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
701
702   actor.SetSize(vector.x, vector.y, vector.z);
703
704   // flush the queue and render once
705   application.SendNotification();
706   application.Render();
707
708   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
709   END_TEST;
710 }
711
712 // SetSize(Vector2 size)
713 int UtcDaliActorSetSize03(void)
714 {
715   TestApplication application;
716
717   Actor actor = Actor::New();
718   Vector3 vector(100.0f, 100.0f, 0.0f);
719
720   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
721
722   actor.SetSize(Vector2(vector.x, vector.y));
723
724   // flush the queue and render once
725   application.SendNotification();
726   application.Render();
727
728   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
729   END_TEST;
730 }
731
732 // SetSize(Vector3 size)
733 int UtcDaliActorSetSize04(void)
734 {
735   TestApplication application;
736
737   Actor actor = Actor::New();
738   Vector3 vector(100.0f, 100.0f, 100.0f);
739
740   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
741
742   actor.SetSize(vector);
743
744   // flush the queue and render once
745   application.SendNotification();
746   application.Render();
747
748   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
749
750   Stage::GetCurrent().Add( actor );
751   actor.SetSize( Vector3( 0.1f, 0.2f, 0.3f ) );
752
753   // flush the queue and render once
754   application.SendNotification();
755   application.Render();
756
757   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentSize(), TEST_LOCATION );
758   Stage::GetCurrent().Remove( actor );
759   END_TEST;
760 }
761
762 int UtcDaliActorGetCurrentSize(void)
763 {
764   TestApplication application;
765
766   Actor actor = Actor::New();
767   Vector3 vector(100.0f, 100.0f, 20.0f);
768
769   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
770
771   actor.SetSize(vector);
772
773   // flush the queue and render once
774   application.SendNotification();
775   application.Render();
776
777   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
778   END_TEST;
779 }
780
781 int UtcDaliActorGetNaturalSize(void)
782 {
783   TestApplication application;
784
785   Actor actor = Actor::New();
786   Vector3 vector( 0.0f, 0.0f, 0.0f );
787
788   DALI_TEST_CHECK( actor.GetNaturalSize() == vector );
789
790   END_TEST;
791 }
792
793 int UtcDaliActorGetCurrentSizeImmediate(void)
794 {
795   TestApplication application;
796
797   Actor actor = Actor::New();
798   Vector3 vector(100.0f, 100.0f, 20.0f);
799
800   DALI_TEST_CHECK(vector != actor.GetTargetSize());
801   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
802
803   actor.SetSize(vector);
804
805   DALI_TEST_CHECK(vector == actor.GetTargetSize());
806   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
807
808   // flush the queue and render once
809   application.SendNotification();
810   application.Render();
811
812   DALI_TEST_CHECK(vector == actor.GetTargetSize());
813   DALI_TEST_CHECK(vector == actor.GetCurrentSize());
814
815   // Animation
816   // Build the animation
817   const float durationSeconds = 2.0f;
818   Animation animation = Animation::New( durationSeconds );
819   const Vector3 targetValue( 10.0f, 20.0f, 30.0f );
820   animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
821
822   DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
823
824   // Start the animation
825   animation.Play();
826
827   application.SendNotification();
828   application.Render( static_cast<unsigned int>( durationSeconds * 1000.0f ) );
829
830   DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
831
832   END_TEST;
833 }
834
835 // SetPosition(float x, float y)
836 int UtcDaliActorSetPosition01(void)
837 {
838   TestApplication application;
839
840   Actor actor = Actor::New();
841
842   // Set to random to start off with
843   actor.SetPosition(Vector3(120.0f, 120.0f, 0.0f));
844
845   Vector3 vector(100.0f, 100.0f, 0.0f);
846
847   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
848
849   actor.SetPosition(vector.x, vector.y);
850   // flush the queue and render once
851   application.SendNotification();
852   application.Render();
853   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
854
855   Stage::GetCurrent().Add( actor );
856   actor.SetPosition( Vector3( 0.1f, 0.2f, 0.3f ) );
857   // flush the queue and render once
858   application.SendNotification();
859   application.Render();
860   DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentPosition(), TEST_LOCATION );
861
862   actor.SetX( 1.0f );
863   actor.SetY( 1.1f );
864   actor.SetZ( 1.2f );
865   // flush the queue and render once
866   application.SendNotification();
867   application.Render();
868   DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentPosition(), TEST_LOCATION );
869
870   actor.TranslateBy( Vector3( 0.1f, 0.1f, 0.1f ) );
871   // flush the queue and render once
872   application.SendNotification();
873   application.Render();
874   DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentPosition(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
875
876   Stage::GetCurrent().Remove( actor );
877   END_TEST;
878 }
879
880 // SetPosition(float x, float y, float z)
881 int UtcDaliActorSetPosition02(void)
882 {
883   TestApplication application;
884
885   Actor actor = Actor::New();
886
887   // Set to random to start off with
888   actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
889
890   Vector3 vector(100.0f, 100.0f, 100.0f);
891
892   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
893
894   actor.SetPosition(vector.x, vector.y, vector.z);
895
896   // flush the queue and render once
897   application.SendNotification();
898   application.Render();
899
900   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
901   END_TEST;
902 }
903
904 // SetPosition(Vector3 position)
905 int UtcDaliActorSetPosition03(void)
906 {
907   TestApplication application;
908
909   Actor actor = Actor::New();
910
911   // Set to random to start off with
912   actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
913
914   Vector3 vector(100.0f, 100.0f, 100.0f);
915
916   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
917
918   actor.SetPosition(vector);
919
920   // flush the queue and render once
921   application.SendNotification();
922   application.Render();
923
924   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
925   END_TEST;
926 }
927
928 int UtcDaliActorSetX(void)
929 {
930   TestApplication application;
931
932   Actor actor = Actor::New();
933
934   Vector3 vector(100.0f, 0.0f, 0.0f);
935
936   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
937
938   actor.SetX(100.0f);
939
940   // flush the queue and render once
941   application.SendNotification();
942   application.Render();
943
944   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
945   END_TEST;
946 }
947
948 int UtcDaliActorSetY(void)
949 {
950   TestApplication application;
951
952   Actor actor = Actor::New();
953
954   Vector3 vector(0.0f, 100.0f, 0.0f);
955
956   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
957
958   actor.SetY(100.0f);
959
960   // flush the queue and render once
961   application.SendNotification();
962   application.Render();
963
964   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
965   END_TEST;
966 }
967
968 int UtcDaliActorSetZ(void)
969 {
970   TestApplication application;
971
972   Actor actor = Actor::New();
973
974   Vector3 vector(0.0f, 0.0f, 100.0f);
975
976   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
977
978   actor.SetZ(100.0f);
979
980   // flush the queue and render once
981   application.SendNotification();
982   application.Render();
983
984   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
985   END_TEST;
986 }
987
988 int UtcDaliActorTranslateBy(void)
989 {
990   TestApplication application;
991
992   Actor actor = Actor::New();
993   Vector3 vector(100.0f, 100.0f, 100.0f);
994
995   DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
996
997   actor.SetPosition(vector);
998
999   // flush the queue and render once
1000   application.SendNotification();
1001   application.Render();
1002
1003   DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1004
1005   actor.TranslateBy(vector);
1006
1007   // flush the queue and render once
1008   application.SendNotification();
1009   application.Render();
1010
1011   DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentPosition());
1012   END_TEST;
1013 }
1014
1015 int UtcDaliActorGetCurrentPosition(void)
1016 {
1017   TestApplication application;
1018
1019   Actor actor = Actor::New();
1020   Vector3 setVector(100.0f, 100.0f, 0.0f);
1021   actor.SetPosition(setVector);
1022
1023   // flush the queue and render once
1024   application.SendNotification();
1025   application.Render();
1026
1027   DALI_TEST_CHECK(actor.GetCurrentPosition() == setVector);
1028   END_TEST;
1029 }
1030
1031 int UtcDaliActorGetCurrentWorldPosition(void)
1032 {
1033   TestApplication application;
1034
1035   Actor parent = Actor::New();
1036   Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1037   parent.SetPosition( parentPosition );
1038   parent.SetParentOrigin( ParentOrigin::CENTER );
1039   parent.SetAnchorPoint( AnchorPoint::CENTER );
1040   Stage::GetCurrent().Add( parent );
1041
1042   Actor child = Actor::New();
1043   child.SetParentOrigin( ParentOrigin::CENTER );
1044   child.SetAnchorPoint( AnchorPoint::CENTER );
1045   Vector3 childPosition( 6.0f, 6.0f, 6.0f );
1046   child.SetPosition( childPosition );
1047   parent.Add( child );
1048
1049   // The actors should not have a world position yet
1050   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1051   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1052
1053   application.SendNotification();
1054   application.Render(0);
1055
1056   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1057   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1058
1059   // The actors should have a world position now
1060   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1061   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1062   END_TEST;
1063 }
1064
1065 int UtcDaliActorInheritPosition(void)
1066 {
1067   tet_infoline("Testing Actor::SetPositionInheritanceMode");
1068   TestApplication application;
1069
1070   Actor parent = Actor::New();
1071   Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1072   parent.SetPosition( parentPosition );
1073   parent.SetParentOrigin( ParentOrigin::CENTER );
1074   parent.SetAnchorPoint( AnchorPoint::CENTER );
1075   Stage::GetCurrent().Add( parent );
1076
1077   Actor child = Actor::New();
1078   child.SetParentOrigin( ParentOrigin::CENTER );
1079   child.SetAnchorPoint( AnchorPoint::CENTER );
1080   Vector3 childPosition( 10.0f, 11.0f, 12.0f );
1081   child.SetPosition( childPosition );
1082   parent.Add( child );
1083
1084   // The actors should not have a world position yet
1085   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1086   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1087
1088   // first test default, which is to inherit position
1089   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::INHERIT_PARENT_POSITION, TEST_LOCATION );
1090   application.SendNotification();
1091   application.Render(0); // should only really call Update as Render is not required to update scene
1092   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1093   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1094   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1095   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1096
1097
1098   //Change child position
1099   Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1100   child.SetPosition( childOffset );
1101
1102   // Change inheritance mode to not inherit
1103   child.SetPositionInheritanceMode( Dali::DONT_INHERIT_POSITION );
1104   DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::DONT_INHERIT_POSITION, TEST_LOCATION );
1105   application.SendNotification();
1106   application.Render(0); // should only really call Update as Render is not required to update scene
1107   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1108   DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1109   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1110   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION );
1111   END_TEST;
1112 }
1113
1114 int UtcDaliActorSetInheritPosition(void)
1115 {
1116   tet_infoline("Testing Actor::SetInheritPosition");
1117   TestApplication application;
1118
1119   Actor parent = Actor::New();
1120   Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1121   parent.SetPosition( parentPosition );
1122   parent.SetParentOrigin( ParentOrigin::CENTER );
1123   parent.SetAnchorPoint( AnchorPoint::CENTER );
1124   Stage::GetCurrent().Add( parent );
1125
1126   Actor child = Actor::New();
1127   child.SetParentOrigin( ParentOrigin::CENTER );
1128   child.SetAnchorPoint( AnchorPoint::CENTER );
1129   Vector3 childPosition( 10.0f, 11.0f, 12.0f );
1130   child.SetPosition( childPosition );
1131   parent.Add( child );
1132
1133   // The actors should not have a world position yet
1134   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1135   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1136
1137   // first test default, which is to inherit position
1138   DALI_TEST_EQUALS( child.IsPositionInherited(), true, TEST_LOCATION );
1139   application.SendNotification();
1140   application.Render(0); // should only really call Update as Render is not required to update scene
1141   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1142   DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1143   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1144   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1145
1146   //Change child position
1147   Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1148   child.SetPosition( childOffset );
1149
1150   // Use local position as world postion
1151   child.SetInheritPosition( false );
1152   DALI_TEST_EQUALS( child.IsPositionInherited(), false, TEST_LOCATION );
1153   application.SendNotification();
1154   application.Render(0); // should only really call Update as Render is not required to update scene
1155   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1156   DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1157   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1158   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION );
1159
1160   //Change back to inherit position from parent
1161   child.SetInheritPosition( true );
1162   DALI_TEST_EQUALS( child.IsPositionInherited(), true, TEST_LOCATION );
1163   application.SendNotification();
1164   application.Render(0); // should only really call Update as Render is not required to update scene
1165   DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1166   DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1167   DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1168   DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childOffset, TEST_LOCATION );
1169   END_TEST;
1170 }
1171
1172 // SetOrientation(float angleRadians, Vector3 axis)
1173 int UtcDaliActorSetOrientation01(void)
1174 {
1175   TestApplication application;
1176
1177   Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1178   Actor actor = Actor::New();
1179
1180   actor.SetOrientation(rotation);
1181
1182   // flush the queue and render once
1183   application.SendNotification();
1184   application.Render();
1185
1186   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1187   END_TEST;
1188 }
1189
1190 int UtcDaliActorSetOrientation02(void)
1191 {
1192   TestApplication application;
1193
1194   Actor actor = Actor::New();
1195
1196   Radian angle( 0.785f );
1197   Vector3 axis(1.0f, 1.0f, 0.0f);
1198
1199   actor.SetOrientation( angle, axis);
1200   Quaternion rotation( angle, axis );
1201   // flush the queue and render once
1202   application.SendNotification();
1203   application.Render();
1204   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1205
1206   Stage::GetCurrent().Add( actor );
1207   actor.RotateBy( Degree( 360 ), axis);
1208   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1209
1210   actor.SetOrientation( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1211   Quaternion result( Radian( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1212   // flush the queue and render once
1213   application.SendNotification();
1214   application.Render();
1215   DALI_TEST_EQUALS( result, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1216
1217   actor.SetOrientation( angle, axis);
1218   // flush the queue and render once
1219   application.SendNotification();
1220   application.Render();
1221   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1222
1223   Stage::GetCurrent().Remove( actor );
1224   END_TEST;
1225 }
1226
1227 // RotateBy(float angleRadians, Vector3 axis)
1228 int UtcDaliActorRotateBy01(void)
1229 {
1230   TestApplication application;
1231
1232   Actor actor = Actor::New();
1233
1234   Radian angle( M_PI * 0.25f );
1235   actor.RotateBy(( angle ), Vector3::ZAXIS);
1236   // flush the queue and render once
1237   application.SendNotification();
1238   application.Render();
1239   DALI_TEST_EQUALS(Quaternion( angle, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1240
1241   Stage::GetCurrent().Add( actor );
1242
1243   actor.RotateBy( angle, Vector3::ZAXIS);
1244   // flush the queue and render once
1245   application.SendNotification();
1246   application.Render();
1247   DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1248
1249   Stage::GetCurrent().Remove( actor );
1250   END_TEST;
1251 }
1252
1253 // RotateBy(Quaternion relativeRotation)
1254 int UtcDaliActorRotateBy02(void)
1255 {
1256   TestApplication application;
1257
1258   Actor actor = Actor::New();
1259
1260   Radian angle( M_PI * 0.25f );
1261   Quaternion rotation(angle, Vector3::ZAXIS);
1262   actor.RotateBy(rotation);
1263   // flush the queue and render once
1264   application.SendNotification();
1265   application.Render();
1266   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1267
1268   actor.RotateBy(rotation);
1269   // flush the queue and render once
1270   application.SendNotification();
1271   application.Render();
1272   DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1273   END_TEST;
1274 }
1275
1276 int UtcDaliActorGetCurrentOrientation(void)
1277 {
1278   TestApplication application;
1279   Actor actor = Actor::New();
1280
1281   Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1282   actor.SetOrientation(rotation);
1283   // flush the queue and render once
1284   application.SendNotification();
1285   application.Render();
1286   DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1287   END_TEST;
1288 }
1289
1290 int UtcDaliActorGetCurrentWorldOrientation(void)
1291 {
1292   tet_infoline("Testing Actor::GetCurrentWorldRotation");
1293   TestApplication application;
1294
1295   Actor parent = Actor::New();
1296   Radian rotationAngle( Degree(90.0f) );
1297   Quaternion rotation( rotationAngle, Vector3::YAXIS );
1298   parent.SetOrientation( rotation );
1299   Stage::GetCurrent().Add( parent );
1300
1301   Actor child = Actor::New();
1302   child.SetOrientation( rotation );
1303   parent.Add( child );
1304
1305   // The actors should not have a world rotation yet
1306   DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1307   DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1308
1309   application.SendNotification();
1310   application.Render(0);
1311
1312   DALI_TEST_EQUALS( parent.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION );
1313   DALI_TEST_EQUALS( child.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION );
1314
1315   // The actors should have a world rotation now
1316   DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1317   DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1318
1319   // turn off child rotation inheritance
1320   child.SetInheritOrientation( false );
1321   DALI_TEST_EQUALS( child.IsOrientationInherited(), false, TEST_LOCATION );
1322   application.SendNotification();
1323   application.Render(0);
1324
1325   // The actors should have a world rotation now
1326   DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1327   DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), rotation, 0.001, TEST_LOCATION );
1328   END_TEST;
1329 }
1330
1331 // SetScale(float scale)
1332 int UtcDaliActorSetScale01(void)
1333 {
1334   TestApplication application;
1335
1336   Actor actor = Actor::New();
1337
1338   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1339   actor.SetScale(0.25f);
1340
1341   Vector3 scale(10.0f, 10.0f, 10.0f);
1342   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1343
1344   actor.SetScale(scale.x);
1345
1346   // flush the queue and render once
1347   application.SendNotification();
1348   application.Render();
1349
1350   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1351   END_TEST;
1352 }
1353
1354 // SetScale(float scaleX, float scaleY, float scaleZ)
1355 int UtcDaliActorSetScale02(void)
1356 {
1357   TestApplication application;
1358   Vector3 scale(10.0f, 10.0f, 10.0f);
1359
1360   Actor actor = Actor::New();
1361
1362   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1363   actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1364
1365   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1366
1367   actor.SetScale(scale.x, scale.y, scale.z);
1368   // flush the queue and render once
1369   application.SendNotification();
1370   application.Render();
1371   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1372
1373   // add to stage and test
1374   Stage::GetCurrent().Add( actor );
1375   actor.SetScale( 2.0f, 2.0f, 2.0f );
1376   // flush the queue and render once
1377   application.SendNotification();
1378   application.Render();
1379   DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentScale(), 0.001, TEST_LOCATION);
1380
1381   Stage::GetCurrent().Remove( actor );
1382
1383   END_TEST;
1384 }
1385
1386 // SetScale(Vector3 scale)
1387 int UtcDaliActorSetScale03(void)
1388 {
1389   TestApplication application;
1390   Vector3 scale(10.0f, 10.0f, 10.0f);
1391
1392   Actor actor = Actor::New();
1393
1394   // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1395   actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1396
1397   DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1398
1399   actor.SetScale(scale);
1400
1401   // flush the queue and render once
1402   application.SendNotification();
1403   application.Render();
1404
1405   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1406   END_TEST;
1407 }
1408
1409 int UtcDaliActorScaleBy(void)
1410 {
1411   TestApplication application;
1412   Actor actor = Actor::New();
1413   Vector3 vector(100.0f, 100.0f, 100.0f);
1414
1415   DALI_TEST_CHECK(vector != actor.GetCurrentScale());
1416
1417   actor.SetScale(vector);
1418
1419   // flush the queue and render once
1420   application.SendNotification();
1421   application.Render();
1422
1423   DALI_TEST_CHECK(vector == actor.GetCurrentScale());
1424
1425   actor.ScaleBy(vector);
1426
1427   // flush the queue and render once
1428   application.SendNotification();
1429   application.Render();
1430
1431   DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentScale());
1432   END_TEST;
1433 }
1434
1435 int UtcDaliActorGetCurrentScale(void)
1436 {
1437   TestApplication application;
1438   Vector3 scale(12.0f, 1.0f, 2.0f);
1439
1440   Actor actor = Actor::New();
1441
1442   actor.SetScale(scale);
1443
1444   // flush the queue and render once
1445   application.SendNotification();
1446   application.Render();
1447
1448   DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1449   END_TEST;
1450 }
1451
1452 int UtcDaliActorGetCurrentWorldScale(void)
1453 {
1454   TestApplication application;
1455
1456   Actor parent = Actor::New();
1457   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1458   parent.SetScale( parentScale );
1459   Stage::GetCurrent().Add( parent );
1460
1461   Actor child = Actor::New();
1462   Vector3 childScale( 2.0f, 2.0f, 2.0f );
1463   child.SetScale( childScale );
1464   parent.Add( child );
1465
1466   // The actors should not have a scale yet
1467   DALI_TEST_EQUALS( parent.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1468   DALI_TEST_EQUALS( child.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1469
1470   // The actors should not have a world scale yet
1471   DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1472   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1473
1474   application.SendNotification();
1475   application.Render(0);
1476
1477   DALI_TEST_EQUALS( parent.GetCurrentScale(), parentScale, TEST_LOCATION );
1478   DALI_TEST_EQUALS( child.GetCurrentScale(), childScale, TEST_LOCATION );
1479
1480   // The actors should have a world scale now
1481   DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), parentScale, TEST_LOCATION );
1482   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1483   END_TEST;
1484 }
1485
1486 int UtcDaliActorInheritScale(void)
1487 {
1488   tet_infoline("Testing Actor::SetInheritScale");
1489   TestApplication application;
1490
1491   Actor parent = Actor::New();
1492   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1493   parent.SetScale( parentScale );
1494   Stage::GetCurrent().Add( parent );
1495
1496   Actor child = Actor::New();
1497   Vector3 childScale( 2.0f, 2.0f, 2.0f );
1498   child.SetScale( childScale );
1499   parent.Add( child );
1500
1501   application.SendNotification();
1502   application.Render(0);
1503
1504   DALI_TEST_EQUALS( child.IsScaleInherited(), true, TEST_LOCATION );
1505   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1506
1507   child.SetInheritScale( false );
1508   DALI_TEST_EQUALS( child.IsScaleInherited(), false, TEST_LOCATION );
1509
1510   application.SendNotification();
1511   application.Render(0);
1512
1513   DALI_TEST_EQUALS( child.GetCurrentWorldScale(), childScale, TEST_LOCATION );
1514   END_TEST;
1515 }
1516
1517 int UtcDaliActorSetVisible(void)
1518 {
1519   TestApplication application;
1520
1521   Actor actor = Actor::New();
1522   actor.SetVisible(false);
1523   // flush the queue and render once
1524   application.SendNotification();
1525   application.Render();
1526   DALI_TEST_CHECK(actor.IsVisible() == false);
1527
1528   actor.SetVisible(true);
1529   // flush the queue and render once
1530   application.SendNotification();
1531   application.Render();
1532   DALI_TEST_CHECK(actor.IsVisible() == true);
1533
1534   // put actor on stage
1535   Stage::GetCurrent().Add( actor );
1536   actor.SetVisible(false);
1537   // flush the queue and render once
1538   application.SendNotification();
1539   application.Render();
1540   DALI_TEST_CHECK(actor.IsVisible() == false);
1541   END_TEST;
1542 }
1543
1544 int UtcDaliActorIsVisible(void)
1545 {
1546   TestApplication application;
1547
1548   Actor actor = Actor::New();
1549
1550   DALI_TEST_CHECK(actor.IsVisible() == true);
1551   END_TEST;
1552 }
1553
1554 int UtcDaliActorSetOpacity(void)
1555 {
1556   TestApplication application;
1557
1558   Actor actor = Actor::New();
1559   // initial opacity is 1
1560   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1561
1562   actor.SetOpacity( 0.4f);
1563   // flush the queue and render once
1564   application.SendNotification();
1565   application.Render();
1566   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.4f, TEST_LOCATION );
1567
1568   // change opacity, actor is on stage to change is not immediate
1569   actor.SetOpacity( actor.GetCurrentOpacity() + 0.1f );
1570   // flush the queue and render once
1571   application.SendNotification();
1572   application.Render();
1573   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1574
1575   // put actor on stage
1576   Stage::GetCurrent().Add( actor );
1577
1578   // change opacity, actor is on stage to change is not immediate
1579   actor.SetOpacity( 0.9f );
1580   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1581   // flush the queue and render once
1582   application.SendNotification();
1583   application.Render();
1584   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.9f, TEST_LOCATION );
1585
1586   // change opacity, actor is on stage to change is not immediate
1587   actor.SetOpacity( actor.GetCurrentOpacity() - 0.9f );
1588   // flush the queue and render once
1589   application.SendNotification();
1590   application.Render();
1591   DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1592   END_TEST;
1593 }
1594
1595 int UtcDaliActorGetCurrentOpacity(void)
1596 {
1597   TestApplication application;
1598
1599   Actor actor = Actor::New();
1600   DALI_TEST_CHECK(actor.GetCurrentOpacity() != 0.5f);
1601
1602   actor.SetOpacity(0.5f);
1603   // flush the queue and render once
1604   application.SendNotification();
1605   application.Render();
1606   DALI_TEST_CHECK(actor.GetCurrentOpacity() == 0.5f);
1607   END_TEST;
1608 }
1609
1610 int UtcDaliActorSetSensitive(void)
1611 {
1612   TestApplication application;
1613   Actor actor = Actor::New();
1614
1615   bool sensitive = !actor.IsSensitive();
1616
1617   actor.SetSensitive(sensitive);
1618
1619   DALI_TEST_CHECK(sensitive == actor.IsSensitive());
1620   END_TEST;
1621 }
1622
1623 int UtcDaliActorIsSensitive(void)
1624 {
1625   TestApplication application;
1626   Actor actor = Actor::New();
1627   actor.SetSensitive(false);
1628
1629   DALI_TEST_CHECK(false == actor.IsSensitive());
1630   END_TEST;
1631 }
1632
1633 int UtcDaliActorSetColor(void)
1634 {
1635   TestApplication application;
1636   Actor actor = Actor::New();
1637   Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1638
1639   DALI_TEST_CHECK(color != actor.GetCurrentColor());
1640
1641   actor.SetColor(color);
1642   // flush the queue and render once
1643   application.SendNotification();
1644   application.Render();
1645   DALI_TEST_CHECK(color == actor.GetCurrentColor());
1646
1647   actor.SetColor( actor.GetCurrentColor() + Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) );
1648   // flush the queue and render once
1649   application.SendNotification();
1650   application.Render();
1651   DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentColor(),  TEST_LOCATION );
1652
1653   Stage::GetCurrent().Add( actor );
1654   actor.SetColor( color );
1655   // flush the queue and render once
1656   application.SendNotification();
1657   application.Render();
1658   DALI_TEST_EQUALS( color, actor.GetCurrentColor(),  TEST_LOCATION );
1659
1660   actor.SetColor( actor.GetCurrentColor() + Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) );
1661   // flush the queue and render once
1662   application.SendNotification();
1663   application.Render();
1664   // Actor color is not clamped
1665   DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentColor(),  TEST_LOCATION );
1666   // world color is clamped
1667   DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentWorldColor(),  TEST_LOCATION );
1668
1669   Stage::GetCurrent().Remove( actor );
1670   END_TEST;
1671 }
1672
1673 int UtcDaliActorGetCurrentColor(void)
1674 {
1675   TestApplication application;
1676   Actor actor = Actor::New();
1677   Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1678
1679   actor.SetColor(color);
1680   // flush the queue and render once
1681   application.SendNotification();
1682   application.Render();
1683   DALI_TEST_CHECK(color == actor.GetCurrentColor());
1684   END_TEST;
1685 }
1686
1687 int UtcDaliActorGetCurrentWorldColor(void)
1688 {
1689   tet_infoline("Actor::GetCurrentWorldColor");
1690   TestApplication application;
1691
1692   Actor parent = Actor::New();
1693   Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f );
1694   parent.SetColor( parentColor );
1695   Stage::GetCurrent().Add( parent );
1696
1697   Actor child = Actor::New();
1698   Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f );
1699   child.SetColor( childColor );
1700   parent.Add( child );
1701
1702   DALI_TEST_EQUALS( parent.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1703   DALI_TEST_EQUALS( child.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1704
1705   // verify the default color mode
1706   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetColorMode(), TEST_LOCATION );
1707
1708   // The actors should not have a world color yet
1709   DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1710   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1711
1712   application.SendNotification();
1713   application.Render(0);
1714
1715   DALI_TEST_EQUALS( parent.GetCurrentColor(), parentColor, TEST_LOCATION );
1716   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1717
1718   // The actors should have a world color now
1719   DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1720   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION );
1721
1722   // use own color
1723   child.SetColorMode( USE_OWN_COLOR );
1724   application.SendNotification();
1725   application.Render(0);
1726   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), childColor, TEST_LOCATION );
1727
1728   // use parent color
1729   child.SetColorMode( USE_PARENT_COLOR );
1730   application.SendNotification();
1731   application.Render(0);
1732   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1733   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1734
1735   // use parent alpha
1736   child.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1737   application.SendNotification();
1738   application.Render(0);
1739   Vector4 expectedColor( childColor );
1740   expectedColor.a *= parentColor.a;
1741   DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1742   DALI_TEST_EQUALS( child.GetCurrentWorldColor(), expectedColor, TEST_LOCATION );
1743   END_TEST;
1744 }
1745
1746 int UtcDaliActorSetColorMode(void)
1747 {
1748   tet_infoline("Actor::SetColorMode");
1749   TestApplication application;
1750   Actor actor = Actor::New();
1751   Actor child = Actor::New();
1752   actor.Add( child );
1753
1754   actor.SetColorMode( USE_OWN_COLOR );
1755   DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetColorMode(), TEST_LOCATION );
1756
1757   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
1758   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1759
1760   actor.SetColorMode( USE_PARENT_COLOR );
1761   DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1762
1763   actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1764   DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetColorMode(), TEST_LOCATION );
1765   END_TEST;
1766 }
1767
1768 int UtcDaliActorScreenToLocal(void)
1769 {
1770   TestApplication application;
1771   Actor actor = Actor::New();
1772   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1773   actor.SetSize(100.0f, 100.0f);
1774   actor.SetPosition(10.0f, 10.0f);
1775   Stage::GetCurrent().Add(actor);
1776
1777   // flush the queue and render once
1778   application.SendNotification();
1779   application.Render();
1780
1781   float localX;
1782   float localY;
1783
1784   application.SendNotification();
1785   application.Render();
1786
1787   DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) );
1788
1789   DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
1790   DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
1791   END_TEST;
1792 }
1793
1794 int UtcDaliActorSetLeaveRequired(void)
1795 {
1796   TestApplication application;
1797
1798   Actor actor = Actor::New();
1799
1800   actor.SetLeaveRequired(false);
1801   DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
1802
1803   actor.SetLeaveRequired(true);
1804   DALI_TEST_CHECK(actor.GetLeaveRequired() == true);
1805   END_TEST;
1806 }
1807
1808 int UtcDaliActorGetLeaveRequired(void)
1809 {
1810   TestApplication application;
1811
1812   Actor actor = Actor::New();
1813
1814   DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
1815   END_TEST;
1816 }
1817
1818 int UtcDaliActorSetKeyboardFocusable(void)
1819 {
1820   TestApplication application;
1821
1822   Actor actor = Actor::New();
1823
1824   actor.SetKeyboardFocusable(true);
1825   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == true);
1826
1827   actor.SetKeyboardFocusable(false);
1828   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
1829   END_TEST;
1830 }
1831
1832 int UtcDaliActorIsKeyboardFocusable(void)
1833 {
1834   TestApplication application;
1835
1836   Actor actor = Actor::New();
1837
1838   DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
1839   END_TEST;
1840 }
1841
1842 int UtcDaliActorRemoveConstraints(void)
1843 {
1844   tet_infoline(" UtcDaliActorRemoveConstraints");
1845   TestApplication application;
1846
1847   gTestConstraintCalled = false;
1848
1849   Actor actor = Actor::New();
1850
1851   Constraint constraint = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraint() );
1852   constraint.Apply();
1853   actor.RemoveConstraints();
1854
1855   DALI_TEST_CHECK( gTestConstraintCalled == false );
1856
1857   Stage::GetCurrent().Add( actor );
1858   constraint.Apply();
1859
1860   // flush the queue and render once
1861   application.SendNotification();
1862   application.Render();
1863
1864   actor.RemoveConstraints();
1865
1866   DALI_TEST_CHECK( gTestConstraintCalled == true );
1867   END_TEST;
1868 }
1869
1870 int UtcDaliActorRemoveConstraintTag(void)
1871 {
1872   tet_infoline(" UtcDaliActorRemoveConstraintTag");
1873   TestApplication application;
1874
1875   Actor actor = Actor::New();
1876
1877   // 1. Apply Constraint1 and Constraint2, and test...
1878   unsigned int result1 = 0u;
1879   unsigned int result2 = 0u;
1880
1881   unsigned constraint1Tag = 1u;
1882   Constraint constraint1 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1) );
1883   constraint1.SetTag( constraint1Tag );
1884   constraint1.Apply();
1885
1886   unsigned constraint2Tag = 2u;
1887   Constraint constraint2 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2) );
1888   constraint2.SetTag( constraint2Tag );
1889   constraint2.Apply();
1890
1891   Stage::GetCurrent().Add( actor );
1892   // flush the queue and render once
1893   application.SendNotification();
1894   application.Render();
1895
1896   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
1897   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
1898
1899   // 2. Remove Constraint1 and test...
1900   result1 = 0;
1901   result2 = 0;
1902   actor.RemoveConstraints(constraint1Tag);
1903   // make color property dirty, which will trigger constraints to be reapplied.
1904   actor.SetColor( Color::WHITE );
1905   // flush the queue and render once
1906   application.SendNotification();
1907   application.Render();
1908
1909   DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION );  ///< constraint 1 should not apply now.
1910   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
1911
1912   // 3. Re-Apply Constraint1 and test...
1913   result1 = 0;
1914   result2 = 0;
1915   constraint1.Apply();
1916   // make color property dirty, which will trigger constraints to be reapplied.
1917   actor.SetColor( Color::WHITE );
1918   // flush the queue and render once
1919   application.SendNotification();
1920   application.Render();
1921
1922   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
1923   DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
1924
1925   // 2. Remove Constraint2 and test...
1926   result1 = 0;
1927   result2 = 0;
1928   actor.RemoveConstraints(constraint2Tag);
1929   // make color property dirty, which will trigger constraints to be reapplied.
1930   actor.SetColor( Color::WHITE );
1931   // flush the queue and render once
1932   application.SendNotification();
1933   application.Render();
1934
1935   DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
1936   DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
1937
1938   // 2. Remove Constraint1 as well and test...
1939   result1 = 0;
1940   result2 = 0;
1941   actor.RemoveConstraints(constraint1Tag);
1942   // make color property dirty, which will trigger constraints to be reapplied.
1943   actor.SetColor( Color::WHITE );
1944   // flush the queue and render once
1945   application.SendNotification();
1946   application.Render();
1947
1948   DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
1949   DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
1950   END_TEST;
1951 }
1952
1953 int UtcDaliActorTouchedSignal(void)
1954 {
1955   TestApplication application;
1956
1957   gTouchCallBackCalled = false;
1958
1959   // get the root layer
1960   Actor actor = Stage::GetCurrent().GetRootLayer();
1961   DALI_TEST_CHECK( gTouchCallBackCalled == false );
1962
1963   application.SendNotification();
1964   application.Render();
1965
1966   // connect to its touch signal
1967   actor.TouchedSignal().Connect( TestCallback );
1968
1969   // simulate a touch event in the middle of the screen
1970   Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
1971   Dali::TouchPoint point( 1, TouchPoint::Down, touchPoint.x, touchPoint.y );
1972   Dali::Integration::TouchEvent event;
1973   event.AddPoint( point );
1974   application.ProcessEvent( event );
1975
1976   DALI_TEST_CHECK( gTouchCallBackCalled == true );
1977   END_TEST;
1978 }
1979
1980 int UtcDaliActorHoveredSignal(void)
1981 {
1982   TestApplication application;
1983
1984   gHoverCallBackCalled = false;
1985
1986   // get the root layer
1987   Actor actor = Stage::GetCurrent().GetRootLayer();
1988   DALI_TEST_CHECK( gHoverCallBackCalled == false );
1989
1990   application.SendNotification();
1991   application.Render();
1992
1993   // connect to its hover signal
1994   actor.HoveredSignal().Connect( TestCallback3 );
1995
1996   // simulate a hover event in the middle of the screen
1997   Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
1998   Dali::TouchPoint point( 1, TouchPoint::Motion, touchPoint.x, touchPoint.y );
1999   Dali::Integration::HoverEvent event;
2000   event.AddPoint( point );
2001   application.ProcessEvent( event );
2002
2003   DALI_TEST_CHECK( gHoverCallBackCalled == true );
2004   END_TEST;
2005 }
2006
2007 int UtcDaliActorOnOffStageSignal(void)
2008 {
2009   tet_infoline("Testing Dali::Actor::OnStageSignal() and OffStageSignal()");
2010
2011   TestApplication application;
2012
2013   // clean test data
2014   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2015   gActorNamesOnOffStage.clear();
2016
2017   Actor parent = Actor::New();
2018   parent.SetName( "parent" );
2019   parent.OnStageSignal().Connect( OnStageCallback );
2020   parent.OffStageSignal().Connect( OffStageCallback );
2021   // sanity check
2022   DALI_TEST_CHECK( gOnStageCallBackCalled == 0 );
2023   DALI_TEST_CHECK( gOffStageCallBackCalled == 0 );
2024
2025   // add parent to stage
2026   Stage::GetCurrent().Add( parent );
2027   // onstage emitted, offstage not
2028   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 1, TEST_LOCATION );
2029   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2030   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2031
2032   // test adding a child, should get onstage emitted
2033   // clean test data
2034   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2035   gActorNamesOnOffStage.clear();
2036
2037   Actor child = Actor::New();
2038   child.SetName( "child" );
2039   child.OnStageSignal().Connect( OnStageCallback );
2040   child.OffStageSignal().Connect( OffStageCallback );
2041   parent.Add( child ); // add child
2042   // onstage emitted, offstage not
2043   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 1, TEST_LOCATION );
2044   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2045   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2046
2047   // test removing parent from stage
2048   // clean test data
2049   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2050   gActorNamesOnOffStage.clear();
2051
2052   Stage::GetCurrent().Remove( parent );
2053   // onstage not emitted, offstage is
2054   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2055   DALI_TEST_EQUALS( gOffStageCallBackCalled, 2, TEST_LOCATION );
2056   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2057   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2058
2059   // test adding parent back to stage
2060   // clean test data
2061   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2062   gActorNamesOnOffStage.clear();
2063
2064   Stage::GetCurrent().Add( parent );
2065   // onstage emitted, offstage not
2066   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 2, TEST_LOCATION );
2067   DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2068   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2069   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2070
2071   // test removing child
2072   // clean test data
2073   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2074   gActorNamesOnOffStage.clear();
2075
2076   parent.Remove( child );
2077   // onstage not emitted, offstage is
2078   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2079   DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2080   DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2081
2082   // test removing parent
2083   // clean test data
2084   gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2085   gActorNamesOnOffStage.clear();
2086
2087   Stage::GetCurrent().Remove( parent );
2088   // onstage not emitted, offstage is
2089   DALI_TEST_EQUALS(  gOnStageCallBackCalled, 0, TEST_LOCATION );
2090   DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2091   DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2092   END_TEST;
2093 }
2094
2095 int UtcDaliActorFindChildByName(void)
2096 {
2097   tet_infoline("Testing Dali::Actor::FindChildByName()");
2098   TestApplication application;
2099
2100   Actor parent = Actor::New();
2101   parent.SetName( "parent" );
2102   Actor first  = Actor::New();
2103   first .SetName( "first" );
2104   Actor second = Actor::New();
2105   second.SetName( "second" );
2106
2107   parent.Add(first);
2108   first.Add(second);
2109
2110   Actor found = parent.FindChildByName( "foo" );
2111   DALI_TEST_CHECK( !found );
2112
2113   found = parent.FindChildByName( "parent" );
2114   DALI_TEST_CHECK( found == parent );
2115
2116   found = parent.FindChildByName( "first" );
2117   DALI_TEST_CHECK( found == first );
2118
2119   found = parent.FindChildByName( "second" );
2120   DALI_TEST_CHECK( found == second );
2121   END_TEST;
2122 }
2123
2124 int UtcDaliActorFindChildById(void)
2125 {
2126   tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2127   TestApplication application;
2128
2129   Actor parent = Actor::New();
2130   Actor first  = Actor::New();
2131   Actor second = Actor::New();
2132
2133   parent.Add(first);
2134   first.Add(second);
2135
2136   Actor found = parent.FindChildById( 100000 );
2137   DALI_TEST_CHECK( !found );
2138
2139   found = parent.FindChildById( parent.GetId() );
2140   DALI_TEST_CHECK( found == parent );
2141
2142   found = parent.FindChildById( first.GetId() );
2143   DALI_TEST_CHECK( found == first );
2144
2145   found = parent.FindChildById( second.GetId() );
2146   DALI_TEST_CHECK( found == second );
2147   END_TEST;
2148 }
2149
2150 int UtcDaliActorHitTest(void)
2151 {
2152   struct HitTestData
2153   {
2154   public:
2155     HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result )
2156     : mScale( scale ),
2157       mTouchPoint( touchPoint ),
2158       mResult( result )
2159     {}
2160
2161     Vector3 mScale;
2162     Vector2 mTouchPoint;
2163     bool mResult;
2164   };
2165
2166   TestApplication application;
2167   tet_infoline(" UtcDaliActorHitTest");
2168
2169   // Fill a vector with different hit tests.
2170   struct HitTestData* hitTestData[] = {
2171     //                    scale                     touch point           result
2172     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ),  // touch point close to the right edge (inside)
2173     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside)
2174     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.
2175     new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside)
2176     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.
2177     NULL,
2178   };
2179
2180   // get the root layer
2181   Actor actor = Actor::New();
2182   actor.SetAnchorPoint( AnchorPoint::CENTER );
2183   actor.SetParentOrigin( ParentOrigin::CENTER );
2184
2185   Stage::GetCurrent().Add( actor );
2186
2187   gTouchCallBackCalled = false;
2188
2189   unsigned int index = 0;
2190   while( NULL != hitTestData[index] )
2191   {
2192     actor.SetSize( 1.f, 1.f );
2193     actor.SetScale( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z );
2194
2195     // flush the queue and render once
2196     application.SendNotification();
2197     application.Render();
2198
2199     DALI_TEST_CHECK( !gTouchCallBackCalled );
2200
2201     // connect to its touch signal
2202     actor.TouchedSignal().Connect(TestCallback);
2203
2204     Dali::TouchPoint point( 0, TouchPoint::Down, hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y );
2205     Dali::Integration::TouchEvent event;
2206     event.AddPoint( point );
2207
2208     // flush the queue and render once
2209     application.SendNotification();
2210     application.Render();
2211     application.ProcessEvent( event );
2212
2213     DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult );
2214
2215     if( gTouchCallBackCalled != hitTestData[index]->mResult )
2216       tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2217                  hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z,
2218                  hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
2219                  hitTestData[index]->mResult );
2220
2221     gTouchCallBackCalled = false;
2222     ++index;
2223   }
2224   END_TEST;
2225 }
2226
2227 int UtcDaliActorSetDrawMode(void)
2228 {
2229   TestApplication app;
2230   tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2231
2232   Actor a = Actor::New();
2233
2234   Stage::GetCurrent().Add(a);
2235   app.SendNotification();
2236   app.Render(0);
2237   app.SendNotification();
2238   app.Render(1);
2239
2240   DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Ensure overlay is off by default
2241
2242   a.SetDrawMode( DrawMode::OVERLAY_2D );
2243   app.SendNotification();
2244   app.Render(1);
2245
2246   DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetDrawMode() ); // Check Actor is overlay
2247
2248   a.SetDrawMode( DrawMode::STENCIL );
2249   app.SendNotification();
2250   app.Render(1);
2251
2252   DALI_TEST_CHECK( DrawMode::STENCIL == a.GetDrawMode() ); // Check Actor is stencil, not overlay
2253
2254   a.SetDrawMode( DrawMode::NORMAL );
2255   app.SendNotification();
2256   app.Render(1);
2257
2258   DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Check Actor is not stencil
2259   END_TEST;
2260 }
2261
2262 int UtcDaliActorSetDrawModeOverlayRender(void)
2263 {
2264   TestApplication app;
2265   tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2266
2267   app.SendNotification();
2268   app.Render(1);
2269
2270   std::vector<GLuint> ids;
2271   ids.push_back( 8 );   // first rendered actor
2272   ids.push_back( 9 );   // second rendered actor
2273   ids.push_back( 10 );  // third rendered actor
2274   app.GetGlAbstraction().SetNextTextureIds( ids );
2275
2276   BufferImage imageA = BufferImage::New(16, 16);
2277   BufferImage imageB = BufferImage::New(16, 16);
2278   BufferImage imageC = BufferImage::New(16, 16);
2279   Actor a = CreateRenderableActor( imageA );
2280   Actor b = CreateRenderableActor( imageB );
2281   Actor c = CreateRenderableActor( imageC );
2282
2283   // Render a,b,c as regular non-overlays. so order will be:
2284   // a (8)
2285   // b (9)
2286   // c (10)
2287   Stage::GetCurrent().Add(a);
2288   Stage::GetCurrent().Add(b);
2289   Stage::GetCurrent().Add(c);
2290
2291   app.SendNotification();
2292   app.Render(1);
2293
2294   // Should be 3 textures changes.
2295   const std::vector<GLuint>& boundTextures = app.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
2296   typedef std::vector<GLuint>::size_type TextureSize;
2297   DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
2298   if( boundTextures.size() == 3 )
2299   {
2300     DALI_TEST_CHECK( boundTextures[0] == 8u );
2301     DALI_TEST_CHECK( boundTextures[1] == 9u );
2302     DALI_TEST_CHECK( boundTextures[2] == 10u );
2303   }
2304
2305   // Now texture ids have been set, we can monitor their render order.
2306   // render a as an overlay (last), so order will be:
2307   // b (9)
2308   // c (10)
2309   // a (8)
2310   a.SetDrawMode( DrawMode::OVERLAY_2D );
2311   app.GetGlAbstraction().ClearBoundTextures();
2312
2313   app.SendNotification();
2314   app.Render(1);
2315
2316   // Should be 3 texture changes.
2317   DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
2318   if( boundTextures.size() == 3 )
2319   {
2320     DALI_TEST_CHECK( boundTextures[0] == 9u );
2321     DALI_TEST_CHECK( boundTextures[1] == 10u );
2322     DALI_TEST_CHECK( boundTextures[2] == 8u );
2323   }
2324   END_TEST;
2325 }
2326
2327 int UtcDaliActorGetCurrentWorldMatrix(void)
2328 {
2329   TestApplication app;
2330   tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
2331
2332   Actor parent = Actor::New();
2333   parent.SetParentOrigin(ParentOrigin::CENTER);
2334   parent.SetAnchorPoint(AnchorPoint::CENTER);
2335   Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2336   Radian rotationAngle(Degree(85.0f));
2337   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2338   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2339   parent.SetPosition( parentPosition );
2340   parent.SetOrientation( parentRotation );
2341   parent.SetScale( parentScale );
2342   Stage::GetCurrent().Add( parent );
2343
2344   Actor child = Actor::New();
2345   child.SetParentOrigin(ParentOrigin::CENTER);
2346   Vector3 childPosition( 0.0f, 0.0f, 100.0f );
2347   Radian childRotationAngle(Degree(23.0f));
2348   Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
2349   Vector3 childScale( 2.0f, 2.0f, 2.0f );
2350   child.SetPosition( childPosition );
2351   child.SetOrientation( childRotation );
2352   child.SetScale( childScale );
2353   parent.Add( child );
2354
2355   app.SendNotification();
2356   app.Render(0);
2357   app.Render();
2358   app.SendNotification();
2359
2360   Matrix parentMatrix(false);
2361   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2362
2363   Matrix childMatrix(false);
2364   childMatrix.SetTransformComponents( childScale, childRotation, childPosition );
2365
2366   //Child matrix should be the composition of child and parent
2367   Matrix childWorldMatrix(false);
2368   Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix);
2369
2370   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2371   DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), childWorldMatrix, 0.001, TEST_LOCATION );
2372   END_TEST;
2373 }
2374
2375
2376
2377 int UtcDaliActorConstrainedToWorldMatrix(void)
2378 {
2379   TestApplication app;
2380   tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
2381
2382   Actor parent = Actor::New();
2383   parent.SetParentOrigin(ParentOrigin::CENTER);
2384   parent.SetAnchorPoint(AnchorPoint::CENTER);
2385   Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2386   Radian rotationAngle(Degree(85.0f));
2387   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2388   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2389   parent.SetPosition( parentPosition );
2390   parent.SetOrientation( parentRotation );
2391   parent.SetScale( parentScale );
2392   Stage::GetCurrent().Add( parent );
2393
2394   Actor child = Actor::New();
2395   child.SetParentOrigin(ParentOrigin::CENTER);
2396   Constraint posConstraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, PositionComponentConstraint() );
2397   posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) );
2398   posConstraint.Apply();
2399
2400   Stage::GetCurrent().Add( child );
2401
2402   app.SendNotification();
2403   app.Render(0);
2404   app.Render();
2405   app.SendNotification();
2406
2407   Matrix parentMatrix(false);
2408   parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2409
2410   DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2411   DALI_TEST_EQUALS( child.GetCurrentPosition(), parent.GetCurrentPosition(), 0.001, TEST_LOCATION );
2412   END_TEST;
2413 }
2414
2415 int UtcDaliActorConstrainedToOrientation(void)
2416 {
2417   TestApplication app;
2418   tet_infoline(" UtcDaliActorConstrainedToOrientation");
2419
2420   Actor parent = Actor::New();
2421   parent.SetParentOrigin(ParentOrigin::CENTER);
2422   parent.SetAnchorPoint(AnchorPoint::CENTER);
2423   Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2424   Radian rotationAngle(Degree(85.0f));
2425   Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2426   Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2427   parent.SetPosition( parentPosition );
2428   parent.SetOrientation( parentRotation );
2429   parent.SetScale( parentScale );
2430   Stage::GetCurrent().Add( parent );
2431
2432   Actor child = Actor::New();
2433   child.SetParentOrigin(ParentOrigin::CENTER);
2434   Constraint posConstraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() );
2435   posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) );
2436   posConstraint.Apply();
2437
2438   Stage::GetCurrent().Add( child );
2439
2440   app.SendNotification();
2441   app.Render(0);
2442   app.Render();
2443   app.SendNotification();
2444
2445   DALI_TEST_EQUALS( child.GetCurrentOrientation(), parent.GetCurrentOrientation(), 0.001, TEST_LOCATION );
2446   END_TEST;
2447 }
2448
2449 int UtcDaliActorUnparent(void)
2450 {
2451   TestApplication app;
2452   tet_infoline(" UtcDaliActorUnparent");
2453
2454   Actor parent = Actor::New();
2455   Stage::GetCurrent().Add( parent );
2456
2457   Actor child = Actor::New();
2458
2459   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2460   DALI_TEST_CHECK( !child.GetParent() );
2461
2462   // Test that calling Unparent with no parent is a NOOP
2463   child.Unparent();
2464
2465   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2466   DALI_TEST_CHECK( !child.GetParent() );
2467
2468   // Test that Unparent works
2469   parent.Add( child );
2470
2471   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2472   DALI_TEST_CHECK( parent == child.GetParent() );
2473
2474   child.Unparent();
2475
2476   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2477   DALI_TEST_CHECK( !child.GetParent() );
2478
2479   // Test that UnparentAndReset works
2480   parent.Add( child );
2481
2482   DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2483   DALI_TEST_CHECK( parent == child.GetParent() );
2484
2485   UnparentAndReset( child );
2486
2487   DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2488   DALI_TEST_CHECK( !child );
2489
2490   // Test that UnparentAndReset is a NOOP with empty handle
2491   UnparentAndReset( child );
2492
2493   DALI_TEST_CHECK( !child );
2494   END_TEST;
2495 }
2496
2497 int UtcDaliActorGetChildAt(void)
2498 {
2499   TestApplication app;
2500   tet_infoline(" UtcDaliActorGetChildAt");
2501
2502   Actor parent = Actor::New();
2503   Stage::GetCurrent().Add( parent );
2504
2505   Actor child0 = Actor::New();
2506   parent.Add( child0 );
2507
2508   Actor child1 = Actor::New();
2509   parent.Add( child1 );
2510
2511   Actor child2 = Actor::New();
2512   parent.Add( child2 );
2513
2514   DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
2515   DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
2516   DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
2517   END_TEST;
2518 }
2519
2520 int UtcDaliActorSetGetOverlay(void)
2521 {
2522   TestApplication app;
2523   tet_infoline(" UtcDaliActorSetGetOverlay");
2524
2525   Actor parent = Actor::New();
2526   parent.SetDrawMode(DrawMode::OVERLAY_2D );
2527   DALI_TEST_CHECK( parent.GetDrawMode() == DrawMode::OVERLAY_2D );
2528   END_TEST;
2529 }
2530
2531
2532 int UtcDaliActorCreateDestroy(void)
2533 {
2534   Actor* actor = new Actor;
2535   DALI_TEST_CHECK( actor );
2536   delete actor;
2537   END_TEST;
2538 }
2539
2540 namespace
2541 {
2542 struct PropertyStringIndex
2543 {
2544   const char * const name;
2545   const Property::Index index;
2546   const Property::Type type;
2547 };
2548
2549 const PropertyStringIndex PROPERTY_TABLE[] =
2550 {
2551   { "parentOrigin",             Actor::Property::PARENT_ORIGIN,            Property::VECTOR3     },
2552   { "parentOriginX",            Actor::Property::PARENT_ORIGIN_X,          Property::FLOAT       },
2553   { "parentOriginY",            Actor::Property::PARENT_ORIGIN_Y,          Property::FLOAT       },
2554   { "parentOriginZ",            Actor::Property::PARENT_ORIGIN_Z,          Property::FLOAT       },
2555   { "anchorPoint",              Actor::Property::ANCHOR_POINT,             Property::VECTOR3     },
2556   { "anchorPointX",             Actor::Property::ANCHOR_POINT_X,           Property::FLOAT       },
2557   { "anchorPointY",             Actor::Property::ANCHOR_POINT_Y,           Property::FLOAT       },
2558   { "anchorPointZ",             Actor::Property::ANCHOR_POINT_Z,           Property::FLOAT       },
2559   { "size",                     Actor::Property::SIZE,                     Property::VECTOR3     },
2560   { "sizeWidth",                Actor::Property::SIZE_WIDTH,               Property::FLOAT       },
2561   { "sizeHeight",               Actor::Property::SIZE_HEIGHT,              Property::FLOAT       },
2562   { "sizeDepth",                Actor::Property::SIZE_DEPTH,               Property::FLOAT       },
2563   { "position",                 Actor::Property::POSITION,                 Property::VECTOR3     },
2564   { "positionX",                Actor::Property::POSITION_X,               Property::FLOAT       },
2565   { "positionY",                Actor::Property::POSITION_Y,               Property::FLOAT       },
2566   { "positionZ",                Actor::Property::POSITION_Z,               Property::FLOAT       },
2567   { "worldPosition",            Actor::Property::WORLD_POSITION,           Property::VECTOR3     },
2568   { "worldPositionX",           Actor::Property::WORLD_POSITION_X,         Property::FLOAT       },
2569   { "worldPositionY",           Actor::Property::WORLD_POSITION_Y,         Property::FLOAT       },
2570   { "worldPositionZ",           Actor::Property::WORLD_POSITION_Z,         Property::FLOAT       },
2571   { "orientation",              Actor::Property::ORIENTATION,              Property::ROTATION    },
2572   { "worldOrientation",         Actor::Property::WORLD_ORIENTATION,        Property::ROTATION    },
2573   { "scale",                    Actor::Property::SCALE,                    Property::VECTOR3     },
2574   { "scaleX",                   Actor::Property::SCALE_X,                  Property::FLOAT       },
2575   { "scaleY",                   Actor::Property::SCALE_Y,                  Property::FLOAT       },
2576   { "scaleZ",                   Actor::Property::SCALE_Z,                  Property::FLOAT       },
2577   { "worldScale",               Actor::Property::WORLD_SCALE,              Property::VECTOR3     },
2578   { "visible",                  Actor::Property::VISIBLE,                  Property::BOOLEAN     },
2579   { "color",                    Actor::Property::COLOR,                    Property::VECTOR4     },
2580   { "colorRed",                 Actor::Property::COLOR_RED,                Property::FLOAT       },
2581   { "colorGreen",               Actor::Property::COLOR_GREEN,              Property::FLOAT       },
2582   { "colorBlue",                Actor::Property::COLOR_BLUE,               Property::FLOAT       },
2583   { "colorAlpha",               Actor::Property::COLOR_ALPHA,              Property::FLOAT       },
2584   { "worldColor",               Actor::Property::WORLD_COLOR,              Property::VECTOR4     },
2585   { "worldMatrix",              Actor::Property::WORLD_MATRIX,             Property::MATRIX      },
2586   { "name",                     Actor::Property::NAME,                     Property::STRING      },
2587   { "sensitive",                Actor::Property::SENSITIVE,                Property::BOOLEAN     },
2588   { "leaveRequired",            Actor::Property::LEAVE_REQUIRED,           Property::BOOLEAN     },
2589   { "inheritOrientation",       Actor::Property::INHERIT_ORIENTATION,      Property::BOOLEAN     },
2590   { "inheritScale",             Actor::Property::INHERIT_SCALE,            Property::BOOLEAN     },
2591   { "colorMode",                Actor::Property::COLOR_MODE,               Property::STRING      },
2592   { "positionInheritance",      Actor::Property::POSITION_INHERITANCE,     Property::STRING      },
2593   { "drawMode",                 Actor::Property::DRAW_MODE,                Property::STRING      },
2594   { "sizeModeFactor",           Actor::Property::SIZE_MODE_FACTOR,         Property::VECTOR3     },
2595   { "widthResizePolicy",        Actor::Property::WIDTH_RESIZE_POLICY,      Property::STRING      },
2596   { "heightResizePolicy",       Actor::Property::HEIGHT_RESIZE_POLICY,     Property::STRING      },
2597   { "sizeScalePolicy",          Actor::Property::SIZE_SCALE_POLICY,        Property::STRING      },
2598   { "widthForHeight",           Actor::Property::WIDTH_FOR_HEIGHT,         Property::BOOLEAN     },
2599   { "heightForWidth",           Actor::Property::HEIGHT_FOR_WIDTH,         Property::BOOLEAN     },
2600   { "padding",                  Actor::Property::PADDING,                  Property::VECTOR4     },
2601   { "minimumSize",              Actor::Property::MINIMUM_SIZE,             Property::VECTOR2     },
2602   { "maximumSize",              Actor::Property::MAXIMUM_SIZE,             Property::VECTOR2     },
2603 };
2604 const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
2605 } // unnamed namespace
2606
2607 int UtcDaliActorProperties(void)
2608 {
2609   TestApplication app;
2610
2611   Actor actor = Actor::New();
2612
2613   for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
2614   {
2615     tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index );
2616     DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION );
2617     DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION );
2618     DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION );
2619   }
2620   END_TEST;
2621 }
2622
2623 int UtcDaliRelayoutProperties_ResizePolicies(void)
2624 {
2625   TestApplication app;
2626
2627   Actor actor = Actor::New();
2628
2629   // Defaults
2630   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2631   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2632
2633   // Set resize policy for all dimensions
2634   actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
2635   for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
2636   {
2637     DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
2638   }
2639
2640   // Set individual dimensions
2641   const char* const widthPolicy = "FILL_TO_PARENT";
2642   const char* const heightPolicy = "FIXED";
2643
2644   actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy );
2645   actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy );
2646
2647   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
2648   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
2649
2650   END_TEST;
2651 }
2652
2653 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
2654 {
2655   TestApplication app;
2656
2657   Actor actor = Actor::New();
2658
2659   // Defaults
2660   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), "USE_SIZE_SET", TEST_LOCATION );
2661   DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
2662
2663   SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
2664   actor.SetSizeScalePolicy( policy );
2665   DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), policy, TEST_LOCATION );
2666
2667   // Set
2668   const char* const policy1 = "FIT_WITH_ASPECT_RATIO";
2669   const char* const policy2 = "FILL_WITH_ASPECT_RATIO";
2670
2671   actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
2672   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy1, TEST_LOCATION );
2673
2674   actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
2675   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy2, TEST_LOCATION );
2676
2677   END_TEST;
2678 }
2679
2680 int UtcDaliRelayoutProperties_SizeModeFactor(void)
2681 {
2682   TestApplication app;
2683
2684   Actor actor = Actor::New();
2685
2686   // Defaults
2687   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2688   DALI_TEST_EQUALS( actor.GetSizeModeFactor(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2689
2690   Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
2691   actor.SetSizeModeFactor( sizeMode );
2692   DALI_TEST_EQUALS( actor.GetSizeModeFactor(), sizeMode, TEST_LOCATION );
2693
2694   // Set
2695   Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
2696
2697   actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
2698   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
2699
2700   END_TEST;
2701 }
2702
2703 int UtcDaliRelayoutProperties_DimensionDependency(void)
2704 {
2705   TestApplication app;
2706
2707   Actor actor = Actor::New();
2708
2709   // Defaults
2710   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2711   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
2712
2713   // Set
2714   actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
2715   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
2716
2717   actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
2718   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
2719
2720   // Test setting another resize policy
2721   actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
2722   DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2723
2724   END_TEST;
2725 }
2726
2727 int UtcDaliRelayoutProperties_Padding(void)
2728 {
2729   TestApplication app;
2730
2731   Actor actor = Actor::New();
2732
2733   // Data
2734   Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
2735
2736   // PADDING
2737   actor.SetProperty( Actor::Property::PADDING, padding );
2738   Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
2739
2740   DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2741
2742   END_TEST;
2743 }
2744
2745 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
2746 {
2747   TestApplication app;
2748
2749   Actor actor = Actor::New();
2750
2751   // Data
2752   Vector2 minSize( 1.0f, 2.0f );
2753
2754   actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
2755   Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
2756
2757   DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2758
2759   Vector2 maxSize( 3.0f, 4.0f );
2760
2761   actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
2762   Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
2763
2764   DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2765
2766   END_TEST;
2767 }
2768
2769 int UtcDaliActorGetHeightForWidth(void)
2770 {
2771   TestApplication app;
2772
2773   Actor actor = Actor::New();
2774
2775   DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
2776
2777   END_TEST;
2778 }
2779
2780 int UtcDaliActorGetWidthForHeight(void)
2781 {
2782   TestApplication app;
2783
2784   Actor actor = Actor::New();
2785
2786   DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
2787
2788   END_TEST;
2789 }
2790
2791 int UtcDaliActorGetRelayoutSize(void)
2792 {
2793   TestApplication app;
2794
2795   Actor actor = Actor::New();
2796
2797   // Add actor to stage
2798   Stage::GetCurrent().Add( actor );
2799
2800   DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
2801
2802   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
2803   actor.SetSize( Vector2( 1.0f, 0.0f ) );
2804
2805   // Flush the queue and render once
2806   app.SendNotification();
2807   app.Render();
2808
2809   DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
2810
2811   END_TEST;
2812 }
2813
2814 int UtcDaliActorSetPadding(void)
2815 {
2816   TestApplication app;
2817
2818   Actor actor = Actor::New();
2819
2820   Padding padding;
2821   actor.GetPadding( padding );
2822
2823   DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
2824   DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
2825   DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
2826   DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
2827
2828   Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
2829   actor.SetPadding( padding2 );
2830
2831   actor.GetPadding( padding );
2832
2833   DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
2834   DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
2835   DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
2836   DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
2837
2838   END_TEST;
2839 }
2840
2841 int UtcDaliActorSetMinimumSize(void)
2842 {
2843   TestApplication app;
2844
2845   Actor actor = Actor::New();
2846
2847   Vector2 size = actor.GetMinimumSize();
2848
2849   DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
2850   DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
2851
2852   Vector2 size2( 1.0f, 2.0f );
2853   actor.SetMinimumSize( size2 );
2854
2855   size = actor.GetMinimumSize();
2856
2857   DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
2858   DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
2859
2860   END_TEST;
2861 }
2862
2863 int UtcDaliActorSetMaximumSize(void)
2864 {
2865   TestApplication app;
2866
2867   Actor actor = Actor::New();
2868
2869   Vector2 size = actor.GetMaximumSize();
2870
2871   DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
2872   DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
2873
2874   Vector2 size2( 1.0f, 2.0f );
2875   actor.SetMaximumSize( size2 );
2876
2877   size = actor.GetMaximumSize();
2878
2879   DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
2880   DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
2881
2882   END_TEST;
2883 }
2884
2885 int UtcDaliActorOnRelayoutSignal(void)
2886 {
2887   tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
2888
2889   TestApplication application;
2890
2891   // Clean test data
2892   gOnRelayoutCallBackCalled = false;
2893   gActorNamesRelayout.clear();
2894
2895   Actor actor = Actor::New();
2896   actor.SetName( "actor" );
2897   actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
2898
2899   // Sanity check
2900   DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
2901
2902   // Add actor to stage
2903   Stage::GetCurrent().Add( actor );
2904
2905   actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
2906   actor.SetSize( Vector2( 1.0f, 2.0 ) );
2907
2908   // Flush the queue and render once
2909   application.SendNotification();
2910   application.Render();
2911
2912   // OnRelayout emitted
2913   DALI_TEST_EQUALS(  gOnRelayoutCallBackCalled, true, TEST_LOCATION );
2914   DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
2915
2916   END_TEST;
2917 }
2918
2919 int UtcDaliActorGetHierachyDepth(void)
2920 {
2921   TestApplication application;
2922   tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
2923
2924
2925   /* Build tree of actors:
2926    *
2927    *                      Depth
2928    *
2929    *       A (parent)       1
2930    *      / \
2931    *     B   C              2`
2932    *    / \   \
2933    *   D   E   F            3
2934    *
2935    * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
2936    */
2937   Stage stage( Stage::GetCurrent() );
2938
2939   Actor actorA = Actor::New();
2940   Actor actorB = Actor::New();
2941   Actor actorC = Actor::New();
2942   Actor actorD = Actor::New();
2943   Actor actorE = Actor::New();
2944   Actor actorF = Actor::New();
2945
2946   //Test that root actor has depth equal 0
2947   DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetHierarchyDepth(), TEST_LOCATION );
2948
2949   //Test actors return depth -1 when not connected to the tree
2950   DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
2951   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
2952   DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
2953   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
2954   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
2955   DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
2956
2957   //Create the hierarchy
2958   stage.Add( actorA );
2959   actorA.Add( actorB );
2960   actorA.Add( actorC );
2961   actorB.Add( actorD );
2962   actorB.Add( actorE );
2963   actorC.Add( actorF );
2964
2965   //Test actors return correct depth
2966   DALI_TEST_EQUALS( 1, actorA.GetHierarchyDepth(), TEST_LOCATION );
2967   DALI_TEST_EQUALS( 2, actorB.GetHierarchyDepth(), TEST_LOCATION );
2968   DALI_TEST_EQUALS( 2, actorC.GetHierarchyDepth(), TEST_LOCATION );
2969   DALI_TEST_EQUALS( 3, actorD.GetHierarchyDepth(), TEST_LOCATION );
2970   DALI_TEST_EQUALS( 3, actorE.GetHierarchyDepth(), TEST_LOCATION );
2971   DALI_TEST_EQUALS( 3, actorF.GetHierarchyDepth(), TEST_LOCATION );
2972
2973   //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
2974   actorA.Remove( actorB );
2975
2976   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
2977   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
2978   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
2979
2980   //Removing actorA from the stage. All actors should have depth equal -1
2981   stage.Remove( actorA );
2982
2983   DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
2984   DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
2985   DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
2986   DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
2987   DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
2988   DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
2989
2990   END_TEST;
2991 }
2992
2993 int UtcDaliActorAnchorPointPropertyAsString(void)
2994 {
2995   TestApplication application;
2996
2997   Actor actor = Actor::New();
2998
2999   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
3000   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3001
3002   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
3003   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3004
3005   actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
3006   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3007
3008   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
3009   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3010
3011   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
3012   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER, TEST_LOCATION );
3013
3014   actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
3015   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3016
3017   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
3018   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3019
3020   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
3021   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3022
3023   actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
3024   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3025
3026   // Invalid should not change anything
3027   actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
3028   DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3029
3030   END_TEST;
3031 }
3032
3033 int UtcDaliActorParentOriginPropertyAsString(void)
3034 {
3035   TestApplication application;
3036
3037   Actor actor = Actor::New();
3038
3039   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
3040   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3041
3042   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
3043   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3044
3045   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
3046   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3047
3048   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
3049   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3050
3051   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
3052   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER, TEST_LOCATION );
3053
3054   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
3055   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3056
3057   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
3058   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3059
3060   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
3061   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3062
3063   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
3064   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3065
3066   // Invalid should not change anything
3067   actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
3068   DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3069
3070   END_TEST;
3071 }
3072
3073 int UtcDaliActorColorModePropertyAsString(void)
3074 {
3075   TestApplication application;
3076
3077   Actor actor = Actor::New();
3078
3079   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
3080   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3081
3082   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
3083   DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3084
3085   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
3086   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3087
3088   actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
3089   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3090
3091   // Invalid should not change anything
3092   actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
3093   DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3094
3095   END_TEST;
3096 }
3097
3098 int UtcDaliActorPositionInheritancePropertyAsString(void)
3099 {
3100   TestApplication application;
3101
3102   Actor actor = Actor::New();
3103
3104   actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INHERIT_PARENT_POSITION" );
3105   DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
3106
3107   actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION" );
3108   DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
3109
3110   actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION_PLUS_LOCAL_POSITION" );
3111   DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
3112
3113   actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "DONT_INHERIT_POSITION" );
3114   DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3115
3116   // Invalid should not change anything
3117   actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INVALID_ARG" );
3118   DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3119
3120   END_TEST;
3121 }
3122
3123 int UtcDaliActorDrawModePropertyAsString(void)
3124 {
3125   TestApplication application;
3126
3127   Actor actor = Actor::New();
3128
3129   actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
3130   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3131
3132   actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
3133   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3134
3135   actor.SetProperty( Actor::Property::DRAW_MODE, "STENCIL" );
3136   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3137
3138   // Invalid should not change anything
3139   actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
3140   DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3141
3142   END_TEST;
3143 }