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