Moved RotationGesture to the Public API
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-TypeRegistry.cpp
1 /*
2  * Copyright (c) 2020 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/touch-event-integ.h>
25 #include <dali/integration-api/events/hover-event-integ.h>
26
27 using namespace Dali;
28
29
30 namespace
31 {
32
33 // Stores data that is populated in the callback and will be read by the Test cases
34 struct SignalData
35 {
36   SignalData()
37   : functorCalled( false ),
38     voidFunctorCalled( false ),
39     receivedGesture( Gesture::Clear ),
40     pressedActor()
41   {}
42
43   void Reset()
44   {
45     functorCalled = false;
46     voidFunctorCalled = false;
47
48     receivedGesture.numberOfTouches = 0u;
49     receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
50     receivedGesture.localPoint = Vector2(0.0f, 0.0f);
51
52     pressedActor.Reset();
53   }
54
55   bool functorCalled;
56   bool voidFunctorCalled;
57   LongPressGesture receivedGesture;
58   Actor pressedActor;
59 };
60
61 // Functor that sets the data when called
62 struct GestureReceivedFunctor
63 {
64   GestureReceivedFunctor(SignalData& data) : signalData(data) { }
65
66   void operator()(Actor actor, LongPressGesture longPress)
67   {
68     signalData.functorCalled = true;
69     signalData.receivedGesture = longPress;
70     signalData.pressedActor = actor;
71   }
72
73   void operator()()
74   {
75     signalData.voidFunctorCalled = true;
76   }
77
78   SignalData& signalData;
79 };
80
81 //
82 // Create function as Init function called
83 //
84 static bool CreateCustomInitCalled = false;
85 BaseHandle CreateCustomInit(void)
86 {
87   CreateCustomInitCalled = true;
88   return BaseHandle();
89 }
90
91 static bool CreateCustomNamedInitCalled = false;
92 BaseHandle CreateCustomNamedInit(void)
93 {
94   CreateCustomNamedInitCalled = true;
95   return BaseHandle();
96 }
97
98 const std::string scriptedName("PopupStyle");
99 static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
100
101 // Property Registration
102 bool setPropertyCalled = false;
103 bool getPropertyCalled = false;
104 void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
105 {
106   setPropertyCalled = true;
107 }
108 Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
109 {
110   getPropertyCalled = true;
111   return Property::Value( true );
112 }
113
114
115
116 /*******************************************************************************
117  *
118  * Custom Actor
119  *
120  ******************************************************************************/
121 namespace Impl
122 {
123 struct MyTestCustomActor : public CustomActorImpl
124 {
125   typedef Signal< void ()> SignalType;
126   typedef Signal< void (float)> SignalTypeFloat;
127
128   MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
129   { }
130
131   virtual ~MyTestCustomActor()
132   { }
133
134   void ResetCallStack()
135   {
136   }
137
138   // From CustomActorImpl
139   virtual void OnSceneConnection( int depth )
140   {
141   }
142   virtual void OnSceneDisconnection()
143   {
144   }
145   virtual void OnChildAdd(Actor& child)
146   {
147   }
148   virtual void OnChildRemove(Actor& child)
149   {
150   }
151   virtual void OnSizeSet(const Vector3& targetSize)
152   {
153   }
154   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
155   {
156   }
157   virtual bool OnHoverEvent(const HoverEvent& event)
158   {
159     return true;
160   }
161   virtual bool OnWheelEvent(const WheelEvent& event)
162   {
163     return true;
164   }
165   virtual bool OnKeyEvent(const KeyEvent& event)
166   {
167     return true;
168   }
169   virtual void OnKeyInputFocusGained()
170   {
171   }
172   virtual void OnKeyInputFocusLost()
173   {
174   }
175   virtual Vector3 GetNaturalSize()
176   {
177     return Vector3( 0.0f, 0.0f, 0.0f );
178   }
179
180   virtual float GetHeightForWidth( float width )
181   {
182     return 0.0f;
183   }
184
185   virtual float GetWidthForHeight( float height )
186   {
187     return 0.0f;
188   }
189
190   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
191   {
192   }
193
194   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
195   {
196   }
197
198   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
199   {
200   }
201
202   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
203   {
204     return 0.0f;
205   }
206
207   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
208   {
209   }
210
211   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
212   {
213     return false;
214   }
215
216 public:
217
218   SignalType mSignal;
219 };
220
221 }; // namespace Impl
222
223 class MyTestCustomActor : public CustomActor
224 {
225 public:
226
227   typedef Signal< void ()> SignalType;
228   typedef Signal< void (float)> SignalTypeFloat;
229
230   MyTestCustomActor()
231   {
232   }
233
234   static MyTestCustomActor New()
235   {
236     Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
237     return MyTestCustomActor( *p ); // takes ownership
238   }
239
240   virtual ~MyTestCustomActor()
241   {
242   }
243
244   static MyTestCustomActor DownCast( BaseHandle handle )
245   {
246     MyTestCustomActor result;
247
248     CustomActor custom = Dali::CustomActor::DownCast( handle );
249     if ( custom )
250     {
251       CustomActorImpl& customImpl = custom.GetImplementation();
252
253       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
254
255       if (impl)
256       {
257         result = MyTestCustomActor(customImpl.GetOwner());
258       }
259     }
260
261     return result;
262   }
263
264   SignalType& GetCustomSignal()
265   {
266     Dali::RefObject& obj = GetImplementation();
267     return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
268   }
269
270 private:
271
272   MyTestCustomActor(Internal::CustomActor* internal)
273   : CustomActor(internal)
274   {
275   }
276
277   MyTestCustomActor( Impl::MyTestCustomActor& impl )
278   : CustomActor( impl )
279   {
280   }
281 };
282
283
284 class MyTestCustomActor2 : public CustomActor
285 {
286 public:
287
288   struct Property
289   {
290     enum
291     {
292       P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
293       P2
294     };
295   };
296
297
298   MyTestCustomActor2()
299   {
300   }
301
302   static MyTestCustomActor2 New()
303   {
304     return MyTestCustomActor2(); // takes ownership
305   }
306
307   virtual ~MyTestCustomActor2()
308   {
309   }
310
311   static MyTestCustomActor2 DownCast( BaseHandle handle )
312   {
313     MyTestCustomActor2 result;
314
315     CustomActor custom = Dali::CustomActor::DownCast( handle );
316     if ( custom )
317     {
318       CustomActorImpl& customImpl = custom.GetImplementation();
319
320       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
321
322       if (impl)
323       {
324         result = MyTestCustomActor2(customImpl.GetOwner());
325       }
326     }
327
328     return result;
329   }
330
331 private:
332
333   MyTestCustomActor2(Internal::CustomActor* internal)
334   : CustomActor(internal)
335   {
336   }
337
338   MyTestCustomActor2( Impl::MyTestCustomActor& impl )
339   : CustomActor( impl )
340   {
341   }
342 };
343
344 static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
345
346 PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty );
347 PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty );
348
349
350 class MyTestCustomActor3 : public CustomActor
351 {
352 public:
353   MyTestCustomActor3()
354   {
355   }
356
357   static MyTestCustomActor3 New()
358   {
359     return MyTestCustomActor3(); // takes ownership
360   }
361
362   virtual ~MyTestCustomActor3()
363   {
364   }
365
366   static MyTestCustomActor3 DownCast( BaseHandle handle )
367   {
368     MyTestCustomActor3 result;
369
370     CustomActor custom = Dali::CustomActor::DownCast( handle );
371     if ( custom )
372     {
373       CustomActorImpl& customImpl = custom.GetImplementation();
374
375       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
376
377       if (impl)
378       {
379         result = MyTestCustomActor3(customImpl.GetOwner());
380       }
381     }
382
383     return result;
384   }
385
386 private:
387
388   MyTestCustomActor3(Internal::CustomActor* internal)
389   : CustomActor(internal)
390   {
391   }
392
393   MyTestCustomActor3( Impl::MyTestCustomActor& impl )
394   : CustomActor( impl )
395   {
396   }
397 };
398
399 static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false );
400
401 BaseHandle CreateCustom(void)
402 {
403   return MyTestCustomActor::New();
404 }
405
406 static std::string lastSignalConnectionCustom;
407
408 bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
409 {
410   lastSignalConnectionCustom = signalName;
411
412   bool connected( true );
413
414   Dali::BaseHandle handle(object);
415   MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
416
417   if( "sig1" == signalName )
418   {
419     customActor.GetCustomSignal().Connect( tracker, functor );
420   }
421   else
422   {
423     // signalName does not match any signal
424     connected = false;
425   }
426
427   return connected;
428 }
429
430 bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
431 {
432   lastSignalConnectionCustom = "failed";
433
434   return false; // This is supposed to fail
435 }
436
437 struct CustomTestFunctor
438 {
439   CustomTestFunctor()
440   {
441     ++mTotalInstanceCount;
442     ++mCurrentInstanceCount;
443   }
444
445   CustomTestFunctor( const CustomTestFunctor& copyMe )
446   {
447     ++mTotalInstanceCount;
448     ++mCurrentInstanceCount;
449   }
450
451   ~CustomTestFunctor()
452   {
453     --mCurrentInstanceCount;
454   }
455
456   void operator()()
457   {
458     ++mCallbackCount;
459   }
460
461   static int mTotalInstanceCount;
462   static int mCurrentInstanceCount;
463   static int mCallbackCount;
464 };
465
466 int CustomTestFunctor::mTotalInstanceCount = 0;
467 int CustomTestFunctor::mCurrentInstanceCount = 0;
468 int CustomTestFunctor::mCallbackCount = 0;
469
470 static void ResetFunctorCounts()
471 {
472   CustomTestFunctor::mTotalInstanceCount   = 0;
473   CustomTestFunctor::mCurrentInstanceCount = 0;
474   CustomTestFunctor::mCallbackCount        = 0;
475 }
476
477 static std::string lastActionCustom;
478 bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
479 {
480   lastActionCustom = actionName;
481   return true;
482 }
483
484 // Custom type registration
485 static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
486
487 // Custom signals
488 static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
489 static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
490 static const int TEST_SIGNAL_COUNT = 2;
491
492 // Custom actions
493 static TypeAction customAction1( customType1, "act1", DoActionCustom);
494 static const int TEST_ACTION_COUNT = 1;
495
496 class TestConnectionTracker : public ConnectionTracker
497 {
498 public:
499
500   TestConnectionTracker()
501   {
502   }
503 };
504
505 BaseHandle CreateNamedActorType()
506 {
507   Actor actor = Actor::New();
508   actor.SetProperty( Actor::Property::NAME, "NamedActor" );
509   return actor;
510 }
511
512 TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
513 PropertyRegistration namedActorPropertyOne( namedActorType, "propName",  PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
514
515 } // Anonymous namespace
516
517 // Note: No negative test case for UtcDaliTypeRegistryGet can be implemented.
518 int UtcDaliTypeRegistryGetP(void)
519 {
520   TestApplication application;
521
522   TypeRegistry registry = TypeRegistry::Get();
523   DALI_TEST_CHECK( registry );
524
525   END_TEST;
526 }
527
528 // Note: No negative test case for UtcDaliTypeRegistryConstructor can be implemented.
529 int UtcDaliTypeRegistryConstructorP(void)
530 {
531   TestApplication application;
532
533   TypeRegistry registry;
534   DALI_TEST_CHECK( !registry );
535   END_TEST;
536 }
537
538 // Note: No negative test case for UtcDaliTypeRegistryCopyConstructor can be implemented.
539 int UtcDaliTypeRegistryCopyConstructorP(void)
540 {
541   TestApplication application;
542
543   TypeRegistry registry = TypeRegistry::Get();
544   DALI_TEST_CHECK( registry );
545
546   TypeRegistry copy( registry );
547   DALI_TEST_CHECK( copy );
548
549   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
550
551   END_TEST;
552 }
553
554 // Note: No negative test case for UtcDaliTypeRegistryAssignmentOperator can be implemented.
555 int UtcDaliTypeRegistryAssignmentOperatorP(void)
556 {
557   TestApplication application;
558
559   TypeRegistry registry = TypeRegistry::Get();
560   DALI_TEST_CHECK( registry );
561
562   TypeRegistry copy = registry;
563   DALI_TEST_CHECK( copy );
564   DALI_TEST_CHECK( registry == copy );
565
566   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
567
568   END_TEST;
569 }
570
571 int UtcDaliTypeRegistryMoveConstructor(void)
572 {
573   TestApplication application;
574
575   TypeRegistry registry = TypeRegistry::Get();
576   DALI_TEST_CHECK( registry );
577   DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
578   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
579
580   TypeRegistry movedRegistry = std::move( registry );
581   DALI_TEST_CHECK( movedRegistry );
582   DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
583   DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
584   DALI_TEST_CHECK( !registry );
585
586   Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" );
587   DALI_TEST_CHECK( info );
588   DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION );
589   DALI_TEST_CHECK( info.GetName() == "Actor" );
590
591   Dali::TypeInfo movedInfo = std::move( info );
592   DALI_TEST_CHECK( movedInfo );
593   DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION );
594   DALI_TEST_CHECK( movedInfo.GetName() == "Actor" );
595   DALI_TEST_CHECK( !info );
596
597   END_TEST;
598 }
599
600 int UtcDaliTypeRegistryMoveAssignment(void)
601 {
602   TestApplication application;
603
604   TypeRegistry registry = TypeRegistry::Get();
605   DALI_TEST_CHECK( registry );
606   DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
607   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
608
609   TypeRegistry movedRegistry;
610   movedRegistry = std::move( registry );
611   DALI_TEST_CHECK( movedRegistry );
612   DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
613   DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
614   DALI_TEST_CHECK( !registry );
615
616   Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" );
617   DALI_TEST_CHECK( info );
618   DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION );
619   DALI_TEST_CHECK( info.GetName() == "Actor" );
620
621   Dali::TypeInfo movedInfo;
622   movedInfo = std::move( info );
623   DALI_TEST_CHECK( movedInfo );
624   DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION );
625   DALI_TEST_CHECK( movedInfo.GetName() == "Actor" );
626   DALI_TEST_CHECK( !info );
627
628   END_TEST;
629 }
630
631 int UtcDaliTypeRegistryAssignP(void)
632 {
633   TestApplication application;
634
635   TypeRegistry registry = TypeRegistry::Get();
636   TypeRegistry registry2;
637   registry2 = registry;
638   DALI_TEST_CHECK( registry2 );
639
640   DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
641
642   END_TEST;
643 }
644
645 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
646 {
647   TestApplication application;
648
649   TypeRegistry registry = TypeRegistry::Get();
650
651   TypeInfo type;
652
653   // camera actor
654   type = registry.GetTypeInfo( "CameraActor" );
655   DALI_TEST_CHECK( type );
656   CameraActor ca = CameraActor::DownCast(type.CreateInstance());
657   DALI_TEST_CHECK( ca );
658   application.GetScene().Add( ca );
659   application.Render();
660
661   // animations
662   type = registry.GetTypeInfo( "Animation" );
663   DALI_TEST_CHECK( type );
664   Animation an = Animation::DownCast(type.CreateInstance());
665   DALI_TEST_CHECK( an );
666   an.Play();
667   application.Render();
668
669   END_TEST;
670 }
671
672 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
673 {
674   TestApplication application;
675
676   TypeRegistry registry = TypeRegistry::Get();
677
678   TypeInfo type;
679
680   type = registry.GetTypeInfo( "MyDummyActor" );
681   DALI_TEST_CHECK( !type );
682
683   END_TEST;
684 }
685
686 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
687 {
688   TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
689   TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
690
691   DALI_TEST_CHECK( named_type );
692   DALI_TEST_CHECK( typeinfo_type );
693
694   // Check named and typeid are equivalent
695   DALI_TEST_CHECK( named_type == typeinfo_type );
696
697   DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
698   DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
699
700   END_TEST;
701 }
702
703 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
704 {
705   TestApplication application;
706   TypeRegistry typeRegistry = TypeRegistry::Get();
707
708   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
709   DALI_TEST_CHECK( !typeInfo );
710
711   END_TEST;
712 }
713
714 int UtcDaliTypeRegistryGetTypeNameCountP(void)
715 {
716   TestApplication application;
717   TypeRegistry typeRegistry = TypeRegistry::Get();
718   TypeInfo type;
719
720   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
721   {
722     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
723     DALI_TEST_CHECK( type );
724   }
725
726   END_TEST;
727 }
728
729
730 int UtcDaliTypeRegistryGetTypeNamesP(void)
731 {
732   TestApplication application;
733   TypeRegistry typeRegistry = TypeRegistry::Get();
734   TypeInfo type;
735
736   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
737   {
738     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
739     DALI_TEST_CHECK( type );
740   }
741
742   END_TEST;
743 }
744
745
746 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
747 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
748 {
749   ResetFunctorCounts();
750
751   TestApplication application;
752
753   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
754   DALI_TEST_CHECK( type );
755
756   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
757   DALI_TEST_CHECK( baseType );
758
759   BaseHandle handle = type.CreateInstance();
760   DALI_TEST_CHECK( handle );
761
762   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
763   DALI_TEST_CHECK( customHandle );
764
765   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
766
767   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
768
769   {
770     TestConnectionTracker tracker;
771
772     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
773     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
774     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
775     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
776     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
777
778     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
779     customHandle.GetCustomSignal().Emit();
780     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
781     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
782     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
783   }
784   // tracker should automatically disconnect here
785   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
786   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
787
788   // Test that functor is disconnected
789   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
790   customHandle.GetCustomSignal().Emit();
791   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
792   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
793   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
794
795   Property::Map attributes;
796   handle.DoAction("act1", attributes);
797   DALI_TEST_CHECK( lastActionCustom == "act1" );
798   END_TEST;
799 }
800
801 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
802 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
803 {
804   TestApplication application;
805
806   DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
807
808   DALI_TEST_CHECK( true == CreateCustomInitCalled );
809   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
810   DALI_TEST_CHECK( type );
811   END_TEST;
812 }
813
814 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
815 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
816 {
817   TestApplication application;
818
819   // Create Named Actor Type
820   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
821   DALI_TEST_CHECK( type );
822
823   BaseHandle namedHandle = type.CreateInstance();
824   DALI_TEST_CHECK( namedHandle );
825   Actor namedActor( Actor::DownCast( namedHandle ) );
826   DALI_TEST_CHECK( namedActor );
827
828   DALI_TEST_CHECK( namedActor.GetProperty< std::string >( Actor::Property::NAME ) == "NamedActor" );
829   DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
830   DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
831
832   END_TEST;
833 }
834
835 int UtcDaliTypeRegistryRegisteredNameP(void)
836 {
837   TestApplication application;
838
839   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
840
841   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
842   DALI_TEST_CHECK( baseType );
843
844   BaseHandle handle = baseType.CreateInstance();
845
846   DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
847   TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
848   DALI_TEST_CHECK( type );
849   END_TEST;
850 }
851
852
853 int UtcDaliTypeRegistryRegisteredNameN(void)
854 {
855   TestApplication application;
856
857   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
858
859   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
860   DALI_TEST_CHECK( baseType );
861
862   // should cause an assert because we're registering same type twice
863   // once statically at the start of this file, then again now
864   try
865   {
866     TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
867     tet_result( TET_FAIL );
868   }
869   catch ( DaliException& e )
870   {
871     DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION );
872   }
873
874   END_TEST;
875 }
876
877
878 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
879 {
880   ResetFunctorCounts();
881
882   TestApplication application;
883
884   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
885   DALI_TEST_CHECK( type );
886
887   BaseHandle handle = type.CreateInstance();
888   DALI_TEST_CHECK( handle );
889
890   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
891   DALI_TEST_CHECK( customHandle );
892
893   {
894     TestConnectionTracker tracker;
895
896     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
897     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
898     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
899     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
900     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
901
902     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
903     customHandle.GetCustomSignal().Emit();
904     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
905     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
906     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
907   }
908   // tracker should automatically disconnect here
909   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
910   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
911
912   // Test that functor is disconnected
913   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
914   customHandle.GetCustomSignal().Emit();
915   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
916   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
917   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
918
919   END_TEST;
920 }
921
922 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
923 {
924   // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
925
926   ResetFunctorCounts();
927
928   TestApplication application;
929
930   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
931   DALI_TEST_CHECK( type );
932
933   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
934   DALI_TEST_CHECK( baseType );
935
936   BaseHandle handle = type.CreateInstance();
937   DALI_TEST_CHECK( handle );
938
939   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
940   DALI_TEST_CHECK( customHandle );
941
942   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
943
944   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
945
946   {
947     TestConnectionTracker tracker;
948
949     bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
950     DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
951     DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
952     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
953     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
954
955     // Should be a NOOP
956     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
957     customHandle.GetCustomSignal().Emit();
958     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
959   }
960   // tracker should have nothing to disconnect here
961
962   // Should be a NOOP
963   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
964   customHandle.GetCustomSignal().Emit();
965   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
966   END_TEST;
967 }
968
969 int UtcDaliTypeRegistryTypeActionP(void)
970 {
971   ResetFunctorCounts();
972
973   TestApplication application;
974
975   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
976   DALI_TEST_CHECK( type );
977
978   BaseHandle handle = type.CreateInstance();
979   DALI_TEST_CHECK( handle );
980
981   Property::Map attributes;
982   DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
983   DALI_TEST_CHECK( lastActionCustom == "act1" );
984
985   END_TEST;
986 }
987
988 int UtcDaliTypeRegistryTypeActionN(void)
989 {
990   ResetFunctorCounts();
991
992   TestApplication application;
993
994   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
995   DALI_TEST_CHECK( type );
996
997   BaseHandle handle = type.CreateInstance();
998   DALI_TEST_CHECK( handle );
999
1000   Property::Map attributes;
1001   DALI_TEST_CHECK( !handle.DoAction( "unknownAction",  attributes ) );
1002
1003   END_TEST;
1004 }
1005
1006 int UtcDaliTypeRegistryPropertyRegistrationP(void)
1007 {
1008   TestApplication application;
1009   TypeRegistry typeRegistry = TypeRegistry::Get();
1010
1011   // Check property count before property registration
1012   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1013   DALI_TEST_CHECK( typeInfo );
1014   BaseHandle handle = typeInfo.CreateInstance();
1015   DALI_TEST_CHECK( handle );
1016   Actor customActor = Actor::DownCast( handle );
1017   DALI_TEST_CHECK( customActor );
1018   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1019
1020   std::string propertyName( "prop1" );
1021   int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
1022   Property::Type propertyType( Property::BOOLEAN );
1023   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
1024
1025   // Check property count after registration
1026   unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
1027   DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
1028
1029   // Add custom property and check property count
1030   customActor.RegisterProperty( "customProp1",   true );
1031   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1032   DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
1033
1034   // Set the property, ensure SetProperty called
1035   DALI_TEST_CHECK( !setPropertyCalled );
1036   customActor.SetProperty( propertyIndex, false );
1037   DALI_TEST_CHECK( setPropertyCalled );
1038
1039   // Get the property, ensure GetProperty called
1040   DALI_TEST_CHECK( !getPropertyCalled );
1041   (void)customActor.GetProperty< bool >( propertyIndex );
1042   DALI_TEST_CHECK( getPropertyCalled );
1043
1044   // Get the property using GetCurrentProperty and ensure GetProperty is called
1045   getPropertyCalled = false;
1046   DALI_TEST_CHECK( !getPropertyCalled );
1047   customActor.GetCurrentProperty< bool >( propertyIndex );
1048   DALI_TEST_CHECK( getPropertyCalled );
1049
1050   // Check the property name
1051   DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1052   DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1053
1054   // Check the property index
1055   DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1056
1057   // Check the property type
1058   DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1059
1060   // Check property count of type-info is 1
1061   Property::IndexContainer indices;
1062   typeInfo.GetPropertyIndices( indices );
1063
1064   size_t typePropertyCount = typeInfo.GetPropertyCount();
1065   DALI_TEST_EQUALS( indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION );
1066   DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION );
1067
1068   // Ensure indices returned from actor and customActor differ by two
1069   Actor actor = Actor::New();
1070   actor.GetPropertyIndices( indices );
1071   unsigned int actorIndices = indices.Size();
1072   customActor.GetPropertyIndices( indices );
1073   unsigned int customActorIndices = indices.Size();
1074   DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1075   END_TEST;
1076 }
1077
1078 int UtcDaliTypeRegistryPropertyRegistrationN(void)
1079 {
1080   TestApplication application;
1081   TypeRegistry typeRegistry = TypeRegistry::Get();
1082
1083   // Attempt to register a property type out-of-bounds index (less than)
1084   try
1085   {
1086     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1087     tet_result( TET_FAIL );
1088   }
1089   catch ( DaliException& e )
1090   {
1091     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1092   }
1093
1094   // Attempt to register a property type out-of-bounds index (greater than)
1095   try
1096   {
1097     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1098     tet_result( TET_FAIL );
1099   }
1100   catch ( DaliException& e )
1101   {
1102     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1103   }
1104
1105   END_TEST;
1106 }
1107
1108 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1109 {
1110   TestApplication application;
1111   TypeRegistry typeRegistry = TypeRegistry::Get();
1112
1113   // Check property count before property registration
1114   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1115   DALI_TEST_CHECK( typeInfo );
1116   BaseHandle handle = typeInfo.CreateInstance();
1117   DALI_TEST_CHECK( handle );
1118   Actor customActor = Actor::DownCast( handle );
1119   DALI_TEST_CHECK( customActor );
1120   application.GetScene().Add(customActor);
1121
1122   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1123
1124   // Register animatable property
1125   std::string animatablePropertyName( "animatableProp1" );
1126   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1127   Property::Type animatablePropertyType( Property::FLOAT );
1128   AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1129
1130   // Check property count after registration
1131   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1132
1133   // Set the animatable property value
1134   customActor.SetProperty( animatablePropertyIndex, 25.0f );
1135
1136   // Render and notify
1137   application.SendNotification();
1138   application.Render();
1139
1140   // Check the animatable property value
1141   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1142
1143   // Check the animatable property name
1144   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1145
1146   // Check the animatable property index
1147   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1148
1149   // Check the animatable property type
1150   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1151
1152   // Check property count of type-info is 1
1153   Property::IndexContainer indices;
1154   typeInfo.GetPropertyIndices( indices );
1155   DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
1156
1157   // Ensure indices returned from actor and customActor differ by one
1158   Actor actor = Actor::New();
1159   actor.GetPropertyIndices( indices );
1160   unsigned int actorIndices = indices.Size();
1161   customActor.GetPropertyIndices( indices );
1162   unsigned int customActorIndices = indices.Size();
1163   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1164
1165   // check that the property is animatable
1166   Animation animation = Animation::New(0.2f);
1167   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1168   animation.Play();
1169
1170   // Target value should change straight away
1171   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION );
1172
1173   // Render and notify, animation play for 0.05 seconds
1174   application.SendNotification();
1175   application.Render(50);
1176   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1177   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1178
1179   // Render and notify, animation play for another 0.1 seconds
1180   application.SendNotification();
1181   application.Render(100);
1182   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1183   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1184
1185   END_TEST;
1186 }
1187
1188 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1189 {
1190   TestApplication application;
1191   TypeRegistry typeRegistry = TypeRegistry::Get();
1192
1193   // Attempt to register an animatable property type out-of-bounds index (less than)
1194   try
1195   {
1196     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1197     tet_result( TET_FAIL );
1198   }
1199   catch ( DaliException& e )
1200   {
1201     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1202   }
1203
1204   // Attempt to register an animatable property type out-of-bounds index (greater than)
1205   try
1206   {
1207     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1208     tet_result( TET_FAIL );
1209   }
1210   catch ( DaliException& e )
1211   {
1212     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1213   }
1214
1215   END_TEST;
1216 }
1217
1218 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1219 {
1220   TestApplication application;
1221   TypeRegistry typeRegistry = TypeRegistry::Get();
1222
1223   // Check property count before property registration
1224   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1225   DALI_TEST_CHECK( typeInfo );
1226   BaseHandle handle = typeInfo.CreateInstance();
1227   DALI_TEST_CHECK( handle );
1228   Actor customActor = Actor::DownCast( handle );
1229   DALI_TEST_CHECK( customActor );
1230   application.GetScene().Add(customActor);
1231
1232   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1233
1234   // Register animatable property
1235   std::string animatablePropertyName( "animatableProp1" );
1236   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1237   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1238
1239   // Check property count after registration
1240   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1241
1242   // Render and notify
1243   application.SendNotification();
1244   application.Render();
1245
1246   // Check the animatable property value
1247   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1248
1249   // Check the animatable property name
1250   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1251
1252   // Check the animatable property index
1253   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1254
1255   // Check the animatable property type
1256   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1257
1258   // Check property count of type-info
1259   Property::IndexContainer indices;
1260   typeInfo.GetPropertyIndices( indices );
1261   DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
1262
1263   // Ensure indices returned from actor and customActor differ by one
1264   Actor actor = Actor::New();
1265   actor.GetPropertyIndices( indices );
1266   unsigned int actorIndices = indices.Size();
1267   customActor.GetPropertyIndices( indices );
1268   unsigned int customActorIndices = indices.Size();
1269   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1270
1271   // check that the property is animatable
1272   Animation animation = Animation::New(0.2f);
1273   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1274   animation.Play();
1275
1276   // Target value should change straight away
1277   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION );
1278
1279   // Render and notify, animation play for 0.05 seconds
1280   application.SendNotification();
1281   application.Render(50);
1282   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1283   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1284
1285   // Render and notify, animation play for another 0.1 seconds
1286   application.SendNotification();
1287   application.Render(100);
1288   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1289   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1290
1291   END_TEST;
1292 }
1293
1294 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1295 {
1296   TestApplication application;
1297   TypeRegistry typeRegistry = TypeRegistry::Get();
1298
1299   // Attempt to register an animatable property type out-of-bounds index (less than)
1300   try
1301   {
1302     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1303     tet_result( TET_FAIL );
1304   }
1305   catch ( DaliException& e )
1306   {
1307     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1308   }
1309
1310   // Attempt to register an animatable property type out-of-bounds index (greater than)
1311   try
1312   {
1313     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1314     tet_result( TET_FAIL );
1315   }
1316   catch ( DaliException& e )
1317   {
1318     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1319   }
1320
1321   END_TEST;
1322 }
1323
1324 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1325 {
1326   TestApplication application;
1327   TypeRegistry typeRegistry = TypeRegistry::Get();
1328
1329   // Check property count before property registration
1330   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1331   DALI_TEST_CHECK( typeInfo );
1332   BaseHandle handle = typeInfo.CreateInstance();
1333   DALI_TEST_CHECK( handle );
1334   Actor customActor = Actor::DownCast( handle );
1335   DALI_TEST_CHECK( customActor );
1336
1337   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1338
1339   // Register animatable property
1340   std::string animatablePropertyName( "animatableProp1" );
1341   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1342   Property::Type animatablePropertyType( Property::VECTOR2 );
1343   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1344
1345   // Check property count after registration
1346   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1347
1348   // Set the animatable property value
1349   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1350
1351   // Render and notify
1352   application.SendNotification();
1353   application.Render();
1354
1355   // Check the animatable property value
1356   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1357
1358   // Check the animatable property name
1359   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1360
1361   // Check the animatable property index
1362   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1363
1364   // Check the animatable property type
1365   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1366
1367   // Check property count of type-info
1368   Property::IndexContainer indices;
1369   typeInfo.GetPropertyIndices( indices );
1370   DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
1371
1372   // Register animatable property components
1373   std::string animatablePropertyComponentName1( "animatableProp1X" );
1374   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1375   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1376
1377   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1378   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1379   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1380
1381   // Check property count after registration
1382   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1383
1384   // Check the animatable property component value
1385   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1386   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1387
1388   // Set the animatable property component value
1389   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1390
1391   // Render and notify
1392   application.SendNotification();
1393   application.Render();
1394
1395   // Check the animatable property value
1396   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1397   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1398   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1399
1400   // Set the animatable property component value
1401   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1402
1403   // Render and notify
1404   application.SendNotification();
1405   application.Render();
1406
1407   // Check the animatable property value
1408   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1409   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1410   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1411
1412   // Ensure indices returned from actor and customActor differ by three
1413   Actor actor = Actor::New();
1414   actor.GetPropertyIndices( indices );
1415   unsigned int actorIndices = indices.Size();
1416   customActor.GetPropertyIndices( indices );
1417   unsigned int customActorIndices = indices.Size();
1418   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1419
1420   // Attempt to animate component property, it should not crash
1421   Animation animation = Animation::New( 1.0f );
1422   animation.AnimateTo( Property( customActor, animatablePropertyComponentIndex1 ), 200.0f );
1423   animation.Play();
1424
1425   // Check the property value
1426   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(200.0f, 225.0f), TEST_LOCATION );
1427   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 200.0f, TEST_LOCATION );
1428   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1429
1430   END_TEST;
1431 }
1432
1433 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void)
1434 {
1435   TestApplication application;
1436   TypeRegistry typeRegistry = TypeRegistry::Get();
1437
1438   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1439   DALI_TEST_CHECK( typeInfo );
1440   BaseHandle handle = typeInfo.CreateInstance();
1441   DALI_TEST_CHECK( handle );
1442   Actor customActor = Actor::DownCast( handle );
1443   DALI_TEST_CHECK( customActor );
1444
1445   const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1446   const unsigned int xComponentIndex = index + 1;
1447   const unsigned int yComponentIndex = index + 2;
1448   const Vector2 initialValue( 20.0f, 40.0f );
1449
1450   // Register animatable property & its components
1451   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1452   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1453   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1454
1455   // Check the animatable property value
1456   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
1457   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1458   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1459
1460   // Render and notify
1461   application.SendNotification();
1462   application.Render();
1463
1464   // Check the animatable property current value
1465   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
1466   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1467   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1468
1469   // Do an AnimateBy
1470   const Vector2 targetValue( 45.0f, 53.0f );
1471   const Vector2 relativeValue( targetValue - initialValue );
1472
1473   Animation animation = Animation::New( 1.0f );
1474   animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1475   animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1476   animation.Play();
1477
1478   // Target values should change straight away
1479   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
1480   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1481   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1482
1483   END_TEST;
1484 }
1485
1486 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void)
1487 {
1488   TestApplication application;
1489   TypeRegistry typeRegistry = TypeRegistry::Get();
1490
1491   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1492   DALI_TEST_CHECK( typeInfo );
1493   BaseHandle handle = typeInfo.CreateInstance();
1494   DALI_TEST_CHECK( handle );
1495   Actor customActor = Actor::DownCast( handle );
1496   DALI_TEST_CHECK( customActor );
1497
1498   const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1499   const unsigned int xComponentIndex = index + 1;
1500   const unsigned int yComponentIndex = index + 2;
1501   const unsigned int zComponentIndex = index + 3;
1502   const Vector3 initialValue( 20.0f, 40.0f, 50.0f );
1503
1504   // Register animatable property & its components
1505   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1506   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1507   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1508   AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
1509
1510   // Check the animatable property value
1511   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
1512   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1513   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1514   DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1515
1516   // Render and notify
1517   application.SendNotification();
1518   application.Render();
1519
1520   // Check the animatable property current value
1521   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
1522   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1523   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1524   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1525
1526   // Do an AnimateBy
1527   const Vector3 targetValue( 45.0f, 53.0f, 25.0f );
1528   const Vector3 relativeValue( targetValue - initialValue );
1529
1530   Animation animation = Animation::New( 1.0f );
1531   animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1532   animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1533   animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
1534   animation.Play();
1535
1536   // Target values should change straight away
1537   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
1538   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1539   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1540   DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
1541
1542   END_TEST;
1543 }
1544
1545 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void)
1546 {
1547   TestApplication application;
1548   TypeRegistry typeRegistry = TypeRegistry::Get();
1549
1550   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1551   DALI_TEST_CHECK( typeInfo );
1552   BaseHandle handle = typeInfo.CreateInstance();
1553   DALI_TEST_CHECK( handle );
1554   Actor customActor = Actor::DownCast( handle );
1555   DALI_TEST_CHECK( customActor );
1556
1557   const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1558   const unsigned int xComponentIndex = index + 1;
1559   const unsigned int yComponentIndex = index + 2;
1560   const unsigned int zComponentIndex = index + 3;
1561   const unsigned int wComponentIndex = index + 4;
1562   const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f );
1563
1564   // Register animatable property & its components
1565   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1566   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1567   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1568   AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
1569   AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 );
1570
1571   // Check the animatable property value
1572   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
1573   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1574   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1575   DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1576   DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
1577
1578   // Render and notify
1579   application.SendNotification();
1580   application.Render();
1581
1582   // Check the animatable property current value
1583   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
1584   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1585   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1586   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1587   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
1588
1589   // Do an AnimateBy
1590   const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f );
1591   const Vector4 relativeValue( targetValue - initialValue );
1592
1593   Animation animation = Animation::New( 1.0f );
1594   animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1595   animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1596   animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
1597   animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w );
1598   animation.Play();
1599
1600   // Target values should change straight away
1601   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
1602   DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1603   DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1604   DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
1605   DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION );
1606
1607   END_TEST;
1608 }
1609
1610 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1611 {
1612   TestApplication application;
1613   TypeRegistry typeRegistry = TypeRegistry::Get();
1614
1615   // Register animatable property with the type of Vector2
1616   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1617   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1618
1619   // Attempt to register an animatable property component out-of-bounds index (less than)
1620   try
1621   {
1622     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1623     tet_result( TET_FAIL );
1624   }
1625   catch ( DaliException& e )
1626   {
1627     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1628   }
1629
1630   // Attempt to register an animatable property component out-of-bounds index (greater than)
1631   try
1632   {
1633     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1634     tet_result( TET_FAIL );
1635   }
1636   catch ( DaliException& e )
1637   {
1638     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1639   }
1640
1641   // Register an animatable property component
1642   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1643
1644   // Attempt to register another animatable property component with the same component index
1645   try
1646   {
1647     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1648     tet_result( TET_FAIL );
1649   }
1650   catch ( DaliException& e )
1651   {
1652     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1653   }
1654
1655   // Register animatable property with the type of boolean
1656   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1657   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1658
1659   // Attempt to register an animatable property component for the above property with boolean type
1660   try
1661   {
1662     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1663     tet_result( TET_FAIL );
1664   }
1665   catch ( DaliException& e )
1666   {
1667     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1668   }
1669
1670   END_TEST;
1671 }
1672
1673 int UtcDaliTypeRegistryChildPropertyRegistrationP(void)
1674 {
1675   TestApplication application;
1676   TypeRegistry typeRegistry = TypeRegistry::Get();
1677
1678   // Check property count before property registration
1679   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1680   DALI_TEST_CHECK( typeInfo );
1681   BaseHandle handle = typeInfo.CreateInstance();
1682   DALI_TEST_CHECK( handle );
1683   Actor customActor = Actor::DownCast( handle );
1684   DALI_TEST_CHECK( customActor );
1685   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1686
1687   // Register child properties to the parent
1688   std::string propertyName( "childProp1" );
1689   int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1690   Property::Type propertyType( Property::BOOLEAN );
1691   ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType );
1692
1693   std::string propertyName2( "childProp2" );
1694   int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 );
1695   Property::Type propertyType2( Property::INTEGER );
1696   ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 );
1697
1698   std::string propertyName3( "childProp3" );
1699   int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 );
1700   Property::Type propertyType3( Property::FLOAT );
1701   ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 );
1702
1703   std::string propertyName4( "childProp4" );
1704   int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 );
1705   Property::Type propertyType4( Property::INTEGER );
1706   ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 );
1707
1708   // Check property count are not changed because the child properties will not be created for the parent
1709   DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION );
1710
1711   // check the child property type
1712   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1713   Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
1714   DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
1715
1716   std::string unRegisteredChildName( typeInfoImpl.GetChildPropertyName( CHILD_PROPERTY_REGISTRATION_START_INDEX + 4 ) );
1717   DALI_TEST_EQUALS( unRegisteredChildName, "", TEST_LOCATION );
1718
1719   // Create a child actor
1720   Actor childActor = Actor::New();
1721   DALI_TEST_CHECK( childActor );
1722   unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() );
1723
1724   // The type of child properties should be Property::None as the child hasn't registered any child property yet.
1725   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION );
1726   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION );
1727   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION );
1728   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION );
1729
1730   // Set the value for the first child property when the child actor doesn't have a parent yet
1731   childActor.SetProperty(propertyIndex, true);
1732
1733   // Check that the first child property is dynamically created
1734   DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION );
1735
1736   // Check the first child property value
1737   DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION );
1738
1739   // Check the first child property type
1740   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1741
1742   // Check that the first child property have no name, as it doesn't have a parent yet.
1743   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION );
1744
1745   // Check that the first property can't be accessed through its name, as it doesn't have a parent yet.
1746   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION );
1747
1748   // Create a custom property for the child with the same name as the second child property registered to the parent
1749   Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE);
1750
1751   // Check that the custom property is created
1752   DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION );
1753
1754   // Check the property value
1755   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1756
1757   // Check the property index
1758   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION );
1759
1760   // Check the property type
1761   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1762
1763   // Check the property name
1764   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION );
1765
1766   // Now add the child actor to the parent
1767   customActor.Add( childActor );
1768
1769   // Check that the first child property now has the correct name as previously registered to the parent
1770   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1771
1772   // Check that the child property index for the first child property can now be retrieved through its child property name
1773   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1774
1775   // Check that the second child property now has the correct index as previously registered to the parent
1776   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION );
1777
1778   // Check that the second child property can be accessed through both its custom property index and its child property index
1779   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1780   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION );
1781   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1782   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION );
1783
1784   // Check that the child property index for the second child property can now be retrieved through its child property name
1785   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION );
1786
1787   // Set the value for the third child property when the child actor is already added to the parent
1788   childActor.SetProperty(propertyIndex3, 0.15f);
1789
1790   // Check that the third child property is dynamically created
1791   DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION );
1792
1793   // Check the third child property value
1794   DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION );
1795
1796   // Check the third child property type
1797   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION );
1798
1799   // Check the third child property name
1800   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION );
1801
1802   // Check the third child property index.
1803   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION );
1804
1805   // Create a custom property for the child with the same name as the fourth child property registered to the parent
1806   Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE);
1807
1808   // Check that the custom property is created
1809   DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION );
1810
1811   // Check the fourth child property value
1812   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION );
1813   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION );
1814
1815   // Check the fourth child property type
1816   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION );
1817   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION );
1818
1819   // Check the fourth child property name
1820   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION );
1821   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION );
1822
1823   // Check the fourth child property index.
1824   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION );
1825
1826   // Now create another parent actor with different child properties registered
1827   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" );
1828   DALI_TEST_CHECK( typeInfo2 );
1829   BaseHandle handle2 = typeInfo2.CreateInstance();
1830   DALI_TEST_CHECK( handle2 );
1831   Actor customActor2 = Actor::DownCast( handle2 );
1832   DALI_TEST_CHECK( customActor2 );
1833
1834   // Register child properties to the new parent
1835   std::string newPropertyName( "newChildProp" );
1836   int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent
1837   Property::Type newPropertyType( Property::VECTOR2 );
1838   ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType );
1839
1840   std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent
1841   int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent
1842   Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent
1843   ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 );
1844
1845   // Now move the child actor to the new parent
1846   customActor2.Add( childActor );
1847
1848   // "childProp1" is not a valid child property supported by the new parent, so nothing changed
1849   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1850   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1851   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1852
1853   // "childProp3" is a valid child property supported by the new parent
1854   // So it should get its new child property index and should just work
1855   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION );
1856   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION );
1857   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION );
1858   DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION );
1859
1860   // Now register a custom property called "newChildProp"
1861   Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE);
1862
1863   // Check that the custom property is created
1864   DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION );
1865
1866   // This is a valid child property registered to the new parent
1867   // So should be able to access it through both its custom property index and its registered child property index
1868   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION );
1869   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION );
1870   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same
1871   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION );
1872   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1873   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1874
1875   // Should return the child property index by given its name
1876   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION );
1877
1878
1879   END_TEST;
1880 }
1881
1882 int UtcDaliTypeRegistryChildPropertyRegistrationN(void)
1883 {
1884   TestApplication application;
1885   TypeRegistry typeRegistry = TypeRegistry::Get();
1886
1887   // Attempt to register a child property type out-of-bounds index (less than)
1888   try
1889   {
1890     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1891     tet_result( TET_FAIL );
1892   }
1893   catch ( DaliException& e )
1894   {
1895     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1896   }
1897
1898   // Attempt to register a child property type out-of-bounds index (greater than)
1899   try
1900   {
1901     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1902     tet_result( TET_FAIL );
1903   }
1904   catch ( DaliException& e )
1905   {
1906     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1907   }
1908
1909   END_TEST;
1910 }
1911
1912
1913 /*******************************************************************************
1914  *
1915  * Action through the base handle
1916  *
1917  ******************************************************************************/
1918 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1919 {
1920   TestApplication application;
1921
1922   TypeInfo type;
1923
1924   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1925   DALI_TEST_CHECK( type );
1926
1927   BaseHandle hdl = type.CreateInstance();
1928   DALI_TEST_CHECK( hdl );
1929
1930   Actor a = Actor::DownCast(hdl);
1931   DALI_TEST_CHECK( a );
1932
1933   a.SetProperty( Actor::Property::VISIBLE,false);
1934
1935   application.SendNotification();
1936   application.Render(0);
1937   DALI_TEST_CHECK(!a.GetCurrentProperty< bool >( Actor::Property::VISIBLE ));
1938
1939   Property::Map attributes;
1940
1941   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1942
1943   application.SendNotification();
1944   application.Render(0);
1945   DALI_TEST_CHECK(a.GetCurrentProperty< bool >( Actor::Property::VISIBLE ));
1946
1947   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1948   END_TEST;
1949 }
1950
1951 int UtcDaliPropertyRegistrationFunctions(void)
1952 {
1953   TestApplication application;
1954   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1955
1956   // Attempt to register a property without a setter
1957   try
1958   {
1959     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1960     tet_result( TET_PASS );
1961   }
1962   catch ( DaliException& e )
1963   {
1964     tet_result( TET_FAIL );
1965   }
1966
1967   // Attempt to register a property without a getter
1968   try
1969   {
1970     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1971     tet_result( TET_FAIL );
1972   }
1973   catch ( DaliException& e )
1974   {
1975     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1976   }
1977   END_TEST;
1978 }
1979
1980 int UtcDaliPropertyRegistrationAddSameIndex(void)
1981 {
1982   TestApplication application;
1983   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1984
1985   // Add one property with a valid property index
1986   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1987
1988   // Attempt to add another property with the same index
1989   try
1990   {
1991     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1992   }
1993   catch ( DaliException& e )
1994   {
1995     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1996   }
1997
1998   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1999
2000   // Add one property with a valid property index
2001   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
2002
2003   // Attempt to add another property with the same index
2004   try
2005   {
2006     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
2007   }
2008   catch ( DaliException& e )
2009   {
2010     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
2011   }
2012   END_TEST;
2013 }
2014
2015 int UtcDaliPropertyRegistrationPropertyWritableP(void)
2016 {
2017   TestApplication application;
2018   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
2019   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
2020
2021   // Add two properties, one with SetProperty, one without
2022   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
2023   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
2024
2025   // Create custom-actor
2026   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2027   DALI_TEST_CHECK( typeInfo );
2028   BaseHandle handle = typeInfo.CreateInstance();
2029   DALI_TEST_CHECK( handle );
2030   Actor customActor = Actor::DownCast( handle );
2031   DALI_TEST_CHECK( customActor );
2032
2033   // Check whether properties are writable
2034   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
2035   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
2036
2037
2038   // Check the property is writable in the type registry
2039   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
2040
2041   DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION );
2042
2043   END_TEST;
2044 }
2045
2046 int UtcDaliPropertyRegistrationPropertyWritableN(void)
2047 {
2048   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2049   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
2050
2051   DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR), true, TEST_LOCATION );
2052
2053   END_TEST;
2054 }
2055
2056 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
2057 {
2058   TestApplication application;
2059   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
2060   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
2061
2062   // These properties are not animatable
2063   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
2064
2065   // These properties are animatable
2066   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
2067
2068   // Create custom-actor
2069   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2070   DALI_TEST_CHECK( typeInfo );
2071   BaseHandle handle = typeInfo.CreateInstance();
2072   DALI_TEST_CHECK( handle );
2073   Actor customActor = Actor::DownCast( handle );
2074   DALI_TEST_CHECK( customActor );
2075
2076   // Check if animatable
2077   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
2078   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
2079
2080   // Create another instance of custom-actor
2081   BaseHandle handle2 = typeInfo.CreateInstance();
2082   DALI_TEST_CHECK( handle2 );
2083   Actor customActor2 = Actor::DownCast( handle2 );
2084   DALI_TEST_CHECK( customActor2 );
2085
2086   // Check if animatable
2087   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
2088   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
2089   END_TEST;
2090 }
2091
2092 int UtcDaliPropertyRegistrationUnregisteredGetAndSet(void)
2093 {
2094   TestApplication application;
2095   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
2096   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
2097
2098   // Create custom-actor
2099   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2100   DALI_TEST_CHECK( typeInfo );
2101   BaseHandle handle = typeInfo.CreateInstance();
2102   DALI_TEST_CHECK( handle );
2103   Actor customActor = Actor::DownCast( handle );
2104   DALI_TEST_CHECK( customActor );
2105
2106   // Try to set an index that hasn't been registered, this is a no-op for now, to be fixed in future
2107   customActor.SetProperty( propertyIndex, true );
2108 //  DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get<bool>(), TEST_LOCATION);
2109
2110   // Try to set an index that hasn't been registered
2111   customActor.SetProperty( animatablePropertyIndex, true );
2112   DALI_TEST_EQUALS( true, customActor.GetProperty( animatablePropertyIndex ).Get<bool>(), TEST_LOCATION);
2113
2114   END_TEST;
2115 }
2116
2117
2118 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
2119 {
2120   TestApplication application;
2121
2122   Actor actor = Actor::New();
2123   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
2124   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2125   application.GetScene().Add(actor);
2126
2127   // Register Type
2128   TypeInfo type;
2129   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
2130   DALI_TEST_CHECK( type );
2131   BaseHandle handle = type.CreateInstance();
2132   DALI_TEST_CHECK( handle );
2133   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
2134   DALI_TEST_CHECK( detector );
2135
2136   // Attach actor to detector
2137   SignalData data;
2138   GestureReceivedFunctor functor( data );
2139   detector.Attach(actor);
2140
2141   // Connect to signal through type
2142   handle.ConnectSignal( &application, "longPressDetected",   functor );
2143
2144   // Render and notify
2145   application.SendNotification();
2146   application.Render();
2147
2148   // Emit gesture
2149   TestGenerateLongPress( application, 50.0f, 10.0f );
2150   TestEndLongPress( application, 50.0f, 10.0f );
2151
2152   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2153   END_TEST;
2154 }
2155
2156 int UtcDaliPanGestureDetectorTypeRegistry(void)
2157 {
2158   TestApplication application;
2159
2160   Actor actor = Actor::New();
2161   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
2162   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2163   application.GetScene().Add(actor);
2164
2165   // Register Type
2166   TypeInfo type;
2167   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
2168   DALI_TEST_CHECK( type );
2169   BaseHandle handle = type.CreateInstance();
2170   DALI_TEST_CHECK( handle );
2171   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
2172   DALI_TEST_CHECK( detector );
2173
2174   // Attach actor to detector
2175   SignalData data;
2176   GestureReceivedFunctor functor( data );
2177   detector.Attach(actor);
2178
2179   // Connect to signal through type
2180   handle.ConnectSignal( &application, "panDetected",  functor );
2181
2182   // Render and notify
2183   application.SendNotification();
2184   application.Render();
2185
2186   // Emit gesture
2187   TestGenerateMiniPan( application );
2188   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2189   END_TEST;
2190 }
2191
2192 int UtcDaliPinchGestureDetectorTypeRegistry(void)
2193 {
2194   TestApplication application;
2195
2196   Actor actor = Actor::New();
2197   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
2198   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2199   application.GetScene().Add(actor);
2200
2201   // Register Type
2202   TypeInfo type;
2203   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
2204   DALI_TEST_CHECK( type );
2205   BaseHandle handle = type.CreateInstance();
2206   DALI_TEST_CHECK( handle );
2207   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
2208   DALI_TEST_CHECK( detector );
2209
2210   // Attach actor to detector
2211   SignalData data;
2212   GestureReceivedFunctor functor( data );
2213   detector.Attach(actor);
2214
2215   // Connect to signal through type
2216   handle.ConnectSignal( &application, "pinchDetected",  functor );
2217
2218   // Render and notify
2219   application.SendNotification();
2220   application.Render();
2221
2222   // Emit gesture
2223   TestGeneratePinch( application );
2224
2225   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2226   END_TEST;
2227 }
2228
2229 int UtcDaliRotationGestureDetectorTypeRegistry(void)
2230 {
2231   TestApplication application;
2232
2233   Actor actor = Actor::New();
2234   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
2235   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2236   application.GetScene().Add(actor);
2237
2238   // Register Type
2239   TypeInfo type;
2240   type = TypeRegistry::Get().GetTypeInfo( "RotationGestureDetector" );
2241   DALI_TEST_CHECK( type );
2242   BaseHandle handle = type.CreateInstance();
2243   DALI_TEST_CHECK( handle );
2244   RotationGestureDetector detector = RotationGestureDetector::DownCast( handle );
2245   DALI_TEST_CHECK( detector );
2246
2247   // Attach actor to detector
2248   SignalData data;
2249   GestureReceivedFunctor functor( data );
2250   detector.Attach(actor);
2251
2252   // Connect to signal through type
2253   handle.ConnectSignal( &application, "rotationDetected",  functor );
2254
2255   // Render and notify
2256   application.SendNotification();
2257   application.Render();
2258
2259   // Emit gesture
2260   TestGenerateRotation( application );
2261
2262   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2263   END_TEST;
2264 }
2265
2266 int UtcDaliTapGestureDetectorTypeRegistry(void)
2267 {
2268   TestApplication application;
2269
2270   Actor actor = Actor::New();
2271   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
2272   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2273   application.GetScene().Add(actor);
2274
2275   // Register Type
2276   TypeInfo type;
2277   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
2278   DALI_TEST_CHECK( type );
2279   BaseHandle handle = type.CreateInstance();
2280   DALI_TEST_CHECK( handle );
2281   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
2282   DALI_TEST_CHECK( detector );
2283
2284   // Attach actor to detector
2285   SignalData data;
2286   GestureReceivedFunctor functor( data );
2287   detector.Attach(actor);
2288
2289   // Connect to signal through type
2290   handle.ConnectSignal( &application, "tapDetected",  functor );
2291
2292   // Render and notify
2293   application.SendNotification();
2294   application.Render();
2295
2296   // Emit gesture
2297   TestGenerateTap( application, 50.0, 10.0, 100 );
2298
2299   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2300   END_TEST;
2301 }
2302
2303 int UtcDaliTypeRegistryNamedType(void)
2304 {
2305   TestApplication application;
2306   TypeRegistry typeRegistry = TypeRegistry::Get();
2307
2308   // Create a normal actor
2309   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
2310   DALI_TEST_CHECK( actorHandle );
2311   Actor actor( Actor::DownCast( actorHandle ) );
2312   DALI_TEST_CHECK( actor );
2313   unsigned int actorPropertyCount( actor.GetPropertyCount() );
2314
2315   // Create Named Actor Type
2316   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
2317   DALI_TEST_CHECK( namedHandle );
2318   Actor namedActor( Actor::DownCast( namedHandle ) );
2319   DALI_TEST_CHECK( namedActor );
2320   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
2321
2322   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
2323   END_TEST;
2324 }
2325
2326 int UtcDaliTypeInfoGetActionNameP(void)
2327 {
2328   TestApplication application;
2329   TypeRegistry typeRegistry = TypeRegistry::Get();
2330
2331   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2332   DALI_TEST_CHECK( typeInfo );
2333
2334   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2335
2336   std::string name = typeInfo.GetActionName(0);
2337
2338   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
2339
2340
2341   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2342
2343   //  search for show action in base class, given a derived class
2344   bool foundChildAction = false;
2345   for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ )
2346   {
2347
2348        std::string name = typeInfo2.GetActionName( i );
2349        if( name == "show")
2350        {
2351          foundChildAction = true;
2352        }
2353
2354   }
2355
2356   DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION );
2357
2358
2359   END_TEST;
2360 }
2361
2362 int UtcDaliTypeInfoGetActionNameN(void)
2363 {
2364   TestApplication application;
2365   TypeRegistry typeRegistry = TypeRegistry::Get();
2366
2367   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2368   DALI_TEST_CHECK( typeInfo );
2369
2370   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2371
2372   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
2373
2374   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2375
2376   END_TEST;
2377 }
2378
2379 int UtcDaliTypeInfoGetSignalNameP(void)
2380 {
2381   TestApplication application;
2382   TypeRegistry typeRegistry = TypeRegistry::Get();
2383
2384   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2385   DALI_TEST_CHECK( typeInfo );
2386
2387   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2388
2389   std::string name = typeInfo.GetSignalName(0);
2390
2391   DALI_TEST_EQUALS( name, "hovered", TEST_LOCATION );
2392
2393   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2394
2395   //  search for signal in base class, given a derived class
2396   bool foundSignal = false;
2397   for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ )
2398   {
2399     std::string name = typeInfo2.GetSignalName( i );
2400     if( name == "hovered")
2401     {
2402       foundSignal = true;
2403     }
2404   }
2405
2406   DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION );
2407
2408   END_TEST;
2409 }
2410
2411 int UtcDaliTypeInfoGetSignalNameN(void)
2412 {
2413   TestApplication application;
2414   TypeRegistry typeRegistry = TypeRegistry::Get();
2415
2416   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2417   DALI_TEST_CHECK( typeInfo );
2418
2419   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2420
2421   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
2422
2423   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2424
2425   END_TEST;
2426 }
2427
2428
2429 int UtcDaliTypeInfoGetCreatorP(void)
2430 {
2431   TestApplication application;
2432   TypeRegistry typeRegistry = TypeRegistry::Get();
2433
2434   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2435   DALI_TEST_CHECK( typeInfo );
2436
2437   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2438   DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
2439   if( createFn )
2440   {
2441     // try calling it:
2442     BaseHandle handle = createFn();
2443     DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
2444   }
2445
2446   END_TEST;
2447 }
2448
2449 int UtcDaliTypeInfoGetCreatorN(void)
2450 {
2451   TestApplication application;
2452   TypeRegistry typeRegistry = TypeRegistry::Get();
2453
2454   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
2455   DALI_TEST_CHECK( typeInfo );
2456
2457   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2458   DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
2459
2460   END_TEST;
2461 }
2462
2463 int UtcDaliTypeInfoGetPropertyCountP1(void)
2464 {
2465   TestApplication application;
2466   TypeRegistry typeRegistry = TypeRegistry::Get();
2467
2468   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2469   DALI_TEST_CHECK( typeInfo );
2470   size_t actorPropertyCount = typeInfo.GetPropertyCount();
2471
2472   DALI_TEST_EQUALS( actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION ); // No event only props
2473   END_TEST;
2474 }
2475
2476 int UtcDaliTypeInfoGetPropertyCountP2(void)
2477 {
2478   TestApplication application;
2479   TypeRegistry typeRegistry = TypeRegistry::Get();
2480
2481   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
2482   DALI_TEST_CHECK( typeInfo );
2483   size_t propertyCount = typeInfo.GetPropertyCount();
2484   Property::IndexContainer indices;
2485   typeInfo.GetPropertyIndices( indices );
2486
2487   DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
2488   DALI_TEST_EQUALS( propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION );
2489
2490   END_TEST;
2491 }
2492
2493 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void)
2494 {
2495   TestApplication application;
2496   TypeRegistry typeRegistry = TypeRegistry::Get();
2497
2498   tet_infoline( "Register a type registered animatable property and ensure set/get behaviour works synchronously" );
2499
2500   // Register animatable property
2501   const int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2502   AnimatablePropertyRegistration animatableProperty( customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT );
2503
2504   // Check property count before property registration
2505   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2506   DALI_TEST_CHECK( typeInfo );
2507   BaseHandle handle = typeInfo.CreateInstance();
2508   DALI_TEST_CHECK( handle );
2509   Actor customActor = Actor::DownCast( handle );
2510   DALI_TEST_CHECK( customActor );
2511   application.GetScene().Add(customActor);
2512
2513   tet_infoline( "Set the value and ensure it changes straight away" );
2514   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2515   customActor.SetProperty( animatablePropertyIndex, 25.0f );
2516   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2517
2518   tet_infoline( "Check latest scene-graph value is unchanged" );
2519   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2520
2521   // Render and notify
2522   application.SendNotification();
2523   application.Render();
2524
2525   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2526
2527   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2528   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2529
2530   END_TEST;
2531 }
2532
2533 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector2(void)
2534 {
2535   TestApplication application;
2536   TypeRegistry typeRegistry = TypeRegistry::Get();
2537
2538   tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
2539
2540   // Register the animatable propeties
2541   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2542   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2543   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2544   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector2( 13.0f, 24.0f ) );
2545   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2546   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2547
2548   // Check property count before property registration
2549   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2550   DALI_TEST_CHECK( typeInfo );
2551   BaseHandle handle = typeInfo.CreateInstance();
2552   DALI_TEST_CHECK( handle );
2553   Actor customActor = Actor::DownCast( handle );
2554   DALI_TEST_CHECK( customActor );
2555   application.GetScene().Add(customActor);
2556
2557   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2558   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2559   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2560   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2561
2562   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2563   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2564   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2565   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 24.0f ), TEST_LOCATION );
2566
2567   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2568   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2569   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2570
2571   tet_infoline( "Check latest scene-graph value is unchanged" );
2572   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2573   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2574   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2575
2576   // Render and notify
2577   application.SendNotification();
2578   application.Render();
2579
2580   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2581   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2582   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2583   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2584
2585   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2586   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2587   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2588
2589   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2590   customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) );
2591   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2592   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2593   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
2594
2595   END_TEST;
2596 }
2597
2598 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector3(void)
2599 {
2600   TestApplication application;
2601   TypeRegistry typeRegistry = TypeRegistry::Get();
2602
2603   tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
2604
2605   // Register the animatable propeties
2606   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2607   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2608   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2609   const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2610   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector3( 13.0f, 24.0f, 35.0 ) );
2611   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2612   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2613   AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2614
2615   // Check property count before property registration
2616   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2617   DALI_TEST_CHECK( typeInfo );
2618   BaseHandle handle = typeInfo.CreateInstance();
2619   DALI_TEST_CHECK( handle );
2620   Actor customActor = Actor::DownCast( handle );
2621   DALI_TEST_CHECK( customActor );
2622   application.GetScene().Add(customActor);
2623
2624   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2625   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2626   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2627   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2628   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2629
2630   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2631   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2632   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2633   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 24.0f, 35.0f ), TEST_LOCATION );
2634
2635   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2636   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2637   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 35.0f ), TEST_LOCATION );
2638
2639   customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2640   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2641   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2642
2643   tet_infoline( "Check latest scene-graph value is unchanged" );
2644   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2645   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2646   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2647   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2648
2649   // Render and notify
2650   application.SendNotification();
2651   application.Render();
2652
2653   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2654   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2655   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2656   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2657   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2658
2659   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2660   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2661   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2662   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2663
2664   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2665   customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) );
2666   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2667   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2668   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2669   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 1.0f, 2.0f, 3.0f ), TEST_LOCATION );
2670
2671   END_TEST;
2672 }
2673
2674 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector4(void)
2675 {
2676   TestApplication application;
2677   TypeRegistry typeRegistry = TypeRegistry::Get();
2678
2679   tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
2680
2681   // Register the animatable propeties
2682   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2683   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2684   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2685   const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2686   const int componentThreePropertyIndex( componentTwoPropertyIndex + 1 );
2687   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector4( 13.0f, 24.0f, 35.0, 47.0f ) );
2688   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2689   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2690   AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2691   AnimatablePropertyComponentRegistration componentThreeAnimatableProperty( customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3 );
2692
2693   // Check property count before property registration
2694   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2695   DALI_TEST_CHECK( typeInfo );
2696   BaseHandle handle = typeInfo.CreateInstance();
2697   DALI_TEST_CHECK( handle );
2698   Actor customActor = Actor::DownCast( handle );
2699   DALI_TEST_CHECK( customActor );
2700   application.GetScene().Add(customActor);
2701
2702   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2703   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2704   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2705   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2706   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2707   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2708
2709   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2710   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2711   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2712   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2713
2714   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2715   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2716   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 35.0f, 47.0f ), TEST_LOCATION );
2717
2718   customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2719   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2720   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 47.0f ), TEST_LOCATION );
2721
2722   customActor.SetProperty( componentThreePropertyIndex, 435.0f );
2723   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2724   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2725
2726   tet_infoline( "Check latest scene-graph value is unchanged" );
2727   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2728   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2729   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2730   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2731   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2732
2733   // Render and notify
2734   application.SendNotification();
2735   application.Render();
2736
2737   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2738   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2739   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2740   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2741   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2742   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2743
2744   DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2745   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2746   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2747   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2748   DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2749
2750   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2751   customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) );
2752   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2753   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2754   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2755   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 4.0f, TEST_LOCATION );
2756   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 1.0f, 2.0f, 3.0f, 4.0f ), TEST_LOCATION );
2757
2758   END_TEST;
2759 }
2760
2761
2762 int UtcDaliTypeInfoRegisterChildProperties01(void)
2763 {
2764   TestApplication application;
2765   TypeRegistry typeRegistry = TypeRegistry::Get();
2766
2767   tet_infoline( "Register child properties on a type via name" );
2768
2769   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
2770   auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2771   DALI_TEST_CHECK( customActorTypeInfo );
2772   DALI_TEST_CHECK( myCustomTypeInfo );
2773
2774   const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
2775   const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
2776   const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
2777
2778   ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
2779   ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
2780   ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
2781
2782   auto customActor = MyTestCustomActor::New();
2783   application.GetScene().Add( customActor );
2784   auto child = Actor::New();
2785   customActor.Add( child );
2786
2787   child.SetProperty( WIDTH_SPECIFICATION, 33 );
2788
2789   auto value = child.GetProperty( WIDTH_SPECIFICATION );
2790   DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION );
2791
2792   child.SetProperty( HEIGHT_SPECIFICATION, 44 );
2793   value = child.GetProperty( HEIGHT_SPECIFICATION );
2794   DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION );
2795
2796   child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) );
2797   value = child.GetProperty( MARGIN_SPECIFICATION );
2798   DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION );
2799
2800   END_TEST;
2801 }
2802
2803
2804 int UtcDaliTypeInfoRegisterChildProperties02(void)
2805 {
2806   TestApplication application;
2807   TypeRegistry typeRegistry = TypeRegistry::Get();
2808
2809   tet_infoline( "Register child properties on a type via name" );
2810
2811   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
2812   auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2813   DALI_TEST_CHECK( customActorTypeInfo );
2814   DALI_TEST_CHECK( myCustomTypeInfo );
2815
2816   const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
2817   const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
2818   const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
2819
2820   ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
2821   ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
2822   ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
2823
2824
2825   auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" );
2826   DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION );
2827
2828   index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" );
2829   DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION );
2830
2831   index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" );
2832   DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
2833
2834   index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" );
2835   DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION );
2836
2837
2838   auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION );
2839   DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION );
2840
2841   name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION );
2842   DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION );
2843
2844   name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION );
2845   DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION );
2846
2847
2848   auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION );
2849   DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
2850
2851   type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION );
2852   DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
2853
2854   type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION );
2855   DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION );
2856
2857
2858   END_TEST;
2859 }
2860
2861
2862 int UtcDaliTypeInfoRegisterChildProperties03(void)
2863 {
2864   TestApplication application;
2865   TypeRegistry typeRegistry = TypeRegistry::Get();
2866
2867   tet_infoline( "Check registered child properties can be retrieved" );
2868
2869   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
2870   auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2871   DALI_TEST_CHECK( customActorTypeInfo );
2872   DALI_TEST_CHECK( myCustomTypeInfo );
2873
2874   const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
2875   const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
2876   const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
2877
2878   ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
2879   ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
2880   ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
2881
2882   Property::IndexContainer indices;
2883   myCustomTypeInfo.GetChildPropertyIndices( indices );
2884
2885   auto result = std::find( indices.Begin(), indices.End(), WIDTH_SPECIFICATION );
2886   DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
2887
2888   result = std::find( indices.Begin(), indices.End(), HEIGHT_SPECIFICATION );
2889   DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
2890
2891   result = std::find( indices.Begin(), indices.End(), MARGIN_SPECIFICATION );
2892   DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
2893
2894   END_TEST;
2895 }
2896
2897 int UtcDaliTypeInfoGetActionNameNegative(void)
2898 {
2899   TestApplication application;
2900   Dali::TypeInfo instance;
2901   try
2902   {
2903     unsigned long arg1(0u);
2904     instance.GetActionName(arg1);
2905     DALI_TEST_CHECK(false); // Should not get here
2906   }
2907   catch(...)
2908   {
2909     DALI_TEST_CHECK(true); // We expect an assert
2910   }
2911   END_TEST;
2912 }
2913
2914 int UtcDaliTypeInfoGetSignalNameNegative(void)
2915 {
2916   TestApplication application;
2917   Dali::TypeInfo instance;
2918   try
2919   {
2920     unsigned long arg1(0u);
2921     instance.GetSignalName(arg1);
2922     DALI_TEST_CHECK(false); // Should not get here
2923   }
2924   catch(...)
2925   {
2926     DALI_TEST_CHECK(true); // We expect an assert
2927   }
2928   END_TEST;
2929 }
2930
2931 int UtcDaliTypeInfoGetCreatorNegative(void)
2932 {
2933   TestApplication application;
2934   Dali::TypeInfo instance;
2935   try
2936   {
2937     instance.GetCreator();
2938     DALI_TEST_CHECK(false); // Should not get here
2939   }
2940   catch(...)
2941   {
2942     DALI_TEST_CHECK(true); // We expect an assert
2943   }
2944   END_TEST;
2945 }
2946
2947 int UtcDaliTypeInfoGetBaseNameNegative(void)
2948 {
2949   TestApplication application;
2950   Dali::TypeInfo instance;
2951   try
2952   {
2953     instance.GetBaseName();
2954     DALI_TEST_CHECK(false); // Should not get here
2955   }
2956   catch(...)
2957   {
2958     DALI_TEST_CHECK(true); // We expect an assert
2959   }
2960   END_TEST;
2961 }
2962
2963 int UtcDaliTypeInfoCreateInstanceNegative(void)
2964 {
2965   TestApplication application;
2966   Dali::TypeInfo instance;
2967   try
2968   {
2969     instance.CreateInstance();
2970     DALI_TEST_CHECK(false); // Should not get here
2971   }
2972   catch(...)
2973   {
2974     DALI_TEST_CHECK(true); // We expect an assert
2975   }
2976   END_TEST;
2977 }
2978
2979 int UtcDaliTypeInfoGetActionCountNegative(void)
2980 {
2981   TestApplication application;
2982   Dali::TypeInfo instance;
2983   try
2984   {
2985     instance.GetActionCount();
2986     DALI_TEST_CHECK(false); // Should not get here
2987   }
2988   catch(...)
2989   {
2990     DALI_TEST_CHECK(true); // We expect an assert
2991   }
2992   END_TEST;
2993 }
2994
2995 int UtcDaliTypeInfoGetSignalCountNegative(void)
2996 {
2997   TestApplication application;
2998   Dali::TypeInfo instance;
2999   try
3000   {
3001     instance.GetSignalCount();
3002     DALI_TEST_CHECK(false); // Should not get here
3003   }
3004   catch(...)
3005   {
3006     DALI_TEST_CHECK(true); // We expect an assert
3007   }
3008   END_TEST;
3009 }
3010
3011 int UtcDaliTypeInfoGetPropertyNameNegative(void)
3012 {
3013   TestApplication application;
3014   Dali::TypeInfo instance;
3015   try
3016   {
3017     int arg1(0);
3018     instance.GetPropertyName(arg1);
3019     DALI_TEST_CHECK(false); // Should not get here
3020   }
3021   catch(...)
3022   {
3023     DALI_TEST_CHECK(true); // We expect an assert
3024   }
3025   END_TEST;
3026 }
3027
3028 int UtcDaliTypeInfoGetPropertyCountNegative(void)
3029 {
3030   TestApplication application;
3031   Dali::TypeInfo instance;
3032   try
3033   {
3034     instance.GetPropertyCount();
3035     DALI_TEST_CHECK(false); // Should not get here
3036   }
3037   catch(...)
3038   {
3039     DALI_TEST_CHECK(true); // We expect an assert
3040   }
3041   END_TEST;
3042 }
3043
3044 int UtcDaliTypeInfoGetPropertyIndicesNegative(void)
3045 {
3046   TestApplication application;
3047   Dali::TypeInfo instance;
3048   try
3049   {
3050     Dali::Vector<int> arg1;
3051     instance.GetPropertyIndices(arg1);
3052     DALI_TEST_CHECK(false); // Should not get here
3053   }
3054   catch(...)
3055   {
3056     DALI_TEST_CHECK(true); // We expect an assert
3057   }
3058   END_TEST;
3059 }
3060
3061 int UtcDaliTypeInfoGetChildPropertyNameNegative(void)
3062 {
3063   TestApplication application;
3064   Dali::TypeInfo instance;
3065   try
3066   {
3067     int arg1(0);
3068     instance.GetChildPropertyName(arg1);
3069     DALI_TEST_CHECK(false); // Should not get here
3070   }
3071   catch(...)
3072   {
3073     DALI_TEST_CHECK(true); // We expect an assert
3074   }
3075   END_TEST;
3076 }
3077
3078 int UtcDaliTypeInfoGetChildPropertyTypeNegative(void)
3079 {
3080   TestApplication application;
3081   Dali::TypeInfo instance;
3082   try
3083   {
3084     int arg1(0);
3085     instance.GetChildPropertyType(arg1);
3086     DALI_TEST_CHECK(false); // Should not get here
3087   }
3088   catch(...)
3089   {
3090     DALI_TEST_CHECK(true); // We expect an assert
3091   }
3092   END_TEST;
3093 }
3094
3095 int UtcDaliTypeInfoGetChildPropertyIndexNegative(void)
3096 {
3097   TestApplication application;
3098   Dali::TypeInfo instance;
3099   try
3100   {
3101     std::string arg1;
3102     instance.GetChildPropertyIndex(arg1);
3103     DALI_TEST_CHECK(false); // Should not get here
3104   }
3105   catch(...)
3106   {
3107     DALI_TEST_CHECK(true); // We expect an assert
3108   }
3109   END_TEST;
3110 }
3111
3112 int UtcDaliTypeInfoGetChildPropertyIndicesNegative(void)
3113 {
3114   TestApplication application;
3115   Dali::TypeInfo instance;
3116   try
3117   {
3118     Dali::Vector<int> arg1;
3119     instance.GetChildPropertyIndices(arg1);
3120     DALI_TEST_CHECK(false); // Should not get here
3121   }
3122   catch(...)
3123   {
3124     DALI_TEST_CHECK(true); // We expect an assert
3125   }
3126   END_TEST;
3127 }
3128
3129 int UtcDaliTypeInfoGetNameNegative(void)
3130 {
3131   TestApplication application;
3132   Dali::TypeInfo instance;
3133   try
3134   {
3135     instance.GetName();
3136     DALI_TEST_CHECK(false); // Should not get here
3137   }
3138   catch(...)
3139   {
3140     DALI_TEST_CHECK(true); // We expect an assert
3141   }
3142   END_TEST;
3143 }
3144
3145 int UtcDaliTypeRegistryGetTypeInfoNegative01(void)
3146 {
3147   TestApplication application;
3148   Dali::TypeRegistry instance;
3149   try
3150   {
3151     std::string arg1;
3152     instance.GetTypeInfo(arg1);
3153     DALI_TEST_CHECK(false); // Should not get here
3154   }
3155   catch(...)
3156   {
3157     DALI_TEST_CHECK(true); // We expect an assert
3158   }
3159   END_TEST;
3160 }
3161
3162 int UtcDaliTypeRegistryGetTypeInfoNegative02(void)
3163 {
3164   TestApplication application;
3165   Dali::TypeRegistry instance;
3166   try
3167   {
3168     instance.GetTypeInfo(typeid(unsigned int));
3169     DALI_TEST_CHECK(false); // Should not get here
3170   }
3171   catch(...)
3172   {
3173     DALI_TEST_CHECK(true); // We expect an assert
3174   }
3175   END_TEST;
3176 }
3177
3178 int UtcDaliTypeRegistryGetTypeNameNegative(void)
3179 {
3180   TestApplication application;
3181   Dali::TypeRegistry instance;
3182   try
3183   {
3184     unsigned long arg1(0u);
3185     instance.GetTypeName(arg1);
3186     DALI_TEST_CHECK(false); // Should not get here
3187   }
3188   catch(...)
3189   {
3190     DALI_TEST_CHECK(true); // We expect an assert
3191   }
3192   END_TEST;
3193 }
3194
3195 int UtcDaliTypeRegistryGetTypeNameCountNegative(void)
3196 {
3197   TestApplication application;
3198   Dali::TypeRegistry instance;
3199   try
3200   {
3201     instance.GetTypeNameCount();
3202     DALI_TEST_CHECK(false); // Should not get here
3203   }
3204   catch(...)
3205   {
3206     DALI_TEST_CHECK(true); // We expect an assert
3207   }
3208   END_TEST;
3209 }