From 649e8a4f076d45b47e26ff907ba5cbd2d7563dbd Mon Sep 17 00:00:00 2001 From: Jahangir Date: Thu, 16 Jun 2016 13:05:58 -0400 Subject: [PATCH] [ITC][dali-core][ACR-648][Added TC according to ACR] Change-Id: I8b1273a7c75f06de1a083a275f5fcc816cad3655 --- .../dali-core/tct-dali-core-native_common_iot.h | 2 + src/itc/dali-core/tct-dali-core-native_mobile.h | 2 + src/itc/dali-core/tct-dali-core-native_tv.h | 2 + src/itc/dali-core/tct-dali-core-native_wearable.h | 2 + .../type-registry/ITs-type-registry-common.h | 9 + .../dali-core/type-registry/ITs-type-registry.cpp | 664 ++++++++++++++++++++- 6 files changed, 679 insertions(+), 2 deletions(-) diff --git a/src/itc/dali-core/tct-dali-core-native_common_iot.h b/src/itc/dali-core/tct-dali-core-native_common_iot.h index 7d3e3d9..bef86bf 100755 --- a/src/itc/dali-core/tct-dali-core-native_common_iot.h +++ b/src/itc/dali-core/tct-dali-core-native_common_iot.h @@ -874,6 +874,7 @@ extern int ITcTypeInfogetActionCountGetSignalCount(void); extern int ITcTypeRegistrationRegisteredName(void); extern int ITcTypeRegistryGetTypeNames(void); extern int ITcTypeRegistryCopyAssign(void); +extern int ITcTypeRegistryChildPropertyRegistration(void); extern int ITcUint16PairFromFloatVec2(void); extern int ITcUint16PairFromFloatArray(void); extern int ITcUint16PairGetHeightWidth(void); @@ -1683,6 +1684,7 @@ testcase tc_array[] = { {"ITcTypeRegistrationRegisteredName", ITcTypeRegistrationRegisteredName, ITs_typeregistration_startup, ITs_typeregistration_cleanup}, {"ITcTypeRegistryGetTypeNames", ITcTypeRegistryGetTypeNames, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcTypeRegistryCopyAssign", ITcTypeRegistryCopyAssign, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, + {"ITcTypeRegistryChildPropertyRegistration", ITcTypeRegistryChildPropertyRegistration, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcUint16PairFromFloatVec2", ITcUint16PairFromFloatVec2, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairFromFloatArray", ITcUint16PairFromFloatArray, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairGetHeightWidth", ITcUint16PairGetHeightWidth, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, diff --git a/src/itc/dali-core/tct-dali-core-native_mobile.h b/src/itc/dali-core/tct-dali-core-native_mobile.h index 7d3e3d9..bef86bf 100755 --- a/src/itc/dali-core/tct-dali-core-native_mobile.h +++ b/src/itc/dali-core/tct-dali-core-native_mobile.h @@ -874,6 +874,7 @@ extern int ITcTypeInfogetActionCountGetSignalCount(void); extern int ITcTypeRegistrationRegisteredName(void); extern int ITcTypeRegistryGetTypeNames(void); extern int ITcTypeRegistryCopyAssign(void); +extern int ITcTypeRegistryChildPropertyRegistration(void); extern int ITcUint16PairFromFloatVec2(void); extern int ITcUint16PairFromFloatArray(void); extern int ITcUint16PairGetHeightWidth(void); @@ -1683,6 +1684,7 @@ testcase tc_array[] = { {"ITcTypeRegistrationRegisteredName", ITcTypeRegistrationRegisteredName, ITs_typeregistration_startup, ITs_typeregistration_cleanup}, {"ITcTypeRegistryGetTypeNames", ITcTypeRegistryGetTypeNames, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcTypeRegistryCopyAssign", ITcTypeRegistryCopyAssign, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, + {"ITcTypeRegistryChildPropertyRegistration", ITcTypeRegistryChildPropertyRegistration, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcUint16PairFromFloatVec2", ITcUint16PairFromFloatVec2, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairFromFloatArray", ITcUint16PairFromFloatArray, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairGetHeightWidth", ITcUint16PairGetHeightWidth, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, diff --git a/src/itc/dali-core/tct-dali-core-native_tv.h b/src/itc/dali-core/tct-dali-core-native_tv.h index 7d3e3d9..bef86bf 100755 --- a/src/itc/dali-core/tct-dali-core-native_tv.h +++ b/src/itc/dali-core/tct-dali-core-native_tv.h @@ -874,6 +874,7 @@ extern int ITcTypeInfogetActionCountGetSignalCount(void); extern int ITcTypeRegistrationRegisteredName(void); extern int ITcTypeRegistryGetTypeNames(void); extern int ITcTypeRegistryCopyAssign(void); +extern int ITcTypeRegistryChildPropertyRegistration(void); extern int ITcUint16PairFromFloatVec2(void); extern int ITcUint16PairFromFloatArray(void); extern int ITcUint16PairGetHeightWidth(void); @@ -1683,6 +1684,7 @@ testcase tc_array[] = { {"ITcTypeRegistrationRegisteredName", ITcTypeRegistrationRegisteredName, ITs_typeregistration_startup, ITs_typeregistration_cleanup}, {"ITcTypeRegistryGetTypeNames", ITcTypeRegistryGetTypeNames, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcTypeRegistryCopyAssign", ITcTypeRegistryCopyAssign, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, + {"ITcTypeRegistryChildPropertyRegistration", ITcTypeRegistryChildPropertyRegistration, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcUint16PairFromFloatVec2", ITcUint16PairFromFloatVec2, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairFromFloatArray", ITcUint16PairFromFloatArray, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairGetHeightWidth", ITcUint16PairGetHeightWidth, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, diff --git a/src/itc/dali-core/tct-dali-core-native_wearable.h b/src/itc/dali-core/tct-dali-core-native_wearable.h index 7d3e3d9..bef86bf 100755 --- a/src/itc/dali-core/tct-dali-core-native_wearable.h +++ b/src/itc/dali-core/tct-dali-core-native_wearable.h @@ -874,6 +874,7 @@ extern int ITcTypeInfogetActionCountGetSignalCount(void); extern int ITcTypeRegistrationRegisteredName(void); extern int ITcTypeRegistryGetTypeNames(void); extern int ITcTypeRegistryCopyAssign(void); +extern int ITcTypeRegistryChildPropertyRegistration(void); extern int ITcUint16PairFromFloatVec2(void); extern int ITcUint16PairFromFloatArray(void); extern int ITcUint16PairGetHeightWidth(void); @@ -1683,6 +1684,7 @@ testcase tc_array[] = { {"ITcTypeRegistrationRegisteredName", ITcTypeRegistrationRegisteredName, ITs_typeregistration_startup, ITs_typeregistration_cleanup}, {"ITcTypeRegistryGetTypeNames", ITcTypeRegistryGetTypeNames, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcTypeRegistryCopyAssign", ITcTypeRegistryCopyAssign, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, + {"ITcTypeRegistryChildPropertyRegistration", ITcTypeRegistryChildPropertyRegistration, ITs_typeRegistry_startup, ITs_typeRegistry_cleanup}, {"ITcUint16PairFromFloatVec2", ITcUint16PairFromFloatVec2, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairFromFloatArray", ITcUint16PairFromFloatArray, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, {"ITcUint16PairGetHeightWidth", ITcUint16PairGetHeightWidth, ITs_unit16_pair_startup, ITs_unit16_pair_cleanup}, diff --git a/src/itc/dali-core/type-registry/ITs-type-registry-common.h b/src/itc/dali-core/type-registry/ITs-type-registry-common.h index 1740eee..d04aee6 100755 --- a/src/itc/dali-core/type-registry/ITs-type-registry-common.h +++ b/src/itc/dali-core/type-registry/ITs-type-registry-common.h @@ -2,6 +2,15 @@ #define _ITS_TYPEREGISTRY_COMMON_H_ #include "dali-common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace std; using namespace Dali; diff --git a/src/itc/dali-core/type-registry/ITs-type-registry.cpp b/src/itc/dali-core/type-registry/ITs-type-registry.cpp index 71da993..8446112 100755 --- a/src/itc/dali-core/type-registry/ITs-type-registry.cpp +++ b/src/itc/dali-core/type-registry/ITs-type-registry.cpp @@ -34,13 +34,507 @@ void ITs_typeRegistry_cleanup(void) void TypeRegistryGetTypeNames(); void TypeRegistryCopyAssign(); +void TypeRegistryChildPropertyRegistration(); + + +namespace +{ + +// Stores data that is populated in the callback and will be read by the Test cases +struct SignalData +{ + SignalData() + : functorCalled( false ), + voidFunctorCalled( false ), + receivedGesture( Gesture::Clear ), + pressedActor() + {} + + void Reset() + { + functorCalled = false; + voidFunctorCalled = false; + + receivedGesture.numberOfTouches = 0u; + receivedGesture.screenPoint = Vector2(0.0f, 0.0f); + receivedGesture.localPoint = Vector2(0.0f, 0.0f); + + pressedActor.Reset(); + } + + bool functorCalled; + bool voidFunctorCalled; + LongPressGesture receivedGesture; + Actor pressedActor; +}; + +// Functor that sets the data when called +struct GestureReceivedFunctor +{ + GestureReceivedFunctor(SignalData& data) : signalData(data) { } + + void operator()(Actor actor, LongPressGesture longPress) + { + signalData.functorCalled = true; + signalData.receivedGesture = longPress; + signalData.pressedActor = actor; + } + + void operator()() + { + signalData.voidFunctorCalled = true; + } + + SignalData& signalData; +}; + +// Generate a LongPressGestureEvent to send to Core +Integration::LongPressGestureEvent GenerateLongPress( + Gesture::State state, + unsigned int numberOfTouches, + Vector2 point) +{ + Integration::LongPressGestureEvent longPress( state ); + + longPress.numberOfTouches = numberOfTouches; + longPress.point = point; + + return longPress; +} + +// Generate a PanGestureEvent to send to Core +Integration::PanGestureEvent GeneratePan( + Gesture::State state, + Vector2 previousPosition, + Vector2 currentPosition, + unsigned long timeDelta, + unsigned int numberOfTouches = 1, + unsigned int time = 1u) +{ + Integration::PanGestureEvent pan(state); + + pan.previousPosition = previousPosition; + pan.currentPosition = currentPosition; + pan.timeDelta = timeDelta; + pan.numberOfTouches = numberOfTouches; + pan.time = time; + + return pan; +} +// Generate a PinchGestureEvent to send to Core +Integration::PinchGestureEvent GeneratePinch( + Gesture::State state, + float scale, + float speed, + Vector2 centerpoint) +{ + Integration::PinchGestureEvent pinch(state); + + pinch.scale = scale; + pinch.speed = speed; + pinch.centerPoint = centerpoint; + + return pinch; +} +// Generate a TapGestureEvent to send to Core +Integration::TapGestureEvent GenerateTap( + Gesture::State state, + unsigned int numberOfTaps, + unsigned int numberOfTouches, + Vector2 point) +{ + Integration::TapGestureEvent tap( state ); + + tap.numberOfTaps = numberOfTaps; + tap.numberOfTouches = numberOfTouches; + tap.point = point; + + return tap; +} + +// +// Create function as Init function called +// +static bool CreateCustomInitCalled = false; +BaseHandle CreateCustomInit(void) +{ + CreateCustomInitCalled = true; + return BaseHandle(); +} + +static bool CreateCustomNamedInitCalled = false; +BaseHandle CreateCustomNamedInit(void) +{ + CreateCustomNamedInitCalled = true; + return BaseHandle(); +} + +const std::string scriptedName("PopupStyle"); +static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit ); + +// Property Registration +bool setPropertyCalled = false; +bool getPropertyCalled = false; +void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value ) +{ + setPropertyCalled = true; +} +Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ) +{ + getPropertyCalled = true; + return Property::Value( true ); +} + + + +/******************************************************************************* + * + * Custom Actor + * + ******************************************************************************/ +namespace Impl +{ +struct MyTestCustomActor : public CustomActorImpl +{ + typedef Signal< void ()> SignalType; + typedef Signal< void (float)> SignalTypeFloat; + + MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) ) + { } + + virtual ~MyTestCustomActor() + { } + + void ResetCallStack() + { + } + + // From CustomActorImpl + virtual void OnStageConnection( int depth ) + { + } + virtual void OnStageDisconnection() + { + } + virtual void OnChildAdd(Actor& child) + { + } + virtual void OnChildRemove(Actor& child) + { + } + virtual void OnSizeSet(const Vector3& targetSize) + { + } + virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) + { + } + virtual bool OnTouchEvent(const TouchEvent& event) + { + return true; + } + virtual bool OnHoverEvent(const HoverEvent& event) + { + return true; + } + virtual bool OnWheelEvent(const WheelEvent& event) + { + return true; + } + virtual bool OnKeyEvent(const KeyEvent& event) + { + return true; + } + virtual void OnKeyInputFocusGained() + { + } + virtual void OnKeyInputFocusLost() + { + } + virtual Vector3 GetNaturalSize() + { + return Vector3( 0.0f, 0.0f, 0.0f ); + } + + virtual float GetHeightForWidth( float width ) + { + return 0.0f; + } + + virtual float GetWidthForHeight( float height ) + { + return 0.0f; + } + + virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) + { + } + + virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) + { + } + + virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) + { + } + + virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) + { + return 0.0f; + } + + virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) + { + } + + virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) + { + return false; + } + +public: + + SignalType mSignal; +}; + +}; // namespace Impl + +class MyTestCustomActor : public CustomActor +{ +public: + + typedef Signal< void ()> SignalType; + typedef Signal< void (float)> SignalTypeFloat; + + MyTestCustomActor() + { + } + + static MyTestCustomActor New() + { + Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor; + return MyTestCustomActor( *p ); // takes ownership + } + + virtual ~MyTestCustomActor() + { + } + + static MyTestCustomActor DownCast( BaseHandle handle ) + { + MyTestCustomActor result; + + CustomActor custom = Dali::CustomActor::DownCast( handle ); + if ( custom ) + { + CustomActorImpl& customImpl = custom.GetImplementation(); + + Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); + + if (impl) + { + result = MyTestCustomActor(customImpl.GetOwner()); + } + } + + return result; + } + + SignalType& GetCustomSignal() + { + Dali::RefObject& obj = GetImplementation(); + return static_cast( obj ).mSignal; + } + +private: + + MyTestCustomActor(Internal::CustomActor* internal) + : CustomActor(internal) + { + } + + MyTestCustomActor( Impl::MyTestCustomActor& impl ) + : CustomActor( impl ) + { + } +}; + + +class MyTestCustomActor2 : public CustomActor +{ +public: + + MyTestCustomActor2() + { + } + + static MyTestCustomActor2 New() + { + return MyTestCustomActor2(); // takes ownership + } + + virtual ~MyTestCustomActor2() + { + } + + static MyTestCustomActor2 DownCast( BaseHandle handle ) + { + MyTestCustomActor2 result; + + CustomActor custom = Dali::CustomActor::DownCast( handle ); + if ( custom ) + { + CustomActorImpl& customImpl = custom.GetImplementation(); + + Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); + + if (impl) + { + result = MyTestCustomActor2(customImpl.GetOwner()); + } + } + + return result; + } + +private: + + MyTestCustomActor2(Internal::CustomActor* internal) + : CustomActor(internal) + { + } + + MyTestCustomActor2( Impl::MyTestCustomActor& impl ) + : CustomActor( impl ) + { + } +}; + +static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true ); + + +BaseHandle CreateCustom(void) +{ + return MyTestCustomActor::New(); +} + +static std::string lastSignalConnectionCustom; + +bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +{ + lastSignalConnectionCustom = signalName; + + bool connected( true ); + + Dali::BaseHandle handle(object); + MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle); + + if( "sig1" == signalName ) + { + customActor.GetCustomSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } + + return connected; +} + +bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +{ + lastSignalConnectionCustom = "failed"; + + return false; // This is supposed to fail +} + +struct CustomTestFunctor +{ + CustomTestFunctor() + { + ++mTotalInstanceCount; + ++mCurrentInstanceCount; + } + + CustomTestFunctor( const CustomTestFunctor& copyMe ) + { + ++mTotalInstanceCount; + ++mCurrentInstanceCount; + } + + ~CustomTestFunctor() + { + --mCurrentInstanceCount; + } + + void operator()() + { + ++mCallbackCount; + } + + static int mTotalInstanceCount; + static int mCurrentInstanceCount; + static int mCallbackCount; +}; + +int CustomTestFunctor::mTotalInstanceCount = 0; +int CustomTestFunctor::mCurrentInstanceCount = 0; +int CustomTestFunctor::mCallbackCount = 0; + +static void ResetFunctorCounts() +{ + CustomTestFunctor::mTotalInstanceCount = 0; + CustomTestFunctor::mCurrentInstanceCount = 0; + CustomTestFunctor::mCallbackCount = 0; +} + +static std::string lastActionCustom; +bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/) +{ + lastActionCustom = actionName; + return true; +} + +// Custom type registration +static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom ); + +// Custom signals +static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom ); +static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure ); +static const int TEST_SIGNAL_COUNT = 2; + +// Custom actions +static TypeAction customAction1( customType1, "act1", DoActionCustom); +static const int TEST_ACTION_COUNT = 1; + +class TestConnectionTracker : public ConnectionTracker +{ +public: + + TestConnectionTracker() + { + } +}; + +BaseHandle CreateNamedActorType() +{ + Actor actor = Actor::New(); + actor.SetName( "NamedActor" ); + return actor; +} + +TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType ); +PropertyRegistration namedActorPropertyOne( namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty ); + +} // Anonymous namespace namespace { enum TEST_CASES_LIST_TYPE_REGISTRy { TYPE_REGISTRY_GET_TYPE_NAMES, - TYPE_REGISTRY_COPY_ASSIGN + TYPE_REGISTRY_COPY_ASSIGN, + TYPE_REGISTRY_CHIELD_PROPERTY_REGISTRATION }; struct Type_Registry_TestApp : public ConnectionTracker @@ -61,7 +555,7 @@ namespace bool Tick() { mTimer.Stop(); - mApplication.Quit(); + mApplication.Quit(); return true; } @@ -76,6 +570,10 @@ namespace case TYPE_REGISTRY_COPY_ASSIGN: TypeRegistryCopyAssign(); break; + + case TYPE_REGISTRY_CHIELD_PROPERTY_REGISTRATION: + TypeRegistryChildPropertyRegistration(); + break; } } @@ -132,6 +630,144 @@ void TypeRegistryCopyAssign() DaliLog::PrintPass(); } +void TypeRegistryChildPropertyRegistration() +{ + TypeRegistry typeRegistry = TypeRegistry::Get(); + + TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); + DALI_CHECK_FAIL( !typeInfo ,"GetTypeInfo() is failed to get specified type"); + BaseHandle handle = typeInfo.CreateInstance(); + DALI_CHECK_FAIL( !handle ,"CreateInstance() is failed to create instance"); + Actor customActor = Actor::DownCast( handle ); + DALI_CHECK_FAIL( !customActor ,"Actor::DownCast() failed"); + unsigned int initialPropertyCount( customActor.GetPropertyCount() ); + + std::string propertyName( "childProp1" ); + int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + Property::Type propertyType( Property::BOOLEAN ); + ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType ); + + std::string propertyName2( "childProp2" ); + int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); + Property::Type propertyType2( Property::INTEGER ); + ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 ); + + std::string propertyName3( "childProp3" ); + int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 ); + Property::Type propertyType3( Property::FLOAT ); + ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 ); + + std::string propertyName4( "childProp4" ); + int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 ); + Property::Type propertyType4( Property::INTEGER ); + ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 ); + + DALI_CHECK_FAIL( initialPropertyCount != customActor.GetPropertyCount(),"Property count not match"); + + // Create a child actor + Actor childActor = Actor::New(); + DALI_CHECK_FAIL( !childActor, "Actor::New() filed."); + unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() ); + + childActor.SetProperty(propertyIndex, true); + DALI_CHECK_FAIL( initialChildActorPropertyCount + 1u != childActor.GetPropertyCount(), "Property count not match"); + + DALI_CHECK_FAIL( childActor.GetProperty< bool >( propertyIndex ) != true, "Property value not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( propertyIndex ) != propertyType, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex ) != "", "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName ) != Property::INVALID_INDEX, "Property index not match" ); + + Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE); + + DALI_CHECK_FAIL( initialChildActorPropertyCount + 2u != childActor.GetPropertyCount(), "Property count not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< int >( customPropertyIndex ) != 100, "Property index not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName2 ) != customPropertyIndex, "Property index not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( customPropertyIndex ) != propertyType2, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( customPropertyIndex ) != propertyName2, "Property name not match" ); + + customActor.Add( childActor ); + + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex ) != propertyName, "Property name not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName ) != propertyIndex, "Property index not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex2 ) != propertyName2, "Property name not match" ); + + DALI_CHECK_FAIL( childActor.GetProperty< int >( customPropertyIndex ) != 100, "Property index not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< int >( propertyIndex2 ) != 100, "Property index not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( customPropertyIndex ) != propertyType2, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( propertyIndex2 ) != propertyType2, "Property type not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName2 ) != propertyIndex2, "Property index not match" ); + + childActor.SetProperty(propertyIndex3, 0.15f); + + DALI_CHECK_FAIL( initialChildActorPropertyCount + 3u != childActor.GetPropertyCount(), "Property count not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< float >( propertyIndex3 ) != 0.15f, "Property value not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( propertyIndex3 ) != propertyType3, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex3 ) != propertyName3, "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName3 ) != propertyIndex3, "Property index not match" ); + + Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE); + + DALI_CHECK_FAIL( initialChildActorPropertyCount + 4u != childActor.GetPropertyCount(), "Property count not match" ); + + DALI_CHECK_FAIL( childActor.GetProperty< int >( propertyIndex4 ) != 20, "Property value not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< int >( customPropertyIndex2 ) != 20, "Property value not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyType( propertyIndex4 ) != propertyType4, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( customPropertyIndex2 ) != propertyType4, "Property type not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex4 ) != propertyName4, "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( customPropertyIndex2 ) != propertyName4, "Property name not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName4 ) != propertyIndex4, "Property index not match" ); + + TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" ); + DALI_CHECK_FAIL( !typeInfo2, "GetTypeInfo() failed to get specified type" ); + BaseHandle handle2 = typeInfo2.CreateInstance(); + DALI_CHECK_FAIL( !handle2, "CreateInstance() failed to create instance" ); + Actor customActor2 = Actor::DownCast( handle2 ); + DALI_CHECK_FAIL( !customActor2, "Actor::DownCast() failed" ); + + // Register child properties to the new parent + std::string newPropertyName( "newChildProp" ); + int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + Property::Type newPropertyType( Property::VECTOR2 ); + ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType ); + + std::string newPropertyName2( "childProp3" ); + int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); + Property::Type newPropertyType2( Property::FLOAT ); + ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 ); + + customActor2.Add( childActor ); + + DALI_CHECK_FAIL( childActor.GetPropertyType( propertyIndex ) != propertyType, "Property TYPE not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( propertyIndex ) != propertyName, "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyIndex( propertyName )!= propertyIndex, "Property INDEX not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyType( newPropertyIndex2 )!= newPropertyType2, "Property TYPE not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( newPropertyIndex2 )!= newPropertyName2, "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyIndex( newPropertyName2 )!= newPropertyIndex2, "Property INDEX not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< float >( newPropertyIndex2 )!= 0.15f, "Property value not match" ); + + Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE); + + DALI_CHECK_FAIL( initialChildActorPropertyCount + 5u != childActor.GetPropertyCount(), "Property count not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyType( newPropertyIndex ) != newPropertyType, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyType( customPropertyIndex3 ) != newPropertyType, "Property type not match" ); + DALI_CHECK_FAIL( childActor.GetPropertyName( newPropertyIndex ) != newPropertyName, "Property name not match" ); // This should return the new name, although the child property index remains the same + DALI_CHECK_FAIL( childActor.GetPropertyName( customPropertyIndex3 ) != newPropertyName, "Property name not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< Vector2 >( newPropertyIndex ) != Vector2( 10.0f, 10.0f ), "Property value not match" ); + DALI_CHECK_FAIL( childActor.GetProperty< Vector2 >( customPropertyIndex3 ) != Vector2( 10.0f, 10.0f ), "Property value not match" ); + + DALI_CHECK_FAIL( childActor.GetPropertyIndex( newPropertyName ) != newPropertyIndex, "Property index not match" ); + + DaliLog::PrintPass(); +} + /** * End of TC Logic Implementation Area. **/ @@ -188,6 +824,30 @@ int ITcTypeRegistryCopyAssign(void) application.MainLoop(); return test_return_value; } +//& purpose: To Child property registration. +//& type: auto +/** + * @testcase ITcTypeRegistryChildPropertyRegistration + * @type Positive + * @since_Tizen 3.0 + * @description To Child property registration. + * @scenario Get Type Registry handle. \n + * Create ChildPropertyRegistration with defferent parameter\n + * Check whether ChildPropertyRegistration is work or not + * @apicovered Get(),GetTypeInfo(), TypeRegistry(Dali::TypeRegistry const&), ChildPropertyRegistration() + * @passcase If ChildPropertyRegistration is work properly + * @failcase If ChildPropertyRegistration is not work properly + * @precondition NA + * @postcondition NA + */ +int ITcTypeRegistryChildPropertyRegistration(void) +{ + DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__); + Application application = Application::New( &gArgc, &gArgv ); + Type_Registry_TestApp testApp( application, TYPE_REGISTRY_CHIELD_PROPERTY_REGISTRATION); + application.MainLoop(); + return test_return_value; +} /** @} */ // end of itc-TypeRegistry- testcases /** @} */ // end of itc-TypeRegistry -- 2.7.4