Merge "Added C# control / property registration to devel API" into devel/master
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-TypeRegistry.cpp
1 /*
2  * Copyright (c) 2016 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/internal/event/common/type-info-impl.h>
24 #include <dali/integration-api/events/long-press-gesture-event.h>
25 #include <dali/integration-api/events/pan-gesture-event.h>
26 #include <dali/integration-api/events/pinch-gesture-event.h>
27 #include <dali/integration-api/events/tap-gesture-event.h>
28 #include <dali/integration-api/events/touch-event-integ.h>
29 #include <dali/integration-api/events/hover-event-integ.h>
30
31 using namespace Dali;
32
33
34 namespace
35 {
36
37 // Stores data that is populated in the callback and will be read by the Test cases
38 struct SignalData
39 {
40   SignalData()
41   : functorCalled( false ),
42     voidFunctorCalled( false ),
43     receivedGesture( Gesture::Clear ),
44     pressedActor()
45   {}
46
47   void Reset()
48   {
49     functorCalled = false;
50     voidFunctorCalled = false;
51
52     receivedGesture.numberOfTouches = 0u;
53     receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
54     receivedGesture.localPoint = Vector2(0.0f, 0.0f);
55
56     pressedActor.Reset();
57   }
58
59   bool functorCalled;
60   bool voidFunctorCalled;
61   LongPressGesture receivedGesture;
62   Actor pressedActor;
63 };
64
65 // Functor that sets the data when called
66 struct GestureReceivedFunctor
67 {
68   GestureReceivedFunctor(SignalData& data) : signalData(data) { }
69
70   void operator()(Actor actor, LongPressGesture longPress)
71   {
72     signalData.functorCalled = true;
73     signalData.receivedGesture = longPress;
74     signalData.pressedActor = actor;
75   }
76
77   void operator()()
78   {
79     signalData.voidFunctorCalled = true;
80   }
81
82   SignalData& signalData;
83 };
84
85 // Generate a LongPressGestureEvent to send to Core
86 Integration::LongPressGestureEvent GenerateLongPress(
87     Gesture::State state,
88     unsigned int numberOfTouches,
89     Vector2 point)
90 {
91   Integration::LongPressGestureEvent longPress( state );
92
93   longPress.numberOfTouches = numberOfTouches;
94   longPress.point = point;
95
96   return longPress;
97 }
98
99 // Generate a PanGestureEvent to send to Core
100 Integration::PanGestureEvent GeneratePan(
101     Gesture::State state,
102     Vector2 previousPosition,
103     Vector2 currentPosition,
104     unsigned long timeDelta,
105     unsigned int numberOfTouches = 1,
106     unsigned int time = 1u)
107 {
108   Integration::PanGestureEvent pan(state);
109
110   pan.previousPosition = previousPosition;
111   pan.currentPosition = currentPosition;
112   pan.timeDelta = timeDelta;
113   pan.numberOfTouches = numberOfTouches;
114   pan.time = time;
115
116   return pan;
117 }
118 // Generate a PinchGestureEvent to send to Core
119 Integration::PinchGestureEvent GeneratePinch(
120     Gesture::State state,
121     float scale,
122     float speed,
123     Vector2 centerpoint)
124 {
125   Integration::PinchGestureEvent pinch(state);
126
127   pinch.scale = scale;
128   pinch.speed = speed;
129   pinch.centerPoint = centerpoint;
130
131   return pinch;
132 }
133 // Generate a TapGestureEvent to send to Core
134 Integration::TapGestureEvent GenerateTap(
135     Gesture::State state,
136     unsigned int numberOfTaps,
137     unsigned int numberOfTouches,
138     Vector2 point)
139 {
140   Integration::TapGestureEvent tap( state );
141
142   tap.numberOfTaps = numberOfTaps;
143   tap.numberOfTouches = numberOfTouches;
144   tap.point = point;
145
146   return tap;
147 }
148
149 //
150 // Create function as Init function called
151 //
152 static bool CreateCustomInitCalled = false;
153 BaseHandle CreateCustomInit(void)
154 {
155   CreateCustomInitCalled = true;
156   return BaseHandle();
157 }
158
159 static bool CreateCustomNamedInitCalled = false;
160 BaseHandle CreateCustomNamedInit(void)
161 {
162   CreateCustomNamedInitCalled = true;
163   return BaseHandle();
164 }
165
166 const std::string scriptedName("PopupStyle");
167 static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
168
169 // Property Registration
170 bool setPropertyCalled = false;
171 bool getPropertyCalled = false;
172 void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
173 {
174   setPropertyCalled = true;
175 }
176 Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
177 {
178   getPropertyCalled = true;
179   return Property::Value( true );
180 }
181
182
183
184 /*******************************************************************************
185  *
186  * Custom Actor
187  *
188  ******************************************************************************/
189 namespace Impl
190 {
191 struct MyTestCustomActor : public CustomActorImpl
192 {
193   typedef Signal< void ()> SignalType;
194   typedef Signal< void (float)> SignalTypeFloat;
195
196   MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
197   { }
198
199   virtual ~MyTestCustomActor()
200   { }
201
202   void ResetCallStack()
203   {
204   }
205
206   // From CustomActorImpl
207   virtual void OnStageConnection( int depth )
208   {
209   }
210   virtual void OnStageDisconnection()
211   {
212   }
213   virtual void OnChildAdd(Actor& child)
214   {
215   }
216   virtual void OnChildRemove(Actor& child)
217   {
218   }
219   virtual void OnSizeSet(const Vector3& targetSize)
220   {
221   }
222   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
223   {
224   }
225   virtual bool OnTouchEvent(const TouchEvent& event)
226   {
227     return true;
228   }
229   virtual bool OnHoverEvent(const HoverEvent& event)
230   {
231     return true;
232   }
233   virtual bool OnWheelEvent(const WheelEvent& event)
234   {
235     return true;
236   }
237   virtual bool OnKeyEvent(const KeyEvent& event)
238   {
239     return true;
240   }
241   virtual void OnKeyInputFocusGained()
242   {
243   }
244   virtual void OnKeyInputFocusLost()
245   {
246   }
247   virtual Vector3 GetNaturalSize()
248   {
249     return Vector3( 0.0f, 0.0f, 0.0f );
250   }
251
252   virtual float GetHeightForWidth( float width )
253   {
254     return 0.0f;
255   }
256
257   virtual float GetWidthForHeight( float height )
258   {
259     return 0.0f;
260   }
261
262   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
263   {
264   }
265
266   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
267   {
268   }
269
270   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
271   {
272   }
273
274   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
275   {
276     return 0.0f;
277   }
278
279   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
280   {
281   }
282
283   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
284   {
285     return false;
286   }
287
288 public:
289
290   SignalType mSignal;
291 };
292
293 }; // namespace Impl
294
295 class MyTestCustomActor : public CustomActor
296 {
297 public:
298
299   typedef Signal< void ()> SignalType;
300   typedef Signal< void (float)> SignalTypeFloat;
301
302   MyTestCustomActor()
303   {
304   }
305
306   static MyTestCustomActor New()
307   {
308     Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
309     return MyTestCustomActor( *p ); // takes ownership
310   }
311
312   virtual ~MyTestCustomActor()
313   {
314   }
315
316   static MyTestCustomActor DownCast( BaseHandle handle )
317   {
318     MyTestCustomActor result;
319
320     CustomActor custom = Dali::CustomActor::DownCast( handle );
321     if ( custom )
322     {
323       CustomActorImpl& customImpl = custom.GetImplementation();
324
325       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
326
327       if (impl)
328       {
329         result = MyTestCustomActor(customImpl.GetOwner());
330       }
331     }
332
333     return result;
334   }
335
336   SignalType& GetCustomSignal()
337   {
338     Dali::RefObject& obj = GetImplementation();
339     return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
340   }
341
342 private:
343
344   MyTestCustomActor(Internal::CustomActor* internal)
345   : CustomActor(internal)
346   {
347   }
348
349   MyTestCustomActor( Impl::MyTestCustomActor& impl )
350   : CustomActor( impl )
351   {
352   }
353 };
354
355
356 class MyTestCustomActor2 : public CustomActor
357 {
358 public:
359
360   struct Property
361   {
362     enum
363     {
364       P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
365       P2
366     };
367   };
368
369
370   MyTestCustomActor2()
371   {
372   }
373
374   static MyTestCustomActor2 New()
375   {
376     return MyTestCustomActor2(); // takes ownership
377   }
378
379   virtual ~MyTestCustomActor2()
380   {
381   }
382
383   static MyTestCustomActor2 DownCast( BaseHandle handle )
384   {
385     MyTestCustomActor2 result;
386
387     CustomActor custom = Dali::CustomActor::DownCast( handle );
388     if ( custom )
389     {
390       CustomActorImpl& customImpl = custom.GetImplementation();
391
392       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
393
394       if (impl)
395       {
396         result = MyTestCustomActor2(customImpl.GetOwner());
397       }
398     }
399
400     return result;
401   }
402
403 private:
404
405   MyTestCustomActor2(Internal::CustomActor* internal)
406   : CustomActor(internal)
407   {
408   }
409
410   MyTestCustomActor2( Impl::MyTestCustomActor& impl )
411   : CustomActor( impl )
412   {
413   }
414 };
415
416 static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
417
418 PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty );
419 PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty );
420
421
422 class MyTestCustomActor3 : public CustomActor
423 {
424 public:
425   MyTestCustomActor3()
426   {
427   }
428
429   static MyTestCustomActor3 New()
430   {
431     return MyTestCustomActor3(); // takes ownership
432   }
433
434   virtual ~MyTestCustomActor3()
435   {
436   }
437
438   static MyTestCustomActor3 DownCast( BaseHandle handle )
439   {
440     MyTestCustomActor3 result;
441
442     CustomActor custom = Dali::CustomActor::DownCast( handle );
443     if ( custom )
444     {
445       CustomActorImpl& customImpl = custom.GetImplementation();
446
447       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
448
449       if (impl)
450       {
451         result = MyTestCustomActor3(customImpl.GetOwner());
452       }
453     }
454
455     return result;
456   }
457
458 private:
459
460   MyTestCustomActor3(Internal::CustomActor* internal)
461   : CustomActor(internal)
462   {
463   }
464
465   MyTestCustomActor3( Impl::MyTestCustomActor& impl )
466   : CustomActor( impl )
467   {
468   }
469 };
470
471 static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false );
472
473 BaseHandle CreateCustom(void)
474 {
475   return MyTestCustomActor::New();
476 }
477
478 static std::string lastSignalConnectionCustom;
479
480 bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
481 {
482   lastSignalConnectionCustom = signalName;
483
484   bool connected( true );
485
486   Dali::BaseHandle handle(object);
487   MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
488
489   if( "sig1" == signalName )
490   {
491     customActor.GetCustomSignal().Connect( tracker, functor );
492   }
493   else
494   {
495     // signalName does not match any signal
496     connected = false;
497   }
498
499   return connected;
500 }
501
502 bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
503 {
504   lastSignalConnectionCustom = "failed";
505
506   return false; // This is supposed to fail
507 }
508
509 struct CustomTestFunctor
510 {
511   CustomTestFunctor()
512   {
513     ++mTotalInstanceCount;
514     ++mCurrentInstanceCount;
515   }
516
517   CustomTestFunctor( const CustomTestFunctor& copyMe )
518   {
519     ++mTotalInstanceCount;
520     ++mCurrentInstanceCount;
521   }
522
523   ~CustomTestFunctor()
524   {
525     --mCurrentInstanceCount;
526   }
527
528   void operator()()
529   {
530     ++mCallbackCount;
531   }
532
533   static int mTotalInstanceCount;
534   static int mCurrentInstanceCount;
535   static int mCallbackCount;
536 };
537
538 int CustomTestFunctor::mTotalInstanceCount = 0;
539 int CustomTestFunctor::mCurrentInstanceCount = 0;
540 int CustomTestFunctor::mCallbackCount = 0;
541
542 static void ResetFunctorCounts()
543 {
544   CustomTestFunctor::mTotalInstanceCount   = 0;
545   CustomTestFunctor::mCurrentInstanceCount = 0;
546   CustomTestFunctor::mCallbackCount        = 0;
547 }
548
549 static std::string lastActionCustom;
550 bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
551 {
552   lastActionCustom = actionName;
553   return true;
554 }
555
556 // Custom type registration
557 static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
558
559 // Custom signals
560 static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
561 static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
562 static const int TEST_SIGNAL_COUNT = 2;
563
564 // Custom actions
565 static TypeAction customAction1( customType1, "act1", DoActionCustom);
566 static const int TEST_ACTION_COUNT = 1;
567
568 class TestConnectionTracker : public ConnectionTracker
569 {
570 public:
571
572   TestConnectionTracker()
573   {
574   }
575 };
576
577 BaseHandle CreateNamedActorType()
578 {
579   Actor actor = Actor::New();
580   actor.SetName( "NamedActor" );
581   return actor;
582 }
583
584 TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
585 PropertyRegistration namedActorPropertyOne( namedActorType, "propName",  PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
586
587 } // Anonymous namespace
588
589 // Note: No negative test case for UtcDaliTypeRegistryGet can be implemented.
590 int UtcDaliTypeRegistryGetP(void)
591 {
592   TestApplication application;
593
594   TypeRegistry registry = TypeRegistry::Get();
595   DALI_TEST_CHECK( registry );
596
597   END_TEST;
598 }
599
600 // Note: No negative test case for UtcDaliTypeRegistryConstructor can be implemented.
601 int UtcDaliTypeRegistryConstructorP(void)
602 {
603   TestApplication application;
604
605   TypeRegistry registry;
606   DALI_TEST_CHECK( !registry );
607   END_TEST;
608 }
609
610 // Note: No negative test case for UtcDaliTypeRegistryCopyConstructor can be implemented.
611 int UtcDaliTypeRegistryCopyConstructorP(void)
612 {
613   TestApplication application;
614
615   TypeRegistry registry = TypeRegistry::Get();
616   DALI_TEST_CHECK( registry );
617
618   TypeRegistry copy( registry );
619   DALI_TEST_CHECK( copy );
620
621   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
622
623   END_TEST;
624 }
625
626 // Note: No negative test case for UtcDaliTypeRegistryAssignmentOperator can be implemented.
627 int UtcDaliTypeRegistryAssignmentOperatorP(void)
628 {
629   TestApplication application;
630
631   TypeRegistry registry = TypeRegistry::Get();
632   DALI_TEST_CHECK( registry );
633
634   TypeRegistry copy = registry;
635   DALI_TEST_CHECK( copy );
636   DALI_TEST_CHECK( registry == copy );
637
638   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
639
640   END_TEST;
641 }
642
643 int UtcDaliTypeRegistryAssignP(void)
644 {
645   TestApplication application;
646
647   TypeRegistry registry = TypeRegistry::Get();
648   TypeRegistry registry2;
649   registry2 = registry;
650   DALI_TEST_CHECK( registry2 );
651
652   DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
653
654   END_TEST;
655 }
656
657 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
658 {
659   TestApplication application;
660
661   TypeRegistry registry = TypeRegistry::Get();
662
663   TypeInfo type;
664
665   // camera actor
666   type = registry.GetTypeInfo( "CameraActor" );
667   DALI_TEST_CHECK( type );
668   CameraActor ca = CameraActor::DownCast(type.CreateInstance());
669   DALI_TEST_CHECK( ca );
670   Stage::GetCurrent().Add( ca );
671   application.Render();
672
673   // animations
674   type = registry.GetTypeInfo( "Animation" );
675   DALI_TEST_CHECK( type );
676   Animation an = Animation::DownCast(type.CreateInstance());
677   DALI_TEST_CHECK( an );
678   an.Play();
679   application.Render();
680
681   END_TEST;
682 }
683
684 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
685 {
686   TestApplication application;
687
688   TypeRegistry registry = TypeRegistry::Get();
689
690   TypeInfo type;
691
692   type = registry.GetTypeInfo( "MyDummyActor" );
693   DALI_TEST_CHECK( !type );
694
695   END_TEST;
696 }
697
698 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
699 {
700   TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
701   TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
702
703   DALI_TEST_CHECK( named_type );
704   DALI_TEST_CHECK( typeinfo_type );
705
706   // Check named and typeid are equivalent
707   DALI_TEST_CHECK( named_type == typeinfo_type );
708
709   DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
710   DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
711
712   END_TEST;
713 }
714
715 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
716 {
717   TestApplication application;
718   TypeRegistry typeRegistry = TypeRegistry::Get();
719
720   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
721   DALI_TEST_CHECK( !typeInfo );
722
723   END_TEST;
724 }
725
726 int UtcDaliTypeRegistryGetTypeNameCountP(void)
727 {
728   TestApplication application;
729   TypeRegistry typeRegistry = TypeRegistry::Get();
730   TypeInfo type;
731
732   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
733   {
734     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
735     DALI_TEST_CHECK( type );
736   }
737
738   END_TEST;
739 }
740
741
742 int UtcDaliTypeRegistryGetTypeNamesP(void)
743 {
744   TestApplication application;
745   TypeRegistry typeRegistry = TypeRegistry::Get();
746   TypeInfo type;
747
748   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
749   {
750     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
751     DALI_TEST_CHECK( type );
752   }
753
754   END_TEST;
755 }
756
757
758 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
759 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
760 {
761   ResetFunctorCounts();
762
763   TestApplication application;
764
765   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
766   DALI_TEST_CHECK( type );
767
768   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
769   DALI_TEST_CHECK( baseType );
770
771   BaseHandle handle = type.CreateInstance();
772   DALI_TEST_CHECK( handle );
773
774   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
775   DALI_TEST_CHECK( customHandle );
776
777   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
778
779   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
780
781   {
782     TestConnectionTracker tracker;
783
784     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
785     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
786     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
787     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
788     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
789
790     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
791     customHandle.GetCustomSignal().Emit();
792     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
793     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
794     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
795   }
796   // tracker should automatically disconnect here
797   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
798   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
799
800   // Test that functor is disconnected
801   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
802   customHandle.GetCustomSignal().Emit();
803   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
804   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
805   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
806
807   Property::Map attributes;
808   handle.DoAction("act1", attributes);
809   DALI_TEST_CHECK( lastActionCustom == "act1" );
810   END_TEST;
811 }
812
813 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
814 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
815 {
816   TestApplication application;
817
818   DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
819
820   DALI_TEST_CHECK( true == CreateCustomInitCalled );
821   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
822   DALI_TEST_CHECK( type );
823   END_TEST;
824 }
825
826 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
827 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
828 {
829   TestApplication application;
830
831   // Create Named Actor Type
832   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
833   DALI_TEST_CHECK( type );
834
835   BaseHandle namedHandle = type.CreateInstance();
836   DALI_TEST_CHECK( namedHandle );
837   Actor namedActor( Actor::DownCast( namedHandle ) );
838   DALI_TEST_CHECK( namedActor );
839
840   DALI_TEST_CHECK( namedActor.GetName() == "NamedActor" );
841   DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
842   DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
843
844   END_TEST;
845 }
846
847 int UtcDaliTypeRegistryRegisteredNameP(void)
848 {
849   TestApplication application;
850
851   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
852
853   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
854   DALI_TEST_CHECK( baseType );
855
856   BaseHandle handle = baseType.CreateInstance();
857
858   DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
859   TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
860   DALI_TEST_CHECK( type );
861   END_TEST;
862 }
863
864
865 int UtcDaliTypeRegistryRegisteredNameN(void)
866 {
867   TestApplication application;
868
869   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
870
871   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
872   DALI_TEST_CHECK( baseType );
873
874   // should cause an assert because we're registering same type twice
875   // once statically at the start of this file, then again now
876   try
877   {
878     TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
879     tet_result( TET_FAIL );
880   }
881   catch ( DaliException& e )
882   {
883     DALI_TEST_ASSERT( e, "Duplicate type name for Type Registation", TEST_LOCATION );
884   }
885
886   END_TEST;
887 }
888
889
890 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
891 {
892   ResetFunctorCounts();
893
894   TestApplication application;
895
896   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
897   DALI_TEST_CHECK( type );
898
899   BaseHandle handle = type.CreateInstance();
900   DALI_TEST_CHECK( handle );
901
902   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
903   DALI_TEST_CHECK( customHandle );
904
905   {
906     TestConnectionTracker tracker;
907
908     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
909     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
910     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
911     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
912     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
913
914     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
915     customHandle.GetCustomSignal().Emit();
916     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
917     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
918     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
919   }
920   // tracker should automatically disconnect here
921   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
922   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
923
924   // Test that functor is disconnected
925   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
926   customHandle.GetCustomSignal().Emit();
927   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
928   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
929   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
930
931   END_TEST;
932 }
933
934 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
935 {
936   // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
937
938   ResetFunctorCounts();
939
940   TestApplication application;
941
942   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
943   DALI_TEST_CHECK( type );
944
945   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
946   DALI_TEST_CHECK( baseType );
947
948   BaseHandle handle = type.CreateInstance();
949   DALI_TEST_CHECK( handle );
950
951   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
952   DALI_TEST_CHECK( customHandle );
953
954   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
955
956   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
957
958   {
959     TestConnectionTracker tracker;
960
961     bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
962     DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
963     DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
964     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
965     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
966
967     // Should be a NOOP
968     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
969     customHandle.GetCustomSignal().Emit();
970     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
971   }
972   // tracker should have nothing to disconnect here
973
974   // Should be a NOOP
975   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
976   customHandle.GetCustomSignal().Emit();
977   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
978   END_TEST;
979 }
980
981 int UtcDaliTypeRegistryTypeActionP(void)
982 {
983   ResetFunctorCounts();
984
985   TestApplication application;
986
987   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
988   DALI_TEST_CHECK( type );
989
990   BaseHandle handle = type.CreateInstance();
991   DALI_TEST_CHECK( handle );
992
993   Property::Map attributes;
994   DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
995   DALI_TEST_CHECK( lastActionCustom == "act1" );
996
997   END_TEST;
998 }
999
1000 int UtcDaliTypeRegistryTypeActionN(void)
1001 {
1002   ResetFunctorCounts();
1003
1004   TestApplication application;
1005
1006   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
1007   DALI_TEST_CHECK( type );
1008
1009   BaseHandle handle = type.CreateInstance();
1010   DALI_TEST_CHECK( handle );
1011
1012   Property::Map attributes;
1013   DALI_TEST_CHECK( !handle.DoAction( "unknownAction",  attributes ) );
1014
1015   END_TEST;
1016 }
1017
1018 int UtcDaliTypeRegistryPropertyRegistrationP(void)
1019 {
1020   TestApplication application;
1021   TypeRegistry typeRegistry = TypeRegistry::Get();
1022
1023   // Check property count before property registration
1024   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1025   DALI_TEST_CHECK( typeInfo );
1026   BaseHandle handle = typeInfo.CreateInstance();
1027   DALI_TEST_CHECK( handle );
1028   Actor customActor = Actor::DownCast( handle );
1029   DALI_TEST_CHECK( customActor );
1030   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1031
1032   std::string propertyName( "prop1" );
1033   int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
1034   Property::Type propertyType( Property::BOOLEAN );
1035   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
1036
1037   // Check property count after registration
1038   unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
1039   DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
1040
1041   // Add custom property and check property count
1042   customActor.RegisterProperty( "customProp1",   true );
1043   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1044   DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
1045
1046   // Set the property, ensure SetProperty called
1047   DALI_TEST_CHECK( !setPropertyCalled );
1048   customActor.SetProperty( propertyIndex, false );
1049   DALI_TEST_CHECK( setPropertyCalled );
1050
1051   // Get the property, ensure GetProperty called
1052   DALI_TEST_CHECK( !getPropertyCalled );
1053   (void)customActor.GetProperty< bool >( propertyIndex );
1054   DALI_TEST_CHECK( getPropertyCalled );
1055
1056   // Check the property name
1057   DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1058   DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1059
1060   // Check the property index
1061   DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1062
1063   // Check the property type
1064   DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1065
1066   // Check property count of type-info is 1
1067   Property::IndexContainer indices;
1068   typeInfo.GetPropertyIndices( indices );
1069
1070   size_t typePropertyCount = typeInfo.GetPropertyCount();
1071   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1072   DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION );
1073
1074   // Ensure indices returned from actor and customActor differ by two
1075   Actor actor = Actor::New();
1076   actor.GetPropertyIndices( indices );
1077   unsigned int actorIndices = indices.Size();
1078   customActor.GetPropertyIndices( indices );
1079   unsigned int customActorIndices = indices.Size();
1080   DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1081   END_TEST;
1082 }
1083
1084 int UtcDaliTypeRegistryPropertyRegistrationN(void)
1085 {
1086   TestApplication application;
1087   TypeRegistry typeRegistry = TypeRegistry::Get();
1088
1089   // Attempt to register a property type out-of-bounds index (less than)
1090   try
1091   {
1092     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1093     tet_result( TET_FAIL );
1094   }
1095   catch ( DaliException& e )
1096   {
1097     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1098   }
1099
1100   // Attempt to register a property type out-of-bounds index (greater than)
1101   try
1102   {
1103     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1104     tet_result( TET_FAIL );
1105   }
1106   catch ( DaliException& e )
1107   {
1108     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1109   }
1110
1111   END_TEST;
1112 }
1113
1114 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1115 {
1116   TestApplication application;
1117   TypeRegistry typeRegistry = TypeRegistry::Get();
1118
1119   // Check property count before property registration
1120   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1121   DALI_TEST_CHECK( typeInfo );
1122   BaseHandle handle = typeInfo.CreateInstance();
1123   DALI_TEST_CHECK( handle );
1124   Actor customActor = Actor::DownCast( handle );
1125   DALI_TEST_CHECK( customActor );
1126   Stage::GetCurrent().Add(customActor);
1127
1128   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1129
1130   // Register animatable property
1131   std::string animatablePropertyName( "animatableProp1" );
1132   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1133   Property::Type animatablePropertyType( Property::FLOAT );
1134   AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1135
1136   // Check property count after registration
1137   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1138
1139   // Set the animatable property value
1140   customActor.SetProperty( animatablePropertyIndex, 25.0f );
1141
1142   // Render and notify
1143   application.SendNotification();
1144   application.Render();
1145
1146   // Check the animatable property value
1147   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1148
1149   // Check the animatable property name
1150   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1151
1152   // Check the animatable property index
1153   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1154
1155   // Check the animatable property type
1156   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1157
1158   // Check property count of type-info is 1
1159   Property::IndexContainer indices;
1160   typeInfo.GetPropertyIndices( indices );
1161   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1162
1163   // Ensure indices returned from actor and customActor differ by one
1164   Actor actor = Actor::New();
1165   actor.GetPropertyIndices( indices );
1166   unsigned int actorIndices = indices.Size();
1167   customActor.GetPropertyIndices( indices );
1168   unsigned int customActorIndices = indices.Size();
1169   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1170
1171   // check that the property is animatable
1172   Animation animation = Animation::New(0.2f);
1173   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1174   animation.Play();
1175   // Render and notify, animation play for 0.05 seconds
1176   application.SendNotification();
1177   application.Render(50);
1178   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1179   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1180   // Render and notify, animation play for another 0.1 seconds
1181   application.SendNotification();
1182   application.Render(100);
1183   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1184   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1185
1186   END_TEST;
1187 }
1188
1189 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1190 {
1191   TestApplication application;
1192   TypeRegistry typeRegistry = TypeRegistry::Get();
1193
1194   // Attempt to register an animatable property type out-of-bounds index (less than)
1195   try
1196   {
1197     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1198     tet_result( TET_FAIL );
1199   }
1200   catch ( DaliException& e )
1201   {
1202     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1203   }
1204
1205   // Attempt to register an animatable property type out-of-bounds index (greater than)
1206   try
1207   {
1208     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1209     tet_result( TET_FAIL );
1210   }
1211   catch ( DaliException& e )
1212   {
1213     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1214   }
1215
1216   END_TEST;
1217 }
1218
1219 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1220 {
1221   TestApplication application;
1222   TypeRegistry typeRegistry = TypeRegistry::Get();
1223
1224   // Check property count before property registration
1225   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1226   DALI_TEST_CHECK( typeInfo );
1227   BaseHandle handle = typeInfo.CreateInstance();
1228   DALI_TEST_CHECK( handle );
1229   Actor customActor = Actor::DownCast( handle );
1230   DALI_TEST_CHECK( customActor );
1231   Stage::GetCurrent().Add(customActor);
1232
1233   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1234
1235   // Register animatable property
1236   std::string animatablePropertyName( "animatableProp1" );
1237   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1238   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1239
1240   // Check property count after registration
1241   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1242
1243   // Render and notify
1244   application.SendNotification();
1245   application.Render();
1246
1247   // Check the animatable property value
1248   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1249
1250   // Check the animatable property name
1251   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1252
1253   // Check the animatable property index
1254   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1255
1256   // Check the animatable property type
1257   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1258
1259   // Check property count of type-info is 1
1260   Property::IndexContainer indices;
1261   typeInfo.GetPropertyIndices( indices );
1262   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1263
1264   // Ensure indices returned from actor and customActor differ by one
1265   Actor actor = Actor::New();
1266   actor.GetPropertyIndices( indices );
1267   unsigned int actorIndices = indices.Size();
1268   customActor.GetPropertyIndices( indices );
1269   unsigned int customActorIndices = indices.Size();
1270   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1271
1272   // check that the property is animatable
1273   Animation animation = Animation::New(0.2f);
1274   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1275   animation.Play();
1276   // Render and notify, animation play for 0.05 seconds
1277   application.SendNotification();
1278   application.Render(50);
1279   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1280   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1281   // Render and notify, animation play for another 0.1 seconds
1282   application.SendNotification();
1283   application.Render(100);
1284   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1285   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1286
1287   END_TEST;
1288 }
1289
1290 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1291 {
1292   TestApplication application;
1293   TypeRegistry typeRegistry = TypeRegistry::Get();
1294
1295   // Attempt to register an animatable property type out-of-bounds index (less than)
1296   try
1297   {
1298     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1299     tet_result( TET_FAIL );
1300   }
1301   catch ( DaliException& e )
1302   {
1303     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1304   }
1305
1306   // Attempt to register an animatable property type out-of-bounds index (greater than)
1307   try
1308   {
1309     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1310     tet_result( TET_FAIL );
1311   }
1312   catch ( DaliException& e )
1313   {
1314     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1315   }
1316
1317   END_TEST;
1318 }
1319
1320 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1321 {
1322   TestApplication application;
1323   TypeRegistry typeRegistry = TypeRegistry::Get();
1324
1325   // Check property count before property registration
1326   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1327   DALI_TEST_CHECK( typeInfo );
1328   BaseHandle handle = typeInfo.CreateInstance();
1329   DALI_TEST_CHECK( handle );
1330   Actor customActor = Actor::DownCast( handle );
1331   DALI_TEST_CHECK( customActor );
1332
1333   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1334
1335   // Register animatable property
1336   std::string animatablePropertyName( "animatableProp1" );
1337   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1338   Property::Type animatablePropertyType( Property::VECTOR2 );
1339   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1340
1341   // Check property count after registration
1342   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1343
1344   // Set the animatable property value
1345   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1346
1347   // Render and notify
1348   application.SendNotification();
1349   application.Render();
1350
1351   // Check the animatable property value
1352   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1353
1354   // Check the animatable property name
1355   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1356
1357   // Check the animatable property index
1358   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1359
1360   // Check the animatable property type
1361   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1362
1363   // Check property count of type-info is 1
1364   Property::IndexContainer indices;
1365   typeInfo.GetPropertyIndices( indices );
1366   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1367
1368   // Register animatable property components
1369   std::string animatablePropertyComponentName1( "animatableProp1X" );
1370   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1371   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1372
1373   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1374   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1375   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1376
1377   // Check property count after registration
1378   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1379
1380   // Check the animatable property component value
1381   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1382   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1383
1384   // Set the animatable property component value
1385   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1386
1387   // Render and notify
1388   application.SendNotification();
1389   application.Render();
1390
1391   // Check the animatable property value
1392   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1393   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1394   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1395
1396   // Set the animatable property component value
1397   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1398
1399   // Render and notify
1400   application.SendNotification();
1401   application.Render();
1402
1403   // Check the animatable property value
1404   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1405   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1406   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1407
1408   // Ensure indices returned from actor and customActor differ by three
1409   Actor actor = Actor::New();
1410   actor.GetPropertyIndices( indices );
1411   unsigned int actorIndices = indices.Size();
1412   customActor.GetPropertyIndices( indices );
1413   unsigned int customActorIndices = indices.Size();
1414   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1415
1416   END_TEST;
1417 }
1418
1419 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1420 {
1421   TestApplication application;
1422   TypeRegistry typeRegistry = TypeRegistry::Get();
1423
1424   // Register animatable property with the type of Vector2
1425   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1426   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1427
1428   // Attempt to register an animatable property component out-of-bounds index (less than)
1429   try
1430   {
1431     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1432     tet_result( TET_FAIL );
1433   }
1434   catch ( DaliException& e )
1435   {
1436     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1437   }
1438
1439   // Attempt to register an animatable property component out-of-bounds index (greater than)
1440   try
1441   {
1442     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1443     tet_result( TET_FAIL );
1444   }
1445   catch ( DaliException& e )
1446   {
1447     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1448   }
1449
1450   // Register an animatable property component
1451   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1452
1453   // Attempt to register another animatable property component with the same component index
1454   try
1455   {
1456     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1457     tet_result( TET_FAIL );
1458   }
1459   catch ( DaliException& e )
1460   {
1461     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1462   }
1463
1464   // Register animatable property with the type of boolean
1465   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1466   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1467
1468   // Attempt to register an animatable property component for the above property with boolean type
1469   try
1470   {
1471     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1472     tet_result( TET_FAIL );
1473   }
1474   catch ( DaliException& e )
1475   {
1476     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1477   }
1478
1479   END_TEST;
1480 }
1481
1482 int UtcDaliTypeRegistryChildPropertyRegistrationP(void)
1483 {
1484   TestApplication application;
1485   TypeRegistry typeRegistry = TypeRegistry::Get();
1486
1487   // Check property count before property registration
1488   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1489   DALI_TEST_CHECK( typeInfo );
1490   BaseHandle handle = typeInfo.CreateInstance();
1491   DALI_TEST_CHECK( handle );
1492   Actor customActor = Actor::DownCast( handle );
1493   DALI_TEST_CHECK( customActor );
1494   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1495
1496   // Register child properties to the parent
1497   std::string propertyName( "childProp1" );
1498   int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1499   Property::Type propertyType( Property::BOOLEAN );
1500   ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType );
1501
1502   std::string propertyName2( "childProp2" );
1503   int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 );
1504   Property::Type propertyType2( Property::INTEGER );
1505   ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 );
1506
1507   std::string propertyName3( "childProp3" );
1508   int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 );
1509   Property::Type propertyType3( Property::FLOAT );
1510   ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 );
1511
1512   std::string propertyName4( "childProp4" );
1513   int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 );
1514   Property::Type propertyType4( Property::INTEGER );
1515   ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 );
1516
1517   // Check property count are not changed because the child properties will not be created for the parent
1518   DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION );
1519
1520   // check the child property type
1521   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1522   Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
1523   DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
1524
1525
1526   // Create a child actor
1527   Actor childActor = Actor::New();
1528   DALI_TEST_CHECK( childActor );
1529   unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() );
1530
1531   // The type of child properties should be Property::None as the child hasn't registered any child property yet.
1532   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION );
1533   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION );
1534   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION );
1535   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION );
1536
1537   // Set the value for the first child property when the child actor doesn't have a parent yet
1538   childActor.SetProperty(propertyIndex, true);
1539
1540   // Check that the first child property is dynamically created
1541   DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION );
1542
1543   // Check the first child property value
1544   DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION );
1545
1546   // Check the first child property type
1547   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1548
1549   // Check that the first child property have no name, as it doesn't have a parent yet.
1550   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION );
1551
1552   // Check that the first property can't be accessed through its name, as it doesn't have a parent yet.
1553   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION );
1554
1555   // Create a custom property for the child with the same name as the second child property registered to the parent
1556   Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE);
1557
1558   // Check that the custom property is created
1559   DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION );
1560
1561   // Check the property value
1562   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1563
1564   // Check the property index
1565   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION );
1566
1567   // Check the property type
1568   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1569
1570   // Check the property name
1571   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION );
1572
1573   // Now add the child actor to the parent
1574   customActor.Add( childActor );
1575
1576   // Check that the first child property now has the correct name as previously registered to the parent
1577   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1578
1579   // Check that the child property index for the first child property can now be retrieved through its child property name
1580   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1581
1582   // Check that the second child property now has the correct index as previously registered to the parent
1583   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION );
1584
1585   // Check that the second child property can be accessed through both its custom property index and its child property index
1586   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1587   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION );
1588   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1589   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION );
1590
1591   // Check that the child property index for the second child property can now be retrieved through its child property name
1592   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION );
1593
1594   // Set the value for the third child property when the child actor is already added to the parent
1595   childActor.SetProperty(propertyIndex3, 0.15f);
1596
1597   // Check that the third child property is dynamically created
1598   DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION );
1599
1600   // Check the third child property value
1601   DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION );
1602
1603   // Check the third child property type
1604   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION );
1605
1606   // Check the third child property name
1607   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION );
1608
1609   // Check the third child property index.
1610   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION );
1611
1612   // Create a custom property for the child with the same name as the fourth child property registered to the parent
1613   Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE);
1614
1615   // Check that the custom property is created
1616   DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION );
1617
1618   // Check the fourth child property value
1619   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION );
1620   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION );
1621
1622   // Check the fourth child property type
1623   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION );
1624   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION );
1625
1626   // Check the fourth child property name
1627   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION );
1628   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION );
1629
1630   // Check the fourth child property index.
1631   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION );
1632
1633   // Now create another parent actor with different child properties registered
1634   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" );
1635   DALI_TEST_CHECK( typeInfo2 );
1636   BaseHandle handle2 = typeInfo2.CreateInstance();
1637   DALI_TEST_CHECK( handle2 );
1638   Actor customActor2 = Actor::DownCast( handle2 );
1639   DALI_TEST_CHECK( customActor2 );
1640
1641   // Register child properties to the new parent
1642   std::string newPropertyName( "newChildProp" );
1643   int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent
1644   Property::Type newPropertyType( Property::VECTOR2 );
1645   ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType );
1646
1647   std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent
1648   int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent
1649   Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent
1650   ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 );
1651
1652   // Now move the child actor to the new parent
1653   customActor2.Add( childActor );
1654
1655   // "childProp1" is not a valid child property supported by the new parent, so nothing changed
1656   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1657   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1658   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1659
1660   // "childProp3" is a valid child property supported by the new parent
1661   // So it should get its new child property index and should just work
1662   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION );
1663   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION );
1664   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION );
1665   DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION );
1666
1667   // Now register a custom property called "newChildProp"
1668   Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE);
1669
1670   // Check that the custom property is created
1671   DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION );
1672
1673   // This is a valid child property registered to the new parent
1674   // So should be able to access it through both its custom property index and its registered child property index
1675   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION );
1676   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION );
1677   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same
1678   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION );
1679   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1680   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1681
1682   // Should return the child property index by given its name
1683   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION );
1684
1685
1686   END_TEST;
1687 }
1688
1689 int UtcDaliTypeRegistryChildPropertyRegistrationN(void)
1690 {
1691   TestApplication application;
1692   TypeRegistry typeRegistry = TypeRegistry::Get();
1693
1694   // Attempt to register a child property type out-of-bounds index (less than)
1695   try
1696   {
1697     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1698     tet_result( TET_FAIL );
1699   }
1700   catch ( DaliException& e )
1701   {
1702     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1703   }
1704
1705   // Attempt to register a child property type out-of-bounds index (greater than)
1706   try
1707   {
1708     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1709     tet_result( TET_FAIL );
1710   }
1711   catch ( DaliException& e )
1712   {
1713     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1714   }
1715
1716   END_TEST;
1717 }
1718
1719
1720 /*******************************************************************************
1721  *
1722  * Action through the base handle
1723  *
1724  ******************************************************************************/
1725 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1726 {
1727   TestApplication application;
1728
1729   TypeInfo type;
1730
1731   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1732   DALI_TEST_CHECK( type );
1733
1734   BaseHandle hdl = type.CreateInstance();
1735   DALI_TEST_CHECK( hdl );
1736
1737   Actor a = Actor::DownCast(hdl);
1738   DALI_TEST_CHECK( a );
1739
1740   a.SetVisible(false);
1741
1742   application.SendNotification();
1743   application.Render(0);
1744   DALI_TEST_CHECK(!a.IsVisible());
1745
1746   Property::Map attributes;
1747
1748   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1749
1750   application.SendNotification();
1751   application.Render(0);
1752   DALI_TEST_CHECK(a.IsVisible());
1753
1754   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1755   END_TEST;
1756 }
1757
1758 int UtcDaliPropertyRegistrationFunctions(void)
1759 {
1760   TestApplication application;
1761   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1762
1763   // Attempt to register a property without a setter
1764   try
1765   {
1766     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1767     tet_result( TET_PASS );
1768   }
1769   catch ( DaliException& e )
1770   {
1771     tet_result( TET_FAIL );
1772   }
1773
1774   // Attempt to register a property without a getter
1775   try
1776   {
1777     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1778     tet_result( TET_FAIL );
1779   }
1780   catch ( DaliException& e )
1781   {
1782     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1783   }
1784   END_TEST;
1785 }
1786
1787 int UtcDaliPropertyRegistrationAddSameIndex(void)
1788 {
1789   TestApplication application;
1790   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1791
1792   // Add one property with a valid property index
1793   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1794
1795   // Attempt to add another property with the same index
1796   try
1797   {
1798     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1799   }
1800   catch ( DaliException& e )
1801   {
1802     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1803   }
1804
1805   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1806
1807   // Add one property with a valid property index
1808   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1809
1810   // Attempt to add another property with the same index
1811   try
1812   {
1813     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
1814   }
1815   catch ( DaliException& e )
1816   {
1817     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1818   }
1819   END_TEST;
1820 }
1821
1822 int UtcDaliPropertyRegistrationPropertyWritableP(void)
1823 {
1824   TestApplication application;
1825   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
1826   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
1827
1828   // Add two properties, one with SetProperty, one without
1829   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
1830   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
1831
1832   // Create custom-actor
1833   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1834   DALI_TEST_CHECK( typeInfo );
1835   BaseHandle handle = typeInfo.CreateInstance();
1836   DALI_TEST_CHECK( handle );
1837   Actor customActor = Actor::DownCast( handle );
1838   DALI_TEST_CHECK( customActor );
1839
1840   // Check whether properties are writable
1841   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
1842   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
1843
1844
1845   // Check the property is writable in the type registry
1846   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1847
1848   DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION );
1849
1850   END_TEST;
1851 }
1852
1853 int UtcDaliPropertyRegistrationPropertyWritableN(void)
1854 {
1855   // Currently Actors don't register properties with the type registry
1856
1857   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1858   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1859
1860   try
1861   {
1862     typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR);
1863     tet_result( TET_FAIL );
1864
1865   }
1866   catch ( DaliException& e )
1867   {
1868      DALI_TEST_ASSERT( e, "Cannot find property index", TEST_LOCATION );
1869   }
1870   END_TEST;
1871
1872 }
1873 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
1874 {
1875   TestApplication application;
1876   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
1877   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
1878
1879   // These properties are not animatable
1880   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1881
1882   // These properties are animatable
1883   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1884
1885   // Create custom-actor
1886   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1887   DALI_TEST_CHECK( typeInfo );
1888   BaseHandle handle = typeInfo.CreateInstance();
1889   DALI_TEST_CHECK( handle );
1890   Actor customActor = Actor::DownCast( handle );
1891   DALI_TEST_CHECK( customActor );
1892
1893   // Check if animatable
1894   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
1895   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
1896
1897   // Create another instance of custom-actor
1898   BaseHandle handle2 = typeInfo.CreateInstance();
1899   DALI_TEST_CHECK( handle2 );
1900   Actor customActor2 = Actor::DownCast( handle2 );
1901   DALI_TEST_CHECK( customActor2 );
1902
1903   // Check if animatable
1904   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
1905   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
1906   END_TEST;
1907 }
1908
1909 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
1910 {
1911   TestApplication application;
1912   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
1913   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
1914
1915   // Create custom-actor
1916   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1917   DALI_TEST_CHECK( typeInfo );
1918   BaseHandle handle = typeInfo.CreateInstance();
1919   DALI_TEST_CHECK( handle );
1920   Actor customActor = Actor::DownCast( handle );
1921   DALI_TEST_CHECK( customActor );
1922
1923   // Try to set an index that hasn't been added
1924   try
1925   {
1926     customActor.SetProperty( propertyIndex, true );
1927     tet_result( TET_FAIL );
1928   }
1929   catch ( DaliException& e )
1930   {
1931     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1932   }
1933
1934   try
1935   {
1936     customActor.SetProperty( animatablePropertyIndex, true );
1937     tet_result( TET_FAIL );
1938   }
1939   catch ( DaliException& e )
1940   {
1941     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1942   }
1943
1944   // Try to get an index that hasn't been added
1945   try
1946   {
1947     (void) customActor.GetProperty< bool >( propertyIndex );
1948     tet_result( TET_FAIL );
1949   }
1950   catch ( DaliException& e )
1951   {
1952     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1953   }
1954
1955   try
1956   {
1957     (void) customActor.GetProperty< bool >( animatablePropertyIndex );
1958     tet_result( TET_FAIL );
1959   }
1960   catch ( DaliException& e )
1961   {
1962     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1963   }
1964   END_TEST;
1965 }
1966
1967
1968 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
1969 {
1970   TestApplication application;
1971
1972   Actor actor = Actor::New();
1973   actor.SetSize(100.0f, 100.0f);
1974   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1975   Stage::GetCurrent().Add(actor);
1976
1977   // Register Type
1978   TypeInfo type;
1979   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
1980   DALI_TEST_CHECK( type );
1981   BaseHandle handle = type.CreateInstance();
1982   DALI_TEST_CHECK( handle );
1983   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
1984   DALI_TEST_CHECK( detector );
1985
1986   // Attach actor to detector
1987   SignalData data;
1988   GestureReceivedFunctor functor( data );
1989   detector.Attach(actor);
1990
1991   // Connect to signal through type
1992   handle.ConnectSignal( &application, "longPressDetected",   functor );
1993
1994   // Render and notify
1995   application.SendNotification();
1996   application.Render();
1997
1998   // Emit gesture
1999   application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
2000   application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
2001   application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
2002   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2003   END_TEST;
2004 }
2005
2006 int UtcDaliPanGestureDetectorTypeRegistry(void)
2007 {
2008   TestApplication application;
2009
2010   Actor actor = Actor::New();
2011   actor.SetSize(100.0f, 100.0f);
2012   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2013   Stage::GetCurrent().Add(actor);
2014
2015   // Register Type
2016   TypeInfo type;
2017   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
2018   DALI_TEST_CHECK( type );
2019   BaseHandle handle = type.CreateInstance();
2020   DALI_TEST_CHECK( handle );
2021   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
2022   DALI_TEST_CHECK( detector );
2023
2024   // Attach actor to detector
2025   SignalData data;
2026   GestureReceivedFunctor functor( data );
2027   detector.Attach(actor);
2028
2029   // Connect to signal through type
2030   handle.ConnectSignal( &application, "panDetected",  functor );
2031
2032   // Render and notify
2033   application.SendNotification();
2034   application.Render();
2035
2036   // Emit gesture
2037   application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2038   application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2039   application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2040   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2041   END_TEST;
2042 }
2043
2044 int UtcDaliPinchGestureDetectorTypeRegistry(void)
2045 {
2046   TestApplication application;
2047
2048   Actor actor = Actor::New();
2049   actor.SetSize(100.0f, 100.0f);
2050   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2051   Stage::GetCurrent().Add(actor);
2052
2053   // Register Type
2054   TypeInfo type;
2055   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
2056   DALI_TEST_CHECK( type );
2057   BaseHandle handle = type.CreateInstance();
2058   DALI_TEST_CHECK( handle );
2059   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
2060   DALI_TEST_CHECK( detector );
2061
2062   // Attach actor to detector
2063   SignalData data;
2064   GestureReceivedFunctor functor( data );
2065   detector.Attach(actor);
2066
2067   // Connect to signal through type
2068   handle.ConnectSignal( &application, "pinchDetected",  functor );
2069
2070   // Render and notify
2071   application.SendNotification();
2072   application.Render();
2073
2074   // Emit gesture
2075   application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
2076   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2077   END_TEST;
2078 }
2079
2080 int UtcDaliTapGestureDetectorTypeRegistry(void)
2081 {
2082   TestApplication application;
2083
2084   Actor actor = Actor::New();
2085   actor.SetSize(100.0f, 100.0f);
2086   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2087   Stage::GetCurrent().Add(actor);
2088
2089   // Register Type
2090   TypeInfo type;
2091   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
2092   DALI_TEST_CHECK( type );
2093   BaseHandle handle = type.CreateInstance();
2094   DALI_TEST_CHECK( handle );
2095   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
2096   DALI_TEST_CHECK( detector );
2097
2098   // Attach actor to detector
2099   SignalData data;
2100   GestureReceivedFunctor functor( data );
2101   detector.Attach(actor);
2102
2103   // Connect to signal through type
2104   handle.ConnectSignal( &application, "tapDetected",  functor );
2105
2106   // Render and notify
2107   application.SendNotification();
2108   application.Render();
2109
2110   // Emit gesture
2111   application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
2112   application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
2113   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2114   END_TEST;
2115 }
2116
2117 int UtcDaliTypeRegistryNamedType(void)
2118 {
2119   TestApplication application;
2120   TypeRegistry typeRegistry = TypeRegistry::Get();
2121
2122   // Create a normal actor
2123   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
2124   DALI_TEST_CHECK( actorHandle );
2125   Actor actor( Actor::DownCast( actorHandle ) );
2126   DALI_TEST_CHECK( actor );
2127   unsigned int actorPropertyCount( actor.GetPropertyCount() );
2128
2129   // Create Named Actor Type
2130   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
2131   DALI_TEST_CHECK( namedHandle );
2132   Actor namedActor( Actor::DownCast( namedHandle ) );
2133   DALI_TEST_CHECK( namedActor );
2134   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
2135
2136   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
2137   END_TEST;
2138 }
2139
2140 int UtcDaliTypeInfoGetActionNameP(void)
2141 {
2142   TestApplication application;
2143   TypeRegistry typeRegistry = TypeRegistry::Get();
2144
2145   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2146   DALI_TEST_CHECK( typeInfo );
2147
2148   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2149
2150   std::string name = typeInfo.GetActionName(0);
2151
2152   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
2153
2154
2155   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2156
2157   //  search for show action in base class, given a derived class
2158   bool foundChildAction = false;
2159   for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ )
2160   {
2161
2162        std::string name = typeInfo2.GetActionName( i );
2163        if( name == "show")
2164        {
2165          foundChildAction = true;
2166        }
2167
2168   }
2169
2170   DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION );
2171
2172
2173   END_TEST;
2174 }
2175
2176 int UtcDaliTypeInfoGetActionNameN(void)
2177 {
2178   TestApplication application;
2179   TypeRegistry typeRegistry = TypeRegistry::Get();
2180
2181   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2182   DALI_TEST_CHECK( typeInfo );
2183
2184   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2185
2186   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
2187
2188   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2189
2190   END_TEST;
2191 }
2192
2193 int UtcDaliTypeInfoGetSignalNameP(void)
2194 {
2195   TestApplication application;
2196   TypeRegistry typeRegistry = TypeRegistry::Get();
2197
2198   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2199   DALI_TEST_CHECK( typeInfo );
2200
2201   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2202
2203   std::string name = typeInfo.GetSignalName(0);
2204
2205   DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
2206
2207   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2208
2209   //  search for signal in base class, given a derived class
2210   bool foundSignal = false;
2211   for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ )
2212   {
2213
2214        std::string name = typeInfo2.GetSignalName( i );
2215        if( name == "touched")
2216        {
2217          foundSignal = true;
2218        }
2219
2220   }
2221
2222   DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION );
2223
2224   END_TEST;
2225 }
2226
2227 int UtcDaliTypeInfoGetSignalNameN(void)
2228 {
2229   TestApplication application;
2230   TypeRegistry typeRegistry = TypeRegistry::Get();
2231
2232   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2233   DALI_TEST_CHECK( typeInfo );
2234
2235   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2236
2237   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
2238
2239   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2240
2241   END_TEST;
2242 }
2243
2244
2245 int UtcDaliTypeInfoGetCreatorP(void)
2246 {
2247   TestApplication application;
2248   TypeRegistry typeRegistry = TypeRegistry::Get();
2249
2250   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2251   DALI_TEST_CHECK( typeInfo );
2252
2253   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2254   DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
2255   if( createFn )
2256   {
2257     // try calling it:
2258     BaseHandle handle = createFn();
2259     DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
2260   }
2261
2262   END_TEST;
2263 }
2264
2265 int UtcDaliTypeInfoGetCreatorN(void)
2266 {
2267   TestApplication application;
2268   TypeRegistry typeRegistry = TypeRegistry::Get();
2269
2270   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
2271   DALI_TEST_CHECK( typeInfo );
2272
2273   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2274   DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
2275
2276   END_TEST;
2277 }
2278
2279 int UtcDaliTypeInfoGetPropertyCountP1(void)
2280 {
2281   TestApplication application;
2282   TypeRegistry typeRegistry = TypeRegistry::Get();
2283
2284   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2285   DALI_TEST_CHECK( typeInfo );
2286   size_t actorPropertyCount = typeInfo.GetPropertyCount();
2287
2288   DALI_TEST_EQUALS( actorPropertyCount == 0 , true, TEST_LOCATION ); // No event only props
2289   END_TEST;
2290 }
2291
2292 int UtcDaliTypeInfoGetPropertyCountP2(void)
2293 {
2294   TestApplication application;
2295   TypeRegistry typeRegistry = TypeRegistry::Get();
2296
2297   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
2298   DALI_TEST_CHECK( typeInfo );
2299   size_t propertyCount = typeInfo.GetPropertyCount();
2300   Property::IndexContainer indices;
2301   typeInfo.GetPropertyIndices( indices );
2302
2303   DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
2304   DALI_TEST_EQUALS( propertyCount == 2, true, TEST_LOCATION );
2305
2306   END_TEST;
2307 }