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