2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23 #include <dali/internal/event/common/type-info-impl.h>
24 #include <dali/integration-api/events/long-press-gesture-event.h>
25 #include <dali/integration-api/events/pan-gesture-event.h>
26 #include <dali/integration-api/events/pinch-gesture-event.h>
27 #include <dali/integration-api/events/tap-gesture-event.h>
28 #include <dali/integration-api/events/touch-event-integ.h>
29 #include <dali/integration-api/events/hover-event-integ.h>
37 // Stores data that is populated in the callback and will be read by the Test cases
41 : functorCalled( false ),
42 voidFunctorCalled( false ),
43 receivedGesture( Gesture::Clear ),
49 functorCalled = false;
50 voidFunctorCalled = false;
52 receivedGesture.numberOfTouches = 0u;
53 receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
54 receivedGesture.localPoint = Vector2(0.0f, 0.0f);
60 bool voidFunctorCalled;
61 LongPressGesture receivedGesture;
65 // Functor that sets the data when called
66 struct GestureReceivedFunctor
68 GestureReceivedFunctor(SignalData& data) : signalData(data) { }
70 void operator()(Actor actor, LongPressGesture longPress)
72 signalData.functorCalled = true;
73 signalData.receivedGesture = longPress;
74 signalData.pressedActor = actor;
79 signalData.voidFunctorCalled = true;
82 SignalData& signalData;
85 // Generate a LongPressGestureEvent to send to Core
86 Integration::LongPressGestureEvent GenerateLongPress(
88 unsigned int numberOfTouches,
91 Integration::LongPressGestureEvent longPress( state );
93 longPress.numberOfTouches = numberOfTouches;
94 longPress.point = point;
99 // Generate a PanGestureEvent to send to Core
100 Integration::PanGestureEvent GeneratePan(
101 Gesture::State state,
102 Vector2 previousPosition,
103 Vector2 currentPosition,
104 unsigned long timeDelta,
105 unsigned int numberOfTouches = 1,
106 unsigned int time = 1u)
108 Integration::PanGestureEvent pan(state);
110 pan.previousPosition = previousPosition;
111 pan.currentPosition = currentPosition;
112 pan.timeDelta = timeDelta;
113 pan.numberOfTouches = numberOfTouches;
118 // Generate a PinchGestureEvent to send to Core
119 Integration::PinchGestureEvent GeneratePinch(
120 Gesture::State state,
125 Integration::PinchGestureEvent pinch(state);
129 pinch.centerPoint = centerpoint;
133 // Generate a TapGestureEvent to send to Core
134 Integration::TapGestureEvent GenerateTap(
135 Gesture::State state,
136 unsigned int numberOfTaps,
137 unsigned int numberOfTouches,
140 Integration::TapGestureEvent tap( state );
142 tap.numberOfTaps = numberOfTaps;
143 tap.numberOfTouches = numberOfTouches;
150 // Create function as Init function called
152 static bool CreateCustomInitCalled = false;
153 BaseHandle CreateCustomInit(void)
155 CreateCustomInitCalled = true;
159 static bool CreateCustomNamedInitCalled = false;
160 BaseHandle CreateCustomNamedInit(void)
162 CreateCustomNamedInitCalled = true;
166 const std::string scriptedName("PopupStyle");
167 static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
169 // Property Registration
170 bool setPropertyCalled = false;
171 bool getPropertyCalled = false;
172 void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
174 setPropertyCalled = true;
176 Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
178 getPropertyCalled = true;
179 return Property::Value( true );
184 /*******************************************************************************
188 ******************************************************************************/
191 struct MyTestCustomActor : public CustomActorImpl
193 typedef Signal< void ()> SignalType;
194 typedef Signal< void (float)> SignalTypeFloat;
196 MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
199 virtual ~MyTestCustomActor()
202 void ResetCallStack()
206 // From CustomActorImpl
207 virtual void OnStageConnection( int depth )
210 virtual void OnStageDisconnection()
213 virtual void OnChildAdd(Actor& child)
216 virtual void OnChildRemove(Actor& child)
219 virtual void OnSizeSet(const Vector3& targetSize)
222 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
225 virtual bool OnTouchEvent(const TouchEvent& event)
229 virtual bool OnHoverEvent(const HoverEvent& event)
233 virtual bool OnWheelEvent(const WheelEvent& event)
237 virtual bool OnKeyEvent(const KeyEvent& event)
241 virtual void OnKeyInputFocusGained()
244 virtual void OnKeyInputFocusLost()
247 virtual Vector3 GetNaturalSize()
249 return Vector3( 0.0f, 0.0f, 0.0f );
252 virtual float GetHeightForWidth( float width )
257 virtual float GetWidthForHeight( float height )
262 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
266 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
270 virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
274 virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
279 virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
283 virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
295 class MyTestCustomActor : public CustomActor
299 typedef Signal< void ()> SignalType;
300 typedef Signal< void (float)> SignalTypeFloat;
306 static MyTestCustomActor New()
308 Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
309 return MyTestCustomActor( *p ); // takes ownership
312 virtual ~MyTestCustomActor()
316 static MyTestCustomActor DownCast( BaseHandle handle )
318 MyTestCustomActor result;
320 CustomActor custom = Dali::CustomActor::DownCast( handle );
323 CustomActorImpl& customImpl = custom.GetImplementation();
325 Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
329 result = MyTestCustomActor(customImpl.GetOwner());
336 SignalType& GetCustomSignal()
338 Dali::RefObject& obj = GetImplementation();
339 return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
344 MyTestCustomActor(Internal::CustomActor* internal)
345 : CustomActor(internal)
349 MyTestCustomActor( Impl::MyTestCustomActor& impl )
350 : CustomActor( impl )
356 class MyTestCustomActor2 : public CustomActor
364 P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
374 static MyTestCustomActor2 New()
376 return MyTestCustomActor2(); // takes ownership
379 virtual ~MyTestCustomActor2()
383 static MyTestCustomActor2 DownCast( BaseHandle handle )
385 MyTestCustomActor2 result;
387 CustomActor custom = Dali::CustomActor::DownCast( handle );
390 CustomActorImpl& customImpl = custom.GetImplementation();
392 Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
396 result = MyTestCustomActor2(customImpl.GetOwner());
405 MyTestCustomActor2(Internal::CustomActor* internal)
406 : CustomActor(internal)
410 MyTestCustomActor2( Impl::MyTestCustomActor& impl )
411 : CustomActor( impl )
416 static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
418 PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty );
419 PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty );
422 class MyTestCustomActor3 : public CustomActor
429 static MyTestCustomActor3 New()
431 return MyTestCustomActor3(); // takes ownership
434 virtual ~MyTestCustomActor3()
438 static MyTestCustomActor3 DownCast( BaseHandle handle )
440 MyTestCustomActor3 result;
442 CustomActor custom = Dali::CustomActor::DownCast( handle );
445 CustomActorImpl& customImpl = custom.GetImplementation();
447 Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
451 result = MyTestCustomActor3(customImpl.GetOwner());
460 MyTestCustomActor3(Internal::CustomActor* internal)
461 : CustomActor(internal)
465 MyTestCustomActor3( Impl::MyTestCustomActor& impl )
466 : CustomActor( impl )
471 static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false );
473 BaseHandle CreateCustom(void)
475 return MyTestCustomActor::New();
478 static std::string lastSignalConnectionCustom;
480 bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
482 lastSignalConnectionCustom = signalName;
484 bool connected( true );
486 Dali::BaseHandle handle(object);
487 MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
489 if( "sig1" == signalName )
491 customActor.GetCustomSignal().Connect( tracker, functor );
495 // signalName does not match any signal
502 bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
504 lastSignalConnectionCustom = "failed";
506 return false; // This is supposed to fail
509 struct CustomTestFunctor
513 ++mTotalInstanceCount;
514 ++mCurrentInstanceCount;
517 CustomTestFunctor( const CustomTestFunctor& copyMe )
519 ++mTotalInstanceCount;
520 ++mCurrentInstanceCount;
525 --mCurrentInstanceCount;
533 static int mTotalInstanceCount;
534 static int mCurrentInstanceCount;
535 static int mCallbackCount;
538 int CustomTestFunctor::mTotalInstanceCount = 0;
539 int CustomTestFunctor::mCurrentInstanceCount = 0;
540 int CustomTestFunctor::mCallbackCount = 0;
542 static void ResetFunctorCounts()
544 CustomTestFunctor::mTotalInstanceCount = 0;
545 CustomTestFunctor::mCurrentInstanceCount = 0;
546 CustomTestFunctor::mCallbackCount = 0;
549 static std::string lastActionCustom;
550 bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
552 lastActionCustom = actionName;
556 // Custom type registration
557 static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
560 static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
561 static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
562 static const int TEST_SIGNAL_COUNT = 2;
565 static TypeAction customAction1( customType1, "act1", DoActionCustom);
566 static const int TEST_ACTION_COUNT = 1;
568 class TestConnectionTracker : public ConnectionTracker
572 TestConnectionTracker()
577 BaseHandle CreateNamedActorType()
579 Actor actor = Actor::New();
580 actor.SetName( "NamedActor" );
584 TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
585 PropertyRegistration namedActorPropertyOne( namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
587 } // Anonymous namespace
589 // Note: No negative test case for UtcDaliTypeRegistryGet can be implemented.
590 int UtcDaliTypeRegistryGetP(void)
592 TestApplication application;
594 TypeRegistry registry = TypeRegistry::Get();
595 DALI_TEST_CHECK( registry );
600 // Note: No negative test case for UtcDaliTypeRegistryConstructor can be implemented.
601 int UtcDaliTypeRegistryConstructorP(void)
603 TestApplication application;
605 TypeRegistry registry;
606 DALI_TEST_CHECK( !registry );
610 // Note: No negative test case for UtcDaliTypeRegistryCopyConstructor can be implemented.
611 int UtcDaliTypeRegistryCopyConstructorP(void)
613 TestApplication application;
615 TypeRegistry registry = TypeRegistry::Get();
616 DALI_TEST_CHECK( registry );
618 TypeRegistry copy( registry );
619 DALI_TEST_CHECK( copy );
621 DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
626 // Note: No negative test case for UtcDaliTypeRegistryAssignmentOperator can be implemented.
627 int UtcDaliTypeRegistryAssignmentOperatorP(void)
629 TestApplication application;
631 TypeRegistry registry = TypeRegistry::Get();
632 DALI_TEST_CHECK( registry );
634 TypeRegistry copy = registry;
635 DALI_TEST_CHECK( copy );
636 DALI_TEST_CHECK( registry == copy );
638 DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
643 int UtcDaliTypeRegistryAssignP(void)
645 TestApplication application;
647 TypeRegistry registry = TypeRegistry::Get();
648 TypeRegistry registry2;
649 registry2 = registry;
650 DALI_TEST_CHECK( registry2 );
652 DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
657 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
659 TestApplication application;
661 TypeRegistry registry = TypeRegistry::Get();
666 type = registry.GetTypeInfo( "CameraActor" );
667 DALI_TEST_CHECK( type );
668 CameraActor ca = CameraActor::DownCast(type.CreateInstance());
669 DALI_TEST_CHECK( ca );
670 Stage::GetCurrent().Add( ca );
671 application.Render();
674 type = registry.GetTypeInfo( "Animation" );
675 DALI_TEST_CHECK( type );
676 Animation an = Animation::DownCast(type.CreateInstance());
677 DALI_TEST_CHECK( an );
679 application.Render();
684 int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void)
686 TestApplication application;
688 TypeRegistry registry = TypeRegistry::Get();
692 type = registry.GetTypeInfo( "MyDummyActor" );
693 DALI_TEST_CHECK( !type );
698 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
700 TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
701 TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
703 DALI_TEST_CHECK( named_type );
704 DALI_TEST_CHECK( typeinfo_type );
706 // Check named and typeid are equivalent
707 DALI_TEST_CHECK( named_type == typeinfo_type );
709 DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
710 DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
715 int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
717 TestApplication application;
718 TypeRegistry typeRegistry = TypeRegistry::Get();
720 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
721 DALI_TEST_CHECK( !typeInfo );
726 int UtcDaliTypeRegistryGetTypeNameCountP(void)
728 TestApplication application;
729 TypeRegistry typeRegistry = TypeRegistry::Get();
732 for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
734 type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
735 DALI_TEST_CHECK( type );
742 int UtcDaliTypeRegistryGetTypeNamesP(void)
744 TestApplication application;
745 TypeRegistry typeRegistry = TypeRegistry::Get();
748 for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
750 type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
751 DALI_TEST_CHECK( type );
758 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
759 int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
761 ResetFunctorCounts();
763 TestApplication application;
765 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
766 DALI_TEST_CHECK( type );
768 TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
769 DALI_TEST_CHECK( baseType );
771 BaseHandle handle = type.CreateInstance();
772 DALI_TEST_CHECK( handle );
774 MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
775 DALI_TEST_CHECK( customHandle );
777 DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
779 DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
782 TestConnectionTracker tracker;
784 bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
785 DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
786 DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
787 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
788 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
790 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
791 customHandle.GetCustomSignal().Emit();
792 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
793 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
794 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
796 // tracker should automatically disconnect here
797 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
798 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
800 // Test that functor is disconnected
801 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
802 customHandle.GetCustomSignal().Emit();
803 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
804 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
805 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
807 Property::Map attributes;
808 handle.DoAction("act1", attributes);
809 DALI_TEST_CHECK( lastActionCustom == "act1" );
813 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
814 int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
816 TestApplication application;
818 DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
820 DALI_TEST_CHECK( true == CreateCustomInitCalled );
821 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
822 DALI_TEST_CHECK( type );
826 // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
827 int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
829 TestApplication application;
831 // Create Named Actor Type
832 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
833 DALI_TEST_CHECK( type );
835 BaseHandle namedHandle = type.CreateInstance();
836 DALI_TEST_CHECK( namedHandle );
837 Actor namedActor( Actor::DownCast( namedHandle ) );
838 DALI_TEST_CHECK( namedActor );
840 DALI_TEST_CHECK( namedActor.GetName() == "NamedActor" );
841 DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
842 DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
847 int UtcDaliTypeRegistryRegisteredNameP(void)
849 TestApplication application;
851 DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
853 TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
854 DALI_TEST_CHECK( baseType );
856 BaseHandle handle = baseType.CreateInstance();
858 DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
859 TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
860 DALI_TEST_CHECK( type );
865 int UtcDaliTypeRegistryRegisteredNameN(void)
867 TestApplication application;
869 DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
871 TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
872 DALI_TEST_CHECK( baseType );
874 // should cause an assert because we're registering same type twice
875 // once statically at the start of this file, then again now
878 TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
879 tet_result( TET_FAIL );
881 catch ( DaliException& e )
883 DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION );
890 int UtcDaliTypeRegistrySignalConnectorTypeP(void)
892 ResetFunctorCounts();
894 TestApplication application;
896 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
897 DALI_TEST_CHECK( type );
899 BaseHandle handle = type.CreateInstance();
900 DALI_TEST_CHECK( handle );
902 MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
903 DALI_TEST_CHECK( customHandle );
906 TestConnectionTracker tracker;
908 bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
909 DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
910 DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
911 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
912 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
914 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
915 customHandle.GetCustomSignal().Emit();
916 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
917 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
918 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
920 // tracker should automatically disconnect here
921 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
922 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
924 // Test that functor is disconnected
925 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
926 customHandle.GetCustomSignal().Emit();
927 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
928 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
929 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
934 int UtcDaliTypeRegistrySignalConnectorTypeN(void)
936 // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
938 ResetFunctorCounts();
940 TestApplication application;
942 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
943 DALI_TEST_CHECK( type );
945 TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
946 DALI_TEST_CHECK( baseType );
948 BaseHandle handle = type.CreateInstance();
949 DALI_TEST_CHECK( handle );
951 MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
952 DALI_TEST_CHECK( customHandle );
954 DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
956 DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
959 TestConnectionTracker tracker;
961 bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
962 DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
963 DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
964 DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
965 DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
968 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
969 customHandle.GetCustomSignal().Emit();
970 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
972 // tracker should have nothing to disconnect here
975 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
976 customHandle.GetCustomSignal().Emit();
977 DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
981 int UtcDaliTypeRegistryTypeActionP(void)
983 ResetFunctorCounts();
985 TestApplication application;
987 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
988 DALI_TEST_CHECK( type );
990 BaseHandle handle = type.CreateInstance();
991 DALI_TEST_CHECK( handle );
993 Property::Map attributes;
994 DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
995 DALI_TEST_CHECK( lastActionCustom == "act1" );
1000 int UtcDaliTypeRegistryTypeActionN(void)
1002 ResetFunctorCounts();
1004 TestApplication application;
1006 TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
1007 DALI_TEST_CHECK( type );
1009 BaseHandle handle = type.CreateInstance();
1010 DALI_TEST_CHECK( handle );
1012 Property::Map attributes;
1013 DALI_TEST_CHECK( !handle.DoAction( "unknownAction", attributes ) );
1018 int UtcDaliTypeRegistryPropertyRegistrationP(void)
1020 TestApplication application;
1021 TypeRegistry typeRegistry = TypeRegistry::Get();
1023 // Check property count before property registration
1024 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1025 DALI_TEST_CHECK( typeInfo );
1026 BaseHandle handle = typeInfo.CreateInstance();
1027 DALI_TEST_CHECK( handle );
1028 Actor customActor = Actor::DownCast( handle );
1029 DALI_TEST_CHECK( customActor );
1030 unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1032 std::string propertyName( "prop1" );
1033 int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
1034 Property::Type propertyType( Property::BOOLEAN );
1035 PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
1037 // Check property count after registration
1038 unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
1039 DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
1041 // Add custom property and check property count
1042 customActor.RegisterProperty( "customProp1", true );
1043 unsigned int customPropertyCount( customActor.GetPropertyCount() );
1044 DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
1046 // Set the property, ensure SetProperty called
1047 DALI_TEST_CHECK( !setPropertyCalled );
1048 customActor.SetProperty( propertyIndex, false );
1049 DALI_TEST_CHECK( setPropertyCalled );
1051 // Get the property, ensure GetProperty called
1052 DALI_TEST_CHECK( !getPropertyCalled );
1053 (void)customActor.GetProperty< bool >( propertyIndex );
1054 DALI_TEST_CHECK( getPropertyCalled );
1056 // Get the property using GetCurrentProperty and ensure GetProperty is called
1057 getPropertyCalled = false;
1058 DALI_TEST_CHECK( !getPropertyCalled );
1059 customActor.GetCurrentProperty< bool >( propertyIndex );
1060 DALI_TEST_CHECK( getPropertyCalled );
1062 // Check the property name
1063 DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1064 DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1066 // Check the property index
1067 DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1069 // Check the property type
1070 DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1072 // Check property count of type-info is 1
1073 Property::IndexContainer indices;
1074 typeInfo.GetPropertyIndices( indices );
1076 size_t typePropertyCount = typeInfo.GetPropertyCount();
1077 DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1078 DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION );
1080 // Ensure indices returned from actor and customActor differ by two
1081 Actor actor = Actor::New();
1082 actor.GetPropertyIndices( indices );
1083 unsigned int actorIndices = indices.Size();
1084 customActor.GetPropertyIndices( indices );
1085 unsigned int customActorIndices = indices.Size();
1086 DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1090 int UtcDaliTypeRegistryPropertyRegistrationN(void)
1092 TestApplication application;
1093 TypeRegistry typeRegistry = TypeRegistry::Get();
1095 // Attempt to register a property type out-of-bounds index (less than)
1098 PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1099 tet_result( TET_FAIL );
1101 catch ( DaliException& e )
1103 DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1106 // Attempt to register a property type out-of-bounds index (greater than)
1109 PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
1110 tet_result( TET_FAIL );
1112 catch ( DaliException& e )
1114 DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1120 int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
1122 TestApplication application;
1123 TypeRegistry typeRegistry = TypeRegistry::Get();
1125 // Check property count before property registration
1126 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1127 DALI_TEST_CHECK( typeInfo );
1128 BaseHandle handle = typeInfo.CreateInstance();
1129 DALI_TEST_CHECK( handle );
1130 Actor customActor = Actor::DownCast( handle );
1131 DALI_TEST_CHECK( customActor );
1132 Stage::GetCurrent().Add(customActor);
1134 unsigned int customPropertyCount( customActor.GetPropertyCount() );
1136 // Register animatable property
1137 std::string animatablePropertyName( "animatableProp1" );
1138 int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1139 Property::Type animatablePropertyType( Property::FLOAT );
1140 AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1142 // Check property count after registration
1143 DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1145 // Set the animatable property value
1146 customActor.SetProperty( animatablePropertyIndex, 25.0f );
1148 // Render and notify
1149 application.SendNotification();
1150 application.Render();
1152 // Check the animatable property value
1153 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
1155 // Check the animatable property name
1156 DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1158 // Check the animatable property index
1159 DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1161 // Check the animatable property type
1162 DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1164 // Check property count of type-info is 1
1165 Property::IndexContainer indices;
1166 typeInfo.GetPropertyIndices( indices );
1167 DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1169 // Ensure indices returned from actor and customActor differ by one
1170 Actor actor = Actor::New();
1171 actor.GetPropertyIndices( indices );
1172 unsigned int actorIndices = indices.Size();
1173 customActor.GetPropertyIndices( indices );
1174 unsigned int customActorIndices = indices.Size();
1175 DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1177 // check that the property is animatable
1178 Animation animation = Animation::New(0.2f);
1179 animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
1182 // Target value should change straight away
1183 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION );
1185 // Render and notify, animation play for 0.05 seconds
1186 application.SendNotification();
1187 application.Render(50);
1188 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1189 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
1191 // Render and notify, animation play for another 0.1 seconds
1192 application.SendNotification();
1193 application.Render(100);
1194 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1195 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1200 int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
1202 TestApplication application;
1203 TypeRegistry typeRegistry = TypeRegistry::Get();
1205 // Attempt to register an animatable property type out-of-bounds index (less than)
1208 AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1209 tet_result( TET_FAIL );
1211 catch ( DaliException& e )
1213 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1216 // Attempt to register an animatable property type out-of-bounds index (greater than)
1219 AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1220 tet_result( TET_FAIL );
1222 catch ( DaliException& e )
1224 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1230 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
1232 TestApplication application;
1233 TypeRegistry typeRegistry = TypeRegistry::Get();
1235 // Check property count before property registration
1236 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1237 DALI_TEST_CHECK( typeInfo );
1238 BaseHandle handle = typeInfo.CreateInstance();
1239 DALI_TEST_CHECK( handle );
1240 Actor customActor = Actor::DownCast( handle );
1241 DALI_TEST_CHECK( customActor );
1242 Stage::GetCurrent().Add(customActor);
1244 unsigned int customPropertyCount( customActor.GetPropertyCount() );
1246 // Register animatable property
1247 std::string animatablePropertyName( "animatableProp1" );
1248 int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1249 AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
1251 // Check property count after registration
1252 DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1254 // Render and notify
1255 application.SendNotification();
1256 application.Render();
1258 // Check the animatable property value
1259 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
1261 // Check the animatable property name
1262 DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1264 // Check the animatable property index
1265 DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1267 // Check the animatable property type
1268 DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
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 );
1275 // Ensure indices returned from actor and customActor differ by one
1276 Actor actor = Actor::New();
1277 actor.GetPropertyIndices( indices );
1278 unsigned int actorIndices = indices.Size();
1279 customActor.GetPropertyIndices( indices );
1280 unsigned int customActorIndices = indices.Size();
1281 DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1283 // check that the property is animatable
1284 Animation animation = Animation::New(0.2f);
1285 animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
1288 // Target value should change straight away
1289 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION );
1291 // Render and notify, animation play for 0.05 seconds
1292 application.SendNotification();
1293 application.Render(50);
1294 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
1295 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
1297 // Render and notify, animation play for another 0.1 seconds
1298 application.SendNotification();
1299 application.Render(100);
1300 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
1301 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
1306 int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
1308 TestApplication application;
1309 TypeRegistry typeRegistry = TypeRegistry::Get();
1311 // Attempt to register an animatable property type out-of-bounds index (less than)
1314 AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
1315 tet_result( TET_FAIL );
1317 catch ( DaliException& e )
1319 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1322 // Attempt to register an animatable property type out-of-bounds index (greater than)
1325 AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
1326 tet_result( TET_FAIL );
1328 catch ( DaliException& e )
1330 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1336 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
1338 TestApplication application;
1339 TypeRegistry typeRegistry = TypeRegistry::Get();
1341 // Check property count before property registration
1342 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1343 DALI_TEST_CHECK( typeInfo );
1344 BaseHandle handle = typeInfo.CreateInstance();
1345 DALI_TEST_CHECK( handle );
1346 Actor customActor = Actor::DownCast( handle );
1347 DALI_TEST_CHECK( customActor );
1349 unsigned int customPropertyCount( customActor.GetPropertyCount() );
1351 // Register animatable property
1352 std::string animatablePropertyName( "animatableProp1" );
1353 int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1354 Property::Type animatablePropertyType( Property::VECTOR2 );
1355 AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
1357 // Check property count after registration
1358 DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
1360 // Set the animatable property value
1361 customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
1363 // Render and notify
1364 application.SendNotification();
1365 application.Render();
1367 // Check the animatable property value
1368 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
1370 // Check the animatable property name
1371 DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
1373 // Check the animatable property index
1374 DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
1376 // Check the animatable property type
1377 DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
1379 // Check property count of type-info is 1
1380 Property::IndexContainer indices;
1381 typeInfo.GetPropertyIndices( indices );
1382 DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
1384 // Register animatable property components
1385 std::string animatablePropertyComponentName1( "animatableProp1X" );
1386 int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
1387 AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
1389 std::string animatablePropertyComponentName2( "animatableProp1Y" );
1390 int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1391 AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
1393 // Check property count after registration
1394 DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
1396 // Check the animatable property component value
1397 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
1398 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1400 // Set the animatable property component value
1401 customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
1403 // Render and notify
1404 application.SendNotification();
1405 application.Render();
1407 // Check the animatable property value
1408 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
1409 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1410 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
1412 // Set the animatable property component value
1413 customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
1415 // Render and notify
1416 application.SendNotification();
1417 application.Render();
1419 // Check the animatable property value
1420 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
1421 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
1422 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
1424 // Ensure indices returned from actor and customActor differ by three
1425 Actor actor = Actor::New();
1426 actor.GetPropertyIndices( indices );
1427 unsigned int actorIndices = indices.Size();
1428 customActor.GetPropertyIndices( indices );
1429 unsigned int customActorIndices = indices.Size();
1430 DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
1435 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void)
1437 TestApplication application;
1438 TypeRegistry typeRegistry = TypeRegistry::Get();
1440 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1441 DALI_TEST_CHECK( typeInfo );
1442 BaseHandle handle = typeInfo.CreateInstance();
1443 DALI_TEST_CHECK( handle );
1444 Actor customActor = Actor::DownCast( handle );
1445 DALI_TEST_CHECK( customActor );
1447 const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1448 const unsigned int xComponentIndex = index + 1;
1449 const unsigned int yComponentIndex = index + 2;
1450 const Vector2 initialValue( 20.0f, 40.0f );
1452 // Register animatable property & its components
1453 AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1454 AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1455 AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1457 // Check the animatable property value
1458 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
1459 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1460 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1462 // Render and notify
1463 application.SendNotification();
1464 application.Render();
1466 // Check the animatable property current value
1467 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
1468 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1469 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1472 const Vector2 targetValue( 45.0f, 53.0f );
1473 const Vector2 relativeValue( targetValue - initialValue );
1475 Animation animation = Animation::New( 1.0f );
1476 animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1477 animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1480 // Target values should change straight away
1481 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
1482 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1483 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1488 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void)
1490 TestApplication application;
1491 TypeRegistry typeRegistry = TypeRegistry::Get();
1493 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1494 DALI_TEST_CHECK( typeInfo );
1495 BaseHandle handle = typeInfo.CreateInstance();
1496 DALI_TEST_CHECK( handle );
1497 Actor customActor = Actor::DownCast( handle );
1498 DALI_TEST_CHECK( customActor );
1500 const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1501 const unsigned int xComponentIndex = index + 1;
1502 const unsigned int yComponentIndex = index + 2;
1503 const unsigned int zComponentIndex = index + 3;
1504 const Vector3 initialValue( 20.0f, 40.0f, 50.0f );
1506 // Register animatable property & its components
1507 AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1508 AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1509 AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1510 AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
1512 // Check the animatable property value
1513 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
1514 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1515 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1516 DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1518 // Render and notify
1519 application.SendNotification();
1520 application.Render();
1522 // Check the animatable property current value
1523 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
1524 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1525 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1526 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1529 const Vector3 targetValue( 45.0f, 53.0f, 25.0f );
1530 const Vector3 relativeValue( targetValue - initialValue );
1532 Animation animation = Animation::New( 1.0f );
1533 animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1534 animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1535 animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
1538 // Target values should change straight away
1539 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
1540 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1541 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1542 DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
1547 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void)
1549 TestApplication application;
1550 TypeRegistry typeRegistry = TypeRegistry::Get();
1552 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1553 DALI_TEST_CHECK( typeInfo );
1554 BaseHandle handle = typeInfo.CreateInstance();
1555 DALI_TEST_CHECK( handle );
1556 Actor customActor = Actor::DownCast( handle );
1557 DALI_TEST_CHECK( customActor );
1559 const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1560 const unsigned int xComponentIndex = index + 1;
1561 const unsigned int yComponentIndex = index + 2;
1562 const unsigned int zComponentIndex = index + 3;
1563 const unsigned int wComponentIndex = index + 4;
1564 const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f );
1566 // Register animatable property & its components
1567 AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
1568 AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
1569 AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
1570 AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
1571 AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 );
1573 // Check the animatable property value
1574 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
1575 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1576 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1577 DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1578 DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
1580 // Render and notify
1581 application.SendNotification();
1582 application.Render();
1584 // Check the animatable property current value
1585 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
1586 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
1587 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
1588 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
1589 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
1592 const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f );
1593 const Vector4 relativeValue( targetValue - initialValue );
1595 Animation animation = Animation::New( 1.0f );
1596 animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
1597 animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
1598 animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
1599 animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w );
1602 // Target values should change straight away
1603 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
1604 DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
1605 DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
1606 DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
1607 DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION );
1612 int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
1614 TestApplication application;
1615 TypeRegistry typeRegistry = TypeRegistry::Get();
1617 // Register animatable property with the type of Vector2
1618 int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
1619 AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", animatablePropertyIndex1, Property::VECTOR2 );
1621 // Attempt to register an animatable property component out-of-bounds index (less than)
1624 AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
1625 tet_result( TET_FAIL );
1627 catch ( DaliException& e )
1629 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1632 // Attempt to register an animatable property component out-of-bounds index (greater than)
1635 AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
1636 tet_result( TET_FAIL );
1638 catch ( DaliException& e )
1640 DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1643 // Register an animatable property component
1644 AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
1646 // Attempt to register another animatable property component with the same component index
1649 AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
1650 tet_result( TET_FAIL );
1652 catch ( DaliException& e )
1654 DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
1657 // Register animatable property with the type of boolean
1658 int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
1659 AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2", animatablePropertyIndex2, Property::BOOLEAN );
1661 // Attempt to register an animatable property component for the above property with boolean type
1664 AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X", animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
1665 tet_result( TET_FAIL );
1667 catch ( DaliException& e )
1669 DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
1675 int UtcDaliTypeRegistryChildPropertyRegistrationP(void)
1677 TestApplication application;
1678 TypeRegistry typeRegistry = TypeRegistry::Get();
1680 // Check property count before property registration
1681 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
1682 DALI_TEST_CHECK( typeInfo );
1683 BaseHandle handle = typeInfo.CreateInstance();
1684 DALI_TEST_CHECK( handle );
1685 Actor customActor = Actor::DownCast( handle );
1686 DALI_TEST_CHECK( customActor );
1687 unsigned int initialPropertyCount( customActor.GetPropertyCount() );
1689 // Register child properties to the parent
1690 std::string propertyName( "childProp1" );
1691 int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1692 Property::Type propertyType( Property::BOOLEAN );
1693 ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType );
1695 std::string propertyName2( "childProp2" );
1696 int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 );
1697 Property::Type propertyType2( Property::INTEGER );
1698 ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 );
1700 std::string propertyName3( "childProp3" );
1701 int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 );
1702 Property::Type propertyType3( Property::FLOAT );
1703 ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 );
1705 std::string propertyName4( "childProp4" );
1706 int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 );
1707 Property::Type propertyType4( Property::INTEGER );
1708 ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 );
1710 // Check property count are not changed because the child properties will not be created for the parent
1711 DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION );
1713 // check the child property type
1714 Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
1715 Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
1716 DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
1718 std::string unRegisteredChildName( typeInfoImpl.GetChildPropertyName( CHILD_PROPERTY_REGISTRATION_START_INDEX + 4 ) );
1719 DALI_TEST_EQUALS( unRegisteredChildName, "", TEST_LOCATION );
1721 // Create a child actor
1722 Actor childActor = Actor::New();
1723 DALI_TEST_CHECK( childActor );
1724 unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() );
1726 // The type of child properties should be Property::None as the child hasn't registered any child property yet.
1727 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION );
1728 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION );
1729 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION );
1730 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION );
1732 // Set the value for the first child property when the child actor doesn't have a parent yet
1733 childActor.SetProperty(propertyIndex, true);
1735 // Check that the first child property is dynamically created
1736 DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION );
1738 // Check the first child property value
1739 DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION );
1741 // Check the first child property type
1742 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1744 // Check that the first child property have no name, as it doesn't have a parent yet.
1745 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION );
1747 // Check that the first property can't be accessed through its name, as it doesn't have a parent yet.
1748 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION );
1750 // Create a custom property for the child with the same name as the second child property registered to the parent
1751 Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE);
1753 // Check that the custom property is created
1754 DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION );
1756 // Check the property value
1757 DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1759 // Check the property index
1760 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION );
1762 // Check the property type
1763 DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1765 // Check the property name
1766 DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION );
1768 // Now add the child actor to the parent
1769 customActor.Add( childActor );
1771 // Check that the first child property now has the correct name as previously registered to the parent
1772 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1774 // Check that the child property index for the first child property can now be retrieved through its child property name
1775 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1777 // Check that the second child property now has the correct index as previously registered to the parent
1778 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION );
1780 // Check that the second child property can be accessed through both its custom property index and its child property index
1781 DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
1782 DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION );
1783 DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
1784 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION );
1786 // Check that the child property index for the second child property can now be retrieved through its child property name
1787 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION );
1789 // Set the value for the third child property when the child actor is already added to the parent
1790 childActor.SetProperty(propertyIndex3, 0.15f);
1792 // Check that the third child property is dynamically created
1793 DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION );
1795 // Check the third child property value
1796 DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION );
1798 // Check the third child property type
1799 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION );
1801 // Check the third child property name
1802 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION );
1804 // Check the third child property index.
1805 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION );
1807 // Create a custom property for the child with the same name as the fourth child property registered to the parent
1808 Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE);
1810 // Check that the custom property is created
1811 DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION );
1813 // Check the fourth child property value
1814 DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION );
1815 DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION );
1817 // Check the fourth child property type
1818 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION );
1819 DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION );
1821 // Check the fourth child property name
1822 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION );
1823 DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION );
1825 // Check the fourth child property index.
1826 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION );
1828 // Now create another parent actor with different child properties registered
1829 TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" );
1830 DALI_TEST_CHECK( typeInfo2 );
1831 BaseHandle handle2 = typeInfo2.CreateInstance();
1832 DALI_TEST_CHECK( handle2 );
1833 Actor customActor2 = Actor::DownCast( handle2 );
1834 DALI_TEST_CHECK( customActor2 );
1836 // Register child properties to the new parent
1837 std::string newPropertyName( "newChildProp" );
1838 int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent
1839 Property::Type newPropertyType( Property::VECTOR2 );
1840 ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType );
1842 std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent
1843 int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent
1844 Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent
1845 ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 );
1847 // Now move the child actor to the new parent
1848 customActor2.Add( childActor );
1850 // "childProp1" is not a valid child property supported by the new parent, so nothing changed
1851 DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
1852 DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
1853 DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
1855 // "childProp3" is a valid child property supported by the new parent
1856 // So it should get its new child property index and should just work
1857 DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION );
1858 DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION );
1859 DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION );
1860 DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION );
1862 // Now register a custom property called "newChildProp"
1863 Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE);
1865 // Check that the custom property is created
1866 DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION );
1868 // This is a valid child property registered to the new parent
1869 // So should be able to access it through both its custom property index and its registered child property index
1870 DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION );
1871 DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION );
1872 DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same
1873 DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION );
1874 DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1875 DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
1877 // Should return the child property index by given its name
1878 DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION );
1884 int UtcDaliTypeRegistryChildPropertyRegistrationN(void)
1886 TestApplication application;
1887 TypeRegistry typeRegistry = TypeRegistry::Get();
1889 // Attempt to register a child property type out-of-bounds index (less than)
1892 ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
1893 tet_result( TET_FAIL );
1895 catch ( DaliException& e )
1897 DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1900 // Attempt to register a child property type out-of-bounds index (greater than)
1903 ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
1904 tet_result( TET_FAIL );
1906 catch ( DaliException& e )
1908 DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
1915 /*******************************************************************************
1917 * Action through the base handle
1919 ******************************************************************************/
1920 int UtcDaliTypeRegistryActionViaBaseHandle(void)
1922 TestApplication application;
1926 type = TypeRegistry::Get().GetTypeInfo( "Actor" );
1927 DALI_TEST_CHECK( type );
1929 BaseHandle hdl = type.CreateInstance();
1930 DALI_TEST_CHECK( hdl );
1932 Actor a = Actor::DownCast(hdl);
1933 DALI_TEST_CHECK( a );
1935 a.SetVisible(false);
1937 application.SendNotification();
1938 application.Render(0);
1939 DALI_TEST_CHECK(!a.IsVisible());
1941 Property::Map attributes;
1943 DALI_TEST_CHECK(hdl.DoAction("show", attributes));
1945 application.SendNotification();
1946 application.Render(0);
1947 DALI_TEST_CHECK(a.IsVisible());
1949 DALI_TEST_CHECK(!hdl.DoAction("unknownAction", attributes));
1953 int UtcDaliPropertyRegistrationFunctions(void)
1955 TestApplication application;
1956 int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
1958 // Attempt to register a property without a setter
1961 PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
1962 tet_result( TET_PASS );
1964 catch ( DaliException& e )
1966 tet_result( TET_FAIL );
1969 // Attempt to register a property without a getter
1972 PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, NULL );
1973 tet_result( TET_FAIL );
1975 catch ( DaliException& e )
1977 DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
1982 int UtcDaliPropertyRegistrationAddSameIndex(void)
1984 TestApplication application;
1985 int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
1987 // Add one property with a valid property index
1988 PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1990 // Attempt to add another property with the same index
1993 PropertyRegistration property2( customType1, "propName2", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
1995 catch ( DaliException& e )
1997 DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
2000 int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
2002 // Add one property with a valid property index
2003 AnimatablePropertyRegistration property3( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN );
2005 // Attempt to add another property with the same index
2008 AnimatablePropertyRegistration property4( customType1, "animPropName2", animatablePropertyIndex, Property::BOOLEAN );
2010 catch ( DaliException& e )
2012 DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
2017 int UtcDaliPropertyRegistrationPropertyWritableP(void)
2019 TestApplication application;
2020 int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
2021 int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
2023 // Add two properties, one with SetProperty, one without
2024 PropertyRegistration property1( customType1, "propNameReadwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
2025 PropertyRegistration property2( customType1, "propNameReadonly", propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
2027 // Create custom-actor
2028 TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2029 DALI_TEST_CHECK( typeInfo );
2030 BaseHandle handle = typeInfo.CreateInstance();
2031 DALI_TEST_CHECK( handle );
2032 Actor customActor = Actor::DownCast( handle );
2033 DALI_TEST_CHECK( customActor );
2035 // Check whether properties are writable
2036 DALI_TEST_CHECK( customActor.IsPropertyWritable( propertyIndex1 ) );
2037 DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
2040 // Check the property is writable in the type registry
2041 Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
2043 DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION );
2048 int UtcDaliPropertyRegistrationPropertyWritableN(void)
2050 // Currently Actors don't register properties with the type registry
2052 TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2053 Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
2057 typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR);
2058 tet_result( TET_FAIL );
2061 catch ( DaliException& e )
2063 DALI_TEST_ASSERT( e, "Cannot find property index", TEST_LOCATION );
2068 int UtcDaliPropertyRegistrationPropertyAnimatable(void)
2070 TestApplication application;
2071 int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
2072 int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
2074 // These properties are not animatable
2075 PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
2077 // These properties are animatable
2078 AnimatablePropertyRegistration property2( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN );
2080 // Create custom-actor
2081 TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2082 DALI_TEST_CHECK( typeInfo );
2083 BaseHandle handle = typeInfo.CreateInstance();
2084 DALI_TEST_CHECK( handle );
2085 Actor customActor = Actor::DownCast( handle );
2086 DALI_TEST_CHECK( customActor );
2088 // Check if animatable
2089 DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
2090 DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
2092 // Create another instance of custom-actor
2093 BaseHandle handle2 = typeInfo.CreateInstance();
2094 DALI_TEST_CHECK( handle2 );
2095 Actor customActor2 = Actor::DownCast( handle2 );
2096 DALI_TEST_CHECK( customActor2 );
2098 // Check if animatable
2099 DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
2100 DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
2104 int UtcDaliPropertyRegistrationInvalidGetAndSet(void)
2106 TestApplication application;
2107 int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
2108 int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
2110 // Create custom-actor
2111 TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
2112 DALI_TEST_CHECK( typeInfo );
2113 BaseHandle handle = typeInfo.CreateInstance();
2114 DALI_TEST_CHECK( handle );
2115 Actor customActor = Actor::DownCast( handle );
2116 DALI_TEST_CHECK( customActor );
2118 // Try to set an index that hasn't been added
2121 customActor.SetProperty( propertyIndex, true );
2122 tet_result( TET_FAIL );
2124 catch ( DaliException& e )
2126 DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
2131 customActor.SetProperty( animatablePropertyIndex, true );
2132 tet_result( TET_FAIL );
2134 catch ( DaliException& e )
2136 DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
2139 // Try to get an index that hasn't been added
2142 (void) customActor.GetProperty< bool >( propertyIndex );
2143 tet_result( TET_FAIL );
2145 catch ( DaliException& e )
2147 DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
2152 (void) customActor.GetProperty< bool >( animatablePropertyIndex );
2153 tet_result( TET_FAIL );
2155 catch ( DaliException& e )
2157 DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
2163 int UtcDaliLongPressGestureDetectorTypeRegistry(void)
2165 TestApplication application;
2167 Actor actor = Actor::New();
2168 actor.SetSize(100.0f, 100.0f);
2169 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2170 Stage::GetCurrent().Add(actor);
2174 type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
2175 DALI_TEST_CHECK( type );
2176 BaseHandle handle = type.CreateInstance();
2177 DALI_TEST_CHECK( handle );
2178 LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
2179 DALI_TEST_CHECK( detector );
2181 // Attach actor to detector
2183 GestureReceivedFunctor functor( data );
2184 detector.Attach(actor);
2186 // Connect to signal through type
2187 handle.ConnectSignal( &application, "longPressDetected", functor );
2189 // Render and notify
2190 application.SendNotification();
2191 application.Render();
2194 application.ProcessEvent(GenerateLongPress(Gesture::Possible, 1u, Vector2(50.0f, 10.0f)));
2195 application.ProcessEvent(GenerateLongPress(Gesture::Started, 1u, Vector2(50.0f, 10.0f)));
2196 application.ProcessEvent(GenerateLongPress(Gesture::Finished, 1u, Vector2(50.0f, 10.0f)));
2197 DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2201 int UtcDaliPanGestureDetectorTypeRegistry(void)
2203 TestApplication application;
2205 Actor actor = Actor::New();
2206 actor.SetSize(100.0f, 100.0f);
2207 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2208 Stage::GetCurrent().Add(actor);
2212 type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
2213 DALI_TEST_CHECK( type );
2214 BaseHandle handle = type.CreateInstance();
2215 DALI_TEST_CHECK( handle );
2216 PanGestureDetector detector = PanGestureDetector::DownCast( handle );
2217 DALI_TEST_CHECK( detector );
2219 // Attach actor to detector
2221 GestureReceivedFunctor functor( data );
2222 detector.Attach(actor);
2224 // Connect to signal through type
2225 handle.ConnectSignal( &application, "panDetected", functor );
2227 // Render and notify
2228 application.SendNotification();
2229 application.Render();
2232 application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2233 application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2234 application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(10.0f, 20.0f), Vector2(20.0f, 20.0f), 10));
2235 DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2239 int UtcDaliPinchGestureDetectorTypeRegistry(void)
2241 TestApplication application;
2243 Actor actor = Actor::New();
2244 actor.SetSize(100.0f, 100.0f);
2245 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2246 Stage::GetCurrent().Add(actor);
2250 type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
2251 DALI_TEST_CHECK( type );
2252 BaseHandle handle = type.CreateInstance();
2253 DALI_TEST_CHECK( handle );
2254 PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
2255 DALI_TEST_CHECK( detector );
2257 // Attach actor to detector
2259 GestureReceivedFunctor functor( data );
2260 detector.Attach(actor);
2262 // Connect to signal through type
2263 handle.ConnectSignal( &application, "pinchDetected", functor );
2265 // Render and notify
2266 application.SendNotification();
2267 application.Render();
2270 application.ProcessEvent(GeneratePinch(Gesture::Started, 10.0f, 50.0f, Vector2(20.0f, 10.0f)));
2271 DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2275 int UtcDaliTapGestureDetectorTypeRegistry(void)
2277 TestApplication application;
2279 Actor actor = Actor::New();
2280 actor.SetSize(100.0f, 100.0f);
2281 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
2282 Stage::GetCurrent().Add(actor);
2286 type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
2287 DALI_TEST_CHECK( type );
2288 BaseHandle handle = type.CreateInstance();
2289 DALI_TEST_CHECK( handle );
2290 TapGestureDetector detector = TapGestureDetector::DownCast( handle );
2291 DALI_TEST_CHECK( detector );
2293 // Attach actor to detector
2295 GestureReceivedFunctor functor( data );
2296 detector.Attach(actor);
2298 // Connect to signal through type
2299 handle.ConnectSignal( &application, "tapDetected", functor );
2301 // Render and notify
2302 application.SendNotification();
2303 application.Render();
2306 application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
2307 application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
2308 DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
2312 int UtcDaliTypeRegistryNamedType(void)
2314 TestApplication application;
2315 TypeRegistry typeRegistry = TypeRegistry::Get();
2317 // Create a normal actor
2318 BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
2319 DALI_TEST_CHECK( actorHandle );
2320 Actor actor( Actor::DownCast( actorHandle ) );
2321 DALI_TEST_CHECK( actor );
2322 unsigned int actorPropertyCount( actor.GetPropertyCount() );
2324 // Create Named Actor Type
2325 BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
2326 DALI_TEST_CHECK( namedHandle );
2327 Actor namedActor( Actor::DownCast( namedHandle ) );
2328 DALI_TEST_CHECK( namedActor );
2329 unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
2331 DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
2335 int UtcDaliTypeInfoGetActionNameP(void)
2337 TestApplication application;
2338 TypeRegistry typeRegistry = TypeRegistry::Get();
2340 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2341 DALI_TEST_CHECK( typeInfo );
2343 DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2345 std::string name = typeInfo.GetActionName(0);
2347 DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
2350 TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2352 // search for show action in base class, given a derived class
2353 bool foundChildAction = false;
2354 for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ )
2357 std::string name = typeInfo2.GetActionName( i );
2360 foundChildAction = true;
2365 DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION );
2371 int UtcDaliTypeInfoGetActionNameN(void)
2373 TestApplication application;
2374 TypeRegistry typeRegistry = TypeRegistry::Get();
2376 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2377 DALI_TEST_CHECK( typeInfo );
2379 DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
2381 std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
2383 DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2388 int UtcDaliTypeInfoGetSignalNameP(void)
2390 TestApplication application;
2391 TypeRegistry typeRegistry = TypeRegistry::Get();
2393 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2394 DALI_TEST_CHECK( typeInfo );
2396 DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2398 std::string name = typeInfo.GetSignalName(0);
2400 DALI_TEST_EQUALS( name, "touched", TEST_LOCATION );
2402 TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
2404 // search for signal in base class, given a derived class
2405 bool foundSignal = false;
2406 for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ )
2409 std::string name = typeInfo2.GetSignalName( i );
2410 if( name == "touched")
2417 DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION );
2422 int UtcDaliTypeInfoGetSignalNameN(void)
2424 TestApplication application;
2425 TypeRegistry typeRegistry = TypeRegistry::Get();
2427 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2428 DALI_TEST_CHECK( typeInfo );
2430 DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
2432 std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
2434 DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
2440 int UtcDaliTypeInfoGetCreatorP(void)
2442 TestApplication application;
2443 TypeRegistry typeRegistry = TypeRegistry::Get();
2445 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2446 DALI_TEST_CHECK( typeInfo );
2448 TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2449 DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
2453 BaseHandle handle = createFn();
2454 DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
2460 int UtcDaliTypeInfoGetCreatorN(void)
2462 TestApplication application;
2463 TypeRegistry typeRegistry = TypeRegistry::Get();
2465 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
2466 DALI_TEST_CHECK( typeInfo );
2468 TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
2469 DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
2474 int UtcDaliTypeInfoGetPropertyCountP1(void)
2476 TestApplication application;
2477 TypeRegistry typeRegistry = TypeRegistry::Get();
2479 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
2480 DALI_TEST_CHECK( typeInfo );
2481 size_t actorPropertyCount = typeInfo.GetPropertyCount();
2483 DALI_TEST_EQUALS( actorPropertyCount == 0 , true, TEST_LOCATION ); // No event only props
2487 int UtcDaliTypeInfoGetPropertyCountP2(void)
2489 TestApplication application;
2490 TypeRegistry typeRegistry = TypeRegistry::Get();
2492 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
2493 DALI_TEST_CHECK( typeInfo );
2494 size_t propertyCount = typeInfo.GetPropertyCount();
2495 Property::IndexContainer indices;
2496 typeInfo.GetPropertyIndices( indices );
2498 DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
2499 DALI_TEST_EQUALS( propertyCount == 2, true, TEST_LOCATION );
2504 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void)
2506 TestApplication application;
2507 TypeRegistry typeRegistry = TypeRegistry::Get();
2509 tet_infoline( "Register a type registered animatable property and ensure set/get behaviour works synchronously" );
2511 // Register animatable property
2512 const int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2513 AnimatablePropertyRegistration animatableProperty( customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT );
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 Stage::GetCurrent().Add(customActor);
2524 tet_infoline( "Set the value and ensure it changes straight away" );
2525 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2526 customActor.SetProperty( animatablePropertyIndex, 25.0f );
2527 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2529 tet_infoline( "Check latest scene-graph value is unchanged" );
2530 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
2532 // Render and notify
2533 application.SendNotification();
2534 application.Render();
2536 tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2538 DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2539 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
2544 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector2(void)
2546 TestApplication application;
2547 TypeRegistry typeRegistry = TypeRegistry::Get();
2549 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" );
2551 // Register the animatable propeties
2552 const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2553 const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2554 const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2555 AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector2( 13.0f, 24.0f ) );
2556 AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2557 AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2559 // Check property count before property registration
2560 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2561 DALI_TEST_CHECK( typeInfo );
2562 BaseHandle handle = typeInfo.CreateInstance();
2563 DALI_TEST_CHECK( handle );
2564 Actor customActor = Actor::DownCast( handle );
2565 DALI_TEST_CHECK( customActor );
2566 Stage::GetCurrent().Add(customActor);
2568 tet_infoline( "Get the component values, they should be the default value of the base-property" );
2569 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2570 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2571 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2573 tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2574 customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2575 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2576 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 24.0f ), TEST_LOCATION );
2578 customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2579 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2580 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2582 tet_infoline( "Check latest scene-graph value is unchanged" );
2583 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
2584 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2585 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2587 // Render and notify
2588 application.SendNotification();
2589 application.Render();
2591 tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2592 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2593 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2594 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2596 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
2597 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2598 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2600 tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2601 customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) );
2602 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2603 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2604 DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
2609 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector3(void)
2611 TestApplication application;
2612 TypeRegistry typeRegistry = TypeRegistry::Get();
2614 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" );
2616 // Register the animatable propeties
2617 const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2618 const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2619 const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2620 const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2621 AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector3( 13.0f, 24.0f, 35.0 ) );
2622 AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2623 AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2624 AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2626 // Check property count before property registration
2627 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2628 DALI_TEST_CHECK( typeInfo );
2629 BaseHandle handle = typeInfo.CreateInstance();
2630 DALI_TEST_CHECK( handle );
2631 Actor customActor = Actor::DownCast( handle );
2632 DALI_TEST_CHECK( customActor );
2633 Stage::GetCurrent().Add(customActor);
2635 tet_infoline( "Get the component values, they should be the default value of the base-property" );
2636 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2637 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2638 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2639 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2641 tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2642 customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2643 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2644 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 24.0f, 35.0f ), TEST_LOCATION );
2646 customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2647 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2648 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 35.0f ), TEST_LOCATION );
2650 customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2651 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2652 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2654 tet_infoline( "Check latest scene-graph value is unchanged" );
2655 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
2656 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2657 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2658 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2660 // Render and notify
2661 application.SendNotification();
2662 application.Render();
2664 tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2665 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2666 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2667 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2668 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2670 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
2671 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2672 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2673 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2675 tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2676 customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) );
2677 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2678 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2679 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2680 DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 1.0f, 2.0f, 3.0f ), TEST_LOCATION );
2685 int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector4(void)
2687 TestApplication application;
2688 TypeRegistry typeRegistry = TypeRegistry::Get();
2690 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" );
2692 // Register the animatable propeties
2693 const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
2694 const int componentZeroPropertyIndex( basePropertyIndex + 1 );
2695 const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
2696 const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
2697 const int componentThreePropertyIndex( componentTwoPropertyIndex + 1 );
2698 AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector4( 13.0f, 24.0f, 35.0, 47.0f ) );
2699 AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
2700 AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
2701 AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
2702 AnimatablePropertyComponentRegistration componentThreeAnimatableProperty( customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3 );
2704 // Check property count before property registration
2705 TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
2706 DALI_TEST_CHECK( typeInfo );
2707 BaseHandle handle = typeInfo.CreateInstance();
2708 DALI_TEST_CHECK( handle );
2709 Actor customActor = Actor::DownCast( handle );
2710 DALI_TEST_CHECK( customActor );
2711 Stage::GetCurrent().Add(customActor);
2713 tet_infoline( "Get the component values, they should be the default value of the base-property" );
2714 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2715 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2716 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2717 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2718 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2720 tet_infoline( "Set a component value and ensure it changes for the base property as well" );
2721 customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
2722 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2723 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2725 customActor.SetProperty( componentOnePropertyIndex, 225.0f );
2726 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2727 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 35.0f, 47.0f ), TEST_LOCATION );
2729 customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
2730 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2731 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 47.0f ), TEST_LOCATION );
2733 customActor.SetProperty( componentThreePropertyIndex, 435.0f );
2734 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2735 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2737 tet_infoline( "Check latest scene-graph value is unchanged" );
2738 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
2739 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
2740 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
2741 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
2742 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
2744 // Render and notify
2745 application.SendNotification();
2746 application.Render();
2748 tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
2749 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2750 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2751 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2752 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2753 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2755 DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
2756 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
2757 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
2758 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
2759 DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
2761 tet_infoline( "Set the base property value and ensure the component values reflect the change" );
2762 customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) );
2763 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
2764 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
2765 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
2766 DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 4.0f, TEST_LOCATION );
2767 DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 1.0f, 2.0f, 3.0f, 4.0f ), TEST_LOCATION );