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