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