Merge "Remove String::EMPTY" into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-CustomActor.cpp
1 /*
2  * Copyright (c) 2014 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 <iostream>
19 #include <stdlib.h>
20 #include <dali/public-api/dali-core.h>
21
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali/integration-api/events/hover-event-integ.h>
24 #include <dali/integration-api/events/wheel-event-integ.h>
25 #include <dali/integration-api/events/key-event-integ.h>
26
27 #include "dali-test-suite-utils/dali-test-suite-utils.h"
28
29 using namespace Dali;
30
31
32 void custom_actor_test_startup(void)
33 {
34   test_return_value = TET_UNDEF;
35 }
36
37 void custom_actor_test_cleanup(void)
38 {
39   test_return_value = TET_PASS;
40 }
41
42 namespace
43 {
44
45 std::vector< std::string > MasterCallStack;
46 bool gOnRelayout = false;
47
48 } // anon namespace
49
50 // TypeRegistry needs custom actor Implementations to have the same name (namespaces are ignored so we use one here)
51 namespace Impl
52 {
53
54 struct TestCustomActor : public CustomActorImpl
55 {
56   /**
57    * Constructor
58    */
59   TestCustomActor()
60   : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ),
61     mDaliProperty( Property::INVALID_INDEX ),
62     mSizeSet( Vector3::ZERO ),
63     mTargetSize( Vector3::ZERO ),
64     mNego( false )
65   {
66   }
67
68   TestCustomActor(bool nego)
69   : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ),
70     mDaliProperty( Property::INVALID_INDEX ),
71     mSizeSet( Vector3::ZERO ),
72     mTargetSize( Vector3::ZERO ),
73     mNego( nego )
74   {
75   }
76   /**
77    * Destructor
78    */
79   virtual ~TestCustomActor()
80   {
81   }
82
83   void Initialize( const char* name = NULL )
84   {
85     mDaliProperty = Self().RegisterProperty( "Dali", std::string("no"), Property::READ_WRITE);
86
87     OnInitialize( name );
88   }
89
90   virtual void OnInitialize( const char* name ) {}
91
92   /**
93    * Resets the call stack
94    */
95   void ResetCallStack()
96   {
97     mSizeSet = Vector3();
98     mTargetSize = Vector3();
99     mMethodsCalled.clear();
100   }
101
102   void AddToCallStacks( const char* method )
103   {
104     mMethodsCalled.push_back( method );
105
106     // Combine Actor name with method string
107     std::string nameAndMethod( Self().GetName() );
108     if ( 0 == nameAndMethod.size() )
109     {
110       nameAndMethod = "Unknown: ";
111     }
112     else
113     {
114       nameAndMethod += ": ";
115     }
116     nameAndMethod += method;
117
118     MasterCallStack.push_back( nameAndMethod );
119   }
120
121   // From CustomActorImpl
122   virtual void OnStageConnection()
123   {
124     AddToCallStacks("OnStageConnection");
125   }
126   virtual void OnStageDisconnection()
127   {
128     AddToCallStacks("OnStageDisconnection");
129   }
130   virtual void OnChildAdd(Actor& child)
131   {
132     AddToCallStacks("OnChildAdd");
133   }
134   virtual void OnChildRemove(Actor& child)
135   {
136     AddToCallStacks("OnChildRemove");
137   }
138   virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
139   {
140     AddToCallStacks("OnPropertySet");
141   }
142   virtual void OnSizeSet(const Vector3& targetSize)
143   {
144     mSizeSet = targetSize;
145     AddToCallStacks("OnSizeSet");
146   }
147   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
148   {
149     mTargetSize = targetSize;
150     AddToCallStacks("OnSizeAnimation");
151   }
152   virtual bool OnTouchEvent(const TouchEvent& event)
153   {
154     AddToCallStacks("OnTouchEvent");
155     return true;
156   }
157   virtual bool OnHoverEvent(const HoverEvent& event)
158   {
159     AddToCallStacks("OnHoverEvent");
160     return true;
161   }
162   virtual bool OnWheelEvent(const WheelEvent& event)
163   {
164     AddToCallStacks("OnWheelEvent");
165     return true;
166   }
167   virtual bool OnKeyEvent(const KeyEvent& event)
168   {
169     AddToCallStacks("OnKeyEvent");
170     return true;
171   }
172   virtual void OnKeyInputFocusGained()
173   {
174     AddToCallStacks("OnKeyInputFocusGained");
175   }
176   virtual void OnKeyInputFocusLost()
177   {
178     AddToCallStacks("OnKeyInputFocusLost");
179   }
180   virtual Vector3 GetNaturalSize()
181   {
182     return Vector3( 0.0f, 0.0f, 0.0f );
183   }
184
185   virtual float GetHeightForWidth( float width )
186   {
187     return 0.0f;
188   }
189
190   virtual float GetWidthForHeight( float height )
191   {
192     return 0.0f;
193   }
194
195   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
196   {
197     gOnRelayout = true;
198   }
199
200   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
201   {
202   }
203
204   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
205   {
206   }
207
208   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
209   {
210     return 0.0f;
211   }
212
213   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
214   {
215   }
216
217   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
218   {
219     return false;
220   }
221
222   void SetDaliProperty(std::string s)
223   {
224     Self().SetProperty(mDaliProperty, s) ;
225   }
226   void TestRelayoutRequest()
227   {
228     RelayoutRequest();
229   }
230
231   float TestGetHeightForWidthBase( float width )
232   {
233     return GetHeightForWidthBase( width );
234   }
235
236   float TestGetWidthForHeightBase( float height )
237   {
238     return GetWidthForHeightBase( height );
239   }
240
241   float TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
242   {
243     return CalculateChildSizeBase( child, dimension );
244   }
245
246   bool TestRelayoutDependentOnChildrenBase( Dimension::Type dimension )
247   {
248     return RelayoutDependentOnChildrenBase( dimension );
249   }
250
251   Property::Index mDaliProperty;
252   std::vector< std::string > mMethodsCalled;
253   Vector3 mSizeSet;
254   Vector3 mTargetSize;
255   bool mNego;
256 };
257
258 /**
259  * Variant which adds a new child during OnStageConnection
260  */
261 struct TestCustomActorVariant1 : public TestCustomActor
262 {
263   /**
264    * Constructor
265    */
266   TestCustomActorVariant1( Actor childToAdd )
267   : mChildToAdd( childToAdd )
268   {
269   }
270
271   // From CustomActorImpl
272   virtual void OnStageConnection()
273   {
274     // Chain up first
275     TestCustomActor::OnStageConnection();
276
277     // Add the child
278     Self().Add( mChildToAdd );
279   }
280
281   Actor mChildToAdd;
282 };
283
284 /**
285  * Variant which removes children during OnStageConnection
286  */
287 struct TestCustomActorVariant2 : public TestCustomActor
288 {
289   /**
290    * Constructor
291    */
292   TestCustomActorVariant2()
293   {
294   }
295
296   // From CustomActorImpl
297   virtual void OnStageConnection()
298   {
299     // Chain up first
300     TestCustomActor::OnStageConnection();
301
302     // Remove all the children
303     for( unsigned int i=0, num=Self().GetChildCount(); i<num; ++i )
304     {
305       Self().Remove( Self().GetChildAt(0) );
306     }
307   }
308 };
309
310 /**
311  * Variant which adds a new child during OnStageDisconnection
312  */
313 struct TestCustomActorVariant3 : public TestCustomActor
314 {
315   /**
316    * Constructor
317    */
318   TestCustomActorVariant3( Actor childToAdd )
319   : mChildToAdd( childToAdd )
320   {
321   }
322
323   // From CustomActorImpl
324   virtual void OnStageDisconnection()
325   {
326     // Chain up first
327     TestCustomActor::OnStageDisconnection();
328
329     // Add the child
330     Self().Add( mChildToAdd );
331   }
332
333   Actor mChildToAdd;
334 };
335
336 /**
337  * Variant which removes children during OnStageDisconnection
338  */
339 struct TestCustomActorVariant4 : public TestCustomActor
340 {
341   /**
342    * Constructor
343    */
344   TestCustomActorVariant4()
345   {
346   }
347
348   // From CustomActorImpl
349   virtual void OnStageDisconnection()
350   {
351     // Chain up first
352     TestCustomActor::OnStageDisconnection();
353
354     // Remove all the children
355     for( unsigned int i=0, num=Self().GetChildCount(); i<num; ++i )
356     {
357       Self().Remove( Self().GetChildAt(0) );
358     }
359   }
360 };
361
362 /**
363  * Variant which removes its parent from Stage during OnStageConnection
364  */
365 struct TestCustomActorVariant5 : public TestCustomActor
366 {
367   /**
368    * Constructor
369    */
370   TestCustomActorVariant5()
371   {
372   }
373
374   // From CustomActorImpl
375   virtual void OnStageConnection()
376   {
377     // Chain up first
378     TestCustomActor::OnStageConnection();
379
380     // Take parent off-stage
381     Actor parent = Self().GetParent();
382     if ( parent )
383     {
384       Stage::GetCurrent().Remove( parent );
385     }
386   }
387 };
388
389 /**
390  * Variant which adds its parent to Stage during OnStageDisconnection
391  */
392 struct TestCustomActorVariant6 : public TestCustomActor
393 {
394   /**
395    * Constructor
396    */
397   TestCustomActorVariant6()
398   {
399   }
400
401   // From CustomActorImpl
402   virtual void OnStageDisconnection()
403   {
404     // Chain up first
405     TestCustomActor::OnStageDisconnection();
406
407     // Put parent on-stage
408     Actor parent = Self().GetParent();
409     if ( parent )
410     {
411       Stage::GetCurrent().Add( parent );
412     }
413   }
414 };
415
416 /**
417  * Variant which reparents its children into a separate container
418  */
419 struct TestCustomActorVariant7 : public TestCustomActor
420 {
421   /**
422    * Constructor
423    */
424   TestCustomActorVariant7()
425   {
426   }
427
428   virtual void OnInitialize( const char* name )
429   {
430     // We need to do this early, before the OnChildAdd is recorded
431     Self().SetName( name );
432
433     mContainer = Actor::New();
434     mContainer.SetName( "Container" );
435     Self().Add( mContainer );
436   }
437
438   // From CustomActorImpl
439   virtual void OnChildAdd(Actor& child)
440   {
441     // Chain up first
442     TestCustomActor::OnChildAdd(child);
443
444     // Reparent child
445     if ( child != mContainer )
446     {
447       mContainer.Add( child );
448     }
449   }
450
451   Actor mContainer;
452 };
453
454 /**
455  * Variant which attempts to interfere with the reparenting of a child to another container
456  */
457 struct TestCustomActorVariant8 : public TestCustomActor
458 {
459   /**
460    * Constructor
461    */
462   TestCustomActorVariant8( Actor rival )
463   : mRivalContainer( rival )
464   {
465   }
466
467   // From CustomActorImpl
468   virtual void OnChildRemove(Actor& child)
469   {
470     // Chain up first
471     TestCustomActor::OnChildRemove(child);
472
473     mRivalContainer.Remove( child ); // attempt to block reparenting to rival (should be a NOOP)
474   }
475
476   Actor mRivalContainer;
477 };
478
479 // Need a class that doesn't override virtual methods
480 class SimpleTestCustomActor : public CustomActorImpl
481 {
482 public:
483
484   /**
485    * Constructor
486    */
487   SimpleTestCustomActor()
488   : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | DISABLE_SIZE_NEGOTIATION ) )
489   {
490   }
491
492   /**
493    * Destructor
494    */
495   virtual ~SimpleTestCustomActor()
496   {
497   }
498
499   // From CustomActorImpl
500   virtual void OnStageConnection()
501   {
502   }
503   virtual void OnStageDisconnection()
504   {
505   }
506   virtual void OnChildAdd(Actor& child)
507   {
508   }
509   virtual void OnChildRemove(Actor& child)
510   {
511   }
512   virtual void OnSizeSet(const Vector3& targetSize)
513   {
514   }
515   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
516   {
517   }
518   virtual bool OnTouchEvent(const TouchEvent& event)
519   {
520     return true;
521   }
522   virtual bool OnHoverEvent(const HoverEvent& event)
523   {
524     return true;
525   }
526   virtual bool OnWheelEvent(const WheelEvent& event)
527   {
528     return true;
529   }
530   virtual bool OnKeyEvent(const KeyEvent& event)
531   {
532     return true;
533   }
534   virtual void OnKeyInputFocusGained()
535   {
536   }
537   virtual void OnKeyInputFocusLost()
538   {
539   }
540
541   virtual Vector3 GetNaturalSize()
542   {
543     return Vector3( 0.0f, 0.0f, 0.0f );
544   }
545
546   virtual float GetHeightForWidth( float width )
547   {
548     return 0.0f;
549   }
550
551   virtual float GetWidthForHeight( float height )
552   {
553     return 0.0f;
554   }
555
556   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
557   {
558   }
559
560   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
561   {
562   }
563
564   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
565   {
566   }
567
568   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
569   {
570     return 0.0f;
571   }
572
573   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
574   {
575   }
576
577   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
578   {
579     return false;
580   }
581 };
582
583 } ; // namespace Impl
584
585
586 namespace
587 {
588
589 /**
590  * Test custom actor handle
591  */
592 class TestCustomActor : public CustomActor
593 {
594 public:
595
596   static TestCustomActor New()
597   {
598     Impl::TestCustomActor* impl = new Impl::TestCustomActor;
599     TestCustomActor custom( *impl ); // takes ownership
600
601     impl->Initialize();
602
603     return custom;
604   }
605
606   static TestCustomActor NewNegoSize()
607   {
608     Impl::TestCustomActor* impl = new Impl::TestCustomActor( true );
609     TestCustomActor custom( *impl ); // takes ownership
610
611     impl->Initialize();
612
613     return custom;
614   }
615
616   static TestCustomActor NewVariant1( Actor childToAdd )
617   {
618     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1( childToAdd );
619     TestCustomActor custom( *impl ); // takes ownership
620
621     impl->Initialize();
622
623     return custom;
624   }
625
626   static TestCustomActor NewVariant2()
627   {
628     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant2();
629     TestCustomActor custom( *impl ); // takes ownership
630
631     impl->Initialize();
632
633     return custom;
634   }
635
636   static TestCustomActor NewVariant3( Actor childToAdd )
637   {
638     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3( childToAdd );
639     TestCustomActor custom( *impl ); // takes ownership
640
641     impl->Initialize();
642
643     return custom;
644   }
645
646   static TestCustomActor NewVariant4()
647   {
648     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant4();
649     TestCustomActor custom( *impl ); // takes ownership
650
651     impl->Initialize();
652
653     return custom;
654   }
655
656   static TestCustomActor NewVariant5()
657   {
658     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant5();
659     TestCustomActor custom( *impl ); // takes ownership
660
661     impl->Initialize();
662
663     return custom;
664   }
665
666   static TestCustomActor NewVariant6()
667   {
668     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant6();
669     TestCustomActor custom( *impl ); // takes ownership
670
671     impl->Initialize();
672
673     return custom;
674   }
675
676   static TestCustomActor NewVariant7( const char* name )
677   {
678     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant7();
679     TestCustomActor custom( *impl ); // takes ownership
680
681     impl->Initialize( name );
682
683     return custom;
684   }
685
686   static TestCustomActor NewVariant8( Actor rival )
687   {
688     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8( rival );
689     TestCustomActor custom( *impl ); // takes ownership
690
691     impl->Initialize();
692
693     return custom;
694   }
695
696   virtual ~TestCustomActor()
697   {
698   }
699
700   Impl::TestCustomActor& GetImpl()
701   {
702     return static_cast<Impl::TestCustomActor&>(GetImplementation());
703   }
704
705   std::vector< std::string >& GetMethodsCalled()
706   {
707     return GetImpl().mMethodsCalled;
708   }
709
710   void ResetCallStack()
711   {
712     GetImpl().ResetCallStack();
713   }
714
715   void SetDaliProperty(std::string s)
716   {
717     GetImpl().SetDaliProperty(s);
718   }
719
720   Vector3 GetSize()
721   {
722     return GetImpl().mSizeSet;
723   }
724
725   Vector3 GetTargetSize()
726   {
727     return GetImpl().mTargetSize;
728   }
729
730   virtual Vector3 GetNaturalSize()
731   {
732     return Vector3( 0.0f, 0.0f, 0.0f );
733   }
734
735   virtual float GetHeightForWidth( float width )
736   {
737     return 0.0f;
738   }
739
740   virtual float GetWidthForHeight( float height )
741   {
742     return 0.0f;
743   }
744
745   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
746   {
747   }
748
749   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
750   {
751   }
752
753   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
754   {
755   }
756
757   void TestRelayoutRequest()
758   {
759     GetImpl().TestRelayoutRequest();
760   }
761
762   float TestGetHeightForWidthBase( float width )
763   {
764     return GetImpl().TestGetHeightForWidthBase( width );
765   }
766
767   float TestGetWidthForHeightBase( float height )
768   {
769     return GetImpl().TestGetWidthForHeightBase( height );
770   }
771
772   float TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
773   {
774     return GetImpl().TestCalculateChildSizeBase( child, dimension );
775   }
776
777   bool TestRelayoutDependentOnChildrenBase( Dimension::Type dimension )
778   {
779     return GetImpl().TestRelayoutDependentOnChildrenBase( dimension );
780   }
781
782 private:
783
784   TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl )
785   {
786   }
787 };
788
789
790
791 using namespace Dali;
792
793 BaseHandle CreateActor()
794 {
795   return TestCustomActor::New();
796 }
797
798 Dali::TypeRegistration mType( typeid(TestCustomActor), typeid(Dali::CustomActor), CreateActor );
799
800 } // anon namespace
801
802
803 int UtcDaliCustomActorDestructor(void)
804 {
805   TestApplication application;
806
807   CustomActor* actor = new CustomActor();
808   delete actor;
809
810   DALI_TEST_CHECK( true );
811   END_TEST;
812 }
813
814 int UtcDaliCustomActorImplDestructor(void)
815 {
816   TestApplication application;
817   CustomActorImpl* actor = new Impl::TestCustomActor();
818   delete actor;
819
820   DALI_TEST_CHECK( true );
821   END_TEST;
822 }
823
824 // Positive test case for a method
825 int UtcDaliCustomActorDownCast(void)
826 {
827   TestApplication application;
828   tet_infoline("Testing Dali::CustomActor::DownCast()");
829
830   TestCustomActor custom = TestCustomActor::New();
831
832   Actor anActor = Actor::New();
833   anActor.Add( custom );
834
835   Actor child = anActor.GetChildAt(0);
836   CustomActor customActor = CustomActor::DownCast( child );
837   DALI_TEST_CHECK( customActor );
838
839   customActor = NULL;
840   DALI_TEST_CHECK( !customActor );
841
842   customActor = DownCast< CustomActor >( child );
843   DALI_TEST_CHECK( customActor );
844   END_TEST;
845 }
846
847 // Negative test case for a method
848 int UtcDaliCustomActorDownCastNegative(void)
849 {
850   TestApplication application;
851   tet_infoline("Testing Dali::CustomActor::DownCast()");
852
853   Actor actor1 = Actor::New();
854   Actor anActor = Actor::New();
855   anActor.Add(actor1);
856
857   Actor child = anActor.GetChildAt(0);
858   CustomActor customActor = CustomActor::DownCast( child );
859   DALI_TEST_CHECK( !customActor );
860
861   Actor unInitialzedActor;
862   customActor = CustomActor::DownCast( unInitialzedActor );
863   DALI_TEST_CHECK( !customActor );
864
865   customActor = DownCast< CustomActor >( unInitialzedActor );
866   DALI_TEST_CHECK( !customActor );
867   END_TEST;
868 }
869
870 int UtcDaliCustomActorOnStageConnectionDisconnection(void)
871 {
872   TestApplication application;
873   tet_infoline("Testing Dali::CustomActor::OnStageConnection() & OnStageDisconnection");
874
875   TestCustomActor custom = TestCustomActor::New();
876   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
877
878   // add the custom actor to stage
879   Stage::GetCurrent().Add( custom );
880
881   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
882   DALI_TEST_EQUALS( "OnStageConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
883
884   Stage::GetCurrent().Remove( custom );
885
886   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
887   DALI_TEST_EQUALS( "OnStageDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
888
889   // Excercise the message passing to Update thread
890
891   application.SendNotification();
892   application.Render();
893   application.Render();
894   END_TEST;
895 }
896
897 int UtcDaliCustomActorOnStageConnectionOrder(void)
898 {
899   TestApplication application;
900   tet_infoline("Testing Dali::CustomActor::OnStageConnection() order");
901
902   MasterCallStack.clear();
903
904   /* Build tree of actors:
905    *
906    *       A (parent)
907    *      / \
908    *     B   C
909    *    / \   \
910    *   D   E   F
911    *
912    * OnStageConnection should be received for A, B, D, E, C, and finally F
913    */
914
915   TestCustomActor actorA = TestCustomActor::New();
916   actorA.SetName( "ActorA" );
917
918   TestCustomActor actorB = TestCustomActor::New();
919   actorB.SetName( "ActorB" );
920   actorA.Add( actorB );
921
922   TestCustomActor actorC = TestCustomActor::New();
923   actorC.SetName( "ActorC" );
924   actorA.Add( actorC );
925
926   TestCustomActor actorD = TestCustomActor::New();
927   actorD.SetName( "ActorD" );
928   actorB.Add( actorD );
929
930   TestCustomActor actorE = TestCustomActor::New();
931   actorE.SetName( "ActorE" );
932   actorB.Add( actorE );
933
934   TestCustomActor actorF = TestCustomActor::New();
935   actorF.SetName( "ActorF" );
936   actorC.Add( actorF );
937
938   // add the custom actor to stage
939   Stage::GetCurrent().Add( actorA );
940
941   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
942   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
943   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
944   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
945
946   DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
947   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
948   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
949   DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
950
951   DALI_TEST_EQUALS( 2, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
952   DALI_TEST_EQUALS( "OnChildAdd",        actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
953   DALI_TEST_EQUALS( "OnStageConnection", actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION );
954
955   DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
956   DALI_TEST_EQUALS( "OnStageConnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
957
958   DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
959   DALI_TEST_EQUALS( "OnStageConnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
960
961   DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
962   DALI_TEST_EQUALS( "OnStageConnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
963
964   // Check sequence is correct in MasterCallStack
965
966   DALI_TEST_EQUALS( 3+3+2+1+1+1, (int)(MasterCallStack.size()), TEST_LOCATION );
967
968   DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION );
969   DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION );
970   DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION );
971   DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 3 ], TEST_LOCATION );
972   DALI_TEST_EQUALS( "ActorC: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
973
974   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 5 ], TEST_LOCATION );
975   DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 6 ], TEST_LOCATION );
976   DALI_TEST_EQUALS( "ActorD: OnStageConnection", MasterCallStack[ 7 ], TEST_LOCATION );
977   DALI_TEST_EQUALS( "ActorE: OnStageConnection", MasterCallStack[ 8 ], TEST_LOCATION );
978   DALI_TEST_EQUALS( "ActorC: OnStageConnection", MasterCallStack[ 9 ], TEST_LOCATION );
979   DALI_TEST_EQUALS( "ActorF: OnStageConnection", MasterCallStack[ 10 ], TEST_LOCATION );
980
981   // Excercise the message passing to Update thread
982
983   application.SendNotification();
984   application.Render();
985   application.Render();
986   END_TEST;
987 }
988
989 int UtcDaliCustomActorOnStageDisconnectionOrder(void)
990 {
991   TestApplication application;
992   tet_infoline("Testing Dali::CustomActor::OnStageDisconnection() order");
993
994   Stage stage = Stage::GetCurrent();
995
996   /* Build tree of actors:
997    *
998    *       A (parent)
999    *      / \
1000    *     B   C
1001    *    / \   \
1002    *   D   E   F
1003    *
1004    * OnStageDisconnection should be received for D, E, B, F, C, and finally A.
1005    */
1006
1007   TestCustomActor actorA = TestCustomActor::New();
1008   actorA.SetName( "ActorA" );
1009   stage.Add( actorA );
1010
1011   TestCustomActor actorB = TestCustomActor::New();
1012   actorB.SetName( "ActorB" );
1013   actorA.Add( actorB );
1014
1015   TestCustomActor actorC = TestCustomActor::New();
1016   actorC.SetName( "ActorC" );
1017   actorA.Add( actorC );
1018
1019   TestCustomActor actorD = TestCustomActor::New();
1020   actorD.SetName( "ActorD" );
1021   actorB.Add( actorD );
1022
1023   TestCustomActor actorE = TestCustomActor::New();
1024   actorE.SetName( "ActorE" );
1025   actorB.Add( actorE );
1026
1027   TestCustomActor actorF = TestCustomActor::New();
1028   actorF.SetName( "ActorF" );
1029   actorC.Add( actorF );
1030
1031   // Excercise the message passing to Update thread
1032
1033   application.SendNotification();
1034   application.Render();
1035   application.Render();
1036
1037   // Clear call stacks before disconnection
1038   actorA.ResetCallStack();
1039   actorB.ResetCallStack();
1040   actorC.ResetCallStack();
1041   actorD.ResetCallStack();
1042   actorE.ResetCallStack();
1043   actorF.ResetCallStack();
1044   MasterCallStack.clear();
1045
1046   stage.Remove( actorA );
1047
1048   DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1049   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1050
1051   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1052   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1053
1054   DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
1055   DALI_TEST_EQUALS( "OnStageDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1056
1057   DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
1058   DALI_TEST_EQUALS( "OnStageDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1059
1060   DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
1061   DALI_TEST_EQUALS( "OnStageDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1062
1063   DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
1064   DALI_TEST_EQUALS( "OnStageDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1065
1066   // Check sequence is correct in MasterCallStack
1067
1068   DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
1069
1070   DALI_TEST_EQUALS( "ActorD: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1071   DALI_TEST_EQUALS( "ActorE: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
1072   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 2 ], TEST_LOCATION );
1073   DALI_TEST_EQUALS( "ActorF: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1074   DALI_TEST_EQUALS( "ActorC: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
1075   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
1076
1077   // Excercise the message passing to Update thread
1078
1079   application.SendNotification();
1080   application.Render();
1081   application.Render();
1082   END_TEST;
1083 }
1084
1085 int UtcDaliCustomActorAddDuringOnStageConnection(void)
1086 {
1087   TestApplication application;
1088   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageConnection() callback");
1089
1090   Stage stage = Stage::GetCurrent();
1091
1092   MasterCallStack.clear();
1093
1094   /* The actorA is a special variant which adds a child to itself during OnStageConnection()
1095    * The actorB is provided as the child
1096    */
1097
1098   TestCustomActor actorB = TestCustomActor::New();
1099   actorB.SetName( "ActorB" );
1100
1101   TestCustomActor actorA = TestCustomActor::NewVariant1( actorB );
1102   actorA.SetName( "ActorA" );
1103   stage.Add( actorA );
1104
1105   // Check callback sequence
1106
1107   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1108   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1109   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // Called from within OnStageConnection()
1110
1111   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1112   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1113
1114   DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
1115
1116   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 0 ], TEST_LOCATION );
1117   DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnStageConnection()
1118   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 2 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnStageConnection()
1119
1120   // Excercise the message passing to Update thread
1121
1122   application.SendNotification();
1123   application.Render();
1124   application.Render();
1125
1126   // Check everything is ok after Actors are removed
1127
1128   stage.Remove( actorA );
1129   application.SendNotification();
1130   application.Render();
1131   application.Render();
1132   END_TEST;
1133 }
1134
1135 int UtcDaliCustomActorRemoveDuringOnStageConnection(void)
1136 {
1137   TestApplication application;
1138   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageConnection() callback");
1139
1140   Stage stage = Stage::GetCurrent();
1141
1142   MasterCallStack.clear();
1143
1144   /* The actorA is a special variant which removes its children during OnStageConnection()
1145    * Actors B & C are provided as the children
1146    */
1147
1148   TestCustomActor actorA = TestCustomActor::NewVariant2();
1149   actorA.SetName( "ActorA" );
1150
1151   TestCustomActor actorB = TestCustomActor::New();
1152   actorB.SetName( "ActorB" );
1153   actorA.Add( actorB );
1154
1155   TestCustomActor actorC = TestCustomActor::New();
1156   actorC.SetName( "ActorC" );
1157   actorA.Add( actorC );
1158
1159   stage.Add( actorA );
1160
1161   // Check callback sequence
1162
1163   DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1164   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1165   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1166   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1167   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // Called from within OnStageConnection()
1168   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnStageConnection()
1169
1170   DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
1171
1172   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 0 ], TEST_LOCATION );
1173   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 1 ], TEST_LOCATION );
1174   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 2 ], TEST_LOCATION );
1175   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 3 ], TEST_LOCATION );
1176   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 4 ], TEST_LOCATION );
1177
1178   /* Actors B & C should be removed before the point where they could receive an OnStageConnection callback
1179    * Therefore they shouldn't receive either OnStageConnection or OnStageDisconnection
1180    */
1181   DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1182   DALI_TEST_EQUALS( 0, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
1183
1184   // Excercise the message passing to Update thread
1185
1186   application.SendNotification();
1187   application.Render();
1188   application.Render();
1189
1190   // Check everything is ok after last actor is removed
1191
1192   stage.Remove( actorA );
1193   application.SendNotification();
1194   application.Render();
1195   application.Render();
1196   END_TEST;
1197 }
1198
1199 int UtcDaliCustomActorAddDuringOnStageDisconnection(void)
1200 {
1201   TestApplication application;
1202   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageDisonnection() callback");
1203
1204   Stage stage = Stage::GetCurrent();
1205
1206   /* The actorA is a special variant which adds a child to itself during OnStageDisconnection()
1207    * The actorB is provided as the child
1208    */
1209
1210   TestCustomActor actorB = TestCustomActor::New();
1211   actorB.SetName( "ActorB" );
1212
1213   TestCustomActor actorA = TestCustomActor::NewVariant3( actorB );
1214   actorA.SetName( "ActorA" );
1215   stage.Add( actorA );
1216
1217   // Excercise the message passing to Update thread
1218
1219   application.SendNotification();
1220   application.Render();
1221   application.Render();
1222
1223   // Clear call stacks before disconnection
1224   actorA.ResetCallStack();
1225   actorB.ResetCallStack();
1226   MasterCallStack.clear();
1227
1228   stage.Remove( actorA );
1229
1230   // Check callback sequence
1231
1232   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1233   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1234   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1235
1236   // Child was added after parent disconnection, so should not receive OnStageConnection()
1237   DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1238
1239   DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION );
1240
1241   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1242   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 1 ], TEST_LOCATION );
1243
1244   // Excercise the message passing to Update thread
1245
1246   application.SendNotification();
1247   application.Render();
1248   application.Render();
1249   END_TEST;
1250 }
1251
1252 int UtcDaliCustomActorRemoveDuringOnStageDisconnection(void)
1253 {
1254   TestApplication application;
1255   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageDisconnection() callback");
1256
1257   Stage stage = Stage::GetCurrent();
1258
1259   /* The actorA is a special variant which removes its children during OnStageDisconnection()
1260    * The actorB is provided as the child
1261    */
1262
1263   TestCustomActor actorA = TestCustomActor::NewVariant4();
1264   actorA.SetName( "ActorA" );
1265   stage.Add( actorA );
1266
1267   TestCustomActor actorB = TestCustomActor::New();
1268   actorB.SetName( "ActorB" );
1269   actorA.Add( actorB );
1270
1271   // Excercise the message passing to Update thread
1272
1273   application.SendNotification();
1274   application.Render();
1275   application.Render();
1276
1277   // Clear call stacks before disconnection
1278   actorA.ResetCallStack();
1279   actorB.ResetCallStack();
1280   MasterCallStack.clear();
1281
1282   stage.Remove( actorA );
1283
1284   // Check callback sequence
1285
1286   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1287   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1288   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1289
1290   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1291   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1292
1293   DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
1294
1295   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1296   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
1297   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 2 ], TEST_LOCATION );
1298
1299   // Excercise the message passing to Update thread
1300
1301   application.SendNotification();
1302   application.Render();
1303   application.Render();
1304   END_TEST;
1305 }
1306
1307 int UtcDaliCustomActorRemoveParentDuringOnStageConnection(void)
1308 {
1309   TestApplication application;
1310   tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnStageConnection() callback");
1311
1312   Stage stage = Stage::GetCurrent();
1313
1314   MasterCallStack.clear();
1315
1316   /* The actorA is the parent of actorB
1317    * The actorB is a special variant which removes its own parent during OnStageConnection()
1318    * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnStageDisconnection()
1319    */
1320
1321   TestCustomActor actorA = TestCustomActor::New();
1322   actorA.SetName( "ActorA" );
1323
1324   TestCustomActor actorB = TestCustomActor::NewVariant5();
1325   actorB.SetName( "ActorB" );
1326   actorA.Add( actorB );
1327
1328   stage.Add( actorA );
1329
1330   // Check callback sequence
1331
1332   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1333   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1334   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1335   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1336
1337   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1338   DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1339
1340   DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION );
1341
1342   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 0 ], TEST_LOCATION );
1343   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1344   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 2 ], TEST_LOCATION );
1345   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1346
1347   // Excercise the message passing to Update thread
1348
1349   application.SendNotification();
1350   application.Render();
1351   application.Render();
1352   END_TEST;
1353 }
1354
1355 int UtcDaliCustomActorAddParentDuringOnStageDisconnection(void)
1356 {
1357   TestApplication application;
1358   tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnStageDisconnection() callback");
1359
1360   Stage stage = Stage::GetCurrent();
1361
1362   MasterCallStack.clear();
1363
1364   /* The actorA is the parent of actorB
1365    * The actorB is a special variant which (weirdly) adds its own parent during OnStageDisconnection()
1366    * The child actor is interrupting the disconnection, such that parent should not get a OnStageDisconnection()
1367    */
1368
1369   TestCustomActor actorA = TestCustomActor::New();
1370   actorA.SetName( "ActorA" );
1371   stage.Add( actorA );
1372
1373   TestCustomActor actorB = TestCustomActor::NewVariant6();
1374   actorB.SetName( "ActorB" );
1375   actorA.Add( actorB );
1376
1377   stage.Remove( actorA );
1378
1379   // Check callback sequence
1380
1381   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1382   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1383   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1384
1385   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1386   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1387   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1388   // Disconnect was interrupted, so we should only get one OnStageConnection() for actorB
1389
1390   DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION );
1391
1392   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 0 ], TEST_LOCATION );
1393   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1394   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 2 ], TEST_LOCATION );
1395   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1396
1397   // Excercise the message passing to Update thread
1398
1399   application.SendNotification();
1400   application.Render();
1401   application.Render();
1402   END_TEST;
1403 }
1404
1405 int UtcDaliCustomActorOnChildAddRemove(void)
1406 {
1407   TestApplication application;
1408   tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()");
1409
1410   TestCustomActor custom = TestCustomActor::New();
1411   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1412
1413   Actor aChild = Actor::New();
1414   custom.Add( aChild );
1415
1416   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1417   DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1418
1419   custom.Remove( aChild );
1420
1421   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1422   DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1423   END_TEST;
1424 }
1425
1426 int UtcDaliCustomActorReparentDuringOnChildAdd(void)
1427 {
1428   TestApplication application;
1429   tet_infoline("Testing Actor:Add (reparenting) behaviour during Dali::CustomActor::OnChildAdd() callback");
1430
1431   Stage stage = Stage::GetCurrent();
1432
1433   MasterCallStack.clear();
1434
1435   /* The actorA is a special variant which reparents children added into a separate container child
1436    * The actorB is the child of actorA
1437    */
1438
1439   TestCustomActor actorA = TestCustomActor::NewVariant7( "ActorA" );
1440   stage.Add( actorA );
1441
1442   TestCustomActor actorB = TestCustomActor::New();
1443   actorB.SetName( "ActorB" );
1444   actorA.Add( actorB );
1445
1446   // Check hierarchy is as follows:
1447   //  A
1448   //  |
1449   //  Container
1450   //  |
1451   //  B
1452
1453   DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION );
1454
1455   Actor container = actorA.GetChildAt(0);
1456   Actor containerChild;
1457
1458   DALI_TEST_CHECK( container );
1459   if ( container )
1460   {
1461     DALI_TEST_EQUALS( "Container", container.GetName(), TEST_LOCATION );
1462     DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION );
1463     containerChild = container.GetChildAt(0);
1464   }
1465
1466   DALI_TEST_CHECK( containerChild );
1467   if ( containerChild )
1468   {
1469     DALI_TEST_EQUALS( "ActorB", containerChild.GetName(), TEST_LOCATION );
1470     DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION );
1471   }
1472
1473   // Check callback sequence
1474
1475   DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1476   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA
1477   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1478   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA
1479   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
1480   // mContainer will then receive OnChildAdd
1481
1482   DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1483   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1484   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1485   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1486
1487   DALI_TEST_EQUALS( 7, (int)(MasterCallStack.size()), TEST_LOCATION );
1488
1489   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 0 ], TEST_LOCATION );
1490   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1491   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 2 ], TEST_LOCATION );
1492   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 3 ], TEST_LOCATION );
1493   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
1494   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 5 ], TEST_LOCATION );
1495   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 6 ], TEST_LOCATION );
1496
1497   // Excercise the message passing to Update thread
1498
1499   application.SendNotification();
1500   application.Render();
1501   application.Render();
1502   END_TEST;
1503 }
1504
1505 /**
1506  * Test that Remove can be called (a NOOP) during the OnChildRemove
1507  * triggered when reparenting an actor
1508  */
1509 int UtcDaliCustomActorRemoveDuringOnChildRemove(void)
1510 {
1511   TestApplication application;
1512   tet_infoline("Testing Actor:Remove behaviour during OnChildRemove() callback triggered when reparenting");
1513
1514   Stage stage = Stage::GetCurrent();
1515
1516   MasterCallStack.clear();
1517
1518   /* The childActor will be reparented from actorA to actorB
1519    * The actorA is a special variant which attempts to remove a child from actorB, during the OnChildRemove callback()
1520    * This should be a NOOP since the reparenting has not occured yet
1521    */
1522
1523   TestCustomActor actorB = TestCustomActor::New();
1524   actorB.SetName( "ActorB" );
1525   stage.Add( actorB );
1526
1527   TestCustomActor actorA = TestCustomActor::NewVariant8( actorB );
1528   actorA.SetName( "ActorA" );
1529   stage.Add( actorA );
1530
1531   Actor childActor = Actor::New();
1532   childActor.SetName( "Child" );
1533   // Reparent from actorA to actorB
1534   actorA.Add( childActor );
1535   actorB.Add( childActor );
1536
1537   // Check hierarchy is as follows:
1538   //  A    B
1539   //       |
1540   //       Child
1541
1542   DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION );
1543   DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION );
1544   DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION );
1545
1546   Actor child = actorB.GetChildAt(0);
1547
1548   DALI_TEST_CHECK( child );
1549   if ( child )
1550   {
1551     DALI_TEST_EQUALS( "Child", child.GetName(), TEST_LOCATION );
1552   }
1553
1554   // Check callback sequence
1555
1556   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1557   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA
1558   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1559   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA
1560   // mContainer will then receive OnChildAdd
1561
1562   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1563   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1564   DALI_TEST_EQUALS( "OnChildAdd",           actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1565
1566   DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
1567
1568   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 0 ], TEST_LOCATION );
1569   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1570   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 2 ], TEST_LOCATION );
1571   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 3 ], TEST_LOCATION );
1572   DALI_TEST_EQUALS( "ActorB: OnChildAdd",           MasterCallStack[ 4 ], TEST_LOCATION );
1573
1574   // Excercise the message passing to Update thread
1575
1576   application.SendNotification();
1577   application.Render();
1578   application.Render();
1579   END_TEST;
1580 }
1581
1582 int UtcDaliCustomActorOnPropertySet(void)
1583 {
1584   TestApplication application;
1585   tet_infoline("Testing Dali::CustomActor::OnPropertySet()");
1586
1587   TestCustomActor custom = TestCustomActor::New();
1588   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1589
1590   custom.SetDaliProperty("yes") ;
1591
1592   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1593   DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1594   END_TEST;
1595 }
1596
1597 int UtcDaliCustomActorOnSizeSet(void)
1598 {
1599   TestApplication application;
1600   tet_infoline("Testing Dali::CustomActor::OnSizeSet()");
1601
1602   TestCustomActor custom = TestCustomActor::New();
1603   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1604
1605   custom.SetSize( Vector2( 9.0f, 10.0f ) );
1606   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1607   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1608   DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION );
1609   DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION );
1610
1611   custom.SetSize( Vector3( 4.0f, 5.0f, 6.0f ) );
1612   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1613   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1614   DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION );
1615   DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION );
1616   DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION );
1617   END_TEST;
1618 }
1619
1620 int UtcDaliCustomActorOnSizeAnimation(void)
1621 {
1622   TestApplication application;
1623   tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()");
1624
1625   TestCustomActor custom = TestCustomActor::New();
1626   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1627
1628   Animation anim = Animation::New( 1.0f );
1629   anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) );
1630   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1631   DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1632   DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION );
1633   DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION );
1634   DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION );
1635   END_TEST;
1636 }
1637
1638 int UtcDaliCustomActorOnTouchEvent(void)
1639 {
1640   TestApplication application;
1641   tet_infoline("Testing Dali::CustomActor::OnTouchEvent()");
1642
1643   TestCustomActor custom = TestCustomActor::New();
1644   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1645
1646   // set size for custom actor
1647   custom.SetSize( 100, 100 );
1648   // add the custom actor to stage
1649   Stage::GetCurrent().Add( custom );
1650   custom.ResetCallStack();
1651
1652   // Render and notify a couple of times
1653   application.SendNotification();
1654   application.Render();
1655   application.SendNotification();
1656   application.Render();
1657
1658   // simulate a touch event
1659   Dali::TouchPoint point( 0, TouchPoint::Down, 1, 1 );
1660   Dali::Integration::TouchEvent event;
1661   event.AddPoint( point );
1662   application.ProcessEvent( event );
1663
1664   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1665   DALI_TEST_EQUALS( "OnTouchEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1666   END_TEST;
1667 }
1668
1669 int UtcDaliCustomActorOnHoverEvent(void)
1670 {
1671   TestApplication application;
1672   tet_infoline("Testing Dali::CustomActor::OnHoverEvent()");
1673
1674   TestCustomActor custom = TestCustomActor::New();
1675   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1676
1677   // set size for custom actor
1678   custom.SetSize( 100, 100 );
1679   // add the custom actor to stage
1680   Stage::GetCurrent().Add( custom );
1681   custom.ResetCallStack();
1682
1683   // Render and notify a couple of times
1684   application.SendNotification();
1685   application.Render();
1686   application.SendNotification();
1687   application.Render();
1688
1689   // simulate a hover event
1690   Dali::TouchPoint point( 0, TouchPoint::Motion, 1, 1 );
1691   Dali::Integration::HoverEvent event;
1692   event.AddPoint( point );
1693   application.ProcessEvent( event );
1694
1695   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1696   DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1697   END_TEST;
1698 }
1699
1700 int UtcDaliCustomActorOnWheelEvent(void)
1701 {
1702   TestApplication application;
1703   tet_infoline("Testing Dali::CustomActor::OnWheelEvent()");
1704
1705   TestCustomActor custom = TestCustomActor::New();
1706   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1707
1708   // set size for custom actor
1709   custom.SetSize( 100, 100 );
1710   // add the custom actor to stage
1711   Stage::GetCurrent().Add( custom );
1712   custom.ResetCallStack();
1713
1714   // Render and notify a couple of times
1715   application.SendNotification();
1716   application.Render();
1717   application.SendNotification();
1718   application.Render();
1719
1720   // simulate a wheel event
1721   Vector2 screenCoordinates( 10.0f, 10.0f );
1722   Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
1723   application.ProcessEvent( event );
1724
1725   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1726   DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1727   END_TEST;
1728 }
1729
1730 int UtcDaliCustomActorImplOnPropertySet(void)
1731 {
1732   TestApplication application;
1733   CustomActorImpl* impl = new Impl::SimpleTestCustomActor();
1734
1735   impl->OnPropertySet( 0, 0 );
1736
1737   DALI_TEST_CHECK( true );
1738
1739   delete impl;
1740   END_TEST;
1741 }
1742
1743 int UtcDaliCustomActorGetImplementation(void)
1744 {
1745   TestApplication application;
1746
1747   TestCustomActor custom = TestCustomActor::New();
1748   CustomActorImpl& impl = custom.GetImplementation();
1749   impl.GetOwner();  // Test
1750
1751   const TestCustomActor constCustom = TestCustomActor::New();
1752   const CustomActorImpl& constImpl = constCustom.GetImplementation();
1753   constImpl.GetOwner();  // Test
1754
1755   DALI_TEST_CHECK( true );
1756   END_TEST;
1757 }
1758
1759 int UtcDaliCustomActorDoAction(void)
1760 {
1761   TestApplication application;
1762   tet_infoline("Testing Dali::CustomActor::DoAction()");
1763
1764   TestCustomActor custom = TestCustomActor::New();
1765
1766   BaseHandle customActorObject = custom;
1767
1768   DALI_TEST_CHECK(customActorObject);
1769
1770   std::vector<Property::Value> attributes;
1771
1772   // Check that an invalid command is not performed
1773   DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
1774
1775   // Check that the custom actor is visible
1776   custom.SetVisible(true);
1777   DALI_TEST_CHECK(custom.IsVisible() == true);
1778
1779   // Check the custom actor performed an action to hide itself
1780   DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
1781
1782   // flush the queue and render once
1783   application.SendNotification();
1784   application.Render();
1785
1786   // Check that the custom actor is now invisible
1787   DALI_TEST_CHECK(custom.IsVisible() == false);
1788
1789   // Check the custom actor performed an action to show itself
1790   DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
1791
1792   // flush the queue and render once
1793   application.SendNotification();
1794   application.Render();
1795
1796   // Check that the custom actor is now visible
1797   DALI_TEST_CHECK(custom.IsVisible() == true);
1798   END_TEST;
1799 }
1800
1801 int UtcDaliCustomActorCustomActor(void)
1802 {
1803   Dali::CustomActor customA;
1804   Dali::CustomActor customB( customA );
1805
1806   DALI_TEST_CHECK( customA == customB );
1807
1808   END_TEST;
1809 }
1810
1811 int UtcDaliCustomActorImplRelayoutRequest(void)
1812 {
1813   TestApplication application;
1814
1815   DALI_TEST_CHECK( gOnRelayout == false );
1816
1817   TestCustomActor custom = TestCustomActor::NewNegoSize();
1818   Stage::GetCurrent().Add(custom);
1819
1820   application.SendNotification();
1821   application.Render();
1822
1823   DALI_TEST_CHECK( gOnRelayout == true );
1824   gOnRelayout = false;
1825
1826   custom.TestRelayoutRequest();
1827   application.SendNotification();
1828   application.Render();
1829
1830   DALI_TEST_CHECK( gOnRelayout == true );
1831
1832   END_TEST;
1833 }
1834
1835 int UtcDaliCustomActorImplGetHeightForWidthBase(void)
1836 {
1837   TestApplication application;
1838   TestCustomActor custom = TestCustomActor::NewNegoSize();
1839
1840   float width = 300.0f;
1841   float v = 0.0f;
1842
1843   application.SendNotification();
1844   application.Render();
1845
1846   v = custom.TestGetHeightForWidthBase( width );
1847
1848   DALI_TEST_CHECK( v == width );
1849
1850   END_TEST;
1851 }
1852
1853 int UtcDaliCustomActorImplGetWidthForHeightBase(void)
1854 {
1855   TestApplication application;
1856   TestCustomActor custom = TestCustomActor::NewNegoSize();
1857
1858   float height = 300.0f;
1859   float v = 0.0f;
1860
1861   application.SendNotification();
1862   application.Render();
1863
1864   v = custom.TestGetWidthForHeightBase( height );
1865
1866   DALI_TEST_CHECK( v == height );
1867
1868   END_TEST;
1869 }
1870
1871 int UtcDaliCustomActorImplCalculateChildSizeBase(void)
1872 {
1873   TestApplication application;
1874   TestCustomActor custom = TestCustomActor::NewNegoSize();
1875
1876   Actor child = Actor::New();
1877   child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1878   child.SetSize(150, 150);
1879
1880   application.SendNotification();
1881   application.Render();
1882
1883   float v = 9.99f;
1884   v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
1885   DALI_TEST_CHECK( v == 0.0f );
1886
1887   END_TEST;
1888 }
1889
1890 int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
1891 {
1892   TestApplication application;
1893   TestCustomActor custom = TestCustomActor::NewNegoSize();
1894   custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
1895
1896   bool v = false;
1897
1898   v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
1899   application.SendNotification();
1900   application.Render();
1901
1902   DALI_TEST_CHECK( v == true );
1903
1904   custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1905   v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH );
1906   application.SendNotification();
1907   application.Render();
1908   DALI_TEST_CHECK( v == false );
1909
1910   END_TEST;
1911 }
1912
1913 int UtcDaliCustomActorTypeRegistry(void)
1914 {
1915   TestApplication application;
1916
1917   // Register Type
1918   TypeInfo type;
1919   type = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
1920   DALI_TEST_CHECK( type );
1921   BaseHandle handle = type.CreateInstance();
1922
1923   std::string name;
1924   std::string exception;
1925
1926   try
1927   {
1928     name = handle.GetTypeName();
1929     tet_result(TET_FAIL);
1930   }
1931   catch( DaliException& e )
1932   {
1933     exception = e.condition;
1934     DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION );
1935   }
1936
1937   END_TEST;
1938 }
1939
1940
1941 int UtcDaliCustomActorGetExtensionP(void)
1942 {
1943   TestApplication application;
1944
1945   TestCustomActor custom = TestCustomActor::NewVariant5();
1946
1947   DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() );
1948
1949   END_TEST;
1950 }