(Automated Tests) Completely remove ImageActor & ShaderEffect test cases
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-TypeRegistry.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20 #include <limits>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23 #include <dali/integration-api/events/long-press-gesture-event.h>
24 #include <dali/integration-api/events/pan-gesture-event.h>
25 #include <dali/integration-api/events/pinch-gesture-event.h>
26 #include <dali/integration-api/events/tap-gesture-event.h>
27 #include <dali/integration-api/events/touch-event-integ.h>
28 #include <dali/integration-api/events/hover-event-integ.h>
29
30 using namespace Dali;
31
32
33 namespace
34 {
35
36 // Stores data that is populated in the callback and will be read by the Test cases
37 struct SignalData
38 {
39   SignalData()
40   : functorCalled( false ),
41     voidFunctorCalled( false ),
42     receivedGesture( Gesture::Clear ),
43     pressedActor()
44   {}
45
46   void Reset()
47   {
48     functorCalled = false;
49     voidFunctorCalled = false;
50
51     receivedGesture.numberOfTouches = 0u;
52     receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
53     receivedGesture.localPoint = Vector2(0.0f, 0.0f);
54
55     pressedActor.Reset();
56   }
57
58   bool functorCalled;
59   bool voidFunctorCalled;
60   LongPressGesture receivedGesture;
61   Actor pressedActor;
62 };
63
64 // Functor that sets the data when called
65 struct GestureReceivedFunctor
66 {
67   GestureReceivedFunctor(SignalData& data) : signalData(data) { }
68
69   void operator()(Actor actor, LongPressGesture longPress)
70   {
71     signalData.functorCalled = true;
72     signalData.receivedGesture = longPress;
73     signalData.pressedActor = actor;
74   }
75
76   void operator()()
77   {
78     signalData.voidFunctorCalled = true;
79   }
80
81   SignalData& signalData;
82 };
83
84 // Generate a LongPressGestureEvent to send to Core
85 Integration::LongPressGestureEvent GenerateLongPress(
86     Gesture::State state,
87     unsigned int numberOfTouches,
88     Vector2 point)
89 {
90   Integration::LongPressGestureEvent longPress( state );
91
92   longPress.numberOfTouches = numberOfTouches;
93   longPress.point = point;
94
95   return longPress;
96 }
97
98 // Generate a PanGestureEvent to send to Core
99 Integration::PanGestureEvent GeneratePan(
100     Gesture::State state,
101     Vector2 previousPosition,
102     Vector2 currentPosition,
103     unsigned long timeDelta,
104     unsigned int numberOfTouches = 1,
105     unsigned int time = 1u)
106 {
107   Integration::PanGestureEvent pan(state);
108
109   pan.previousPosition = previousPosition;
110   pan.currentPosition = currentPosition;
111   pan.timeDelta = timeDelta;
112   pan.numberOfTouches = numberOfTouches;
113   pan.time = time;
114
115   return pan;
116 }
117 // Generate a PinchGestureEvent to send to Core
118 Integration::PinchGestureEvent GeneratePinch(
119     Gesture::State state,
120     float scale,
121     float speed,
122     Vector2 centerpoint)
123 {
124   Integration::PinchGestureEvent pinch(state);
125
126   pinch.scale = scale;
127   pinch.speed = speed;
128   pinch.centerPoint = centerpoint;
129
130   return pinch;
131 }
132 // Generate a TapGestureEvent to send to Core
133 Integration::TapGestureEvent GenerateTap(
134     Gesture::State state,
135     unsigned int numberOfTaps,
136     unsigned int numberOfTouches,
137     Vector2 point)
138 {
139   Integration::TapGestureEvent tap( state );
140
141   tap.numberOfTaps = numberOfTaps;
142   tap.numberOfTouches = numberOfTouches;
143   tap.point = point;
144
145   return tap;
146 }
147
148 //
149 // Create function as Init function called
150 //
151 static bool CreateCustomInitCalled = false;
152 BaseHandle CreateCustomInit(void)
153 {
154   CreateCustomInitCalled = true;
155   return BaseHandle();
156 }
157
158 static bool CreateCustomNamedInitCalled = false;
159 BaseHandle CreateCustomNamedInit(void)
160 {
161   CreateCustomNamedInitCalled = true;
162   return BaseHandle();
163 }
164
165 const std::string scriptedName("PopupStyle");
166 static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
167
168 // Property Registration
169 bool setPropertyCalled = false;
170 bool getPropertyCalled = false;
171 void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
172 {
173   setPropertyCalled = true;
174 }
175 Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
176 {
177   getPropertyCalled = true;
178   return Property::Value( true );
179 }
180
181
182
183 /*******************************************************************************
184  *
185  * Custom Actor
186  *
187  ******************************************************************************/
188 namespace Impl
189 {
190 struct MyTestCustomActor : public CustomActorImpl
191 {
192   typedef Signal< void ()> SignalType;
193   typedef Signal< void (float)> SignalTypeFloat;
194
195   MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
196   { }
197
198   virtual ~MyTestCustomActor()
199   { }
200
201   void ResetCallStack()
202   {
203   }
204
205   // From CustomActorImpl
206   virtual void OnStageConnection( int depth )
207   {
208   }
209   virtual void OnStageDisconnection()
210   {
211   }
212   virtual void OnChildAdd(Actor& child)
213   {
214   }
215   virtual void OnChildRemove(Actor& child)
216   {
217   }
218   virtual void OnSizeSet(const Vector3& targetSize)
219   {
220   }
221   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
222   {
223   }
224   virtual bool OnTouchEvent(const TouchEvent& event)
225   {
226     return true;
227   }
228   virtual bool OnHoverEvent(const HoverEvent& event)
229   {
230     return true;
231   }
232   virtual bool OnWheelEvent(const WheelEvent& event)
233   {
234     return true;
235   }
236   virtual bool OnKeyEvent(const KeyEvent& event)
237   {
238     return true;
239   }
240   virtual void OnKeyInputFocusGained()
241   {
242   }
243   virtual void OnKeyInputFocusLost()
244   {
245   }
246   virtual Vector3 GetNaturalSize()
247   {
248     return Vector3( 0.0f, 0.0f, 0.0f );
249   }
250
251   virtual float GetHeightForWidth( float width )
252   {
253     return 0.0f;
254   }
255
256   virtual float GetWidthForHeight( float height )
257   {
258     return 0.0f;
259   }
260
261   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
262   {
263   }
264
265   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
266   {
267   }
268
269   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
270   {
271   }
272
273   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
274   {
275     return 0.0f;
276   }
277
278   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
279   {
280   }
281
282   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
283   {
284     return false;
285   }
286
287 public:
288
289   SignalType mSignal;
290 };
291
292 }; // namespace Impl
293
294 class MyTestCustomActor : public CustomActor
295 {
296 public:
297
298   typedef Signal< void ()> SignalType;
299   typedef Signal< void (float)> SignalTypeFloat;
300
301   MyTestCustomActor()
302   {
303   }
304
305   static MyTestCustomActor New()
306   {
307     Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
308     return MyTestCustomActor( *p ); // takes ownership
309   }
310
311   virtual ~MyTestCustomActor()
312   {
313   }
314
315   static MyTestCustomActor DownCast( BaseHandle handle )
316   {
317     MyTestCustomActor result;
318
319     CustomActor custom = Dali::CustomActor::DownCast( handle );
320     if ( custom )
321     {
322       CustomActorImpl& customImpl = custom.GetImplementation();
323
324       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
325
326       if (impl)
327       {
328         result = MyTestCustomActor(customImpl.GetOwner());
329       }
330     }
331
332     return result;
333   }
334
335   SignalType& GetCustomSignal()
336   {
337     Dali::RefObject& obj = GetImplementation();
338     return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
339   }
340
341 private:
342
343   MyTestCustomActor(Internal::CustomActor* internal)
344   : CustomActor(internal)
345   {
346   }
347
348   MyTestCustomActor( Impl::MyTestCustomActor& impl )
349   : CustomActor( impl )
350   {
351   }
352 };
353
354
355 class MyTestCustomActor2 : public CustomActor
356 {
357 public:
358
359   MyTestCustomActor2()
360   {
361   }
362
363   static MyTestCustomActor2 New()
364   {
365     return MyTestCustomActor2(); // takes ownership
366   }
367
368   virtual ~MyTestCustomActor2()
369   {
370   }
371
372   static MyTestCustomActor2 DownCast( BaseHandle handle )
373   {
374     MyTestCustomActor2 result;
375
376     CustomActor custom = Dali::CustomActor::DownCast( handle );
377     if ( custom )
378     {
379       CustomActorImpl& customImpl = custom.GetImplementation();
380
381       Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
382
383       if (impl)
384       {
385         result = MyTestCustomActor2(customImpl.GetOwner());
386       }
387     }
388
389     return result;
390   }
391
392 private:
393
394   MyTestCustomActor2(Internal::CustomActor* internal)
395   : CustomActor(internal)
396   {
397   }
398
399   MyTestCustomActor2( Impl::MyTestCustomActor& impl )
400   : CustomActor( impl )
401   {
402   }
403 };
404
405 static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
406
407
408 BaseHandle CreateCustom(void)
409 {
410   return MyTestCustomActor::New();
411 }
412
413 static std::string lastSignalConnectionCustom;
414
415 bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
416 {
417   lastSignalConnectionCustom = signalName;
418
419   bool connected( true );
420
421   Dali::BaseHandle handle(object);
422   MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
423
424   if( "sig1" == signalName )
425   {
426     customActor.GetCustomSignal().Connect( tracker, functor );
427   }
428   else
429   {
430     // signalName does not match any signal
431     connected = false;
432   }
433
434   return connected;
435 }
436
437 bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
438 {
439   lastSignalConnectionCustom = "failed";
440
441   return false; // This is supposed to fail
442 }
443
444 struct CustomTestFunctor
445 {
446   CustomTestFunctor()
447   {
448     ++mTotalInstanceCount;
449     ++mCurrentInstanceCount;
450   }
451
452   CustomTestFunctor( const CustomTestFunctor& copyMe )
453   {
454     ++mTotalInstanceCount;
455     ++mCurrentInstanceCount;
456   }
457
458   ~CustomTestFunctor()
459   {
460     --mCurrentInstanceCount;
461   }
462
463   void operator()()
464   {
465     ++mCallbackCount;
466   }
467
468   static int mTotalInstanceCount;
469   static int mCurrentInstanceCount;
470   static int mCallbackCount;
471 };
472
473 int CustomTestFunctor::mTotalInstanceCount = 0;
474 int CustomTestFunctor::mCurrentInstanceCount = 0;
475 int CustomTestFunctor::mCallbackCount = 0;
476
477 static void ResetFunctorCounts()
478 {
479   CustomTestFunctor::mTotalInstanceCount   = 0;
480   CustomTestFunctor::mCurrentInstanceCount = 0;
481   CustomTestFunctor::mCallbackCount        = 0;
482 }
483
484 static std::string lastActionCustom;
485 bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
486 {
487   lastActionCustom = actionName;
488   return true;
489 }
490
491 // Custom type registration
492 static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
493
494 // Custom signals
495 static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
496 static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
497 static const int TEST_SIGNAL_COUNT = 2;
498
499 // Custom actions
500 static TypeAction customAction1( customType1, "act1", DoActionCustom);
501 static const int TEST_ACTION_COUNT = 1;
502
503 class TestConnectionTracker : public ConnectionTracker
504 {
505 public:
506
507   TestConnectionTracker()
508   {
509   }
510 };
511
512 BaseHandle CreateNamedActorType()
513 {
514   Actor actor = Actor::New();
515   actor.SetName( "NamedActor" );
516   return actor;
517 }
518
519 TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
520 PropertyRegistration namedActorPropertyOne( namedActorType, "propName",  PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
521
522 } // Anonymous namespace
523
524 // Note: No negative test case for UtcDaliTypeRegistryGet can be implemented.
525 int UtcDaliTypeRegistryGetP(void)
526 {
527   TestApplication application;
528
529   TypeRegistry registry = TypeRegistry::Get();
530   DALI_TEST_CHECK( registry );
531
532   END_TEST;
533 }
534
535 // Note: No negative test case for UtcDaliTypeRegistryConstructor can be implemented.
536 int UtcDaliTypeRegistryConstructorP(void)
537 {
538   TestApplication application;
539
540   TypeRegistry registry;
541   DALI_TEST_CHECK( !registry );
542   END_TEST;
543 }
544
545 // Note: No negative test case for UtcDaliTypeRegistryCopyConstructor can be implemented.
546 int UtcDaliTypeRegistryCopyConstructorP(void)
547 {
548   TestApplication application;
549
550   TypeRegistry registry = TypeRegistry::Get();
551   DALI_TEST_CHECK( registry );
552
553   TypeRegistry copy( registry );
554   DALI_TEST_CHECK( copy );
555
556   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
557
558   END_TEST;
559 }
560
561 // Note: No negative test case for UtcDaliTypeRegistryAssignmentOperator can be implemented.
562 int UtcDaliTypeRegistryAssignmentOperatorP(void)
563 {
564   TestApplication application;
565
566   TypeRegistry registry = TypeRegistry::Get();
567   DALI_TEST_CHECK( registry );
568
569   TypeRegistry copy = registry;
570   DALI_TEST_CHECK( copy );
571   DALI_TEST_CHECK( registry == copy );
572
573   DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
574
575   END_TEST;
576 }
577
578 int UtcDaliTypeRegistryAssignP(void)
579 {
580   TestApplication application;
581
582   TypeRegistry registry = TypeRegistry::Get();
583   TypeRegistry registry2;
584   registry2 = registry;
585   DALI_TEST_CHECK( registry2 );
586
587   DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
588
589   END_TEST;
590 }
591
592 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
593 {
594   TestApplication application;
595
596   TypeRegistry registry = TypeRegistry::Get();
597
598   TypeInfo type;
599
600   // camera actor
601   type = registry.GetTypeInfo( "CameraActor" );
602   DALI_TEST_CHECK( type );
603   CameraActor ca = CameraActor::DownCast(type.CreateInstance());
604   DALI_TEST_CHECK( ca );
605   Stage::GetCurrent().Add( ca );
606   application.Render();
607
608   // animations
609   type = registry.GetTypeInfo( "Animation" );
610   DALI_TEST_CHECK( type );
611   Animation an = Animation::DownCast(type.CreateInstance());
612   DALI_TEST_CHECK( an );
613   an.Play();
614   application.Render();
615
616   END_TEST;
617 }
618
619 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
620 {
621   TestApplication application;
622
623   TypeRegistry registry = TypeRegistry::Get();
624
625   TypeInfo type;
626
627   type = registry.GetTypeInfo( "MyDummyActor" );
628   DALI_TEST_CHECK( !type );
629
630   END_TEST;
631 }
632
633 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
634 {
635   TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
636   TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
637
638   DALI_TEST_CHECK( named_type );
639   DALI_TEST_CHECK( typeinfo_type );
640
641   // Check named and typeid are equivalent
642   DALI_TEST_CHECK( named_type == typeinfo_type );
643
644   DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
645   DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
646
647   END_TEST;
648 }
649
650 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
651 {
652   TestApplication application;
653   TypeRegistry typeRegistry = TypeRegistry::Get();
654
655   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
656   DALI_TEST_CHECK( !typeInfo );
657
658   END_TEST;
659 }
660
661 int UtcDaliTypeRegistryGetTypeNameCountP(void)
662 {
663   TestApplication application;
664   TypeRegistry typeRegistry = TypeRegistry::Get();
665   TypeInfo type;
666
667   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
668   {
669     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
670     DALI_TEST_CHECK( type );
671   }
672
673   END_TEST;
674 }
675
676
677 int UtcDaliTypeRegistryGetTypeNamesP(void)
678 {
679   TestApplication application;
680   TypeRegistry typeRegistry = TypeRegistry::Get();
681   TypeInfo type;
682
683   for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
684   {
685     type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
686     DALI_TEST_CHECK( type );
687   }
688
689   END_TEST;
690 }
691
692
693 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
694 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
695 {
696   ResetFunctorCounts();
697
698   TestApplication application;
699
700   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
701   DALI_TEST_CHECK( type );
702
703   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
704   DALI_TEST_CHECK( baseType );
705
706   BaseHandle handle = type.CreateInstance();
707   DALI_TEST_CHECK( handle );
708
709   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
710   DALI_TEST_CHECK( customHandle );
711
712   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
713
714   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
715
716   {
717     TestConnectionTracker tracker;
718
719     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
720     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
721     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
722     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
723     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
724
725     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
726     customHandle.GetCustomSignal().Emit();
727     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
728     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
729     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
730   }
731   // tracker should automatically disconnect here
732   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
733   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
734
735   // Test that functor is disconnected
736   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
737   customHandle.GetCustomSignal().Emit();
738   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
739   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
740   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
741
742   Property::Map attributes;
743   handle.DoAction("act1", attributes);
744   DALI_TEST_CHECK( lastActionCustom == "act1" );
745   END_TEST;
746 }
747
748 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
749 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
750 {
751   TestApplication application;
752
753   DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
754
755   DALI_TEST_CHECK( true == CreateCustomInitCalled );
756   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
757   DALI_TEST_CHECK( type );
758   END_TEST;
759 }
760
761 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
762 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
763 {
764   TestApplication application;
765
766   // Create Named Actor Type
767   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
768   DALI_TEST_CHECK( type );
769
770   BaseHandle namedHandle = type.CreateInstance();
771   DALI_TEST_CHECK( namedHandle );
772   Actor namedActor( Actor::DownCast( namedHandle ) );
773   DALI_TEST_CHECK( namedActor );
774
775   DALI_TEST_CHECK( namedActor.GetName() == "NamedActor" );
776   DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
777   DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
778
779   END_TEST;
780 }
781
782 // Note: No negative test case for UtcDaliTypeRegistryRegisteredName can be implemented.
783 int UtcDaliTypeRegistryRegisteredNameP(void)
784 {
785   TestApplication application;
786
787   DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
788
789   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
790   DALI_TEST_CHECK( baseType );
791
792   BaseHandle handle = baseType.CreateInstance();
793
794   DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
795   TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
796   DALI_TEST_CHECK( type );
797   END_TEST;
798 }
799
800 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
801 {
802   ResetFunctorCounts();
803
804   TestApplication application;
805
806   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
807   DALI_TEST_CHECK( type );
808
809   BaseHandle handle = type.CreateInstance();
810   DALI_TEST_CHECK( handle );
811
812   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
813   DALI_TEST_CHECK( customHandle );
814
815   {
816     TestConnectionTracker tracker;
817
818     bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
819     DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
820     DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
821     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
822     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
823
824     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
825     customHandle.GetCustomSignal().Emit();
826     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
827     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
828     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
829   }
830   // tracker should automatically disconnect here
831   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
832   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
833
834   // Test that functor is disconnected
835   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
836   customHandle.GetCustomSignal().Emit();
837   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
838   DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
839   DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
840
841   END_TEST;
842 }
843
844 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
845 {
846   // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
847
848   ResetFunctorCounts();
849
850   TestApplication application;
851
852   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
853   DALI_TEST_CHECK( type );
854
855   TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
856   DALI_TEST_CHECK( baseType );
857
858   BaseHandle handle = type.CreateInstance();
859   DALI_TEST_CHECK( handle );
860
861   MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
862   DALI_TEST_CHECK( customHandle );
863
864   DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
865
866   DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
867
868   {
869     TestConnectionTracker tracker;
870
871     bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
872     DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
873     DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
874     DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
875     DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
876
877     // Should be a NOOP
878     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
879     customHandle.GetCustomSignal().Emit();
880     DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
881   }
882   // tracker should have nothing to disconnect here
883
884   // Should be a NOOP
885   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
886   customHandle.GetCustomSignal().Emit();
887   DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
888   END_TEST;
889 }
890
891 int UtcDaliTypeRegistryTypeActionP(void)
892 {
893   ResetFunctorCounts();
894
895   TestApplication application;
896
897   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
898   DALI_TEST_CHECK( type );
899
900   BaseHandle handle = type.CreateInstance();
901   DALI_TEST_CHECK( handle );
902
903   Property::Map attributes;
904   DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
905   DALI_TEST_CHECK( lastActionCustom == "act1" );
906
907   END_TEST;
908 }
909
910 int UtcDaliTypeRegistryTypeActionN(void)
911 {
912   ResetFunctorCounts();
913
914   TestApplication application;
915
916   TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
917   DALI_TEST_CHECK( type );
918
919   BaseHandle handle = type.CreateInstance();
920   DALI_TEST_CHECK( handle );
921
922   Property::Map attributes;
923   DALI_TEST_CHECK( !handle.DoAction( "unknownAction",  attributes ) );
924
925   END_TEST;
926 }
927
928 int UtcDaliTypeRegistryPropertyRegistrationP(void)
929 {
930   TestApplication application;
931   TypeRegistry typeRegistry = TypeRegistry::Get();
932
933   // Check property count before property registration
934   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
935   DALI_TEST_CHECK( typeInfo );
936   BaseHandle handle = typeInfo.CreateInstance();
937   DALI_TEST_CHECK( handle );
938   Actor customActor = Actor::DownCast( handle );
939   DALI_TEST_CHECK( customActor );
940   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
941
942   std::string propertyName( "prop1" );
943   int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
944   Property::Type propertyType( Property::BOOLEAN );
945   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
946
947   // Check property count after registration
948   unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
949   DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
950
951   // Add custom property and check property count
952   customActor.RegisterProperty( "customProp1",   true );
953   unsigned int customPropertyCount( customActor.GetPropertyCount() );
954   DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
955
956   // Set the property, ensure SetProperty called
957   DALI_TEST_CHECK( !setPropertyCalled );
958   customActor.SetProperty( propertyIndex, false );
959   DALI_TEST_CHECK( setPropertyCalled );
960
961   // Get the property, ensure GetProperty called
962   DALI_TEST_CHECK( !getPropertyCalled );
963   (void)customActor.GetProperty< bool >( propertyIndex );
964   DALI_TEST_CHECK( getPropertyCalled );
965
966   // Check the property name
967   DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
968   DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
969
970   // Check the property index
971   DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
972
973   // Check the property type
974   DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
975
976   // Check property count of type-info is 1
977   Property::IndexContainer indices;
978   typeInfo.GetPropertyIndices( indices );
979   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
980
981   // Ensure indices returned from actor and customActor differ by two
982   Actor actor = Actor::New();
983   actor.GetPropertyIndices( indices );
984   unsigned int actorIndices = indices.Size();
985   customActor.GetPropertyIndices( indices );
986   unsigned int customActorIndices = indices.Size();
987   DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
988   END_TEST;
989 }
990
991 int UtcDaliTypeRegistryPropertyRegistrationN(void)
992 {
993   TestApplication application;
994   TypeRegistry typeRegistry = TypeRegistry::Get();
995
996   // Attempt to register a property type out-of-bounds index (less than)
997   try
998   {
999     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1000     tet_result( TET_FAIL );
1001   }
1002   catch ( DaliException& e )
1003   {
1004     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1005   }
1006
1007   // Attempt to register a property type out-of-bounds index (greater than)
1008   try
1009   {
1010     PropertyRegistration property1( customType1, "propName",  PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1011     tet_result( TET_FAIL );
1012   }
1013   catch ( DaliException& e )
1014   {
1015     DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1016   }
1017
1018   END_TEST;
1019 }
1020
1021 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1022 {
1023   TestApplication application;
1024   TypeRegistry typeRegistry = TypeRegistry::Get();
1025
1026   // Check property count before property registration
1027   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1028   DALI_TEST_CHECK( typeInfo );
1029   BaseHandle handle = typeInfo.CreateInstance();
1030   DALI_TEST_CHECK( handle );
1031   Actor customActor = Actor::DownCast( handle );
1032   DALI_TEST_CHECK( customActor );
1033   Stage::GetCurrent().Add(customActor);
1034
1035   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1036
1037   // Register animatable property
1038   std::string animatablePropertyName( "animatableProp1" );
1039   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1040   Property::Type animatablePropertyType( Property::FLOAT );
1041   AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1042
1043   // Check property count after registration
1044   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1045
1046   // Set the animatable property value
1047   customActor.SetProperty( animatablePropertyIndex, 25.0f );
1048
1049   // Render and notify
1050   application.SendNotification();
1051   application.Render();
1052
1053   // Check the animatable property value
1054   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1055
1056   // Check the animatable property name
1057   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1058
1059   // Check the animatable property index
1060   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1061
1062   // Check the animatable property type
1063   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1064
1065   // Check property count of type-info is 1
1066   Property::IndexContainer indices;
1067   typeInfo.GetPropertyIndices( indices );
1068   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1069
1070   // Ensure indices returned from actor and customActor differ by one
1071   Actor actor = Actor::New();
1072   actor.GetPropertyIndices( indices );
1073   unsigned int actorIndices = indices.Size();
1074   customActor.GetPropertyIndices( indices );
1075   unsigned int customActorIndices = indices.Size();
1076   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1077
1078   // check that the property is animatable
1079   Animation animation = Animation::New(0.2f);
1080   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1081   animation.Play();
1082   // Render and notify, animation play for 0.05 seconds
1083   application.SendNotification();
1084   application.Render(50);
1085   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1086   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1087   // Render and notify, animation play for another 0.1 seconds
1088   application.SendNotification();
1089   application.Render(100);
1090   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1091   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1092
1093   END_TEST;
1094 }
1095
1096 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1097 {
1098   TestApplication application;
1099   TypeRegistry typeRegistry = TypeRegistry::Get();
1100
1101   // Attempt to register an animatable property type out-of-bounds index (less than)
1102   try
1103   {
1104     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1105     tet_result( TET_FAIL );
1106   }
1107   catch ( DaliException& e )
1108   {
1109     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1110   }
1111
1112   // Attempt to register an animatable property type out-of-bounds index (greater than)
1113   try
1114   {
1115     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1116     tet_result( TET_FAIL );
1117   }
1118   catch ( DaliException& e )
1119   {
1120     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1121   }
1122
1123   END_TEST;
1124 }
1125
1126 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1127 {
1128   TestApplication application;
1129   TypeRegistry typeRegistry = TypeRegistry::Get();
1130
1131   // Check property count before property registration
1132   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1133   DALI_TEST_CHECK( typeInfo );
1134   BaseHandle handle = typeInfo.CreateInstance();
1135   DALI_TEST_CHECK( handle );
1136   Actor customActor = Actor::DownCast( handle );
1137   DALI_TEST_CHECK( customActor );
1138   Stage::GetCurrent().Add(customActor);
1139
1140   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1141
1142   // Register animatable property
1143   std::string animatablePropertyName( "animatableProp1" );
1144   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1145   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1146
1147   // Check property count after registration
1148   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1149
1150   // Render and notify
1151   application.SendNotification();
1152   application.Render();
1153
1154   // Check the animatable property value
1155   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1156
1157   // Check the animatable property name
1158   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1159
1160   // Check the animatable property index
1161   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1162
1163   // Check the animatable property type
1164   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
1165
1166   // Check property count of type-info is 1
1167   Property::IndexContainer indices;
1168   typeInfo.GetPropertyIndices( indices );
1169   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1170
1171   // Ensure indices returned from actor and customActor differ by one
1172   Actor actor = Actor::New();
1173   actor.GetPropertyIndices( indices );
1174   unsigned int actorIndices = indices.Size();
1175   customActor.GetPropertyIndices( indices );
1176   unsigned int customActorIndices = indices.Size();
1177   DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1178
1179   // check that the property is animatable
1180   Animation animation = Animation::New(0.2f);
1181   animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1182   animation.Play();
1183   // Render and notify, animation play for 0.05 seconds
1184   application.SendNotification();
1185   application.Render(50);
1186   DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1187   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1188   // Render and notify, animation play for another 0.1 seconds
1189   application.SendNotification();
1190   application.Render(100);
1191   DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1192   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1193
1194   END_TEST;
1195 }
1196
1197 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1198 {
1199   TestApplication application;
1200   TypeRegistry typeRegistry = TypeRegistry::Get();
1201
1202   // Attempt to register an animatable property type out-of-bounds index (less than)
1203   try
1204   {
1205     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1206     tet_result( TET_FAIL );
1207   }
1208   catch ( DaliException& e )
1209   {
1210     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1211   }
1212
1213   // Attempt to register an animatable property type out-of-bounds index (greater than)
1214   try
1215   {
1216     AnimatablePropertyRegistration property1( customType1, "animPropName",   ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1217     tet_result( TET_FAIL );
1218   }
1219   catch ( DaliException& e )
1220   {
1221     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1222   }
1223
1224   END_TEST;
1225 }
1226
1227 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1228 {
1229   TestApplication application;
1230   TypeRegistry typeRegistry = TypeRegistry::Get();
1231
1232   // Check property count before property registration
1233   TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1234   DALI_TEST_CHECK( typeInfo );
1235   BaseHandle handle = typeInfo.CreateInstance();
1236   DALI_TEST_CHECK( handle );
1237   Actor customActor = Actor::DownCast( handle );
1238   DALI_TEST_CHECK( customActor );
1239
1240   unsigned int customPropertyCount( customActor.GetPropertyCount() );
1241
1242   // Register animatable property
1243   std::string animatablePropertyName( "animatableProp1" );
1244   int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1245   Property::Type animatablePropertyType( Property::VECTOR2 );
1246   AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1247
1248   // Check property count after registration
1249   DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1250
1251   // Set the animatable property value
1252   customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1253
1254   // Render and notify
1255   application.SendNotification();
1256   application.Render();
1257
1258   // Check the animatable property value
1259   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1260
1261   // Check the animatable property name
1262   DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1263
1264   // Check the animatable property index
1265   DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1266
1267   // Check the animatable property type
1268   DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1269
1270   // Check property count of type-info is 1
1271   Property::IndexContainer indices;
1272   typeInfo.GetPropertyIndices( indices );
1273   DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1274
1275   // Register animatable property components
1276   std::string animatablePropertyComponentName1( "animatableProp1X" );
1277   int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1278   AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1279
1280   std::string animatablePropertyComponentName2( "animatableProp1Y" );
1281   int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1282   AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1283
1284   // Check property count after registration
1285   DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1286
1287   // Check the animatable property component value
1288   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1289   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1290
1291   // Set the animatable property component value
1292   customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1293
1294   // Render and notify
1295   application.SendNotification();
1296   application.Render();
1297
1298   // Check the animatable property value
1299   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1300   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1301   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1302
1303   // Set the animatable property component value
1304   customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1305
1306   // Render and notify
1307   application.SendNotification();
1308   application.Render();
1309
1310   // Check the animatable property value
1311   DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1312   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1313   DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1314
1315   // Ensure indices returned from actor and customActor differ by three
1316   Actor actor = Actor::New();
1317   actor.GetPropertyIndices( indices );
1318   unsigned int actorIndices = indices.Size();
1319   customActor.GetPropertyIndices( indices );
1320   unsigned int customActorIndices = indices.Size();
1321   DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1322
1323   END_TEST;
1324 }
1325
1326 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1327 {
1328   TestApplication application;
1329   TypeRegistry typeRegistry = TypeRegistry::Get();
1330
1331   // Register animatable property with the type of Vector2
1332   int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1333   AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1",   animatablePropertyIndex1, Property::VECTOR2 );
1334
1335   // Attempt to register an animatable property component out-of-bounds index (less than)
1336   try
1337   {
1338     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1339     tet_result( TET_FAIL );
1340   }
1341   catch ( DaliException& e )
1342   {
1343     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1344   }
1345
1346   // Attempt to register an animatable property component out-of-bounds index (greater than)
1347   try
1348   {
1349     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1350     tet_result( TET_FAIL );
1351   }
1352   catch ( DaliException& e )
1353   {
1354     DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1355   }
1356
1357   // Register an animatable property component
1358   AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1359
1360   // Attempt to register another animatable property component with the same component index
1361   try
1362   {
1363     AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y",    ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1364     tet_result( TET_FAIL );
1365   }
1366   catch ( DaliException& e )
1367   {
1368     DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1369   }
1370
1371   // Register animatable property with the type of boolean
1372   int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1373   AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2",   animatablePropertyIndex2, Property::BOOLEAN );
1374
1375   // Attempt to register an animatable property component for the above property with boolean type
1376   try
1377   {
1378     AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X",    animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1379     tet_result( TET_FAIL );
1380   }
1381   catch ( DaliException& e )
1382   {
1383     DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1384   }
1385
1386   END_TEST;
1387 }
1388
1389
1390 /*******************************************************************************
1391  *
1392  * Action through the base handle
1393  *
1394  ******************************************************************************/
1395 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1396 {
1397   TestApplication application;
1398
1399   TypeInfo type;
1400
1401   type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1402   DALI_TEST_CHECK( type );
1403
1404   BaseHandle hdl = type.CreateInstance();
1405   DALI_TEST_CHECK( hdl );
1406
1407   Actor a = Actor::DownCast(hdl);
1408   DALI_TEST_CHECK( a );
1409
1410   a.SetVisible(false);
1411
1412   application.SendNotification();
1413   application.Render(0);
1414   DALI_TEST_CHECK(!a.IsVisible());
1415
1416   Property::Map attributes;
1417
1418   DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1419
1420   application.SendNotification();
1421   application.Render(0);
1422   DALI_TEST_CHECK(a.IsVisible());
1423
1424   DALI_TEST_CHECK(!hdl.DoAction("unknownAction",  attributes));
1425   END_TEST;
1426 }
1427
1428 int UtcDaliPropertyRegistrationFunctions(void)
1429 {
1430   TestApplication application;
1431   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1432
1433   // Attempt to register a property without a setter
1434   try
1435   {
1436     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1437     tet_result( TET_PASS );
1438   }
1439   catch ( DaliException& e )
1440   {
1441     tet_result( TET_FAIL );
1442   }
1443
1444   // Attempt to register a property without a getter
1445   try
1446   {
1447     PropertyRegistration property1( customType1, "propName",  propertyIndex++, Property::BOOLEAN, NULL, NULL );
1448     tet_result( TET_FAIL );
1449   }
1450   catch ( DaliException& e )
1451   {
1452     DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1453   }
1454   END_TEST;
1455 }
1456
1457 int UtcDaliPropertyRegistrationAddSameIndex(void)
1458 {
1459   TestApplication application;
1460   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1461
1462   // Add one property with a valid property index
1463   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1464
1465   // Attempt to add another property with the same index
1466   try
1467   {
1468     PropertyRegistration property2( customType1, "propName2",   propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1469   }
1470   catch ( DaliException& e )
1471   {
1472     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1473   }
1474
1475   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
1476
1477   // Add one property with a valid property index
1478   AnimatablePropertyRegistration property3( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1479
1480   // Attempt to add another property with the same index
1481   try
1482   {
1483     AnimatablePropertyRegistration property4( customType1, "animPropName2",    animatablePropertyIndex, Property::BOOLEAN );
1484   }
1485   catch ( DaliException& e )
1486   {
1487     DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
1488   }
1489   END_TEST;
1490 }
1491
1492 int UtcDaliPropertyRegistrationPropertyWritable(void)
1493 {
1494   TestApplication application;
1495   int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
1496   int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
1497
1498   // Add two properties, one with SetProperty, one without
1499   PropertyRegistration property1( customType1, "propNameReadwrite",   propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
1500   PropertyRegistration property2( customType1, "propNameReadonly",    propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
1501
1502   // Create custom-actor
1503   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1504   DALI_TEST_CHECK( typeInfo );
1505   BaseHandle handle = typeInfo.CreateInstance();
1506   DALI_TEST_CHECK( handle );
1507   Actor customActor = Actor::DownCast( handle );
1508   DALI_TEST_CHECK( customActor );
1509
1510   // Check whether properties are writable
1511   DALI_TEST_CHECK(   customActor.IsPropertyWritable( propertyIndex1 ) );
1512   DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
1513   END_TEST;
1514 }
1515
1516 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
1517 {
1518   TestApplication application;
1519   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
1520   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
1521
1522   // These properties are not animatable
1523   PropertyRegistration property1( customType1, "propName",  propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1524
1525   // These properties are animatable
1526   AnimatablePropertyRegistration property2( customType1, "animPropName",   animatablePropertyIndex, Property::BOOLEAN );
1527
1528   // Create custom-actor
1529   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1530   DALI_TEST_CHECK( typeInfo );
1531   BaseHandle handle = typeInfo.CreateInstance();
1532   DALI_TEST_CHECK( handle );
1533   Actor customActor = Actor::DownCast( handle );
1534   DALI_TEST_CHECK( customActor );
1535
1536   // Check if animatable
1537   DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
1538   DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
1539
1540   // Create another instance of custom-actor
1541   BaseHandle handle2 = typeInfo.CreateInstance();
1542   DALI_TEST_CHECK( handle2 );
1543   Actor customActor2 = Actor::DownCast( handle2 );
1544   DALI_TEST_CHECK( customActor2 );
1545
1546   // Check if animatable
1547   DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
1548   DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
1549   END_TEST;
1550 }
1551
1552 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
1553 {
1554   TestApplication application;
1555   int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
1556   int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
1557
1558   // Create custom-actor
1559   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
1560   DALI_TEST_CHECK( typeInfo );
1561   BaseHandle handle = typeInfo.CreateInstance();
1562   DALI_TEST_CHECK( handle );
1563   Actor customActor = Actor::DownCast( handle );
1564   DALI_TEST_CHECK( customActor );
1565
1566   // Try to set an index that hasn't been added
1567   try
1568   {
1569     customActor.SetProperty( propertyIndex, true );
1570     tet_result( TET_FAIL );
1571   }
1572   catch ( DaliException& e )
1573   {
1574     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1575   }
1576
1577   try
1578   {
1579     customActor.SetProperty( animatablePropertyIndex, true );
1580     tet_result( TET_FAIL );
1581   }
1582   catch ( DaliException& e )
1583   {
1584     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1585   }
1586
1587   // Try to get an index that hasn't been added
1588   try
1589   {
1590     (void) customActor.GetProperty< bool >( propertyIndex );
1591     tet_result( TET_FAIL );
1592   }
1593   catch ( DaliException& e )
1594   {
1595     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1596   }
1597
1598   try
1599   {
1600     (void) customActor.GetProperty< bool >( animatablePropertyIndex );
1601     tet_result( TET_FAIL );
1602   }
1603   catch ( DaliException& e )
1604   {
1605     DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
1606   }
1607   END_TEST;
1608 }
1609
1610
1611 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
1612 {
1613   TestApplication application;
1614
1615   Actor actor = Actor::New();
1616   actor.SetSize(100.0f, 100.0f);
1617   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1618   Stage::GetCurrent().Add(actor);
1619
1620   // Register Type
1621   TypeInfo type;
1622   type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
1623   DALI_TEST_CHECK( type );
1624   BaseHandle handle = type.CreateInstance();
1625   DALI_TEST_CHECK( handle );
1626   LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
1627   DALI_TEST_CHECK( detector );
1628
1629   // Attach actor to detector
1630   SignalData data;
1631   GestureReceivedFunctor functor( data );
1632   detector.Attach(actor);
1633
1634   // Connect to signal through type
1635   handle.ConnectSignal( &application, "longPressDetected",   functor );
1636
1637   // Render and notify
1638   application.SendNotification();
1639   application.Render();
1640
1641   // Emit gesture
1642   application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
1643   application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
1644   application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
1645   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1646   END_TEST;
1647 }
1648
1649 int UtcDaliPanGestureDetectorTypeRegistry(void)
1650 {
1651   TestApplication application;
1652
1653   Actor actor = Actor::New();
1654   actor.SetSize(100.0f, 100.0f);
1655   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1656   Stage::GetCurrent().Add(actor);
1657
1658   // Register Type
1659   TypeInfo type;
1660   type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
1661   DALI_TEST_CHECK( type );
1662   BaseHandle handle = type.CreateInstance();
1663   DALI_TEST_CHECK( handle );
1664   PanGestureDetector detector = PanGestureDetector::DownCast( handle );
1665   DALI_TEST_CHECK( detector );
1666
1667   // Attach actor to detector
1668   SignalData data;
1669   GestureReceivedFunctor functor( data );
1670   detector.Attach(actor);
1671
1672   // Connect to signal through type
1673   handle.ConnectSignal( &application, "panDetected",  functor );
1674
1675   // Render and notify
1676   application.SendNotification();
1677   application.Render();
1678
1679   // Emit gesture
1680   application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1681   application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1682   application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
1683   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1684   END_TEST;
1685 }
1686
1687 int UtcDaliPinchGestureDetectorTypeRegistry(void)
1688 {
1689   TestApplication application;
1690
1691   Actor actor = Actor::New();
1692   actor.SetSize(100.0f, 100.0f);
1693   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1694   Stage::GetCurrent().Add(actor);
1695
1696   // Register Type
1697   TypeInfo type;
1698   type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
1699   DALI_TEST_CHECK( type );
1700   BaseHandle handle = type.CreateInstance();
1701   DALI_TEST_CHECK( handle );
1702   PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
1703   DALI_TEST_CHECK( detector );
1704
1705   // Attach actor to detector
1706   SignalData data;
1707   GestureReceivedFunctor functor( data );
1708   detector.Attach(actor);
1709
1710   // Connect to signal through type
1711   handle.ConnectSignal( &application, "pinchDetected",  functor );
1712
1713   // Render and notify
1714   application.SendNotification();
1715   application.Render();
1716
1717   // Emit gesture
1718   application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
1719   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1720   END_TEST;
1721 }
1722
1723 int UtcDaliTapGestureDetectorTypeRegistry(void)
1724 {
1725   TestApplication application;
1726
1727   Actor actor = Actor::New();
1728   actor.SetSize(100.0f, 100.0f);
1729   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1730   Stage::GetCurrent().Add(actor);
1731
1732   // Register Type
1733   TypeInfo type;
1734   type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
1735   DALI_TEST_CHECK( type );
1736   BaseHandle handle = type.CreateInstance();
1737   DALI_TEST_CHECK( handle );
1738   TapGestureDetector detector = TapGestureDetector::DownCast( handle );
1739   DALI_TEST_CHECK( detector );
1740
1741   // Attach actor to detector
1742   SignalData data;
1743   GestureReceivedFunctor functor( data );
1744   detector.Attach(actor);
1745
1746   // Connect to signal through type
1747   handle.ConnectSignal( &application, "tapDetected",  functor );
1748
1749   // Render and notify
1750   application.SendNotification();
1751   application.Render();
1752
1753   // Emit gesture
1754   application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
1755   application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
1756   DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
1757   END_TEST;
1758 }
1759
1760 int UtcDaliTypeRegistryNamedType(void)
1761 {
1762   TestApplication application;
1763   TypeRegistry typeRegistry = TypeRegistry::Get();
1764
1765   // Create a normal actor
1766   BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
1767   DALI_TEST_CHECK( actorHandle );
1768   Actor actor( Actor::DownCast( actorHandle ) );
1769   DALI_TEST_CHECK( actor );
1770   unsigned int actorPropertyCount( actor.GetPropertyCount() );
1771
1772   // Create Named Actor Type
1773   BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
1774   DALI_TEST_CHECK( namedHandle );
1775   Actor namedActor( Actor::DownCast( namedHandle ) );
1776   DALI_TEST_CHECK( namedActor );
1777   unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
1778
1779   DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
1780   END_TEST;
1781 }
1782
1783 int UtcDaliTypeInfoGetActionNameP(void)
1784 {
1785   TestApplication application;
1786   TypeRegistry typeRegistry = TypeRegistry::Get();
1787
1788   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1789   DALI_TEST_CHECK( typeInfo );
1790
1791   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1792
1793   std::string name = typeInfo.GetActionName(0);
1794
1795   DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
1796
1797   END_TEST;
1798 }
1799
1800 int UtcDaliTypeInfoGetActionNameN(void)
1801 {
1802   TestApplication application;
1803   TypeRegistry typeRegistry = TypeRegistry::Get();
1804
1805   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1806   DALI_TEST_CHECK( typeInfo );
1807
1808   DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
1809
1810   std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
1811
1812   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1813
1814   END_TEST;
1815 }
1816
1817 int UtcDaliTypeInfoGetSignalNameP(void)
1818 {
1819   TestApplication application;
1820   TypeRegistry typeRegistry = TypeRegistry::Get();
1821
1822   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1823   DALI_TEST_CHECK( typeInfo );
1824
1825   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1826
1827   std::string name = typeInfo.GetSignalName(0);
1828
1829   DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
1830
1831   END_TEST;
1832 }
1833
1834 int UtcDaliTypeInfoGetSignalNameN(void)
1835 {
1836   TestApplication application;
1837   TypeRegistry typeRegistry = TypeRegistry::Get();
1838
1839   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1840   DALI_TEST_CHECK( typeInfo );
1841
1842   DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
1843
1844   std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
1845
1846   DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
1847
1848   END_TEST;
1849 }