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