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