Revert "[Tizen] Move DevelHandle::GetCurrentProperty to public"
[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
1183   // Target value should change straight away
1184   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION );
1185
1186   // Render and notify, animation play for 0.05 seconds
1187   application.SendNotification();
1188   application.Render(50);
1189   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1190   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1191
1192   // Render and notify, animation play for another 0.1 seconds
1193   application.SendNotification();
1194   application.Render(100);
1195   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1196   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1197
1198   END_TEST;
1199 }
1200
1201 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1202 {
1203   TestApplication application;
1204   TypeRegistry typeRegistry = TypeRegistry::Get();
1205
1206   // Attempt to register an animatable property type out-of-bounds index (less than)
1207   try
1208   {
1209     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1210     tet_result( TET_FAIL );
1211   }
1212   catch ( DaliException& e )
1213   {
1214     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1215   }
1216
1217   // Attempt to register an animatable property type out-of-bounds index (greater than)
1218   try
1219   {
1220     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1221     tet_result( TET_FAIL );
1222   }
1223   catch ( DaliException& e )
1224   {
1225     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1226   }
1227
1228   END_TEST;
1229 }
1230
1231 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1232 {
1233   TestApplication application;
1234   TypeRegistry typeRegistry = TypeRegistry::Get();
1235
1236   // Check property count before property registration
1237   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1238   DALI_TEST_CHECK( typeInfo );
1239   BaseHandle handle = typeInfo.CreateInstance();
1240   DALI_TEST_CHECK( handle );
1241   Actor customActor = Actor::DownCast( handle );
1242   DALI_TEST_CHECK( customActor );
1243   Stage::GetCurrent().Add(customActor);
1244
1245   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1246
1247   // Register animatable property
1248   std::string animatablePropertyName( "animatableProp1" );
1249   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1250   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1251
1252   // Check property count after registration
1253   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1254
1255   // Render and notify
1256   application.SendNotification();
1257   application.Render();
1258
1259   // Check the animatable property value
1260   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1261
1262   // Check the animatable property name
1263   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1264
1265   // Check the animatable property index
1266   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1267
1268   // Check the animatable property type
1269   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1270
1271   // Check property count of type-info is 1
1272   Property::IndexContainer indices;
1273   typeInfo.GetPropertyIndices( indices );
1274   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1275
1276   // Ensure indices returned from actor and customActor differ by one
1277   Actor actor = Actor::New();
1278   actor.GetPropertyIndices( indices );
1279   unsigned int actorIndices = indices.Size();
1280   customActor.GetPropertyIndices( indices );
1281   unsigned int customActorIndices = indices.Size();
1282   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1283
1284   // check that the property is animatable
1285   Animation animation = Animation::New(0.2f);
1286   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1287   animation.Play();
1288
1289   // Target value should change straight away
1290   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION );
1291
1292   // Render and notify, animation play for 0.05 seconds
1293   application.SendNotification();
1294   application.Render(50);
1295   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1296   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1297
1298   // Render and notify, animation play for another 0.1 seconds
1299   application.SendNotification();
1300   application.Render(100);
1301   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1302   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1303
1304   END_TEST;
1305 }
1306
1307 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1308 {
1309   TestApplication application;
1310   TypeRegistry typeRegistry = TypeRegistry::Get();
1311
1312   // Attempt to register an animatable property type out-of-bounds index (less than)
1313   try
1314   {
1315     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1316     tet_result( TET_FAIL );
1317   }
1318   catch ( DaliException& e )
1319   {
1320     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1321   }
1322
1323   // Attempt to register an animatable property type out-of-bounds index (greater than)
1324   try
1325   {
1326     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1327     tet_result( TET_FAIL );
1328   }
1329   catch ( DaliException& e )
1330   {
1331     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1332   }
1333
1334   END_TEST;
1335 }
1336
1337 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1338 {
1339   TestApplication application;
1340   TypeRegistry typeRegistry = TypeRegistry::Get();
1341
1342   // Check property count before property registration
1343   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1344   DALI_TEST_CHECK( typeInfo );
1345   BaseHandle handle = typeInfo.CreateInstance();
1346   DALI_TEST_CHECK( handle );
1347   Actor customActor = Actor::DownCast( handle );
1348   DALI_TEST_CHECK( customActor );
1349
1350   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1351
1352   // Register animatable property
1353   std::string animatablePropertyName( "animatableProp1" );
1354   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1355   Property::Type animatablePropertyType( Property::VECTOR2 );
1356   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1357
1358   // Check property count after registration
1359   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1360
1361   // Set the animatable property value
1362   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1363
1364   // Render and notify
1365   application.SendNotification();
1366   application.Render();
1367
1368   // Check the animatable property value
1369   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1370
1371   // Check the animatable property name
1372   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1373
1374   // Check the animatable property index
1375   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1376
1377   // Check the animatable property type
1378   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1379
1380   // Check property count of type-info is 1
1381   Property::IndexContainer indices;
1382   typeInfo.GetPropertyIndices( indices );
1383   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1384
1385   // Register animatable property components
1386   std::string animatablePropertyComponentName1( "animatableProp1X" );
1387   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1388   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1389
1390   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1391   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1392   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1393
1394   // Check property count after registration
1395   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1396
1397   // Check the animatable property component value
1398   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1399   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1400
1401   // Set the animatable property component value
1402   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1403
1404   // Render and notify
1405   application.SendNotification();
1406   application.Render();
1407
1408   // Check the animatable property value
1409   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1410   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1411   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1412
1413   // Set the animatable property component value
1414   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1415
1416   // Render and notify
1417   application.SendNotification();
1418   application.Render();
1419
1420   // Check the animatable property value
1421   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1422   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1423   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1424
1425   // Ensure indices returned from actor and customActor differ by three
1426   Actor actor = Actor::New();
1427   actor.GetPropertyIndices( indices );
1428   unsigned int actorIndices = indices.Size();
1429   customActor.GetPropertyIndices( indices );
1430   unsigned int customActorIndices = indices.Size();
1431   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1432
1433   END_TEST;
1434 }
1435
1436 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1437 {
1438   TestApplication application;
1439   TypeRegistry typeRegistry = TypeRegistry::Get();
1440
1441   // Register animatable property with the type of Vector2
1442   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1443   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1444
1445   // Attempt to register an animatable property component out-of-bounds index (less than)
1446   try
1447   {
1448     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1449     tet_result( TET_FAIL );
1450   }
1451   catch ( DaliException& e )
1452   {
1453     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1454   }
1455
1456   // Attempt to register an animatable property component out-of-bounds index (greater than)
1457   try
1458   {
1459     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1460     tet_result( TET_FAIL );
1461   }
1462   catch ( DaliException& e )
1463   {
1464     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1465   }
1466
1467   // Register an animatable property component
1468   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1469
1470   // Attempt to register another animatable property component with the same component index
1471   try
1472   {
1473     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1474     tet_result( TET_FAIL );
1475   }
1476   catch ( DaliException& e )
1477   {
1478     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1479   }
1480
1481   // Register animatable property with the type of boolean
1482   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1483   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1484
1485   // Attempt to register an animatable property component for the above property with boolean type
1486   try
1487   {
1488     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1489     tet_result( TET_FAIL );
1490   }
1491   catch ( DaliException& e )
1492   {
1493     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1494   }
1495
1496   END_TEST;
1497 }
1498
1499 int UtcDaliTypeRegistryChildPropertyRegistrationP(void)
1500 {
1501   TestApplication application;
1502   TypeRegistry typeRegistry = TypeRegistry::Get();
1503
1504   // Check property count before property registration
1505   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1506   DALI_TEST_CHECK( typeInfo );
1507   BaseHandle handle = typeInfo.CreateInstance();
1508   DALI_TEST_CHECK( handle );
1509   Actor customActor = Actor::DownCast( handle );
1510   DALI_TEST_CHECK( customActor );
1511   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1512
1513   // Register child properties to the parent
1514   std::string propertyName( "childProp1" );
1515   int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1516   Property::Type propertyType( Property::BOOLEAN );
1517   ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType );
1518
1519   std::string propertyName2( "childProp2" );
1520   int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 );
1521   Property::Type propertyType2( Property::INTEGER );
1522   ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 );
1523
1524   std::string propertyName3( "childProp3" );
1525   int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 );
1526   Property::Type propertyType3( Property::FLOAT );
1527   ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 );
1528
1529   std::string propertyName4( "childProp4" );
1530   int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 );
1531   Property::Type propertyType4( Property::INTEGER );
1532   ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 );
1533
1534   // Check property count are not changed because the child properties will not be created for the parent
1535   DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION );
1536
1537   // check the child property type
1538   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1539   Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
1540   DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
1541
1542
1543   // Create a child actor
1544   Actor childActor = Actor::New();
1545   DALI_TEST_CHECK( childActor );
1546   unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() );
1547
1548   // The type of child properties should be Property::None as the child hasn't registered any child property yet.
1549   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION );
1550   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION );
1551   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION );
1552   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION );
1553
1554   // Set the value for the first child property when the child actor doesn't have a parent yet
1555   childActor.SetProperty(propertyIndex, true);
1556
1557   // Check that the first child property is dynamically created
1558   DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION );
1559
1560   // Check the first child property value
1561   DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION );
1562
1563   // Check the first child property type
1564   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1565
1566   // Check that the first child property have no name, as it doesn't have a parent yet.
1567   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION );
1568
1569   // Check that the first property can't be accessed through its name, as it doesn't have a parent yet.
1570   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION );
1571
1572   // Create a custom property for the child with the same name as the second child property registered to the parent
1573   Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE);
1574
1575   // Check that the custom property is created
1576   DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION );
1577
1578   // Check the property value
1579   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1580
1581   // Check the property index
1582   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION );
1583
1584   // Check the property type
1585   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1586
1587   // Check the property name
1588   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION );
1589
1590   // Now add the child actor to the parent
1591   customActor.Add( childActor );
1592
1593   // Check that the first child property now has the correct name as previously registered to the parent
1594   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1595
1596   // Check that the child property index for the first child property can now be retrieved through its child property name
1597   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1598
1599   // Check that the second child property now has the correct index as previously registered to the parent
1600   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION );
1601
1602   // Check that the second child property can be accessed through both its custom property index and its child property index
1603   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1604   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION );
1605   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1606   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION );
1607
1608   // Check that the child property index for the second child property can now be retrieved through its child property name
1609   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION );
1610
1611   // Set the value for the third child property when the child actor is already added to the parent
1612   childActor.SetProperty(propertyIndex3, 0.15f);
1613
1614   // Check that the third child property is dynamically created
1615   DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION );
1616
1617   // Check the third child property value
1618   DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION );
1619
1620   // Check the third child property type
1621   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION );
1622
1623   // Check the third child property name
1624   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION );
1625
1626   // Check the third child property index.
1627   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION );
1628
1629   // Create a custom property for the child with the same name as the fourth child property registered to the parent
1630   Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE);
1631
1632   // Check that the custom property is created
1633   DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION );
1634
1635   // Check the fourth child property value
1636   DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION );
1637   DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION );
1638
1639   // Check the fourth child property type
1640   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION );
1641   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION );
1642
1643   // Check the fourth child property name
1644   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION );
1645   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION );
1646
1647   // Check the fourth child property index.
1648   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION );
1649
1650   // Now create another parent actor with different child properties registered
1651   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" );
1652   DALI_TEST_CHECK( typeInfo2 );
1653   BaseHandle handle2 = typeInfo2.CreateInstance();
1654   DALI_TEST_CHECK( handle2 );
1655   Actor customActor2 = Actor::DownCast( handle2 );
1656   DALI_TEST_CHECK( customActor2 );
1657
1658   // Register child properties to the new parent
1659   std::string newPropertyName( "newChildProp" );
1660   int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent
1661   Property::Type newPropertyType( Property::VECTOR2 );
1662   ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType );
1663
1664   std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent
1665   int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent
1666   Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent
1667   ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 );
1668
1669   // Now move the child actor to the new parent
1670   customActor2.Add( childActor );
1671
1672   // "childProp1" is not a valid child property supported by the new parent, so nothing changed
1673   DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1674   DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1675   DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1676
1677   // "childProp3" is a valid child property supported by the new parent
1678   // So it should get its new child property index and should just work
1679   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION );
1680   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION );
1681   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION );
1682   DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION );
1683
1684   // Now register a custom property called "newChildProp"
1685   Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE);
1686
1687   // Check that the custom property is created
1688   DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION );
1689
1690   // This is a valid child property registered to the new parent
1691   // So should be able to access it through both its custom property index and its registered child property index
1692   DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION );
1693   DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION );
1694   DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same
1695   DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION );
1696   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1697   DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1698
1699   // Should return the child property index by given its name
1700   DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION );
1701
1702
1703   END_TEST;
1704 }
1705
1706 int UtcDaliTypeRegistryChildPropertyRegistrationN(void)
1707 {
1708   TestApplication application;
1709   TypeRegistry typeRegistry = TypeRegistry::Get();
1710
1711   // Attempt to register a child property type out-of-bounds index (less than)
1712   try
1713   {
1714     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1715     tet_result( TET_FAIL );
1716   }
1717   catch ( DaliException& e )
1718   {
1719     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1720   }
1721
1722   // Attempt to register a child property type out-of-bounds index (greater than)
1723   try
1724   {
1725     ChildPropertyRegistration property1( customType1, "propName",  CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1726     tet_result( TET_FAIL );
1727   }
1728   catch ( DaliException& e )
1729   {
1730     DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1731   }
1732
1733   END_TEST;
1734 }
1735
1736
1737 /*******************************************************************************
1738  *
1739  * Action through the base handle
1740  *
1741  ******************************************************************************/
1742 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1743 {
1744   TestApplication application;
1745
1746   TypeInfo type;
1747
1748   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1749   DALI_TEST_CHECK( type );
1750
1751   BaseHandle hdl = type.CreateInstance();
1752   DALI_TEST_CHECK( hdl );
1753
1754   Actor a = Actor::DownCast(hdl);
1755   DALI_TEST_CHECK( a );
1756
1757   a.SetVisible(false);
1758
1759   application.SendNotification();
1760   application.Render(0);
1761   DALI_TEST_CHECK(!a.IsVisible());
1762
1763   Property::Map attributes;
1764
1765   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1766
1767   application.SendNotification();
1768   application.Render(0);
1769   DALI_TEST_CHECK(a.IsVisible());
1770
1771   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1772   END_TEST;
1773 }
1774
1775 int UtcDaliPropertyRegistrationFunctions(void)
1776 {
1777   TestApplication application;
1778   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1779
1780   // Attempt to register a property without a setter
1781   try
1782   {
1783     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1784     tet_result( TET_PASS );
1785   }
1786   catch ( DaliException& e )
1787   {
1788     tet_result( TET_FAIL );
1789   }
1790
1791   // Attempt to register a property without a getter
1792   try
1793   {
1794     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1795     tet_result( TET_FAIL );
1796   }
1797   catch ( DaliException& e )
1798   {
1799     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1800   }
1801   END_TEST;
1802 }
1803
1804 int UtcDaliPropertyRegistrationAddSameIndex(void)
1805 {
1806   TestApplication application;
1807   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1808
1809   // Add one property with a valid property index
1810   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1811
1812   // Attempt to add another property with the same index
1813   try
1814   {
1815     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1816   }
1817   catch ( DaliException& e )
1818   {
1819     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1820   }
1821
1822   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1823
1824   // Add one property with a valid property index
1825   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1826
1827   // Attempt to add another property with the same index
1828   try
1829   {
1830     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
1831   }
1832   catch ( DaliException& e )
1833   {
1834     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1835   }
1836   END_TEST;
1837 }
1838
1839 int UtcDaliPropertyRegistrationPropertyWritableP(void)
1840 {
1841   TestApplication application;
1842   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
1843   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
1844
1845   // Add two properties, one with SetProperty, one without
1846   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
1847   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
1848
1849   // Create custom-actor
1850   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1851   DALI_TEST_CHECK( typeInfo );
1852   BaseHandle handle = typeInfo.CreateInstance();
1853   DALI_TEST_CHECK( handle );
1854   Actor customActor = Actor::DownCast( handle );
1855   DALI_TEST_CHECK( customActor );
1856
1857   // Check whether properties are writable
1858   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
1859   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
1860
1861
1862   // Check the property is writable in the type registry
1863   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1864
1865   DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION );
1866
1867   END_TEST;
1868 }
1869
1870 int UtcDaliPropertyRegistrationPropertyWritableN(void)
1871 {
1872   // Currently Actors don't register properties with the type registry
1873
1874   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1875   Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1876
1877   try
1878   {
1879     typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR);
1880     tet_result( TET_FAIL );
1881
1882   }
1883   catch ( DaliException& e )
1884   {
1885      DALI_TEST_ASSERT( e, "Cannot find property index", TEST_LOCATION );
1886   }
1887   END_TEST;
1888
1889 }
1890 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
1891 {
1892   TestApplication application;
1893   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
1894   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
1895
1896   // These properties are not animatable
1897   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1898
1899   // These properties are animatable
1900   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1901
1902   // Create custom-actor
1903   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1904   DALI_TEST_CHECK( typeInfo );
1905   BaseHandle handle = typeInfo.CreateInstance();
1906   DALI_TEST_CHECK( handle );
1907   Actor customActor = Actor::DownCast( handle );
1908   DALI_TEST_CHECK( customActor );
1909
1910   // Check if animatable
1911   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
1912   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
1913
1914   // Create another instance of custom-actor
1915   BaseHandle handle2 = typeInfo.CreateInstance();
1916   DALI_TEST_CHECK( handle2 );
1917   Actor customActor2 = Actor::DownCast( handle2 );
1918   DALI_TEST_CHECK( customActor2 );
1919
1920   // Check if animatable
1921   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
1922   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
1923   END_TEST;
1924 }
1925
1926 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
1927 {
1928   TestApplication application;
1929   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
1930   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
1931
1932   // Create custom-actor
1933   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1934   DALI_TEST_CHECK( typeInfo );
1935   BaseHandle handle = typeInfo.CreateInstance();
1936   DALI_TEST_CHECK( handle );
1937   Actor customActor = Actor::DownCast( handle );
1938   DALI_TEST_CHECK( customActor );
1939
1940   // Try to set an index that hasn't been added
1941   try
1942   {
1943     customActor.SetProperty( propertyIndex, 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
1952   {
1953     customActor.SetProperty( animatablePropertyIndex, true );
1954     tet_result( TET_FAIL );
1955   }
1956   catch ( DaliException& e )
1957   {
1958     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1959   }
1960
1961   // Try to get an index that hasn't been added
1962   try
1963   {
1964     (void) customActor.GetProperty< bool >( propertyIndex );
1965     tet_result( TET_FAIL );
1966   }
1967   catch ( DaliException& e )
1968   {
1969     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1970   }
1971
1972   try
1973   {
1974     (void) customActor.GetProperty< bool >( animatablePropertyIndex );
1975     tet_result( TET_FAIL );
1976   }
1977   catch ( DaliException& e )
1978   {
1979     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1980   }
1981   END_TEST;
1982 }
1983
1984
1985 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
1986 {
1987   TestApplication application;
1988
1989   Actor actor = Actor::New();
1990   actor.SetSize(100.0f, 100.0f);
1991   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1992   Stage::GetCurrent().Add(actor);
1993
1994   // Register Type
1995   TypeInfo type;
1996   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
1997   DALI_TEST_CHECK( type );
1998   BaseHandle handle = type.CreateInstance();
1999   DALI_TEST_CHECK( handle );
2000   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
2001   DALI_TEST_CHECK( detector );
2002
2003   // Attach actor to detector
2004   SignalData data;
2005   GestureReceivedFunctor functor( data );
2006   detector.Attach(actor);
2007
2008   // Connect to signal through type
2009   handle.ConnectSignal( &application, "longPressDetected",   functor );
2010
2011   // Render and notify
2012   application.SendNotification();
2013   application.Render();
2014
2015   // Emit gesture
2016   application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
2017   application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
2018   application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
2019   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2020   END_TEST;
2021 }
2022
2023 int UtcDaliPanGestureDetectorTypeRegistry(void)
2024 {
2025   TestApplication application;
2026
2027   Actor actor = Actor::New();
2028   actor.SetSize(100.0f, 100.0f);
2029   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2030   Stage::GetCurrent().Add(actor);
2031
2032   // Register Type
2033   TypeInfo type;
2034   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
2035   DALI_TEST_CHECK( type );
2036   BaseHandle handle = type.CreateInstance();
2037   DALI_TEST_CHECK( handle );
2038   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
2039   DALI_TEST_CHECK( detector );
2040
2041   // Attach actor to detector
2042   SignalData data;
2043   GestureReceivedFunctor functor( data );
2044   detector.Attach(actor);
2045
2046   // Connect to signal through type
2047   handle.ConnectSignal( &application, "panDetected",  functor );
2048
2049   // Render and notify
2050   application.SendNotification();
2051   application.Render();
2052
2053   // Emit gesture
2054   application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2055   application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2056   application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2057   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2058   END_TEST;
2059 }
2060
2061 int UtcDaliPinchGestureDetectorTypeRegistry(void)
2062 {
2063   TestApplication application;
2064
2065   Actor actor = Actor::New();
2066   actor.SetSize(100.0f, 100.0f);
2067   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2068   Stage::GetCurrent().Add(actor);
2069
2070   // Register Type
2071   TypeInfo type;
2072   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
2073   DALI_TEST_CHECK( type );
2074   BaseHandle handle = type.CreateInstance();
2075   DALI_TEST_CHECK( handle );
2076   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
2077   DALI_TEST_CHECK( detector );
2078
2079   // Attach actor to detector
2080   SignalData data;
2081   GestureReceivedFunctor functor( data );
2082   detector.Attach(actor);
2083
2084   // Connect to signal through type
2085   handle.ConnectSignal( &application, "pinchDetected",  functor );
2086
2087   // Render and notify
2088   application.SendNotification();
2089   application.Render();
2090
2091   // Emit gesture
2092   application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
2093   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2094   END_TEST;
2095 }
2096
2097 int UtcDaliTapGestureDetectorTypeRegistry(void)
2098 {
2099   TestApplication application;
2100
2101   Actor actor = Actor::New();
2102   actor.SetSize(100.0f, 100.0f);
2103   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2104   Stage::GetCurrent().Add(actor);
2105
2106   // Register Type
2107   TypeInfo type;
2108   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
2109   DALI_TEST_CHECK( type );
2110   BaseHandle handle = type.CreateInstance();
2111   DALI_TEST_CHECK( handle );
2112   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
2113   DALI_TEST_CHECK( detector );
2114
2115   // Attach actor to detector
2116   SignalData data;
2117   GestureReceivedFunctor functor( data );
2118   detector.Attach(actor);
2119
2120   // Connect to signal through type
2121   handle.ConnectSignal( &application, "tapDetected",  functor );
2122
2123   // Render and notify
2124   application.SendNotification();
2125   application.Render();
2126
2127   // Emit gesture
2128   application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
2129   application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
2130   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2131   END_TEST;
2132 }
2133
2134 int UtcDaliTypeRegistryNamedType(void)
2135 {
2136   TestApplication application;
2137   TypeRegistry typeRegistry = TypeRegistry::Get();
2138
2139   // Create a normal actor
2140   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
2141   DALI_TEST_CHECK( actorHandle );
2142   Actor actor( Actor::DownCast( actorHandle ) );
2143   DALI_TEST_CHECK( actor );
2144   unsigned int actorPropertyCount( actor.GetPropertyCount() );
2145
2146   // Create Named Actor Type
2147   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
2148   DALI_TEST_CHECK( namedHandle );
2149   Actor namedActor( Actor::DownCast( namedHandle ) );
2150   DALI_TEST_CHECK( namedActor );
2151   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
2152
2153   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
2154   END_TEST;
2155 }
2156
2157 int UtcDaliTypeInfoGetActionNameP(void)
2158 {
2159   TestApplication application;
2160   TypeRegistry typeRegistry = TypeRegistry::Get();
2161
2162   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2163   DALI_TEST_CHECK( typeInfo );
2164
2165   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2166
2167   std::string name = typeInfo.GetActionName(0);
2168
2169   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
2170
2171
2172   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2173
2174   //  search for show action in base class, given a derived class
2175   bool foundChildAction = false;
2176   for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ )
2177   {
2178
2179        std::string name = typeInfo2.GetActionName( i );
2180        if( name == "show")
2181        {
2182          foundChildAction = true;
2183        }
2184
2185   }
2186
2187   DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION );
2188
2189
2190   END_TEST;
2191 }
2192
2193 int UtcDaliTypeInfoGetActionNameN(void)
2194 {
2195   TestApplication application;
2196   TypeRegistry typeRegistry = TypeRegistry::Get();
2197
2198   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2199   DALI_TEST_CHECK( typeInfo );
2200
2201   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2202
2203   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
2204
2205   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2206
2207   END_TEST;
2208 }
2209
2210 int UtcDaliTypeInfoGetSignalNameP(void)
2211 {
2212   TestApplication application;
2213   TypeRegistry typeRegistry = TypeRegistry::Get();
2214
2215   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2216   DALI_TEST_CHECK( typeInfo );
2217
2218   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2219
2220   std::string name = typeInfo.GetSignalName(0);
2221
2222   DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
2223
2224   TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2225
2226   //  search for signal in base class, given a derived class
2227   bool foundSignal = false;
2228   for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ )
2229   {
2230
2231        std::string name = typeInfo2.GetSignalName( i );
2232        if( name == "touched")
2233        {
2234          foundSignal = true;
2235        }
2236
2237   }
2238
2239   DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION );
2240
2241   END_TEST;
2242 }
2243
2244 int UtcDaliTypeInfoGetSignalNameN(void)
2245 {
2246   TestApplication application;
2247   TypeRegistry typeRegistry = TypeRegistry::Get();
2248
2249   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2250   DALI_TEST_CHECK( typeInfo );
2251
2252   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2253
2254   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
2255
2256   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2257
2258   END_TEST;
2259 }
2260
2261
2262 int UtcDaliTypeInfoGetCreatorP(void)
2263 {
2264   TestApplication application;
2265   TypeRegistry typeRegistry = TypeRegistry::Get();
2266
2267   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2268   DALI_TEST_CHECK( typeInfo );
2269
2270   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2271   DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
2272   if( createFn )
2273   {
2274     // try calling it:
2275     BaseHandle handle = createFn();
2276     DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
2277   }
2278
2279   END_TEST;
2280 }
2281
2282 int UtcDaliTypeInfoGetCreatorN(void)
2283 {
2284   TestApplication application;
2285   TypeRegistry typeRegistry = TypeRegistry::Get();
2286
2287   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
2288   DALI_TEST_CHECK( typeInfo );
2289
2290   TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2291   DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
2292
2293   END_TEST;
2294 }
2295
2296 int UtcDaliTypeInfoGetPropertyCountP1(void)
2297 {
2298   TestApplication application;
2299   TypeRegistry typeRegistry = TypeRegistry::Get();
2300
2301   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2302   DALI_TEST_CHECK( typeInfo );
2303   size_t actorPropertyCount = typeInfo.GetPropertyCount();
2304
2305   DALI_TEST_EQUALS( actorPropertyCount == 0 , true, TEST_LOCATION ); // No event only props
2306   END_TEST;
2307 }
2308
2309 int UtcDaliTypeInfoGetPropertyCountP2(void)
2310 {
2311   TestApplication application;
2312   TypeRegistry typeRegistry = TypeRegistry::Get();
2313
2314   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
2315   DALI_TEST_CHECK( typeInfo );
2316   size_t propertyCount = typeInfo.GetPropertyCount();
2317   Property::IndexContainer indices;
2318   typeInfo.GetPropertyIndices( indices );
2319
2320   DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
2321   DALI_TEST_EQUALS( propertyCount == 2, true, TEST_LOCATION );
2322
2323   END_TEST;
2324 }
2325
2326 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void)
2327 {
2328   TestApplication application;
2329   TypeRegistry typeRegistry = TypeRegistry::Get();
2330
2331   tet_infoline( "Register a type registered animatable property and ensure set/get behaviour works synchronously" );
2332
2333   // Register animatable property
2334   const int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2335   AnimatablePropertyRegistration animatableProperty( customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT );
2336
2337   // Check property count before property registration
2338   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2339   DALI_TEST_CHECK( typeInfo );
2340   BaseHandle handle = typeInfo.CreateInstance();
2341   DALI_TEST_CHECK( handle );
2342   Actor customActor = Actor::DownCast( handle );
2343   DALI_TEST_CHECK( customActor );
2344   Stage::GetCurrent().Add(customActor);
2345
2346   tet_infoline( "Set the value and ensure it changes straight away" );
2347   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2348   customActor.SetProperty( animatablePropertyIndex, 25.0f );
2349   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2350
2351   tet_infoline( "Check latest scene-graph value is unchanged" );
2352   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2353
2354   // Render and notify
2355   application.SendNotification();
2356   application.Render();
2357
2358   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2359
2360   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2361   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2362
2363   END_TEST;
2364 }
2365
2366 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector2(void)
2367 {
2368   TestApplication application;
2369   TypeRegistry typeRegistry = TypeRegistry::Get();
2370
2371   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" );
2372
2373   // Register the animatable propeties
2374   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2375   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2376   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2377   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector2( 13.0f, 24.0f ) );
2378   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2379   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2380
2381   // Check property count before property registration
2382   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2383   DALI_TEST_CHECK( typeInfo );
2384   BaseHandle handle = typeInfo.CreateInstance();
2385   DALI_TEST_CHECK( handle );
2386   Actor customActor = Actor::DownCast( handle );
2387   DALI_TEST_CHECK( customActor );
2388   Stage::GetCurrent().Add(customActor);
2389
2390   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2391   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2392   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2393   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2394
2395   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2396   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2397   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2398   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 24.0f ), TEST_LOCATION );
2399
2400   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2401   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2402   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2403
2404   tet_infoline( "Check latest scene-graph value is unchanged" );
2405   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2406   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2407   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2408
2409   // Render and notify
2410   application.SendNotification();
2411   application.Render();
2412
2413   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2414   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2415   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2416   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2417
2418   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2419   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2420   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2421
2422   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2423   customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) );
2424   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2425   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2426   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
2427
2428   END_TEST;
2429 }
2430
2431 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector3(void)
2432 {
2433   TestApplication application;
2434   TypeRegistry typeRegistry = TypeRegistry::Get();
2435
2436   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" );
2437
2438   // Register the animatable propeties
2439   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2440   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2441   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2442   const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2443   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector3( 13.0f, 24.0f, 35.0 ) );
2444   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2445   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2446   AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2447
2448   // Check property count before property registration
2449   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2450   DALI_TEST_CHECK( typeInfo );
2451   BaseHandle handle = typeInfo.CreateInstance();
2452   DALI_TEST_CHECK( handle );
2453   Actor customActor = Actor::DownCast( handle );
2454   DALI_TEST_CHECK( customActor );
2455   Stage::GetCurrent().Add(customActor);
2456
2457   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2458   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2459   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2460   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2461   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2462
2463   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2464   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2465   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2466   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 24.0f, 35.0f ), TEST_LOCATION );
2467
2468   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2469   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2470   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 35.0f ), TEST_LOCATION );
2471
2472   customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2473   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2474   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2475
2476   tet_infoline( "Check latest scene-graph value is unchanged" );
2477   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( customActor, basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2478   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2479   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2480   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2481
2482   // Render and notify
2483   application.SendNotification();
2484   application.Render();
2485
2486   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2487   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2488   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2489   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2490   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2491
2492   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( customActor, basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2493   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2494   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2495   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2496
2497   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2498   customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) );
2499   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2500   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2501   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2502   DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 1.0f, 2.0f, 3.0f ), TEST_LOCATION );
2503
2504   END_TEST;
2505 }
2506
2507 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector4(void)
2508 {
2509   TestApplication application;
2510   TypeRegistry typeRegistry = TypeRegistry::Get();
2511
2512   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" );
2513
2514   // Register the animatable propeties
2515   const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2516   const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2517   const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2518   const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2519   const int componentThreePropertyIndex( componentTwoPropertyIndex + 1 );
2520   AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector4( 13.0f, 24.0f, 35.0, 47.0f ) );
2521   AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2522   AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2523   AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2524   AnimatablePropertyComponentRegistration componentThreeAnimatableProperty( customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3 );
2525
2526   // Check property count before property registration
2527   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2528   DALI_TEST_CHECK( typeInfo );
2529   BaseHandle handle = typeInfo.CreateInstance();
2530   DALI_TEST_CHECK( handle );
2531   Actor customActor = Actor::DownCast( handle );
2532   DALI_TEST_CHECK( customActor );
2533   Stage::GetCurrent().Add(customActor);
2534
2535   tet_infoline( "Get the component values, they should be the default value of the base-property" );
2536   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2537   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2538   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2539   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2540   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2541
2542   tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2543   customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2544   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2545   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2546
2547   customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2548   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2549   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 35.0f, 47.0f ), TEST_LOCATION );
2550
2551   customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2552   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2553   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 47.0f ), TEST_LOCATION );
2554
2555   customActor.SetProperty( componentThreePropertyIndex, 435.0f );
2556   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2557   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2558
2559   tet_infoline( "Check latest scene-graph value is unchanged" );
2560   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( customActor, basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2561   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2562   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2563   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2564   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2565
2566   // Render and notify
2567   application.SendNotification();
2568   application.Render();
2569
2570   tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2571   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2572   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2573   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2574   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2575   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2576
2577   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( customActor, basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2578   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2579   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2580   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2581   DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2582
2583   tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2584   customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) );
2585   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2586   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2587   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2588   DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 4.0f, TEST_LOCATION );
2589   DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 1.0f, 2.0f, 3.0f, 4.0f ), TEST_LOCATION );
2590
2591   END_TEST;
2592 }