Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-TypeRegistry.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20 #include <limits>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23 #include <dali/integration-api/events/long-press-gesture-event.h>
24 #include <dali/integration-api/events/pan-gesture-event.h>
25 #include <dali/integration-api/events/pinch-gesture-event.h>
26 #include <dali/integration-api/events/tap-gesture-event.h>
27 #include <dali/integration-api/events/touch-event-integ.h>
28 #include <dali/integration-api/events/hover-event-integ.h>
29
30 using namespace Dali;
31
32
33 namespace
34 {
35
36 // Stores data that is populated in the callback and will be read by the Test cases
37 struct SignalData
38 {
39   SignalData()
40   : functorCalled( false ),
41     voidFunctorCalled( false ),
42     receivedGesture( Gesture::Clear ),
43     pressedActor()
44   {}
45
46   void Reset()
47   {
48     functorCalled = false;
49     voidFunctorCalled = false;
50
51     receivedGesture.numberOfTouches = 0u;
52     receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
53     receivedGesture.localPoint = Vector2(0.0f, 0.0f);
54
55     pressedActor.Reset();
56   }
57
58   bool functorCalled;
59   bool voidFunctorCalled;
60   LongPressGesture receivedGesture;
61   Actor pressedActor;
62 };
63
64 // Functor that sets the data when called
65 struct GestureReceivedFunctor
66 {
67   GestureReceivedFunctor(SignalData& data) : signalData(data) { }
68
69   void operator()(Actor actor, LongPressGesture longPress)
70   {
71     signalData.functorCalled = true;
72     signalData.receivedGesture = longPress;
73     signalData.pressedActor = actor;
74   }
75
76   void operator()()
77   {
78     signalData.voidFunctorCalled = true;
79   }
80
81   SignalData& signalData;
82 };
83
84 // Generate a LongPressGestureEvent to send to Core
85 Integration::LongPressGestureEvent GenerateLongPress(
86     Gesture::State state,
87     unsigned int numberOfTouches,
88     Vector2 point)
89 {
90   Integration::LongPressGestureEvent longPress( state );
91
92   longPress.numberOfTouches = numberOfTouches;
93   longPress.point = point;
94
95   return longPress;
96 }
97
98 // Generate a PanGestureEvent to send to Core
99 Integration::PanGestureEvent GeneratePan(
100     Gesture::State state,
101     Vector2 previousPosition,
102     Vector2 currentPosition,
103     unsigned long timeDelta,
104     unsigned int numberOfTouches = 1,
105     unsigned int time = 1u)
106 {
107   Integration::PanGestureEvent pan(state);
108
109   pan.previousPosition = previousPosition;
110   pan.currentPosition = currentPosition;
111   pan.timeDelta = timeDelta;
112   pan.numberOfTouches = numberOfTouches;
113   pan.time = time;
114
115   return pan;
116 }
117 // Generate a PinchGestureEvent to send to Core
118 Integration::PinchGestureEvent GeneratePinch(
119     Gesture::State state,
120     float scale,
121     float speed,
122     Vector2 centerpoint)
123 {
124   Integration::PinchGestureEvent pinch(state);
125
126   pinch.scale = scale;
127   pinch.speed = speed;
128   pinch.centerPoint = centerpoint;
129
130   return pinch;
131 }
132 // Generate a TapGestureEvent to send to Core
133 Integration::TapGestureEvent GenerateTap(
134     Gesture::State state,
135     unsigned int numberOfTaps,
136     unsigned int numberOfTouches,
137     Vector2 point)
138 {
139   Integration::TapGestureEvent tap( state );
140
141   tap.numberOfTaps = numberOfTaps;
142   tap.numberOfTouches = numberOfTouches;
143   tap.point = point;
144
145   return tap;
146 }
147
148 //
149 // Create function as Init function called
150 //
151 static bool CreateCustomInitCalled = false;
152 BaseHandle CreateCustomInit(void)
153 {
154   CreateCustomInitCalled = true;
155   return BaseHandle();
156 }
157
158 static bool CreateCustomNamedInitCalled = false;
159 BaseHandle CreateCustomNamedInit(void)
160 {
161   CreateCustomNamedInitCalled = true;
162   return BaseHandle();
163 }
164
165 const std::string scriptedName("PopupStyle");
166 static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
167
168 // Property Registration
169 bool setPropertyCalled = false;
170 bool getPropertyCalled = false;
171 void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
172 {
173   setPropertyCalled = true;
174 }
175 Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
176 {
177   getPropertyCalled = true;
178   return Property::Value( true );
179 }
180
181
182
183 /*******************************************************************************
184  *
185  * Custom Actor
186  *
187  ******************************************************************************/
188 namespace Impl
189 {
190 struct MyTestCustomActor : public CustomActorImpl
191 {
192   typedef Signal< void ()> SignalType;
193   typedef Signal< void (float)> SignalTypeFloat;
194
195   MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
196   { }
197
198   virtual ~MyTestCustomActor()
199   { }
200
201   void ResetCallStack()
202   {
203   }
204
205   // From CustomActorImpl
206   virtual void OnStageConnection( int depth )
207   {
208   }
209   virtual void OnStageDisconnection()
210   {
211   }
212   virtual void OnChildAdd(Actor& child)
213   {
214   }
215   virtual void OnChildRemove(Actor& child)
216   {
217   }
218   virtual void OnSizeSet(const Vector3& targetSize)
219   {
220   }
221   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
222   {
223   }
224   virtual bool OnTouchEvent(const TouchEvent& event)
225   {
226     return true;
227   }
228   virtual bool OnHoverEvent(const HoverEvent& event)
229   {
230     return true;
231   }
232   virtual bool OnWheelEvent(const WheelEvent& event)
233   {
234     return true;
235   }
236   virtual bool OnKeyEvent(const KeyEvent& event)
237   {
238     return true;
239   }
240   virtual void OnKeyInputFocusGained()
241   {
242   }
243   virtual void OnKeyInputFocusLost()
244   {
245   }
246   virtual Vector3 GetNaturalSize()
247   {
248     return Vector3( 0.0f, 0.0f, 0.0f );
249   }
250
251   virtual float GetHeightForWidth( float width )
252   {
253     return 0.0f;
254   }
255
256   virtual float GetWidthForHeight( float height )
257   {
258     return 0.0f;
259   }
260
261   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
262   {
263   }
264
265   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
266   {
267   }
268
269   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
270   {
271   }
272
273   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
274   {
275     return 0.0f;
276   }
277
278   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
279   {
280   }
281
282   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
283   {
284     return false;
285   }
286
287 public:
288
289   SignalType mSignal;
290 };
291
292 }; // namespace Impl
293
294 class MyTestCustomActor : public CustomActor
295 {
296 public:
297
298   typedef Signal< void ()> SignalType;
299   typedef Signal< void (float)> SignalTypeFloat;
300
301   MyTestCustomActor()
302   {
303   }
304
305   static MyTestCustomActor New()
306   {
307     Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
308     return MyTestCustomActor( *p ); // takes ownership
309   }
310
311   virtual ~MyTestCustomActor()
312   {
313   }
314
315   static MyTestCustomActor DownCast( BaseHandle handle )
316   {
317     MyTestCustomActor result;
318
319     CustomActor custom = Dali::CustomActor::DownCast( handle );
320     if ( custom )
321     {
322       CustomActorImpl& customImpl = custom.GetImplementation();
323
324       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
325
326       if (impl)
327       {
328         result = MyTestCustomActor(customImpl.GetOwner());
329       }
330     }
331
332     return result;
333   }
334
335   SignalType& GetCustomSignal()
336   {
337     Dali::RefObject& obj = GetImplementation();
338     return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
339   }
340
341 private:
342
343   MyTestCustomActor(Internal::CustomActor* internal)
344   : CustomActor(internal)
345   {
346   }
347
348   MyTestCustomActor( Impl::MyTestCustomActor& impl )
349   : CustomActor( impl )
350   {
351   }
352 };
353
354
355 class MyTestCustomActor2 : public CustomActor
356 {
357 public:
358
359   MyTestCustomActor2()
360   {
361   }
362
363   static MyTestCustomActor2 New()
364   {
365     return MyTestCustomActor2(); // takes ownership
366   }
367
368   virtual ~MyTestCustomActor2()
369   {
370   }
371
372   static MyTestCustomActor2 DownCast( BaseHandle handle )
373   {
374     MyTestCustomActor2 result;
375
376     CustomActor custom = Dali::CustomActor::DownCast( handle );
377     if ( custom )
378     {
379       CustomActorImpl& customImpl = custom.GetImplementation();
380
381       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
382
383       if (impl)
384       {
385         result = MyTestCustomActor2(customImpl.GetOwner());
386       }
387     }
388
389     return result;
390   }
391
392 private:
393
394   MyTestCustomActor2(Internal::CustomActor* internal)
395   : CustomActor(internal)
396   {
397   }
398
399   MyTestCustomActor2( Impl::MyTestCustomActor& impl )
400   : CustomActor( impl )
401   {
402   }
403 };
404
405 static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
406
407
408 BaseHandle CreateCustom(void)
409 {
410   return MyTestCustomActor::New();
411 }
412
413 static std::string lastSignalConnectionCustom;
414
415 bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
416 {
417   lastSignalConnectionCustom = signalName;
418
419   bool connected( true );
420
421   Dali::BaseHandle handle(object);
422   MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
423
424   if( "sig1" == signalName )
425   {
426     customActor.GetCustomSignal().Connect( tracker, functor );
427   }
428   else
429   {
430     // signalName does not match any signal
431     connected = false;
432   }
433
434   return connected;
435 }
436
437 bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
438 {
439   lastSignalConnectionCustom = "failed";
440
441   return false; // This is supposed to fail
442 }
443
444 struct CustomTestFunctor
445 {
446   CustomTestFunctor()
447   {
448     ++mTotalInstanceCount;
449     ++mCurrentInstanceCount;
450   }
451
452   CustomTestFunctor( const CustomTestFunctor& copyMe )
453   {
454     ++mTotalInstanceCount;
455     ++mCurrentInstanceCount;
456   }
457
458   ~CustomTestFunctor()
459   {
460     --mCurrentInstanceCount;
461   }
462
463   void operator()()
464   {
465     ++mCallbackCount;
466   }
467
468   static int mTotalInstanceCount;
469   static int mCurrentInstanceCount;
470   static int mCallbackCount;
471 };
472
473 int CustomTestFunctor::mTotalInstanceCount = 0;
474 int CustomTestFunctor::mCurrentInstanceCount = 0;
475 int CustomTestFunctor::mCallbackCount = 0;
476
477 static void ResetFunctorCounts()
478 {
479   CustomTestFunctor::mTotalInstanceCount   = 0;
480   CustomTestFunctor::mCurrentInstanceCount = 0;
481   CustomTestFunctor::mCallbackCount        = 0;
482 }
483
484 static std::string lastActionCustom;
485 bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
486 {
487   lastActionCustom = actionName;
488   return true;
489 }
490
491 // Custom type registration
492 static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
493
494 // Custom signals
495 static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
496 static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
497 static const int TEST_SIGNAL_COUNT = 2;
498
499 // Custom actions
500 static TypeAction customAction1( customType1, "act1", DoActionCustom);
501 static const int TEST_ACTION_COUNT = 1;
502
503 class TestConnectionTracker : public ConnectionTracker
504 {
505 public:
506
507   TestConnectionTracker()
508   {
509   }
510 };
511
512 BaseHandle CreateNamedActorType()
513 {
514   Actor actor = Actor::New();
515   actor.SetName( "NamedActor" );
516   return actor;
517 }
518
519 TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
520 PropertyRegistration namedActorPropertyOne( namedActorType, "propName",  PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
521
522 } // Anonymous namespace
523
524 // Note: No negative test case for UtcDaliTypeRegistryGet can be implemented.
525 int UtcDaliTypeRegistryGetP(void)
526 {
527   TestApplication application;
528
529   TypeRegistry registry = TypeRegistry::Get();
530   DALI_TEST_CHECK( registry );
531
532   END_TEST;
533 }
534
535 // Note: No negative test case for UtcDaliTypeRegistryConstructor can be implemented.
536 int UtcDaliTypeRegistryConstructorP(void)
537 {
538   TestApplication application;
539
540   TypeRegistry registry;
541   DALI_TEST_CHECK( !registry );
542   END_TEST;
543 }
544
545 // Note: No negative test case for UtcDaliTypeRegistryCopyConstructor can be implemented.
546 int UtcDaliTypeRegistryCopyConstructorP(void)
547 {
548   TestApplication application;
549
550   TypeRegistry registry = TypeRegistry::Get();
551   DALI_TEST_CHECK( registry );
552
553   TypeRegistry copy( registry );
554   DALI_TEST_CHECK( copy );
555
556   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
557
558   END_TEST;
559 }
560
561 // Note: No negative test case for UtcDaliTypeRegistryAssignmentOperator can be implemented.
562 int UtcDaliTypeRegistryAssignmentOperatorP(void)
563 {
564   TestApplication application;
565
566   TypeRegistry registry = TypeRegistry::Get();
567   DALI_TEST_CHECK( registry );
568
569   TypeRegistry copy = registry;
570   DALI_TEST_CHECK( copy );
571   DALI_TEST_CHECK( registry == copy );
572
573   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
574
575   END_TEST;
576 }
577
578 int UtcDaliTypeRegistryAssignP(void)
579 {
580   TestApplication application;
581
582   TypeRegistry registry = TypeRegistry::Get();
583   TypeRegistry registry2;
584   registry2 = registry;
585   DALI_TEST_CHECK( registry2 );
586
587   DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
588
589   END_TEST;
590 }
591
592 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
593 {
594   TestApplication application;
595
596   TypeRegistry registry = TypeRegistry::Get();
597
598   TypeInfo type;
599
600   // image actor
601   type = registry.GetTypeInfo( "ImageActor" );
602   DALI_TEST_CHECK( type );
603   DALI_TEST_CHECK( type.GetCreator() );
604   DALI_TEST_CHECK( ImageActor::DownCast( type.GetCreator()() ) );
605   ImageActor ia = ImageActor::DownCast(type.CreateInstance());
606   DALI_TEST_CHECK( ia );
607   Stage::GetCurrent().Add( ia );
608   application.Render();
609
610   // camera actor
611   type = registry.GetTypeInfo( "CameraActor" );
612   DALI_TEST_CHECK( type );
613   CameraActor ca = CameraActor::DownCast(type.CreateInstance());
614   DALI_TEST_CHECK( ca );
615   Stage::GetCurrent().Add( ca );
616   application.Render();
617
618   // animations
619   type = registry.GetTypeInfo( "Animation" );
620   DALI_TEST_CHECK( type );
621   Animation an = Animation::DownCast(type.CreateInstance());
622   DALI_TEST_CHECK( an );
623   an.Play();
624   application.Render();
625
626   // shader effect
627   type = registry.GetTypeInfo( "ShaderEffect" );
628   DALI_TEST_CHECK( type );
629   ShaderEffect ef = ShaderEffect::DownCast(type.CreateInstance());
630   DALI_TEST_CHECK( ef );
631   application.Render();
632
633   END_TEST;
634 }
635
636 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
637 {
638   TestApplication application;
639
640   TypeRegistry registry = TypeRegistry::Get();
641
642   TypeInfo type;
643
644   type = registry.GetTypeInfo( "MyDummyActor" );
645   DALI_TEST_CHECK( !type );
646
647   END_TEST;
648 }
649
650 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
651 {
652   TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "ImageActor" );
653   TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::ImageActor) );
654
655   DALI_TEST_CHECK( named_type );
656   DALI_TEST_CHECK( typeinfo_type );
657
658   // Check named and typeid are equivalent
659   DALI_TEST_CHECK( named_type == typeinfo_type );
660
661   DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
662   DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
663
664   END_TEST;
665 }
666
667 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
668 {
669   TestApplication application;
670   TypeRegistry typeRegistry = TypeRegistry::Get();
671
672   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
673   DALI_TEST_CHECK( !typeInfo );
674
675   END_TEST;
676 }
677
678 int UtcDaliTypeRegistryGetTypeNameCountP(void)
679 {
680   TestApplication application;
681   TypeRegistry typeRegistry = TypeRegistry::Get();
682   TypeInfo type;
683
684   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
685   {
686     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
687     DALI_TEST_CHECK( type );
688   }
689
690   END_TEST;
691 }
692
693
694 int UtcDaliTypeRegistryGetTypeNamesP(void)
695 {
696   TestApplication application;
697   TypeRegistry typeRegistry = TypeRegistry::Get();
698   TypeInfo type;
699
700   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
701   {
702     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
703     DALI_TEST_CHECK( type );
704   }
705
706   END_TEST;
707 }
708
709
710 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
711 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
712 {
713   ResetFunctorCounts();
714
715   TestApplication application;
716
717   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
718   DALI_TEST_CHECK( type );
719
720   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
721   DALI_TEST_CHECK( baseType );
722
723   BaseHandle handle = type.CreateInstance();
724   DALI_TEST_CHECK( handle );
725
726   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
727   DALI_TEST_CHECK( customHandle );
728
729   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
730
731   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
732
733   {
734     TestConnectionTracker tracker;
735
736     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
737     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
738     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
739     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
740     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
741
742     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
743     customHandle.GetCustomSignal().Emit();
744     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
745     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
746     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
747   }
748   // tracker should automatically disconnect here
749   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
750   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
751
752   // Test that functor is disconnected
753   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
754   customHandle.GetCustomSignal().Emit();
755   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
756   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
757   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
758
759   Property::Map attributes;
760   handle.DoAction("act1", attributes);
761   DALI_TEST_CHECK( lastActionCustom == "act1" );
762   END_TEST;
763 }
764
765 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
766 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
767 {
768   TestApplication application;
769
770   DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
771
772   DALI_TEST_CHECK( true == CreateCustomInitCalled );
773   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
774   DALI_TEST_CHECK( type );
775   END_TEST;
776 }
777
778 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
779 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
780 {
781   TestApplication application;
782
783   // Create Named Actor Type
784   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
785   DALI_TEST_CHECK( type );
786
787   BaseHandle namedHandle = type.CreateInstance();
788   DALI_TEST_CHECK( namedHandle );
789   Actor namedActor( Actor::DownCast( namedHandle ) );
790   DALI_TEST_CHECK( namedActor );
791
792   DALI_TEST_CHECK( namedActor.GetName() == "NamedActor" );
793   DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
794   DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
795
796   END_TEST;
797 }
798
799 // Note: No negative test case for UtcDaliTypeRegistryRegisteredName can be implemented.
800 int UtcDaliTypeRegistryRegisteredNameP(void)
801 {
802   TestApplication application;
803
804   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
805
806   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
807   DALI_TEST_CHECK( baseType );
808
809   BaseHandle handle = baseType.CreateInstance();
810
811   DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
812   TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
813   DALI_TEST_CHECK( type );
814   END_TEST;
815 }
816
817 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
818 {
819   ResetFunctorCounts();
820
821   TestApplication application;
822
823   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
824   DALI_TEST_CHECK( type );
825
826   BaseHandle handle = type.CreateInstance();
827   DALI_TEST_CHECK( handle );
828
829   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
830   DALI_TEST_CHECK( customHandle );
831
832   {
833     TestConnectionTracker tracker;
834
835     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
836     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
837     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
838     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
839     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
840
841     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
842     customHandle.GetCustomSignal().Emit();
843     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
844     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
845     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
846   }
847   // tracker should automatically disconnect here
848   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
849   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
850
851   // Test that functor is disconnected
852   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
853   customHandle.GetCustomSignal().Emit();
854   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
855   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
856   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
857
858   END_TEST;
859 }
860
861 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
862 {
863   // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
864
865   ResetFunctorCounts();
866
867   TestApplication application;
868
869   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
870   DALI_TEST_CHECK( type );
871
872   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
873   DALI_TEST_CHECK( baseType );
874
875   BaseHandle handle = type.CreateInstance();
876   DALI_TEST_CHECK( handle );
877
878   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
879   DALI_TEST_CHECK( customHandle );
880
881   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
882
883   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
884
885   {
886     TestConnectionTracker tracker;
887
888     bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
889     DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
890     DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
891     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
892     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
893
894     // Should be a NOOP
895     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
896     customHandle.GetCustomSignal().Emit();
897     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
898   }
899   // tracker should have nothing to disconnect here
900
901   // Should be a NOOP
902   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
903   customHandle.GetCustomSignal().Emit();
904   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
905   END_TEST;
906 }
907
908 int UtcDaliTypeRegistryTypeActionP(void)
909 {
910   ResetFunctorCounts();
911
912   TestApplication application;
913
914   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
915   DALI_TEST_CHECK( type );
916
917   BaseHandle handle = type.CreateInstance();
918   DALI_TEST_CHECK( handle );
919
920   Property::Map attributes;
921   DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
922   DALI_TEST_CHECK( lastActionCustom == "act1" );
923
924   END_TEST;
925 }
926
927 int UtcDaliTypeRegistryTypeActionN(void)
928 {
929   ResetFunctorCounts();
930
931   TestApplication application;
932
933   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
934   DALI_TEST_CHECK( type );
935
936   BaseHandle handle = type.CreateInstance();
937   DALI_TEST_CHECK( handle );
938
939   Property::Map attributes;
940   DALI_TEST_CHECK( !handle.DoAction( "unknownAction",  attributes ) );
941
942   END_TEST;
943 }
944
945 int UtcDaliTypeRegistryPropertyRegistrationP(void)
946 {
947   TestApplication application;
948   TypeRegistry typeRegistry = TypeRegistry::Get();
949
950   // Check property count before property registration
951   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
952   DALI_TEST_CHECK( typeInfo );
953   BaseHandle handle = typeInfo.CreateInstance();
954   DALI_TEST_CHECK( handle );
955   Actor customActor = Actor::DownCast( handle );
956   DALI_TEST_CHECK( customActor );
957   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
958
959   std::string propertyName( "prop1" );
960   int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
961   Property::Type propertyType( Property::BOOLEAN );
962   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
963
964   // Check property count after registration
965   unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
966   DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
967
968   // Add custom property and check property count
969   customActor.RegisterProperty( "customProp1",   true );
970   unsigned int customPropertyCount( customActor.GetPropertyCount() );
971   DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
972
973   // Set the property, ensure SetProperty called
974   DALI_TEST_CHECK( !setPropertyCalled );
975   customActor.SetProperty( propertyIndex, false );
976   DALI_TEST_CHECK( setPropertyCalled );
977
978   // Get the property, ensure GetProperty called
979   DALI_TEST_CHECK( !getPropertyCalled );
980   (void)customActor.GetProperty< bool >( propertyIndex );
981   DALI_TEST_CHECK( getPropertyCalled );
982
983   // Check the property name
984   DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
985   DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
986
987   // Check the property index
988   DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
989
990   // Check the property type
991   DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
992
993   // Check property count of type-info is 1
994   Property::IndexContainer indices;
995   typeInfo.GetPropertyIndices( indices );
996   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
997
998   // Ensure indices returned from actor and customActor differ by two
999   Actor actor = Actor::New();
1000   actor.GetPropertyIndices( indices );
1001   unsigned int actorIndices = indices.Size();
1002   customActor.GetPropertyIndices( indices );
1003   unsigned int customActorIndices = indices.Size();
1004   DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1005   END_TEST;
1006 }
1007
1008 int UtcDaliTypeRegistryPropertyRegistrationN(void)
1009 {
1010   TestApplication application;
1011   TypeRegistry typeRegistry = TypeRegistry::Get();
1012
1013   // Attempt to register a property type out-of-bounds index (less than)
1014   try
1015   {
1016     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1017     tet_result( TET_FAIL );
1018   }
1019   catch ( DaliException& e )
1020   {
1021     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1022   }
1023
1024   // Attempt to register a property type out-of-bounds index (greater than)
1025   try
1026   {
1027     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1028     tet_result( TET_FAIL );
1029   }
1030   catch ( DaliException& e )
1031   {
1032     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1033   }
1034
1035   END_TEST;
1036 }
1037
1038 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1039 {
1040   TestApplication application;
1041   TypeRegistry typeRegistry = TypeRegistry::Get();
1042
1043   // Check property count before property registration
1044   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1045   DALI_TEST_CHECK( typeInfo );
1046   BaseHandle handle = typeInfo.CreateInstance();
1047   DALI_TEST_CHECK( handle );
1048   Actor customActor = Actor::DownCast( handle );
1049   DALI_TEST_CHECK( customActor );
1050   Stage::GetCurrent().Add(customActor);
1051
1052   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1053
1054   // Register animatable property
1055   std::string animatablePropertyName( "animatableProp1" );
1056   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1057   Property::Type animatablePropertyType( Property::FLOAT );
1058   AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1059
1060   // Check property count after registration
1061   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1062
1063   // Set the animatable property value
1064   customActor.SetProperty( animatablePropertyIndex, 25.0f );
1065
1066   // Render and notify
1067   application.SendNotification();
1068   application.Render();
1069
1070   // Check the animatable property value
1071   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1072
1073   // Check the animatable property name
1074   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1075
1076   // Check the animatable property index
1077   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1078
1079   // Check the animatable property type
1080   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1081
1082   // Check property count of type-info is 1
1083   Property::IndexContainer indices;
1084   typeInfo.GetPropertyIndices( indices );
1085   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1086
1087   // Ensure indices returned from actor and customActor differ by one
1088   Actor actor = Actor::New();
1089   actor.GetPropertyIndices( indices );
1090   unsigned int actorIndices = indices.Size();
1091   customActor.GetPropertyIndices( indices );
1092   unsigned int customActorIndices = indices.Size();
1093   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1094
1095   // check that the property is animatable
1096   Animation animation = Animation::New(0.2f);
1097   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1098   animation.Play();
1099   // Render and notify, animation play for 0.05 seconds
1100   application.SendNotification();
1101   application.Render(50);
1102   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1103   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1104   // Render and notify, animation play for another 0.1 seconds
1105   application.SendNotification();
1106   application.Render(100);
1107   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1108   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1109
1110   END_TEST;
1111 }
1112
1113 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1114 {
1115   TestApplication application;
1116   TypeRegistry typeRegistry = TypeRegistry::Get();
1117
1118   // Attempt to register an animatable property type out-of-bounds index (less than)
1119   try
1120   {
1121     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1122     tet_result( TET_FAIL );
1123   }
1124   catch ( DaliException& e )
1125   {
1126     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1127   }
1128
1129   // Attempt to register an animatable property type out-of-bounds index (greater than)
1130   try
1131   {
1132     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1133     tet_result( TET_FAIL );
1134   }
1135   catch ( DaliException& e )
1136   {
1137     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1138   }
1139
1140   END_TEST;
1141 }
1142
1143 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1144 {
1145   TestApplication application;
1146   TypeRegistry typeRegistry = TypeRegistry::Get();
1147
1148   // Check property count before property registration
1149   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1150   DALI_TEST_CHECK( typeInfo );
1151   BaseHandle handle = typeInfo.CreateInstance();
1152   DALI_TEST_CHECK( handle );
1153   Actor customActor = Actor::DownCast( handle );
1154   DALI_TEST_CHECK( customActor );
1155   Stage::GetCurrent().Add(customActor);
1156
1157   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1158
1159   // Register animatable property
1160   std::string animatablePropertyName( "animatableProp1" );
1161   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1162   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1163
1164   // Check property count after registration
1165   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1166
1167   // Render and notify
1168   application.SendNotification();
1169   application.Render();
1170
1171   // Check the animatable property value
1172   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1173
1174   // Check the animatable property name
1175   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1176
1177   // Check the animatable property index
1178   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1179
1180   // Check the animatable property type
1181   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1182
1183   // Check property count of type-info is 1
1184   Property::IndexContainer indices;
1185   typeInfo.GetPropertyIndices( indices );
1186   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1187
1188   // Ensure indices returned from actor and customActor differ by one
1189   Actor actor = Actor::New();
1190   actor.GetPropertyIndices( indices );
1191   unsigned int actorIndices = indices.Size();
1192   customActor.GetPropertyIndices( indices );
1193   unsigned int customActorIndices = indices.Size();
1194   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1195
1196   // check that the property is animatable
1197   Animation animation = Animation::New(0.2f);
1198   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1199   animation.Play();
1200   // Render and notify, animation play for 0.05 seconds
1201   application.SendNotification();
1202   application.Render(50);
1203   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1204   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1205   // Render and notify, animation play for another 0.1 seconds
1206   application.SendNotification();
1207   application.Render(100);
1208   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1209   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1210
1211   END_TEST;
1212 }
1213
1214 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1215 {
1216   TestApplication application;
1217   TypeRegistry typeRegistry = TypeRegistry::Get();
1218
1219   // Attempt to register an animatable property type out-of-bounds index (less than)
1220   try
1221   {
1222     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1223     tet_result( TET_FAIL );
1224   }
1225   catch ( DaliException& e )
1226   {
1227     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1228   }
1229
1230   // Attempt to register an animatable property type out-of-bounds index (greater than)
1231   try
1232   {
1233     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1234     tet_result( TET_FAIL );
1235   }
1236   catch ( DaliException& e )
1237   {
1238     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1239   }
1240
1241   END_TEST;
1242 }
1243
1244 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1245 {
1246   TestApplication application;
1247   TypeRegistry typeRegistry = TypeRegistry::Get();
1248
1249   // Check property count before property registration
1250   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1251   DALI_TEST_CHECK( typeInfo );
1252   BaseHandle handle = typeInfo.CreateInstance();
1253   DALI_TEST_CHECK( handle );
1254   Actor customActor = Actor::DownCast( handle );
1255   DALI_TEST_CHECK( customActor );
1256
1257   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1258
1259   // Register animatable property
1260   std::string animatablePropertyName( "animatableProp1" );
1261   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1262   Property::Type animatablePropertyType( Property::VECTOR2 );
1263   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1264
1265   // Check property count after registration
1266   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1267
1268   // Set the animatable property value
1269   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1270
1271   // Render and notify
1272   application.SendNotification();
1273   application.Render();
1274
1275   // Check the animatable property value
1276   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1277
1278   // Check the animatable property name
1279   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1280
1281   // Check the animatable property index
1282   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1283
1284   // Check the animatable property type
1285   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1286
1287   // Check property count of type-info is 1
1288   Property::IndexContainer indices;
1289   typeInfo.GetPropertyIndices( indices );
1290   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1291
1292   // Register animatable property components
1293   std::string animatablePropertyComponentName1( "animatableProp1X" );
1294   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1295   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1296
1297   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1298   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1299   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1300
1301   // Check property count after registration
1302   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1303
1304   // Check the animatable property component value
1305   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1306   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1307
1308   // Set the animatable property component value
1309   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1310
1311   // Render and notify
1312   application.SendNotification();
1313   application.Render();
1314
1315   // Check the animatable property value
1316   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1317   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1318   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1319
1320   // Set the animatable property component value
1321   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1322
1323   // Render and notify
1324   application.SendNotification();
1325   application.Render();
1326
1327   // Check the animatable property value
1328   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1329   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1330   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1331
1332   // Ensure indices returned from actor and customActor differ by three
1333   Actor actor = Actor::New();
1334   actor.GetPropertyIndices( indices );
1335   unsigned int actorIndices = indices.Size();
1336   customActor.GetPropertyIndices( indices );
1337   unsigned int customActorIndices = indices.Size();
1338   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1339
1340   END_TEST;
1341 }
1342
1343 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1344 {
1345   TestApplication application;
1346   TypeRegistry typeRegistry = TypeRegistry::Get();
1347
1348   // Register animatable property with the type of Vector2
1349   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1350   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1351
1352   // Attempt to register an animatable property component out-of-bounds index (less than)
1353   try
1354   {
1355     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1356     tet_result( TET_FAIL );
1357   }
1358   catch ( DaliException& e )
1359   {
1360     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1361   }
1362
1363   // Attempt to register an animatable property component out-of-bounds index (greater than)
1364   try
1365   {
1366     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1367     tet_result( TET_FAIL );
1368   }
1369   catch ( DaliException& e )
1370   {
1371     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1372   }
1373
1374   // Register an animatable property component
1375   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1376
1377   // Attempt to register another animatable property component with the same component index
1378   try
1379   {
1380     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1381     tet_result( TET_FAIL );
1382   }
1383   catch ( DaliException& e )
1384   {
1385     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1386   }
1387
1388   // Register animatable property with the type of boolean
1389   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1390   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1391
1392   // Attempt to register an animatable property component for the above property with boolean type
1393   try
1394   {
1395     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1396     tet_result( TET_FAIL );
1397   }
1398   catch ( DaliException& e )
1399   {
1400     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1401   }
1402
1403   END_TEST;
1404 }
1405
1406
1407 /*******************************************************************************
1408  *
1409  * Action through the base handle
1410  *
1411  ******************************************************************************/
1412 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1413 {
1414   TestApplication application;
1415
1416   TypeInfo type;
1417
1418   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1419   DALI_TEST_CHECK( type );
1420
1421   BaseHandle hdl = type.CreateInstance();
1422   DALI_TEST_CHECK( hdl );
1423
1424   Actor a = Actor::DownCast(hdl);
1425   DALI_TEST_CHECK( a );
1426
1427   a.SetVisible(false);
1428
1429   application.SendNotification();
1430   application.Render(0);
1431   DALI_TEST_CHECK(!a.IsVisible());
1432
1433   Property::Map attributes;
1434
1435   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1436
1437   application.SendNotification();
1438   application.Render(0);
1439   DALI_TEST_CHECK(a.IsVisible());
1440
1441   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1442   END_TEST;
1443 }
1444
1445 int UtcDaliPropertyRegistrationFunctions(void)
1446 {
1447   TestApplication application;
1448   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1449
1450   // Attempt to register a property without a setter
1451   try
1452   {
1453     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1454     tet_result( TET_PASS );
1455   }
1456   catch ( DaliException& e )
1457   {
1458     tet_result( TET_FAIL );
1459   }
1460
1461   // Attempt to register a property without a getter
1462   try
1463   {
1464     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1465     tet_result( TET_FAIL );
1466   }
1467   catch ( DaliException& e )
1468   {
1469     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1470   }
1471   END_TEST;
1472 }
1473
1474 int UtcDaliPropertyRegistrationAddSameIndex(void)
1475 {
1476   TestApplication application;
1477   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1478
1479   // Add one property with a valid property index
1480   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1481
1482   // Attempt to add another property with the same index
1483   try
1484   {
1485     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1486   }
1487   catch ( DaliException& e )
1488   {
1489     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1490   }
1491
1492   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1493
1494   // Add one property with a valid property index
1495   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1496
1497   // Attempt to add another property with the same index
1498   try
1499   {
1500     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
1501   }
1502   catch ( DaliException& e )
1503   {
1504     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1505   }
1506   END_TEST;
1507 }
1508
1509 int UtcDaliPropertyRegistrationPropertyWritable(void)
1510 {
1511   TestApplication application;
1512   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
1513   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
1514
1515   // Add two properties, one with SetProperty, one without
1516   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
1517   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
1518
1519   // Create custom-actor
1520   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1521   DALI_TEST_CHECK( typeInfo );
1522   BaseHandle handle = typeInfo.CreateInstance();
1523   DALI_TEST_CHECK( handle );
1524   Actor customActor = Actor::DownCast( handle );
1525   DALI_TEST_CHECK( customActor );
1526
1527   // Check whether properties are writable
1528   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
1529   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
1530   END_TEST;
1531 }
1532
1533 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
1534 {
1535   TestApplication application;
1536   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
1537   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
1538
1539   // These properties are not animatable
1540   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1541
1542   // These properties are animatable
1543   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1544
1545   // Create custom-actor
1546   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1547   DALI_TEST_CHECK( typeInfo );
1548   BaseHandle handle = typeInfo.CreateInstance();
1549   DALI_TEST_CHECK( handle );
1550   Actor customActor = Actor::DownCast( handle );
1551   DALI_TEST_CHECK( customActor );
1552
1553   // Check if animatable
1554   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
1555   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
1556
1557   // Create another instance of custom-actor
1558   BaseHandle handle2 = typeInfo.CreateInstance();
1559   DALI_TEST_CHECK( handle2 );
1560   Actor customActor2 = Actor::DownCast( handle2 );
1561   DALI_TEST_CHECK( customActor2 );
1562
1563   // Check if animatable
1564   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
1565   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
1566   END_TEST;
1567 }
1568
1569 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
1570 {
1571   TestApplication application;
1572   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
1573   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
1574
1575   // Create custom-actor
1576   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1577   DALI_TEST_CHECK( typeInfo );
1578   BaseHandle handle = typeInfo.CreateInstance();
1579   DALI_TEST_CHECK( handle );
1580   Actor customActor = Actor::DownCast( handle );
1581   DALI_TEST_CHECK( customActor );
1582
1583   // Try to set an index that hasn't been added
1584   try
1585   {
1586     customActor.SetProperty( propertyIndex, true );
1587     tet_result( TET_FAIL );
1588   }
1589   catch ( DaliException& e )
1590   {
1591     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1592   }
1593
1594   try
1595   {
1596     customActor.SetProperty( animatablePropertyIndex, true );
1597     tet_result( TET_FAIL );
1598   }
1599   catch ( DaliException& e )
1600   {
1601     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1602   }
1603
1604   // Try to get an index that hasn't been added
1605   try
1606   {
1607     (void) customActor.GetProperty< bool >( propertyIndex );
1608     tet_result( TET_FAIL );
1609   }
1610   catch ( DaliException& e )
1611   {
1612     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1613   }
1614
1615   try
1616   {
1617     (void) customActor.GetProperty< bool >( animatablePropertyIndex );
1618     tet_result( TET_FAIL );
1619   }
1620   catch ( DaliException& e )
1621   {
1622     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1623   }
1624   END_TEST;
1625 }
1626
1627
1628 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
1629 {
1630   TestApplication application;
1631
1632   Actor actor = Actor::New();
1633   actor.SetSize(100.0f, 100.0f);
1634   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1635   Stage::GetCurrent().Add(actor);
1636
1637   // Register Type
1638   TypeInfo type;
1639   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
1640   DALI_TEST_CHECK( type );
1641   BaseHandle handle = type.CreateInstance();
1642   DALI_TEST_CHECK( handle );
1643   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
1644   DALI_TEST_CHECK( detector );
1645
1646   // Attach actor to detector
1647   SignalData data;
1648   GestureReceivedFunctor functor( data );
1649   detector.Attach(actor);
1650
1651   // Connect to signal through type
1652   handle.ConnectSignal( &application, "longPressDetected",   functor );
1653
1654   // Render and notify
1655   application.SendNotification();
1656   application.Render();
1657
1658   // Emit gesture
1659   application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
1660   application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
1661   application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
1662   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1663   END_TEST;
1664 }
1665
1666 int UtcDaliPanGestureDetectorTypeRegistry(void)
1667 {
1668   TestApplication application;
1669
1670   Actor actor = Actor::New();
1671   actor.SetSize(100.0f, 100.0f);
1672   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1673   Stage::GetCurrent().Add(actor);
1674
1675   // Register Type
1676   TypeInfo type;
1677   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
1678   DALI_TEST_CHECK( type );
1679   BaseHandle handle = type.CreateInstance();
1680   DALI_TEST_CHECK( handle );
1681   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
1682   DALI_TEST_CHECK( detector );
1683
1684   // Attach actor to detector
1685   SignalData data;
1686   GestureReceivedFunctor functor( data );
1687   detector.Attach(actor);
1688
1689   // Connect to signal through type
1690   handle.ConnectSignal( &application, "panDetected",  functor );
1691
1692   // Render and notify
1693   application.SendNotification();
1694   application.Render();
1695
1696   // Emit gesture
1697   application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1698   application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1699   application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1700   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1701   END_TEST;
1702 }
1703
1704 int UtcDaliPinchGestureDetectorTypeRegistry(void)
1705 {
1706   TestApplication application;
1707
1708   Actor actor = Actor::New();
1709   actor.SetSize(100.0f, 100.0f);
1710   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1711   Stage::GetCurrent().Add(actor);
1712
1713   // Register Type
1714   TypeInfo type;
1715   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
1716   DALI_TEST_CHECK( type );
1717   BaseHandle handle = type.CreateInstance();
1718   DALI_TEST_CHECK( handle );
1719   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
1720   DALI_TEST_CHECK( detector );
1721
1722   // Attach actor to detector
1723   SignalData data;
1724   GestureReceivedFunctor functor( data );
1725   detector.Attach(actor);
1726
1727   // Connect to signal through type
1728   handle.ConnectSignal( &application, "pinchDetected",  functor );
1729
1730   // Render and notify
1731   application.SendNotification();
1732   application.Render();
1733
1734   // Emit gesture
1735   application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
1736   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1737   END_TEST;
1738 }
1739
1740 int UtcDaliTapGestureDetectorTypeRegistry(void)
1741 {
1742   TestApplication application;
1743
1744   Actor actor = Actor::New();
1745   actor.SetSize(100.0f, 100.0f);
1746   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1747   Stage::GetCurrent().Add(actor);
1748
1749   // Register Type
1750   TypeInfo type;
1751   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
1752   DALI_TEST_CHECK( type );
1753   BaseHandle handle = type.CreateInstance();
1754   DALI_TEST_CHECK( handle );
1755   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
1756   DALI_TEST_CHECK( detector );
1757
1758   // Attach actor to detector
1759   SignalData data;
1760   GestureReceivedFunctor functor( data );
1761   detector.Attach(actor);
1762
1763   // Connect to signal through type
1764   handle.ConnectSignal( &application, "tapDetected",  functor );
1765
1766   // Render and notify
1767   application.SendNotification();
1768   application.Render();
1769
1770   // Emit gesture
1771   application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
1772   application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
1773   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1774   END_TEST;
1775 }
1776
1777 int UtcDaliTypeRegistryNamedType(void)
1778 {
1779   TestApplication application;
1780   TypeRegistry typeRegistry = TypeRegistry::Get();
1781
1782   // Create a normal actor
1783   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
1784   DALI_TEST_CHECK( actorHandle );
1785   Actor actor( Actor::DownCast( actorHandle ) );
1786   DALI_TEST_CHECK( actor );
1787   unsigned int actorPropertyCount( actor.GetPropertyCount() );
1788
1789   // Create Named Actor Type
1790   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
1791   DALI_TEST_CHECK( namedHandle );
1792   Actor namedActor( Actor::DownCast( namedHandle ) );
1793   DALI_TEST_CHECK( namedActor );
1794   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
1795
1796   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
1797   END_TEST;
1798 }
1799
1800 int UtcDaliTypeInfoGetActionNameP(void)
1801 {
1802   TestApplication application;
1803   TypeRegistry typeRegistry = TypeRegistry::Get();
1804
1805   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1806   DALI_TEST_CHECK( typeInfo );
1807
1808   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1809
1810   std::string name = typeInfo.GetActionName(0);
1811
1812   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
1813
1814   END_TEST;
1815 }
1816
1817 int UtcDaliTypeInfoGetActionNameN(void)
1818 {
1819   TestApplication application;
1820   TypeRegistry typeRegistry = TypeRegistry::Get();
1821
1822   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1823   DALI_TEST_CHECK( typeInfo );
1824
1825   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1826
1827   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
1828
1829   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1830
1831   END_TEST;
1832 }
1833
1834 int UtcDaliTypeInfoGetSignalNameP(void)
1835 {
1836   TestApplication application;
1837   TypeRegistry typeRegistry = TypeRegistry::Get();
1838
1839   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1840   DALI_TEST_CHECK( typeInfo );
1841
1842   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1843
1844   std::string name = typeInfo.GetSignalName(0);
1845
1846   DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
1847
1848   END_TEST;
1849 }
1850
1851 int UtcDaliTypeInfoGetSignalNameN(void)
1852 {
1853   TestApplication application;
1854   TypeRegistry typeRegistry = TypeRegistry::Get();
1855
1856   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1857   DALI_TEST_CHECK( typeInfo );
1858
1859   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1860
1861   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
1862
1863   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1864
1865   END_TEST;
1866 }