[dali_1.1.31] Merge branch 'devel/master'
[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   // camera actor
601   type = registry.GetTypeInfo( "CameraActor" );
602   DALI_TEST_CHECK( type );
603   CameraActor ca = CameraActor::DownCast(type.CreateInstance());
604   DALI_TEST_CHECK( ca );
605   Stage::GetCurrent().Add( ca );
606   application.Render();
607
608   // animations
609   type = registry.GetTypeInfo( "Animation" );
610   DALI_TEST_CHECK( type );
611   Animation an = Animation::DownCast(type.CreateInstance());
612   DALI_TEST_CHECK( an );
613   an.Play();
614   application.Render();
615
616   // shader effect
617   type = registry.GetTypeInfo( "ShaderEffect" );
618   DALI_TEST_CHECK( type );
619   ShaderEffect ef = ShaderEffect::DownCast(type.CreateInstance());
620   DALI_TEST_CHECK( ef );
621   application.Render();
622
623   END_TEST;
624 }
625
626 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
627 {
628   TestApplication application;
629
630   TypeRegistry registry = TypeRegistry::Get();
631
632   TypeInfo type;
633
634   type = registry.GetTypeInfo( "MyDummyActor" );
635   DALI_TEST_CHECK( !type );
636
637   END_TEST;
638 }
639
640 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
641 {
642   TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
643   TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
644
645   DALI_TEST_CHECK( named_type );
646   DALI_TEST_CHECK( typeinfo_type );
647
648   // Check named and typeid are equivalent
649   DALI_TEST_CHECK( named_type == typeinfo_type );
650
651   DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
652   DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
653
654   END_TEST;
655 }
656
657 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
658 {
659   TestApplication application;
660   TypeRegistry typeRegistry = TypeRegistry::Get();
661
662   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
663   DALI_TEST_CHECK( !typeInfo );
664
665   END_TEST;
666 }
667
668 int UtcDaliTypeRegistryGetTypeNameCountP(void)
669 {
670   TestApplication application;
671   TypeRegistry typeRegistry = TypeRegistry::Get();
672   TypeInfo type;
673
674   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
675   {
676     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
677     DALI_TEST_CHECK( type );
678   }
679
680   END_TEST;
681 }
682
683
684 int UtcDaliTypeRegistryGetTypeNamesP(void)
685 {
686   TestApplication application;
687   TypeRegistry typeRegistry = TypeRegistry::Get();
688   TypeInfo type;
689
690   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
691   {
692     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
693     DALI_TEST_CHECK( type );
694   }
695
696   END_TEST;
697 }
698
699
700 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
701 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
702 {
703   ResetFunctorCounts();
704
705   TestApplication application;
706
707   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
708   DALI_TEST_CHECK( type );
709
710   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
711   DALI_TEST_CHECK( baseType );
712
713   BaseHandle handle = type.CreateInstance();
714   DALI_TEST_CHECK( handle );
715
716   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
717   DALI_TEST_CHECK( customHandle );
718
719   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
720
721   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
722
723   {
724     TestConnectionTracker tracker;
725
726     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
727     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
728     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
729     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
730     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
731
732     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
733     customHandle.GetCustomSignal().Emit();
734     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
735     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
736     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
737   }
738   // tracker should automatically disconnect here
739   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
740   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
741
742   // Test that functor is disconnected
743   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
744   customHandle.GetCustomSignal().Emit();
745   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
746   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
747   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
748
749   Property::Map attributes;
750   handle.DoAction("act1", attributes);
751   DALI_TEST_CHECK( lastActionCustom == "act1" );
752   END_TEST;
753 }
754
755 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
756 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
757 {
758   TestApplication application;
759
760   DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
761
762   DALI_TEST_CHECK( true == CreateCustomInitCalled );
763   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
764   DALI_TEST_CHECK( type );
765   END_TEST;
766 }
767
768 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
769 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
770 {
771   TestApplication application;
772
773   // Create Named Actor Type
774   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
775   DALI_TEST_CHECK( type );
776
777   BaseHandle namedHandle = type.CreateInstance();
778   DALI_TEST_CHECK( namedHandle );
779   Actor namedActor( Actor::DownCast( namedHandle ) );
780   DALI_TEST_CHECK( namedActor );
781
782   DALI_TEST_CHECK( namedActor.GetName() == "NamedActor" );
783   DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
784   DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
785
786   END_TEST;
787 }
788
789 // Note: No negative test case for UtcDaliTypeRegistryRegisteredName can be implemented.
790 int UtcDaliTypeRegistryRegisteredNameP(void)
791 {
792   TestApplication application;
793
794   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
795
796   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
797   DALI_TEST_CHECK( baseType );
798
799   BaseHandle handle = baseType.CreateInstance();
800
801   DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
802   TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
803   DALI_TEST_CHECK( type );
804   END_TEST;
805 }
806
807 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
808 {
809   ResetFunctorCounts();
810
811   TestApplication application;
812
813   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
814   DALI_TEST_CHECK( type );
815
816   BaseHandle handle = type.CreateInstance();
817   DALI_TEST_CHECK( handle );
818
819   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
820   DALI_TEST_CHECK( customHandle );
821
822   {
823     TestConnectionTracker tracker;
824
825     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
826     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
827     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
828     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
829     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
830
831     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
832     customHandle.GetCustomSignal().Emit();
833     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
834     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
835     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
836   }
837   // tracker should automatically disconnect here
838   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
839   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
840
841   // Test that functor is disconnected
842   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
843   customHandle.GetCustomSignal().Emit();
844   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
845   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
846   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
847
848   END_TEST;
849 }
850
851 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
852 {
853   // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
854
855   ResetFunctorCounts();
856
857   TestApplication application;
858
859   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
860   DALI_TEST_CHECK( type );
861
862   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
863   DALI_TEST_CHECK( baseType );
864
865   BaseHandle handle = type.CreateInstance();
866   DALI_TEST_CHECK( handle );
867
868   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
869   DALI_TEST_CHECK( customHandle );
870
871   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
872
873   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
874
875   {
876     TestConnectionTracker tracker;
877
878     bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
879     DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
880     DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
881     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
882     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
883
884     // Should be a NOOP
885     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
886     customHandle.GetCustomSignal().Emit();
887     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
888   }
889   // tracker should have nothing to disconnect here
890
891   // Should be a NOOP
892   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
893   customHandle.GetCustomSignal().Emit();
894   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
895   END_TEST;
896 }
897
898 int UtcDaliTypeRegistryTypeActionP(void)
899 {
900   ResetFunctorCounts();
901
902   TestApplication application;
903
904   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
905   DALI_TEST_CHECK( type );
906
907   BaseHandle handle = type.CreateInstance();
908   DALI_TEST_CHECK( handle );
909
910   Property::Map attributes;
911   DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
912   DALI_TEST_CHECK( lastActionCustom == "act1" );
913
914   END_TEST;
915 }
916
917 int UtcDaliTypeRegistryTypeActionN(void)
918 {
919   ResetFunctorCounts();
920
921   TestApplication application;
922
923   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
924   DALI_TEST_CHECK( type );
925
926   BaseHandle handle = type.CreateInstance();
927   DALI_TEST_CHECK( handle );
928
929   Property::Map attributes;
930   DALI_TEST_CHECK( !handle.DoAction( "unknownAction",  attributes ) );
931
932   END_TEST;
933 }
934
935 int UtcDaliTypeRegistryPropertyRegistrationP(void)
936 {
937   TestApplication application;
938   TypeRegistry typeRegistry = TypeRegistry::Get();
939
940   // Check property count before property registration
941   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
942   DALI_TEST_CHECK( typeInfo );
943   BaseHandle handle = typeInfo.CreateInstance();
944   DALI_TEST_CHECK( handle );
945   Actor customActor = Actor::DownCast( handle );
946   DALI_TEST_CHECK( customActor );
947   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
948
949   std::string propertyName( "prop1" );
950   int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
951   Property::Type propertyType( Property::BOOLEAN );
952   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
953
954   // Check property count after registration
955   unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
956   DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
957
958   // Add custom property and check property count
959   customActor.RegisterProperty( "customProp1",   true );
960   unsigned int customPropertyCount( customActor.GetPropertyCount() );
961   DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
962
963   // Set the property, ensure SetProperty called
964   DALI_TEST_CHECK( !setPropertyCalled );
965   customActor.SetProperty( propertyIndex, false );
966   DALI_TEST_CHECK( setPropertyCalled );
967
968   // Get the property, ensure GetProperty called
969   DALI_TEST_CHECK( !getPropertyCalled );
970   (void)customActor.GetProperty< bool >( propertyIndex );
971   DALI_TEST_CHECK( getPropertyCalled );
972
973   // Check the property name
974   DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
975   DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
976
977   // Check the property index
978   DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
979
980   // Check the property type
981   DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
982
983   // Check property count of type-info is 1
984   Property::IndexContainer indices;
985   typeInfo.GetPropertyIndices( indices );
986   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
987
988   // Ensure indices returned from actor and customActor differ by two
989   Actor actor = Actor::New();
990   actor.GetPropertyIndices( indices );
991   unsigned int actorIndices = indices.Size();
992   customActor.GetPropertyIndices( indices );
993   unsigned int customActorIndices = indices.Size();
994   DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
995   END_TEST;
996 }
997
998 int UtcDaliTypeRegistryPropertyRegistrationN(void)
999 {
1000   TestApplication application;
1001   TypeRegistry typeRegistry = TypeRegistry::Get();
1002
1003   // Attempt to register a property type out-of-bounds index (less than)
1004   try
1005   {
1006     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1007     tet_result( TET_FAIL );
1008   }
1009   catch ( DaliException& e )
1010   {
1011     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1012   }
1013
1014   // Attempt to register a property type out-of-bounds index (greater than)
1015   try
1016   {
1017     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1018     tet_result( TET_FAIL );
1019   }
1020   catch ( DaliException& e )
1021   {
1022     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1023   }
1024
1025   END_TEST;
1026 }
1027
1028 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1029 {
1030   TestApplication application;
1031   TypeRegistry typeRegistry = TypeRegistry::Get();
1032
1033   // Check property count before property registration
1034   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1035   DALI_TEST_CHECK( typeInfo );
1036   BaseHandle handle = typeInfo.CreateInstance();
1037   DALI_TEST_CHECK( handle );
1038   Actor customActor = Actor::DownCast( handle );
1039   DALI_TEST_CHECK( customActor );
1040   Stage::GetCurrent().Add(customActor);
1041
1042   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1043
1044   // Register animatable property
1045   std::string animatablePropertyName( "animatableProp1" );
1046   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1047   Property::Type animatablePropertyType( Property::FLOAT );
1048   AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1049
1050   // Check property count after registration
1051   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1052
1053   // Set the animatable property value
1054   customActor.SetProperty( animatablePropertyIndex, 25.0f );
1055
1056   // Render and notify
1057   application.SendNotification();
1058   application.Render();
1059
1060   // Check the animatable property value
1061   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1062
1063   // Check the animatable property name
1064   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1065
1066   // Check the animatable property index
1067   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1068
1069   // Check the animatable property type
1070   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1071
1072   // Check property count of type-info is 1
1073   Property::IndexContainer indices;
1074   typeInfo.GetPropertyIndices( indices );
1075   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1076
1077   // Ensure indices returned from actor and customActor differ by one
1078   Actor actor = Actor::New();
1079   actor.GetPropertyIndices( indices );
1080   unsigned int actorIndices = indices.Size();
1081   customActor.GetPropertyIndices( indices );
1082   unsigned int customActorIndices = indices.Size();
1083   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1084
1085   // check that the property is animatable
1086   Animation animation = Animation::New(0.2f);
1087   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1088   animation.Play();
1089   // Render and notify, animation play for 0.05 seconds
1090   application.SendNotification();
1091   application.Render(50);
1092   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1093   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1094   // Render and notify, animation play for another 0.1 seconds
1095   application.SendNotification();
1096   application.Render(100);
1097   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1098   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1099
1100   END_TEST;
1101 }
1102
1103 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1104 {
1105   TestApplication application;
1106   TypeRegistry typeRegistry = TypeRegistry::Get();
1107
1108   // Attempt to register an animatable property type out-of-bounds index (less than)
1109   try
1110   {
1111     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1112     tet_result( TET_FAIL );
1113   }
1114   catch ( DaliException& e )
1115   {
1116     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1117   }
1118
1119   // Attempt to register an animatable property type out-of-bounds index (greater than)
1120   try
1121   {
1122     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1123     tet_result( TET_FAIL );
1124   }
1125   catch ( DaliException& e )
1126   {
1127     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1128   }
1129
1130   END_TEST;
1131 }
1132
1133 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1134 {
1135   TestApplication application;
1136   TypeRegistry typeRegistry = TypeRegistry::Get();
1137
1138   // Check property count before property registration
1139   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1140   DALI_TEST_CHECK( typeInfo );
1141   BaseHandle handle = typeInfo.CreateInstance();
1142   DALI_TEST_CHECK( handle );
1143   Actor customActor = Actor::DownCast( handle );
1144   DALI_TEST_CHECK( customActor );
1145   Stage::GetCurrent().Add(customActor);
1146
1147   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1148
1149   // Register animatable property
1150   std::string animatablePropertyName( "animatableProp1" );
1151   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1152   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1153
1154   // Check property count after registration
1155   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1156
1157   // Render and notify
1158   application.SendNotification();
1159   application.Render();
1160
1161   // Check the animatable property value
1162   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1163
1164   // Check the animatable property name
1165   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1166
1167   // Check the animatable property index
1168   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1169
1170   // Check the animatable property type
1171   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1172
1173   // Check property count of type-info is 1
1174   Property::IndexContainer indices;
1175   typeInfo.GetPropertyIndices( indices );
1176   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1177
1178   // Ensure indices returned from actor and customActor differ by one
1179   Actor actor = Actor::New();
1180   actor.GetPropertyIndices( indices );
1181   unsigned int actorIndices = indices.Size();
1182   customActor.GetPropertyIndices( indices );
1183   unsigned int customActorIndices = indices.Size();
1184   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1185
1186   // check that the property is animatable
1187   Animation animation = Animation::New(0.2f);
1188   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1189   animation.Play();
1190   // Render and notify, animation play for 0.05 seconds
1191   application.SendNotification();
1192   application.Render(50);
1193   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1194   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1195   // Render and notify, animation play for another 0.1 seconds
1196   application.SendNotification();
1197   application.Render(100);
1198   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1199   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1200
1201   END_TEST;
1202 }
1203
1204 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1205 {
1206   TestApplication application;
1207   TypeRegistry typeRegistry = TypeRegistry::Get();
1208
1209   // Attempt to register an animatable property type out-of-bounds index (less than)
1210   try
1211   {
1212     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1213     tet_result( TET_FAIL );
1214   }
1215   catch ( DaliException& e )
1216   {
1217     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1218   }
1219
1220   // Attempt to register an animatable property type out-of-bounds index (greater than)
1221   try
1222   {
1223     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1224     tet_result( TET_FAIL );
1225   }
1226   catch ( DaliException& e )
1227   {
1228     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1229   }
1230
1231   END_TEST;
1232 }
1233
1234 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1235 {
1236   TestApplication application;
1237   TypeRegistry typeRegistry = TypeRegistry::Get();
1238
1239   // Check property count before property registration
1240   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1241   DALI_TEST_CHECK( typeInfo );
1242   BaseHandle handle = typeInfo.CreateInstance();
1243   DALI_TEST_CHECK( handle );
1244   Actor customActor = Actor::DownCast( handle );
1245   DALI_TEST_CHECK( customActor );
1246
1247   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1248
1249   // Register animatable property
1250   std::string animatablePropertyName( "animatableProp1" );
1251   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1252   Property::Type animatablePropertyType( Property::VECTOR2 );
1253   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1254
1255   // Check property count after registration
1256   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1257
1258   // Set the animatable property value
1259   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1260
1261   // Render and notify
1262   application.SendNotification();
1263   application.Render();
1264
1265   // Check the animatable property value
1266   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1267
1268   // Check the animatable property name
1269   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1270
1271   // Check the animatable property index
1272   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1273
1274   // Check the animatable property type
1275   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1276
1277   // Check property count of type-info is 1
1278   Property::IndexContainer indices;
1279   typeInfo.GetPropertyIndices( indices );
1280   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1281
1282   // Register animatable property components
1283   std::string animatablePropertyComponentName1( "animatableProp1X" );
1284   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1285   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1286
1287   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1288   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1289   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1290
1291   // Check property count after registration
1292   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1293
1294   // Check the animatable property component value
1295   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1296   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1297
1298   // Set the animatable property component value
1299   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1300
1301   // Render and notify
1302   application.SendNotification();
1303   application.Render();
1304
1305   // Check the animatable property value
1306   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1307   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1308   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1309
1310   // Set the animatable property component value
1311   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1312
1313   // Render and notify
1314   application.SendNotification();
1315   application.Render();
1316
1317   // Check the animatable property value
1318   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1319   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1320   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1321
1322   // Ensure indices returned from actor and customActor differ by three
1323   Actor actor = Actor::New();
1324   actor.GetPropertyIndices( indices );
1325   unsigned int actorIndices = indices.Size();
1326   customActor.GetPropertyIndices( indices );
1327   unsigned int customActorIndices = indices.Size();
1328   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1329
1330   END_TEST;
1331 }
1332
1333 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1334 {
1335   TestApplication application;
1336   TypeRegistry typeRegistry = TypeRegistry::Get();
1337
1338   // Register animatable property with the type of Vector2
1339   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1340   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1341
1342   // Attempt to register an animatable property component out-of-bounds index (less than)
1343   try
1344   {
1345     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1346     tet_result( TET_FAIL );
1347   }
1348   catch ( DaliException& e )
1349   {
1350     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1351   }
1352
1353   // Attempt to register an animatable property component out-of-bounds index (greater than)
1354   try
1355   {
1356     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1357     tet_result( TET_FAIL );
1358   }
1359   catch ( DaliException& e )
1360   {
1361     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1362   }
1363
1364   // Register an animatable property component
1365   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1366
1367   // Attempt to register another animatable property component with the same component index
1368   try
1369   {
1370     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1371     tet_result( TET_FAIL );
1372   }
1373   catch ( DaliException& e )
1374   {
1375     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1376   }
1377
1378   // Register animatable property with the type of boolean
1379   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1380   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1381
1382   // Attempt to register an animatable property component for the above property with boolean type
1383   try
1384   {
1385     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1386     tet_result( TET_FAIL );
1387   }
1388   catch ( DaliException& e )
1389   {
1390     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1391   }
1392
1393   END_TEST;
1394 }
1395
1396
1397 /*******************************************************************************
1398  *
1399  * Action through the base handle
1400  *
1401  ******************************************************************************/
1402 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1403 {
1404   TestApplication application;
1405
1406   TypeInfo type;
1407
1408   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1409   DALI_TEST_CHECK( type );
1410
1411   BaseHandle hdl = type.CreateInstance();
1412   DALI_TEST_CHECK( hdl );
1413
1414   Actor a = Actor::DownCast(hdl);
1415   DALI_TEST_CHECK( a );
1416
1417   a.SetVisible(false);
1418
1419   application.SendNotification();
1420   application.Render(0);
1421   DALI_TEST_CHECK(!a.IsVisible());
1422
1423   Property::Map attributes;
1424
1425   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1426
1427   application.SendNotification();
1428   application.Render(0);
1429   DALI_TEST_CHECK(a.IsVisible());
1430
1431   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1432   END_TEST;
1433 }
1434
1435 int UtcDaliPropertyRegistrationFunctions(void)
1436 {
1437   TestApplication application;
1438   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1439
1440   // Attempt to register a property without a setter
1441   try
1442   {
1443     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1444     tet_result( TET_PASS );
1445   }
1446   catch ( DaliException& e )
1447   {
1448     tet_result( TET_FAIL );
1449   }
1450
1451   // Attempt to register a property without a getter
1452   try
1453   {
1454     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1455     tet_result( TET_FAIL );
1456   }
1457   catch ( DaliException& e )
1458   {
1459     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1460   }
1461   END_TEST;
1462 }
1463
1464 int UtcDaliPropertyRegistrationAddSameIndex(void)
1465 {
1466   TestApplication application;
1467   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1468
1469   // Add one property with a valid property index
1470   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1471
1472   // Attempt to add another property with the same index
1473   try
1474   {
1475     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1476   }
1477   catch ( DaliException& e )
1478   {
1479     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1480   }
1481
1482   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1483
1484   // Add one property with a valid property index
1485   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1486
1487   // Attempt to add another property with the same index
1488   try
1489   {
1490     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
1491   }
1492   catch ( DaliException& e )
1493   {
1494     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1495   }
1496   END_TEST;
1497 }
1498
1499 int UtcDaliPropertyRegistrationPropertyWritable(void)
1500 {
1501   TestApplication application;
1502   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
1503   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
1504
1505   // Add two properties, one with SetProperty, one without
1506   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
1507   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
1508
1509   // Create custom-actor
1510   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1511   DALI_TEST_CHECK( typeInfo );
1512   BaseHandle handle = typeInfo.CreateInstance();
1513   DALI_TEST_CHECK( handle );
1514   Actor customActor = Actor::DownCast( handle );
1515   DALI_TEST_CHECK( customActor );
1516
1517   // Check whether properties are writable
1518   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
1519   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
1520   END_TEST;
1521 }
1522
1523 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
1524 {
1525   TestApplication application;
1526   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
1527   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
1528
1529   // These properties are not animatable
1530   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1531
1532   // These properties are animatable
1533   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1534
1535   // Create custom-actor
1536   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1537   DALI_TEST_CHECK( typeInfo );
1538   BaseHandle handle = typeInfo.CreateInstance();
1539   DALI_TEST_CHECK( handle );
1540   Actor customActor = Actor::DownCast( handle );
1541   DALI_TEST_CHECK( customActor );
1542
1543   // Check if animatable
1544   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
1545   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
1546
1547   // Create another instance of custom-actor
1548   BaseHandle handle2 = typeInfo.CreateInstance();
1549   DALI_TEST_CHECK( handle2 );
1550   Actor customActor2 = Actor::DownCast( handle2 );
1551   DALI_TEST_CHECK( customActor2 );
1552
1553   // Check if animatable
1554   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
1555   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
1556   END_TEST;
1557 }
1558
1559 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
1560 {
1561   TestApplication application;
1562   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
1563   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
1564
1565   // Create custom-actor
1566   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1567   DALI_TEST_CHECK( typeInfo );
1568   BaseHandle handle = typeInfo.CreateInstance();
1569   DALI_TEST_CHECK( handle );
1570   Actor customActor = Actor::DownCast( handle );
1571   DALI_TEST_CHECK( customActor );
1572
1573   // Try to set an index that hasn't been added
1574   try
1575   {
1576     customActor.SetProperty( propertyIndex, true );
1577     tet_result( TET_FAIL );
1578   }
1579   catch ( DaliException& e )
1580   {
1581     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1582   }
1583
1584   try
1585   {
1586     customActor.SetProperty( animatablePropertyIndex, 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 to get an index that hasn't been added
1595   try
1596   {
1597     (void) customActor.GetProperty< bool >( propertyIndex );
1598     tet_result( TET_FAIL );
1599   }
1600   catch ( DaliException& e )
1601   {
1602     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1603   }
1604
1605   try
1606   {
1607     (void) customActor.GetProperty< bool >( animatablePropertyIndex );
1608     tet_result( TET_FAIL );
1609   }
1610   catch ( DaliException& e )
1611   {
1612     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1613   }
1614   END_TEST;
1615 }
1616
1617
1618 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
1619 {
1620   TestApplication application;
1621
1622   Actor actor = Actor::New();
1623   actor.SetSize(100.0f, 100.0f);
1624   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1625   Stage::GetCurrent().Add(actor);
1626
1627   // Register Type
1628   TypeInfo type;
1629   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
1630   DALI_TEST_CHECK( type );
1631   BaseHandle handle = type.CreateInstance();
1632   DALI_TEST_CHECK( handle );
1633   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
1634   DALI_TEST_CHECK( detector );
1635
1636   // Attach actor to detector
1637   SignalData data;
1638   GestureReceivedFunctor functor( data );
1639   detector.Attach(actor);
1640
1641   // Connect to signal through type
1642   handle.ConnectSignal( &application, "longPressDetected",   functor );
1643
1644   // Render and notify
1645   application.SendNotification();
1646   application.Render();
1647
1648   // Emit gesture
1649   application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
1650   application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
1651   application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
1652   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1653   END_TEST;
1654 }
1655
1656 int UtcDaliPanGestureDetectorTypeRegistry(void)
1657 {
1658   TestApplication application;
1659
1660   Actor actor = Actor::New();
1661   actor.SetSize(100.0f, 100.0f);
1662   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1663   Stage::GetCurrent().Add(actor);
1664
1665   // Register Type
1666   TypeInfo type;
1667   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
1668   DALI_TEST_CHECK( type );
1669   BaseHandle handle = type.CreateInstance();
1670   DALI_TEST_CHECK( handle );
1671   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
1672   DALI_TEST_CHECK( detector );
1673
1674   // Attach actor to detector
1675   SignalData data;
1676   GestureReceivedFunctor functor( data );
1677   detector.Attach(actor);
1678
1679   // Connect to signal through type
1680   handle.ConnectSignal( &application, "panDetected",  functor );
1681
1682   // Render and notify
1683   application.SendNotification();
1684   application.Render();
1685
1686   // Emit gesture
1687   application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1688   application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1689   application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1690   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1691   END_TEST;
1692 }
1693
1694 int UtcDaliPinchGestureDetectorTypeRegistry(void)
1695 {
1696   TestApplication application;
1697
1698   Actor actor = Actor::New();
1699   actor.SetSize(100.0f, 100.0f);
1700   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1701   Stage::GetCurrent().Add(actor);
1702
1703   // Register Type
1704   TypeInfo type;
1705   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
1706   DALI_TEST_CHECK( type );
1707   BaseHandle handle = type.CreateInstance();
1708   DALI_TEST_CHECK( handle );
1709   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
1710   DALI_TEST_CHECK( detector );
1711
1712   // Attach actor to detector
1713   SignalData data;
1714   GestureReceivedFunctor functor( data );
1715   detector.Attach(actor);
1716
1717   // Connect to signal through type
1718   handle.ConnectSignal( &application, "pinchDetected",  functor );
1719
1720   // Render and notify
1721   application.SendNotification();
1722   application.Render();
1723
1724   // Emit gesture
1725   application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
1726   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1727   END_TEST;
1728 }
1729
1730 int UtcDaliTapGestureDetectorTypeRegistry(void)
1731 {
1732   TestApplication application;
1733
1734   Actor actor = Actor::New();
1735   actor.SetSize(100.0f, 100.0f);
1736   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1737   Stage::GetCurrent().Add(actor);
1738
1739   // Register Type
1740   TypeInfo type;
1741   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
1742   DALI_TEST_CHECK( type );
1743   BaseHandle handle = type.CreateInstance();
1744   DALI_TEST_CHECK( handle );
1745   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
1746   DALI_TEST_CHECK( detector );
1747
1748   // Attach actor to detector
1749   SignalData data;
1750   GestureReceivedFunctor functor( data );
1751   detector.Attach(actor);
1752
1753   // Connect to signal through type
1754   handle.ConnectSignal( &application, "tapDetected",  functor );
1755
1756   // Render and notify
1757   application.SendNotification();
1758   application.Render();
1759
1760   // Emit gesture
1761   application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
1762   application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
1763   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1764   END_TEST;
1765 }
1766
1767 int UtcDaliTypeRegistryNamedType(void)
1768 {
1769   TestApplication application;
1770   TypeRegistry typeRegistry = TypeRegistry::Get();
1771
1772   // Create a normal actor
1773   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
1774   DALI_TEST_CHECK( actorHandle );
1775   Actor actor( Actor::DownCast( actorHandle ) );
1776   DALI_TEST_CHECK( actor );
1777   unsigned int actorPropertyCount( actor.GetPropertyCount() );
1778
1779   // Create Named Actor Type
1780   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
1781   DALI_TEST_CHECK( namedHandle );
1782   Actor namedActor( Actor::DownCast( namedHandle ) );
1783   DALI_TEST_CHECK( namedActor );
1784   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
1785
1786   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
1787   END_TEST;
1788 }
1789
1790 int UtcDaliTypeInfoGetActionNameP(void)
1791 {
1792   TestApplication application;
1793   TypeRegistry typeRegistry = TypeRegistry::Get();
1794
1795   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1796   DALI_TEST_CHECK( typeInfo );
1797
1798   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1799
1800   std::string name = typeInfo.GetActionName(0);
1801
1802   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
1803
1804   END_TEST;
1805 }
1806
1807 int UtcDaliTypeInfoGetActionNameN(void)
1808 {
1809   TestApplication application;
1810   TypeRegistry typeRegistry = TypeRegistry::Get();
1811
1812   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1813   DALI_TEST_CHECK( typeInfo );
1814
1815   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1816
1817   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
1818
1819   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1820
1821   END_TEST;
1822 }
1823
1824 int UtcDaliTypeInfoGetSignalNameP(void)
1825 {
1826   TestApplication application;
1827   TypeRegistry typeRegistry = TypeRegistry::Get();
1828
1829   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1830   DALI_TEST_CHECK( typeInfo );
1831
1832   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1833
1834   std::string name = typeInfo.GetSignalName(0);
1835
1836   DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
1837
1838   END_TEST;
1839 }
1840
1841 int UtcDaliTypeInfoGetSignalNameN(void)
1842 {
1843   TestApplication application;
1844   TypeRegistry typeRegistry = TypeRegistry::Get();
1845
1846   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1847   DALI_TEST_CHECK( typeInfo );
1848
1849   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1850
1851   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
1852
1853   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1854
1855   END_TEST;
1856 }