Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
[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     custom.SetName( "SizeNegotiationActor" );
611
612     impl->Initialize();
613
614     return custom;
615   }
616
617   static TestCustomActor NewVariant1( Actor childToAdd )
618   {
619     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1( childToAdd );
620     TestCustomActor custom( *impl ); // takes ownership
621
622     impl->Initialize();
623
624     return custom;
625   }
626
627   static TestCustomActor NewVariant2()
628   {
629     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant2();
630     TestCustomActor custom( *impl ); // takes ownership
631
632     impl->Initialize();
633
634     return custom;
635   }
636
637   static TestCustomActor NewVariant3( Actor childToAdd )
638   {
639     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3( childToAdd );
640     TestCustomActor custom( *impl ); // takes ownership
641
642     impl->Initialize();
643
644     return custom;
645   }
646
647   static TestCustomActor NewVariant4()
648   {
649     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant4();
650     TestCustomActor custom( *impl ); // takes ownership
651
652     impl->Initialize();
653
654     return custom;
655   }
656
657   static TestCustomActor NewVariant5()
658   {
659     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant5();
660     TestCustomActor custom( *impl ); // takes ownership
661
662     impl->Initialize();
663
664     return custom;
665   }
666
667   static TestCustomActor NewVariant6()
668   {
669     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant6();
670     TestCustomActor custom( *impl ); // takes ownership
671
672     impl->Initialize();
673
674     return custom;
675   }
676
677   static TestCustomActor NewVariant7( const char* name )
678   {
679     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant7();
680     TestCustomActor custom( *impl ); // takes ownership
681
682     impl->Initialize( name );
683
684     return custom;
685   }
686
687   static TestCustomActor NewVariant8( Actor rival )
688   {
689     Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8( rival );
690     TestCustomActor custom( *impl ); // takes ownership
691
692     impl->Initialize();
693
694     return custom;
695   }
696
697   virtual ~TestCustomActor()
698   {
699   }
700
701   Impl::TestCustomActor& GetImpl()
702   {
703     return static_cast<Impl::TestCustomActor&>(GetImplementation());
704   }
705
706   std::vector< std::string >& GetMethodsCalled()
707   {
708     return GetImpl().mMethodsCalled;
709   }
710
711   void ResetCallStack()
712   {
713     GetImpl().ResetCallStack();
714   }
715
716   void SetDaliProperty(std::string s)
717   {
718     GetImpl().SetDaliProperty(s);
719   }
720
721   Vector3 GetSize()
722   {
723     return GetImpl().mSizeSet;
724   }
725
726   Vector3 GetTargetSize()
727   {
728     return GetImpl().mTargetSize;
729   }
730
731   virtual Vector3 GetNaturalSize()
732   {
733     return Vector3( 0.0f, 0.0f, 0.0f );
734   }
735
736   virtual float GetHeightForWidth( float width )
737   {
738     return 0.0f;
739   }
740
741   virtual float GetWidthForHeight( float height )
742   {
743     return 0.0f;
744   }
745
746   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
747   {
748   }
749
750   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
751   {
752   }
753
754   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
755   {
756   }
757
758   void TestRelayoutRequest()
759   {
760     GetImpl().TestRelayoutRequest();
761   }
762
763   float TestGetHeightForWidthBase( float width )
764   {
765     return GetImpl().TestGetHeightForWidthBase( width );
766   }
767
768   float TestGetWidthForHeightBase( float height )
769   {
770     return GetImpl().TestGetWidthForHeightBase( height );
771   }
772
773   float TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
774   {
775     return GetImpl().TestCalculateChildSizeBase( child, dimension );
776   }
777
778   bool TestRelayoutDependentOnChildrenBase( Dimension::Type dimension )
779   {
780     return GetImpl().TestRelayoutDependentOnChildrenBase( dimension );
781   }
782
783 private:
784
785   TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl )
786   {
787   }
788 };
789
790
791
792 using namespace Dali;
793
794 BaseHandle CreateActor()
795 {
796   return TestCustomActor::New();
797 }
798
799 Dali::TypeRegistration mType( typeid(TestCustomActor), typeid(Dali::CustomActor), CreateActor );
800
801 } // anon namespace
802
803
804 int UtcDaliCustomActorDestructor(void)
805 {
806   TestApplication application;
807
808   CustomActor* actor = new CustomActor();
809   delete actor;
810
811   DALI_TEST_CHECK( true );
812   END_TEST;
813 }
814
815 int UtcDaliCustomActorImplDestructor(void)
816 {
817   TestApplication application;
818   CustomActorImpl* actor = new Impl::TestCustomActor();
819   delete actor;
820
821   DALI_TEST_CHECK( true );
822   END_TEST;
823 }
824
825 // Positive test case for a method
826 int UtcDaliCustomActorDownCast(void)
827 {
828   TestApplication application;
829   tet_infoline("Testing Dali::CustomActor::DownCast()");
830
831   TestCustomActor custom = TestCustomActor::New();
832
833   Actor anActor = Actor::New();
834   anActor.Add( custom );
835
836   Actor child = anActor.GetChildAt(0);
837   CustomActor customActor = CustomActor::DownCast( child );
838   DALI_TEST_CHECK( customActor );
839
840   customActor = NULL;
841   DALI_TEST_CHECK( !customActor );
842
843   customActor = DownCast< CustomActor >( child );
844   DALI_TEST_CHECK( customActor );
845   END_TEST;
846 }
847
848 // Negative test case for a method
849 int UtcDaliCustomActorDownCastNegative(void)
850 {
851   TestApplication application;
852   tet_infoline("Testing Dali::CustomActor::DownCast()");
853
854   Actor actor1 = Actor::New();
855   Actor anActor = Actor::New();
856   anActor.Add(actor1);
857
858   Actor child = anActor.GetChildAt(0);
859   CustomActor customActor = CustomActor::DownCast( child );
860   DALI_TEST_CHECK( !customActor );
861
862   Actor unInitialzedActor;
863   customActor = CustomActor::DownCast( unInitialzedActor );
864   DALI_TEST_CHECK( !customActor );
865
866   customActor = DownCast< CustomActor >( unInitialzedActor );
867   DALI_TEST_CHECK( !customActor );
868   END_TEST;
869 }
870
871 int UtcDaliCustomActorOnStageConnectionDisconnection(void)
872 {
873   TestApplication application;
874   tet_infoline("Testing Dali::CustomActor::OnStageConnection() & OnStageDisconnection");
875
876   TestCustomActor custom = TestCustomActor::New();
877   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
878
879   // add the custom actor to stage
880   Stage::GetCurrent().Add( custom );
881
882   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
883   DALI_TEST_EQUALS( "OnStageConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
884
885   Stage::GetCurrent().Remove( custom );
886
887   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
888   DALI_TEST_EQUALS( "OnStageDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
889
890   // Excercise the message passing to Update thread
891
892   application.SendNotification();
893   application.Render();
894   application.Render();
895   END_TEST;
896 }
897
898 int UtcDaliCustomActorOnStageConnectionOrder(void)
899 {
900   TestApplication application;
901   tet_infoline("Testing Dali::CustomActor::OnStageConnection() order");
902
903   MasterCallStack.clear();
904
905   /* Build tree of actors:
906    *
907    *       A (parent)
908    *      / \
909    *     B   C
910    *    / \   \
911    *   D   E   F
912    *
913    * OnStageConnection should be received for A, B, D, E, C, and finally F
914    */
915
916   TestCustomActor actorA = TestCustomActor::New();
917   actorA.SetName( "ActorA" );
918
919   TestCustomActor actorB = TestCustomActor::New();
920   actorB.SetName( "ActorB" );
921   actorA.Add( actorB );
922
923   TestCustomActor actorC = TestCustomActor::New();
924   actorC.SetName( "ActorC" );
925   actorA.Add( actorC );
926
927   TestCustomActor actorD = TestCustomActor::New();
928   actorD.SetName( "ActorD" );
929   actorB.Add( actorD );
930
931   TestCustomActor actorE = TestCustomActor::New();
932   actorE.SetName( "ActorE" );
933   actorB.Add( actorE );
934
935   TestCustomActor actorF = TestCustomActor::New();
936   actorF.SetName( "ActorF" );
937   actorC.Add( actorF );
938
939   // add the custom actor to stage
940   Stage::GetCurrent().Add( actorA );
941
942   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
943   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
944   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
945   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
946
947   DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
948   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
949   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
950   DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
951
952   DALI_TEST_EQUALS( 2, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
953   DALI_TEST_EQUALS( "OnChildAdd",        actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
954   DALI_TEST_EQUALS( "OnStageConnection", actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION );
955
956   DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
957   DALI_TEST_EQUALS( "OnStageConnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
958
959   DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
960   DALI_TEST_EQUALS( "OnStageConnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
961
962   DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
963   DALI_TEST_EQUALS( "OnStageConnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
964
965   // Check sequence is correct in MasterCallStack
966
967   DALI_TEST_EQUALS( 3+3+2+1+1+1, (int)(MasterCallStack.size()), TEST_LOCATION );
968
969   DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 0 ], TEST_LOCATION );
970   DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION );
971   DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION );
972   DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 3 ], TEST_LOCATION );
973   DALI_TEST_EQUALS( "ActorC: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
974
975   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 5 ], TEST_LOCATION );
976   DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 6 ], TEST_LOCATION );
977   DALI_TEST_EQUALS( "ActorD: OnStageConnection", MasterCallStack[ 7 ], TEST_LOCATION );
978   DALI_TEST_EQUALS( "ActorE: OnStageConnection", MasterCallStack[ 8 ], TEST_LOCATION );
979   DALI_TEST_EQUALS( "ActorC: OnStageConnection", MasterCallStack[ 9 ], TEST_LOCATION );
980   DALI_TEST_EQUALS( "ActorF: OnStageConnection", MasterCallStack[ 10 ], TEST_LOCATION );
981
982   // Excercise the message passing to Update thread
983
984   application.SendNotification();
985   application.Render();
986   application.Render();
987   END_TEST;
988 }
989
990 int UtcDaliCustomActorOnStageDisconnectionOrder(void)
991 {
992   TestApplication application;
993   tet_infoline("Testing Dali::CustomActor::OnStageDisconnection() order");
994
995   Stage stage = Stage::GetCurrent();
996
997   /* Build tree of actors:
998    *
999    *       A (parent)
1000    *      / \
1001    *     B   C
1002    *    / \   \
1003    *   D   E   F
1004    *
1005    * OnStageDisconnection should be received for D, E, B, F, C, and finally A.
1006    */
1007
1008   TestCustomActor actorA = TestCustomActor::New();
1009   actorA.SetName( "ActorA" );
1010   stage.Add( actorA );
1011
1012   TestCustomActor actorB = TestCustomActor::New();
1013   actorB.SetName( "ActorB" );
1014   actorA.Add( actorB );
1015
1016   TestCustomActor actorC = TestCustomActor::New();
1017   actorC.SetName( "ActorC" );
1018   actorA.Add( actorC );
1019
1020   TestCustomActor actorD = TestCustomActor::New();
1021   actorD.SetName( "ActorD" );
1022   actorB.Add( actorD );
1023
1024   TestCustomActor actorE = TestCustomActor::New();
1025   actorE.SetName( "ActorE" );
1026   actorB.Add( actorE );
1027
1028   TestCustomActor actorF = TestCustomActor::New();
1029   actorF.SetName( "ActorF" );
1030   actorC.Add( actorF );
1031
1032   // Excercise the message passing to Update thread
1033
1034   application.SendNotification();
1035   application.Render();
1036   application.Render();
1037
1038   // Clear call stacks before disconnection
1039   actorA.ResetCallStack();
1040   actorB.ResetCallStack();
1041   actorC.ResetCallStack();
1042   actorD.ResetCallStack();
1043   actorE.ResetCallStack();
1044   actorF.ResetCallStack();
1045   MasterCallStack.clear();
1046
1047   stage.Remove( actorA );
1048
1049   DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1050   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1051
1052   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1053   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1054
1055   DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
1056   DALI_TEST_EQUALS( "OnStageDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1057
1058   DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
1059   DALI_TEST_EQUALS( "OnStageDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1060
1061   DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
1062   DALI_TEST_EQUALS( "OnStageDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1063
1064   DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
1065   DALI_TEST_EQUALS( "OnStageDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1066
1067   // Check sequence is correct in MasterCallStack
1068
1069   DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
1070
1071   DALI_TEST_EQUALS( "ActorD: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1072   DALI_TEST_EQUALS( "ActorE: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
1073   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 2 ], TEST_LOCATION );
1074   DALI_TEST_EQUALS( "ActorF: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1075   DALI_TEST_EQUALS( "ActorC: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
1076   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
1077
1078   // Excercise the message passing to Update thread
1079
1080   application.SendNotification();
1081   application.Render();
1082   application.Render();
1083   END_TEST;
1084 }
1085
1086 int UtcDaliCustomActorAddDuringOnStageConnection(void)
1087 {
1088   TestApplication application;
1089   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageConnection() callback");
1090
1091   Stage stage = Stage::GetCurrent();
1092
1093   MasterCallStack.clear();
1094
1095   /* The actorA is a special variant which adds a child to itself during OnStageConnection()
1096    * The actorB is provided as the child
1097    */
1098
1099   TestCustomActor actorB = TestCustomActor::New();
1100   actorB.SetName( "ActorB" );
1101
1102   TestCustomActor actorA = TestCustomActor::NewVariant1( actorB );
1103   actorA.SetName( "ActorA" );
1104   stage.Add( actorA );
1105
1106   // Check callback sequence
1107
1108   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1109   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1110   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // Called from within OnStageConnection()
1111
1112   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1113   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1114
1115   DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
1116
1117   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 0 ], TEST_LOCATION );
1118   DALI_TEST_EQUALS( "ActorB: OnStageConnection", MasterCallStack[ 1 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnStageConnection()
1119   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 2 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnStageConnection()
1120
1121   // Excercise the message passing to Update thread
1122
1123   application.SendNotification();
1124   application.Render();
1125   application.Render();
1126
1127   // Check everything is ok after Actors are removed
1128
1129   stage.Remove( actorA );
1130   application.SendNotification();
1131   application.Render();
1132   application.Render();
1133   END_TEST;
1134 }
1135
1136 int UtcDaliCustomActorRemoveDuringOnStageConnection(void)
1137 {
1138   TestApplication application;
1139   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageConnection() callback");
1140
1141   Stage stage = Stage::GetCurrent();
1142
1143   MasterCallStack.clear();
1144
1145   /* The actorA is a special variant which removes its children during OnStageConnection()
1146    * Actors B & C are provided as the children
1147    */
1148
1149   TestCustomActor actorA = TestCustomActor::NewVariant2();
1150   actorA.SetName( "ActorA" );
1151
1152   TestCustomActor actorB = TestCustomActor::New();
1153   actorB.SetName( "ActorB" );
1154   actorA.Add( actorB );
1155
1156   TestCustomActor actorC = TestCustomActor::New();
1157   actorC.SetName( "ActorC" );
1158   actorA.Add( actorC );
1159
1160   stage.Add( actorA );
1161
1162   // Check callback sequence
1163
1164   DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1165   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1166   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1167   DALI_TEST_EQUALS( "OnStageConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1168   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // Called from within OnStageConnection()
1169   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnStageConnection()
1170
1171   DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
1172
1173   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 0 ], TEST_LOCATION );
1174   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 1 ], TEST_LOCATION );
1175   DALI_TEST_EQUALS( "ActorA: OnStageConnection", MasterCallStack[ 2 ], TEST_LOCATION );
1176   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 3 ], TEST_LOCATION );
1177   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 4 ], TEST_LOCATION );
1178
1179   /* Actors B & C should be removed before the point where they could receive an OnStageConnection callback
1180    * Therefore they shouldn't receive either OnStageConnection or OnStageDisconnection
1181    */
1182   DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1183   DALI_TEST_EQUALS( 0, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
1184
1185   // Excercise the message passing to Update thread
1186
1187   application.SendNotification();
1188   application.Render();
1189   application.Render();
1190
1191   // Check everything is ok after last actor is removed
1192
1193   stage.Remove( actorA );
1194   application.SendNotification();
1195   application.Render();
1196   application.Render();
1197   END_TEST;
1198 }
1199
1200 int UtcDaliCustomActorAddDuringOnStageDisconnection(void)
1201 {
1202   TestApplication application;
1203   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnStageDisonnection() callback");
1204
1205   Stage stage = Stage::GetCurrent();
1206
1207   /* The actorA is a special variant which adds a child to itself during OnStageDisconnection()
1208    * The actorB is provided as the child
1209    */
1210
1211   TestCustomActor actorB = TestCustomActor::New();
1212   actorB.SetName( "ActorB" );
1213
1214   TestCustomActor actorA = TestCustomActor::NewVariant3( actorB );
1215   actorA.SetName( "ActorA" );
1216   stage.Add( actorA );
1217
1218   // Excercise the message passing to Update thread
1219
1220   application.SendNotification();
1221   application.Render();
1222   application.Render();
1223
1224   // Clear call stacks before disconnection
1225   actorA.ResetCallStack();
1226   actorB.ResetCallStack();
1227   MasterCallStack.clear();
1228
1229   stage.Remove( actorA );
1230
1231   // Check callback sequence
1232
1233   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1234   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1235   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1236
1237   // Child was added after parent disconnection, so should not receive OnStageConnection()
1238   DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1239
1240   DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION );
1241
1242   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1243   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 1 ], TEST_LOCATION );
1244
1245   // Excercise the message passing to Update thread
1246
1247   application.SendNotification();
1248   application.Render();
1249   application.Render();
1250   END_TEST;
1251 }
1252
1253 int UtcDaliCustomActorRemoveDuringOnStageDisconnection(void)
1254 {
1255   TestApplication application;
1256   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnStageDisconnection() callback");
1257
1258   Stage stage = Stage::GetCurrent();
1259
1260   /* The actorA is a special variant which removes its children during OnStageDisconnection()
1261    * The actorB is provided as the child
1262    */
1263
1264   TestCustomActor actorA = TestCustomActor::NewVariant4();
1265   actorA.SetName( "ActorA" );
1266   stage.Add( actorA );
1267
1268   TestCustomActor actorB = TestCustomActor::New();
1269   actorB.SetName( "ActorB" );
1270   actorA.Add( actorB );
1271
1272   // Excercise the message passing to Update thread
1273
1274   application.SendNotification();
1275   application.Render();
1276   application.Render();
1277
1278   // Clear call stacks before disconnection
1279   actorA.ResetCallStack();
1280   actorB.ResetCallStack();
1281   MasterCallStack.clear();
1282
1283   stage.Remove( actorA );
1284
1285   // Check callback sequence
1286
1287   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1288   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1289   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1290
1291   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1292   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1293
1294   DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
1295
1296   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
1297   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
1298   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 2 ], TEST_LOCATION );
1299
1300   // Excercise the message passing to Update thread
1301
1302   application.SendNotification();
1303   application.Render();
1304   application.Render();
1305   END_TEST;
1306 }
1307
1308 int UtcDaliCustomActorRemoveParentDuringOnStageConnection(void)
1309 {
1310   TestApplication application;
1311   tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnStageConnection() callback");
1312
1313   Stage stage = Stage::GetCurrent();
1314
1315   MasterCallStack.clear();
1316
1317   /* The actorA is the parent of actorB
1318    * The actorB is a special variant which removes its own parent during OnStageConnection()
1319    * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnStageDisconnection()
1320    */
1321
1322   TestCustomActor actorA = TestCustomActor::New();
1323   actorA.SetName( "ActorA" );
1324
1325   TestCustomActor actorB = TestCustomActor::NewVariant5();
1326   actorB.SetName( "ActorB" );
1327   actorA.Add( actorB );
1328
1329   stage.Add( actorA );
1330
1331   // Check callback sequence
1332
1333   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1334   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1335   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1336   DALI_TEST_EQUALS( "OnStageDisconnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1337
1338   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1339   DALI_TEST_EQUALS( "OnStageConnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1340
1341   DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION );
1342
1343   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 0 ], TEST_LOCATION );
1344   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1345   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 2 ], TEST_LOCATION );
1346   DALI_TEST_EQUALS( "ActorA: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1347
1348   // Excercise the message passing to Update thread
1349
1350   application.SendNotification();
1351   application.Render();
1352   application.Render();
1353   END_TEST;
1354 }
1355
1356 int UtcDaliCustomActorAddParentDuringOnStageDisconnection(void)
1357 {
1358   TestApplication application;
1359   tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnStageDisconnection() callback");
1360
1361   Stage stage = Stage::GetCurrent();
1362
1363   MasterCallStack.clear();
1364
1365   /* The actorA is the parent of actorB
1366    * The actorB is a special variant which (weirdly) adds its own parent during OnStageDisconnection()
1367    * The child actor is interrupting the disconnection, such that parent should not get a OnStageDisconnection()
1368    */
1369
1370   TestCustomActor actorA = TestCustomActor::New();
1371   actorA.SetName( "ActorA" );
1372   stage.Add( actorA );
1373
1374   TestCustomActor actorB = TestCustomActor::NewVariant6();
1375   actorB.SetName( "ActorB" );
1376   actorA.Add( actorB );
1377
1378   stage.Remove( actorA );
1379
1380   // Check callback sequence
1381
1382   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1383   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1384   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1385
1386   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1387   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1388   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1389   // Disconnect was interrupted, so we should only get one OnStageConnection() for actorB
1390
1391   DALI_TEST_EQUALS( 4, (int)(MasterCallStack.size()), TEST_LOCATION );
1392
1393   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 0 ], TEST_LOCATION );
1394   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1395   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 2 ], TEST_LOCATION );
1396   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
1397
1398   // Excercise the message passing to Update thread
1399
1400   application.SendNotification();
1401   application.Render();
1402   application.Render();
1403   END_TEST;
1404 }
1405
1406 int UtcDaliCustomActorOnChildAddRemove(void)
1407 {
1408   TestApplication application;
1409   tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()");
1410
1411   TestCustomActor custom = TestCustomActor::New();
1412   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1413
1414   Actor aChild = Actor::New();
1415   custom.Add( aChild );
1416
1417   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1418   DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1419
1420   custom.Remove( aChild );
1421
1422   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1423   DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1424   END_TEST;
1425 }
1426
1427 int UtcDaliCustomActorReparentDuringOnChildAdd(void)
1428 {
1429   TestApplication application;
1430   tet_infoline("Testing Actor:Add (reparenting) behaviour during Dali::CustomActor::OnChildAdd() callback");
1431
1432   Stage stage = Stage::GetCurrent();
1433
1434   MasterCallStack.clear();
1435
1436   /* The actorA is a special variant which reparents children added into a separate container child
1437    * The actorB is the child of actorA
1438    */
1439
1440   TestCustomActor actorA = TestCustomActor::NewVariant7( "ActorA" );
1441   stage.Add( actorA );
1442
1443   TestCustomActor actorB = TestCustomActor::New();
1444   actorB.SetName( "ActorB" );
1445   actorA.Add( actorB );
1446
1447   // Check hierarchy is as follows:
1448   //  A
1449   //  |
1450   //  Container
1451   //  |
1452   //  B
1453
1454   DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION );
1455
1456   Actor container = actorA.GetChildAt(0);
1457   Actor containerChild;
1458
1459   DALI_TEST_CHECK( container );
1460   if ( container )
1461   {
1462     DALI_TEST_EQUALS( "Container", container.GetName(), TEST_LOCATION );
1463     DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION );
1464     containerChild = container.GetChildAt(0);
1465   }
1466
1467   DALI_TEST_CHECK( containerChild );
1468   if ( containerChild )
1469   {
1470     DALI_TEST_EQUALS( "ActorB", containerChild.GetName(), TEST_LOCATION );
1471     DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION );
1472   }
1473
1474   // Check callback sequence
1475
1476   DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1477   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA
1478   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1479   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA
1480   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
1481   // mContainer will then receive OnChildAdd
1482
1483   DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1484   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1485   DALI_TEST_EQUALS( "OnStageDisconnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1486   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
1487
1488   DALI_TEST_EQUALS( 7, (int)(MasterCallStack.size()), TEST_LOCATION );
1489
1490   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 0 ], TEST_LOCATION );
1491   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1492   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 2 ], TEST_LOCATION );
1493   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 3 ], TEST_LOCATION );
1494   DALI_TEST_EQUALS( "ActorB: OnStageDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
1495   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 5 ], TEST_LOCATION );
1496   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 6 ], TEST_LOCATION );
1497
1498   // Excercise the message passing to Update thread
1499
1500   application.SendNotification();
1501   application.Render();
1502   application.Render();
1503   END_TEST;
1504 }
1505
1506 /**
1507  * Test that Remove can be called (a NOOP) during the OnChildRemove
1508  * triggered when reparenting an actor
1509  */
1510 int UtcDaliCustomActorRemoveDuringOnChildRemove(void)
1511 {
1512   TestApplication application;
1513   tet_infoline("Testing Actor:Remove behaviour during OnChildRemove() callback triggered when reparenting");
1514
1515   Stage stage = Stage::GetCurrent();
1516
1517   MasterCallStack.clear();
1518
1519   /* The childActor will be reparented from actorA to actorB
1520    * The actorA is a special variant which attempts to remove a child from actorB, during the OnChildRemove callback()
1521    * This should be a NOOP since the reparenting has not occured yet
1522    */
1523
1524   TestCustomActor actorB = TestCustomActor::New();
1525   actorB.SetName( "ActorB" );
1526   stage.Add( actorB );
1527
1528   TestCustomActor actorA = TestCustomActor::NewVariant8( actorB );
1529   actorA.SetName( "ActorA" );
1530   stage.Add( actorA );
1531
1532   Actor childActor = Actor::New();
1533   childActor.SetName( "Child" );
1534   // Reparent from actorA to actorB
1535   actorA.Add( childActor );
1536   actorB.Add( childActor );
1537
1538   // Check hierarchy is as follows:
1539   //  A    B
1540   //       |
1541   //       Child
1542
1543   DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION );
1544   DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION );
1545   DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION );
1546
1547   Actor child = actorB.GetChildAt(0);
1548
1549   DALI_TEST_CHECK( child );
1550   if ( child )
1551   {
1552     DALI_TEST_EQUALS( "Child", child.GetName(), TEST_LOCATION );
1553   }
1554
1555   // Check callback sequence
1556
1557   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
1558   DALI_TEST_EQUALS( "OnStageConnection",    actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); // The mContainer added to actorA
1559   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1560   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // The actorB added to actorA
1561   // mContainer will then receive OnChildAdd
1562
1563   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
1564   DALI_TEST_EQUALS( "OnStageConnection",    actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1565   DALI_TEST_EQUALS( "OnChildAdd",           actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1566
1567   DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
1568
1569   DALI_TEST_EQUALS( "ActorB: OnStageConnection",    MasterCallStack[ 0 ], TEST_LOCATION );
1570   DALI_TEST_EQUALS( "ActorA: OnStageConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
1571   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 2 ], TEST_LOCATION );
1572   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 3 ], TEST_LOCATION );
1573   DALI_TEST_EQUALS( "ActorB: OnChildAdd",           MasterCallStack[ 4 ], TEST_LOCATION );
1574
1575   // Excercise the message passing to Update thread
1576
1577   application.SendNotification();
1578   application.Render();
1579   application.Render();
1580   END_TEST;
1581 }
1582
1583 int UtcDaliCustomActorOnPropertySet(void)
1584 {
1585   TestApplication application;
1586   tet_infoline("Testing Dali::CustomActor::OnPropertySet()");
1587
1588   TestCustomActor custom = TestCustomActor::New();
1589   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1590
1591   custom.SetDaliProperty("yes");
1592
1593   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1594   DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1595   END_TEST;
1596 }
1597
1598 int UtcDaliCustomActorOnSizeSet(void)
1599 {
1600   TestApplication application;
1601   tet_infoline("Testing Dali::CustomActor::OnSizeSet()");
1602
1603   TestCustomActor custom = TestCustomActor::New();
1604   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1605
1606   custom.SetSize( Vector2( 9.0f, 10.0f ) );
1607   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1608   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1609   DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION );
1610   DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION );
1611
1612   custom.SetSize( Vector3( 4.0f, 5.0f, 6.0f ) );
1613   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1614   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
1615   DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION );
1616   DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION );
1617   DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION );
1618   END_TEST;
1619 }
1620
1621 int UtcDaliCustomActorOnSizeAnimation(void)
1622 {
1623   TestApplication application;
1624   tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()");
1625
1626   TestCustomActor custom = TestCustomActor::New();
1627   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1628
1629   Animation anim = Animation::New( 1.0f );
1630   anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) );
1631   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1632   DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1633   DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION );
1634   DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION );
1635   DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION );
1636   END_TEST;
1637 }
1638
1639 int UtcDaliCustomActorOnTouchEvent(void)
1640 {
1641   TestApplication application;
1642   tet_infoline("Testing Dali::CustomActor::OnTouchEvent()");
1643
1644   TestCustomActor custom = TestCustomActor::New();
1645   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1646
1647   // set size for custom actor
1648   custom.SetSize( 100, 100 );
1649   // add the custom actor to stage
1650   Stage::GetCurrent().Add( custom );
1651   custom.ResetCallStack();
1652
1653   // Render and notify a couple of times
1654   application.SendNotification();
1655   application.Render();
1656   application.SendNotification();
1657   application.Render();
1658
1659   // simulate a touch event
1660   Dali::TouchPoint point( 0, TouchPoint::Down, 1, 1 );
1661   Dali::Integration::TouchEvent event;
1662   event.AddPoint( point );
1663   application.ProcessEvent( event );
1664
1665   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1666   DALI_TEST_EQUALS( "OnTouchEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1667   END_TEST;
1668 }
1669
1670 int UtcDaliCustomActorOnHoverEvent(void)
1671 {
1672   TestApplication application;
1673   tet_infoline("Testing Dali::CustomActor::OnHoverEvent()");
1674
1675   TestCustomActor custom = TestCustomActor::New();
1676   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1677
1678   // set size for custom actor
1679   custom.SetSize( 100, 100 );
1680   // add the custom actor to stage
1681   Stage::GetCurrent().Add( custom );
1682   custom.ResetCallStack();
1683
1684   // Render and notify a couple of times
1685   application.SendNotification();
1686   application.Render();
1687   application.SendNotification();
1688   application.Render();
1689
1690   // simulate a hover event
1691   Dali::TouchPoint point( 0, TouchPoint::Motion, 1, 1 );
1692   Dali::Integration::HoverEvent event;
1693   event.AddPoint( point );
1694   application.ProcessEvent( event );
1695
1696   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1697   DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1698   END_TEST;
1699 }
1700
1701 int UtcDaliCustomActorOnWheelEvent(void)
1702 {
1703   TestApplication application;
1704   tet_infoline("Testing Dali::CustomActor::OnWheelEvent()");
1705
1706   TestCustomActor custom = TestCustomActor::New();
1707   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1708
1709   // set size for custom actor
1710   custom.SetSize( 100, 100 );
1711   // add the custom actor to stage
1712   Stage::GetCurrent().Add( custom );
1713   custom.ResetCallStack();
1714
1715   // Render and notify a couple of times
1716   application.SendNotification();
1717   application.Render();
1718   application.SendNotification();
1719   application.Render();
1720
1721   // simulate a wheel event
1722   Vector2 screenCoordinates( 10.0f, 10.0f );
1723   Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
1724   application.ProcessEvent( event );
1725
1726   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
1727   DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
1728   END_TEST;
1729 }
1730
1731 int UtcDaliCustomActorImplOnPropertySet(void)
1732 {
1733   TestApplication application;
1734   CustomActorImpl* impl = new Impl::SimpleTestCustomActor();
1735
1736   impl->OnPropertySet( 0, 0 );
1737
1738   DALI_TEST_CHECK( true );
1739
1740   delete impl;
1741   END_TEST;
1742 }
1743
1744 int UtcDaliCustomActorGetImplementation(void)
1745 {
1746   TestApplication application;
1747
1748   TestCustomActor custom = TestCustomActor::New();
1749   CustomActorImpl& impl = custom.GetImplementation();
1750   impl.GetOwner();  // Test
1751
1752   const TestCustomActor constCustom = TestCustomActor::New();
1753   const CustomActorImpl& constImpl = constCustom.GetImplementation();
1754   constImpl.GetOwner();  // Test
1755
1756   DALI_TEST_CHECK( true );
1757   END_TEST;
1758 }
1759
1760 int UtcDaliCustomActorDoAction(void)
1761 {
1762   TestApplication application;
1763   tet_infoline("Testing Dali::CustomActor::DoAction()");
1764
1765   TestCustomActor custom = TestCustomActor::New();
1766
1767   BaseHandle customActorObject = custom;
1768
1769   DALI_TEST_CHECK(customActorObject);
1770
1771   Property::Map attributes;
1772
1773   // Check that an invalid command is not performed
1774   DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
1775
1776   // Check that the custom actor is visible
1777   custom.SetVisible(true);
1778   DALI_TEST_CHECK(custom.IsVisible() == true);
1779
1780   // Check the custom actor performed an action to hide itself
1781   DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
1782
1783   // flush the queue and render once
1784   application.SendNotification();
1785   application.Render();
1786
1787   // Check that the custom actor is now invisible
1788   DALI_TEST_CHECK(custom.IsVisible() == false);
1789
1790   // Check the custom actor performed an action to show itself
1791   DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
1792
1793   // flush the queue and render once
1794   application.SendNotification();
1795   application.Render();
1796
1797   // Check that the custom actor is now visible
1798   DALI_TEST_CHECK(custom.IsVisible() == true);
1799   END_TEST;
1800 }
1801
1802 int UtcDaliCustomActorCustomActor(void)
1803 {
1804   Dali::CustomActor customA;
1805   Dali::CustomActor customB( customA );
1806
1807   DALI_TEST_CHECK( customA == customB );
1808
1809   END_TEST;
1810 }
1811
1812 int UtcDaliCustomActorImplRelayoutRequest(void)
1813 {
1814   TestApplication application;
1815
1816   DALI_TEST_CHECK( gOnRelayout == false );
1817
1818   TestCustomActor custom = TestCustomActor::NewNegoSize();
1819   Stage::GetCurrent().Add(custom);
1820
1821   application.SendNotification();
1822   application.Render();
1823
1824   DALI_TEST_CHECK( gOnRelayout == true );
1825   gOnRelayout = false;
1826
1827   custom.TestRelayoutRequest();
1828   application.SendNotification();
1829   application.Render();
1830
1831   DALI_TEST_CHECK( gOnRelayout == true );
1832
1833   END_TEST;
1834 }
1835
1836 int UtcDaliCustomActorImplGetHeightForWidthBase(void)
1837 {
1838   TestApplication application;
1839   TestCustomActor custom = TestCustomActor::NewNegoSize();
1840
1841   float width = 300.0f;
1842   float v = 0.0f;
1843
1844   application.SendNotification();
1845   application.Render();
1846
1847   v = custom.TestGetHeightForWidthBase( width );
1848
1849   DALI_TEST_CHECK( v == width );
1850
1851   END_TEST;
1852 }
1853
1854 int UtcDaliCustomActorImplGetWidthForHeightBase(void)
1855 {
1856   TestApplication application;
1857   TestCustomActor custom = TestCustomActor::NewNegoSize();
1858
1859   float height = 300.0f;
1860   float v = 0.0f;
1861
1862   application.SendNotification();
1863   application.Render();
1864
1865   v = custom.TestGetWidthForHeightBase( height );
1866
1867   DALI_TEST_CHECK( v == height );
1868
1869   END_TEST;
1870 }
1871
1872 int UtcDaliCustomActorImplCalculateChildSizeBase(void)
1873 {
1874   TestApplication application;
1875   TestCustomActor custom = TestCustomActor::NewNegoSize();
1876
1877   Actor child = Actor::New();
1878   child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1879   child.SetSize(150, 150);
1880
1881   application.SendNotification();
1882   application.Render();
1883
1884   float v = 9.99f;
1885   v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
1886   DALI_TEST_CHECK( v == 0.0f );
1887
1888   END_TEST;
1889 }
1890
1891 int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
1892 {
1893   TestApplication application;
1894   TestCustomActor custom = TestCustomActor::NewNegoSize();
1895   custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
1896
1897   bool v = false;
1898
1899   v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
1900   application.SendNotification();
1901   application.Render();
1902
1903   DALI_TEST_CHECK( v == true );
1904
1905   custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1906   v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH );
1907   application.SendNotification();
1908   application.Render();
1909   DALI_TEST_CHECK( v == false );
1910
1911   END_TEST;
1912 }
1913
1914 int UtcDaliCustomActorTypeRegistry(void)
1915 {
1916   TestApplication application;
1917
1918   // Register Type
1919   TypeInfo type;
1920   type = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
1921   DALI_TEST_CHECK( type );
1922   BaseHandle handle = type.CreateInstance();
1923
1924   std::string name;
1925   std::string exception;
1926
1927   try
1928   {
1929     name = handle.GetTypeName();
1930     tet_result(TET_FAIL);
1931   }
1932   catch( DaliException& e )
1933   {
1934     exception = e.condition;
1935     DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION );
1936   }
1937
1938   END_TEST;
1939 }
1940
1941
1942 int UtcDaliCustomActorGetExtensionP(void)
1943 {
1944   TestApplication application;
1945
1946   TestCustomActor custom = TestCustomActor::NewVariant5();
1947
1948   DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() );
1949
1950   END_TEST;
1951 }