extern char ** gArgv;
extern int test_return_value;
+namespace
+{
+ //
+ // 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 MyTypeRegistryTestCustomActor : public CustomActorImpl
+ {
+ typedef Signal< void ()> SignalType;
+ typedef Signal< void (float)> SignalTypeFloat;
+
+ MyTypeRegistryTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
+ { }
+
+ virtual ~MyTypeRegistryTestCustomActor()
+ { }
+
+ 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 MyTypeRegistryTestCustomActor : public CustomActor
+ {
+ public:
+
+ typedef Signal< void ()> SignalType;
+ typedef Signal< void (float)> SignalTypeFloat;
+
+ MyTypeRegistryTestCustomActor()
+ {
+ }
+
+ static MyTypeRegistryTestCustomActor New()
+ {
+ Impl::MyTypeRegistryTestCustomActor* p = new Impl::MyTypeRegistryTestCustomActor;
+ return MyTypeRegistryTestCustomActor( *p ); // takes ownership
+ }
+
+ virtual ~MyTypeRegistryTestCustomActor()
+ {
+ }
+
+ static MyTypeRegistryTestCustomActor DownCast( BaseHandle handle )
+ {
+ MyTypeRegistryTestCustomActor result;
+
+ CustomActor custom = Dali::CustomActor::DownCast( handle );
+ if ( custom )
+ {
+ CustomActorImpl& customImpl = custom.GetImplementation();
+
+ Impl::MyTypeRegistryTestCustomActor* impl = dynamic_cast<Impl::MyTypeRegistryTestCustomActor*>(&customImpl);
+
+ if (impl)
+ {
+ result = MyTypeRegistryTestCustomActor(customImpl.GetOwner());
+ }
+ }
+
+ return result;
+ }
+
+ SignalType& GetCustomSignal()
+ {
+ Dali::RefObject& obj = GetImplementation();
+ return static_cast<Impl::MyTypeRegistryTestCustomActor&>( obj ).mSignal;
+ }
+
+ private:
+
+ MyTypeRegistryTestCustomActor(Internal::CustomActor* internal)
+ : CustomActor(internal)
+ {
+ }
+
+ MyTypeRegistryTestCustomActor( Impl::MyTypeRegistryTestCustomActor& impl )
+ : CustomActor( impl )
+ {
+ }
+ };
+
+
+ class MyTypeRegistryTestCustomActor2 : public CustomActor
+ {
+ public:
+
+ MyTypeRegistryTestCustomActor2()
+ {
+ }
+
+ static MyTypeRegistryTestCustomActor2 New()
+ {
+ return MyTypeRegistryTestCustomActor2(); // takes ownership
+ }
+
+ virtual ~MyTypeRegistryTestCustomActor2()
+ {
+ }
+
+ static MyTypeRegistryTestCustomActor2 DownCast( BaseHandle handle )
+ {
+ MyTypeRegistryTestCustomActor2 result;
+
+ CustomActor custom = Dali::CustomActor::DownCast( handle );
+ if ( custom )
+ {
+ CustomActorImpl& customImpl = custom.GetImplementation();
+
+ Impl::MyTypeRegistryTestCustomActor* impl = dynamic_cast<Impl::MyTypeRegistryTestCustomActor*>(&customImpl);
+
+ if (impl)
+ {
+ result = MyTypeRegistryTestCustomActor2(customImpl.GetOwner());
+ }
+ }
+
+ return result;
+ }
+
+ private:
+
+ MyTypeRegistryTestCustomActor2(Internal::CustomActor* internal)
+ : CustomActor(internal)
+ {
+ }
+
+ MyTypeRegistryTestCustomActor2( Impl::MyTypeRegistryTestCustomActor& impl )
+ : CustomActor( impl )
+ {
+ }
+ };
+
+ static TypeRegistration customTypeInit( typeid(MyTypeRegistryTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
+
+
+ BaseHandle CreateCustom1(void)
+ {
+ return MyTypeRegistryTestCustomActor::New();
+ }
+
+ static std::string lastSignalConnectionCustom;
+
+ bool DoConnectSignalCustom1( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+ {
+ lastSignalConnectionCustom = signalName;
+
+ bool connected( true );
+
+ Dali::BaseHandle handle(object);
+ MyTypeRegistryTestCustomActor customActor = MyTypeRegistryTestCustomActor::DownCast(handle);
+
+ if( "sig1" == signalName )
+ {
+ customActor.GetCustomSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+ }
+
+ bool DoConnectSignalCustomFailure1( 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(MyTypeRegistryTestCustomActor), typeid(Dali::CustomActor), CreateCustom1 );
+
+ // Custom signals
+ static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom1 );
+ static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure1 );
+ 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
+
/**
* @function utc_Dali_TypeRegistry_startup
* @description Called before each test
void TypeRegistryGetTypeInfoP2();
void TypeRegistryGetTypeNameCountP();
void TypeRegistryGetTypeNamesP();
+void TypeRegistryAnimatablePropertyRegistrationP();
+void TypeRegistryAnimatablePropertyComponentRegistrationP();
+void TypeRegistryPropertyRegistrationP();
+void TypeRegistryRegisteredNameP();
+void TypeRegistrySignalConnectorTypeP();
+void TypeRegistrySignalConnectorTypeN();
+void TypeRegistryTypeActionP();
+void TypeRegistryTypeActionN();
+void TypeRegistryTypeRegistrationNotCallingCreateOnInitP();
+void TypeRegistryTypeRegistrationCallingCreateOnInitP();
+void TypeRegistryTypeRegistrationForNamedTypeP();
namespace
{
TYPE_REGISTRY_GET_TYPE_INFO_P,
TYPE_REGISTRY_GET_TYPE_INFO_P2,
TYPE_REGISTRY_GET_TYPE_P_NAME_COUNT_P,
- TYPE_REGISTRY_GET_TYPE_P_NAMES_P
+ TYPE_REGISTRY_GET_TYPE_P_NAMES_P,
+ TYPE_REGISTRY_ANIMATABLE_PROPERTY_REGISTRATION_P,
+ TYPE_REGISTRY_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_P,
+ TYPE_REGISTRY_PROPERTY_REGISTRATION_P,
+ TYPE_REGISTRY_REGISTERED_NAME_P,
+ TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_P,
+ TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_N,
+ TYPE_REGISTRY_TYPE_ACTION_P,
+ TYPE_REGISTRY_TYPE_ACTION_N,
+ TYPE_REGISTRY_TYPE_REGISTRATION_NOT_CALLING_CREATE_ON_INIT_P,
+ TYPE_REGISTRY_TYPE_REGISTRATION_CALLING_CREATE_ON_INIT_P,
+ TYPE_REGISTRY_TYPE_REGISTRATION_FOR_NAMED_TYPE_P
};
struct Type_Registry_TestApp : public ConnectionTracker
case TYPE_REGISTRY_GET_TYPE_P_NAMES_P:
TypeRegistryGetTypeNamesP();
break;
+
+ case TYPE_REGISTRY_ANIMATABLE_PROPERTY_REGISTRATION_P:
+ TypeRegistryAnimatablePropertyRegistrationP();
+ break;
+
+ case TYPE_REGISTRY_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_P:
+ TypeRegistryAnimatablePropertyComponentRegistrationP();
+ break;
+
+ case TYPE_REGISTRY_PROPERTY_REGISTRATION_P:
+ TypeRegistryPropertyRegistrationP();
+ break;
+
+ case TYPE_REGISTRY_REGISTERED_NAME_P:
+ TypeRegistryRegisteredNameP();
+ break;
+
+ case TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_P:
+ TypeRegistrySignalConnectorTypeP();
+ break;
+
+ case TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_N:
+ TypeRegistrySignalConnectorTypeN();
+ break;
+
+ case TYPE_REGISTRY_TYPE_ACTION_P:
+ TypeRegistryTypeActionP();
+ break;
+
+ case TYPE_REGISTRY_TYPE_ACTION_N:
+ TypeRegistryTypeActionN();
+ break;
+
+ case TYPE_REGISTRY_TYPE_REGISTRATION_NOT_CALLING_CREATE_ON_INIT_P:
+ TypeRegistryTypeRegistrationNotCallingCreateOnInitP();
+ break;
+
+ case TYPE_REGISTRY_TYPE_REGISTRATION_CALLING_CREATE_ON_INIT_P:
+ TypeRegistryTypeRegistrationCallingCreateOnInitP();
+ break;
+
+ case TYPE_REGISTRY_TYPE_REGISTRATION_FOR_NAMED_TYPE_P:
+ TypeRegistryTypeRegistrationForNamedTypeP();
+ break;
}
}
}
DaliLog::PrintPass();
}
+
+
+void TypeRegistryAnimatablePropertyRegistrationP()
+{
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryAnimatablePropertyComponentRegistrationP()
+{
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryPropertyRegistrationP()
+{
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ // Check property count before property registration
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTypeRegistryTestCustomActor) );
+ DALI_CHECK_FAIL( !typeInfo, "TypeInfo is failed" );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_CHECK_FAIL( !customActor, "Actor downcast is failed" );
+ unsigned int initialPropertyCount( customActor.GetPropertyCount() );
+
+ std::string propertyName( "prop1" );
+ int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
+ Property::Type propertyType( Property::BOOLEAN );
+ PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
+
+ // Check property count after registration
+ unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
+ DALI_CHECK_FAIL( initialPropertyCount + 1u != postRegistrationPropertyCount, "postRegistrationPropertyCount is failed" );
+
+ // Add custom property and check property count
+ customActor.RegisterProperty( "customProp1", true );
+ unsigned int customPropertyCount( customActor.GetPropertyCount() );
+ DALI_CHECK_FAIL( postRegistrationPropertyCount + 1u != customPropertyCount, "customPropertyCount is failed" );
+
+ // Set the property, ensure SetProperty called
+ DALI_CHECK_FAIL( setPropertyCalled, "SetProperty exists" );
+ customActor.SetProperty( propertyIndex, false );
+ DALI_CHECK_FAIL( !setPropertyCalled, "SetProperty is failed" );
+
+ // Get the property, ensure GetProperty called
+ DALI_CHECK_FAIL( getPropertyCalled, "GetProperty exists" );
+ (void)customActor.GetProperty< bool >( propertyIndex );
+ DALI_CHECK_FAIL( !getPropertyCalled, "GetProperty is failed");
+
+ // Check the property name
+ DALI_CHECK_FAIL( customActor.GetPropertyName( propertyIndex ) != propertyName, "GetPropertyName is failed" );
+ DALI_CHECK_FAIL( typeInfo.GetPropertyName( propertyIndex ) != propertyName, "GetPropertyName is failed" );
+
+ // Check the property index
+ DALI_CHECK_FAIL( customActor.GetPropertyIndex( propertyName ) != propertyIndex, "GetPropertyIndex is failed" );
+
+ // Check the property type
+ DALI_CHECK_FAIL( customActor.GetPropertyType( propertyIndex ) != propertyType, "GetPropertyType is failed" );
+
+ // Check property count of type-info is 1
+ Property::IndexContainer indices;
+ typeInfo.GetPropertyIndices( indices );
+ DALI_CHECK_FAIL( indices.Size() != 1u, "GetPropertyIndices is failed" );
+
+ // Ensure indices returned from actor and customActor differ by two
+ Actor actor = Actor::New();
+ actor.GetPropertyIndices( indices );
+ unsigned int actorIndices = indices.Size();
+ customActor.GetPropertyIndices( indices );
+ unsigned int customActorIndices = indices.Size();
+ DALI_CHECK_FAIL( actorIndices + 2u != customActorIndices, "customActorIndices is failed" ); // Custom property + registered property
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryRegisteredNameP()
+{
+ DALI_CHECK_FAIL( scriptedName != scriptedType.RegisteredName(), "Script name is different" );
+
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
+ DALI_CHECK_FAIL( !baseType, "GetTypeInfo is failed" );
+
+ BaseHandle handle = baseType.CreateInstance();
+ DALI_CHECK_FAIL( !CreateCustomNamedInitCalled, "CreateInstance is failed" );
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistrySignalConnectorTypeP()
+{
+ ResetFunctorCounts();
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ BaseHandle handle = type.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+
+ MyTypeRegistryTestCustomActor customHandle = MyTypeRegistryTestCustomActor::DownCast( handle );
+ DALI_CHECK_FAIL( !customHandle, "DownCast is failed" );
+
+ {
+ TestConnectionTracker tracker;
+
+ bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
+ DALI_CHECK_FAIL( connected != true, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( lastSignalConnectionCustom != "sig1", "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 1, "ConnectSignal is failed" );
+
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 1, "GetCustomSignal is failed" );
+ }
+ //tracker should automatically disconnect here
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 0, "ConnectSignal is failed" );
+
+ //Test that functor is disconnected
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1/*not incremented*/, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 0, "GetCustomSignal is failed" );
+
+ DaliLog::PrintPass();
+}
+void TypeRegistrySignalConnectorTypeN()
+{
+ // Test what happens when signal connnector (DoConnectSignalFailure method) returns false
+
+ ResetFunctorCounts();
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
+ DALI_CHECK_FAIL( !baseType, "GetTypeInfo is failed" );
+
+ BaseHandle handle = type.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+
+ MyTypeRegistryTestCustomActor customHandle = MyTypeRegistryTestCustomActor::DownCast( handle );
+ DALI_CHECK_FAIL( !customHandle, "DownCast is failed" );
+
+ DALI_CHECK_FAIL( type.GetActionCount() != TEST_ACTION_COUNT + baseType.GetActionCount(), "GetActionCount is failed" );
+
+ DALI_CHECK_FAIL( type.GetSignalCount() != TEST_SIGNAL_COUNT + baseType.GetSignalCount(), "GetSignalCount is failed" );
+
+ {
+ TestConnectionTracker tracker;
+
+ bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
+ DALI_CHECK_FAIL( connected != false/*This is supposed to fail*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( lastSignalConnectionCustom != "failed", "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 0/*deleted along with FunctorDelegate*/, "ConnectSignal is failed" );
+
+ // Should be a NOOP
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0/*never called*/, "GetCustomSignal is failed" );
+ }
+ //tracker should have nothing to disconnect here
+
+ // Should be a NOOP
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0/*never called*/, "GetCustomSignal is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryTypeActionP()
+{
+ ResetFunctorCounts();
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ BaseHandle handle = type.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+
+ Property::Map attributes;
+ DALI_CHECK_FAIL( !handle.DoAction("act1", attributes), "DoAction is failed" );
+ DALI_CHECK_FAIL( lastActionCustom != "act1", "DoAction is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryTypeActionN()
+{
+ ResetFunctorCounts();
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ BaseHandle handle = type.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+
+ Property::Map attributes;
+ DALI_CHECK_FAIL( handle.DoAction( "unknownAction", attributes ), "DoAction is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryTypeRegistrationNotCallingCreateOnInitP()
+{
+ ResetFunctorCounts();
+
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
+ DALI_CHECK_FAIL( !baseType, "GetTypeInfo is failed" );
+
+ BaseHandle handle = type.CreateInstance();
+ DALI_CHECK_FAIL( !handle, "CreateInstance is failed" );
+
+ MyTypeRegistryTestCustomActor customHandle = MyTypeRegistryTestCustomActor::DownCast( handle );
+ DALI_CHECK_FAIL( !customHandle, "DownCast is failed" );
+
+ DALI_CHECK_FAIL( type.GetActionCount() != TEST_ACTION_COUNT + baseType.GetActionCount(), "GetActionCount is failed" );
+
+ DALI_CHECK_FAIL( type.GetSignalCount() != TEST_SIGNAL_COUNT + baseType.GetSignalCount(), "GetSignalCount is failed" );
+
+ {
+ TestConnectionTracker tracker;
+
+ bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
+ DALI_CHECK_FAIL( connected != true, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( lastSignalConnectionCustom != "sig1", "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 1, "ConnectSignal is failed" );
+
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 0, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 1, "ConnectSignal is failed" );
+ }
+ // tracker should automatically disconnect here
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 0, "ConnectSignal is failed" );
+
+ // Test that functor is disconnected
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1, "ConnectSignal is failed" );
+ customHandle.GetCustomSignal().Emit();
+ DALI_CHECK_FAIL( CustomTestFunctor::mCallbackCount != 1/*not incremented*/, "GetCustomSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mTotalInstanceCount != 2/*temporary copy + FunctorDelegate copy*/, "ConnectSignal is failed" );
+ DALI_CHECK_FAIL( CustomTestFunctor::mCurrentInstanceCount != 0, "ConnectSignal is failed" );
+
+ Property::Map attributes;
+ handle.DoAction("act1", attributes);
+ DALI_CHECK_FAIL( lastActionCustom != "act1", "DoAction is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryTypeRegistrationCallingCreateOnInitP()
+{
+ DALI_CHECK_FAIL( "MyTypeRegistryTestCustomActor2" != customTypeInit.RegisteredName(), "RegisteredName is failed" );
+
+ DALI_CHECK_FAIL( true != CreateCustomInitCalled, "RegisteredName is failed" );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTypeRegistryTestCustomActor2" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ DaliLog::PrintPass();
+}
+
+void TypeRegistryTypeRegistrationForNamedTypeP()
+{
+ // Create Named Actor Type
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
+ DALI_CHECK_FAIL( !type, "GetTypeInfo is failed" );
+
+ BaseHandle namedHandle = type.CreateInstance();
+ DALI_CHECK_FAIL( !namedHandle, "CreateInstance is failed" );
+ Actor namedActor( Actor::DownCast( namedHandle ) );
+ DALI_CHECK_FAIL( !namedActor, "DownCast is failed" );
+
+ DALI_CHECK_FAIL( namedActor.GetName() != "NamedActor", "GetName is failed" );
+ DALI_CHECK_FAIL( type.GetName() != "MyNamedActor", "GetName is failed" );
+ DALI_CHECK_FAIL( type.GetBaseName() != "Actor", "GetBaseName is failed" );
+
+ DaliLog::PrintPass();
+}
+
/**
* End of TC Logic Implementation Area.
**/
application.MainLoop();
return test_return_value;
}
+
+/**
+ * @testcase UtcDaliTypeRegistryAnimatablePropertyRegistrationP
+ * @since_Tizen 2.4
+ * @description checks the registeration of an animatable property
+ */
+int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_ANIMATABLE_PROPERTY_REGISTRATION_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP
+ * @since_Tizen 2.4
+ * @description checks the registeration a component of an animatable property
+ */
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryPropertyRegistrationP
+ * @since_Tizen 2.4
+ * @description constructor registers the property with the registered type.
+ */
+int UtcDaliTypeRegistryPropertyRegistrationP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_PROPERTY_REGISTRATION_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryRegisteredNameP
+ * @since_Tizen 2.4
+ * @description Constructor registers the type creation function For registered NamedType.
+ */
+int UtcDaliTypeRegistryRegisteredNameP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_REGISTERED_NAME_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistrySignalConnectorTypeP
+ * @since_Tizen 2.4
+ * @description Register a signal connector function to a registered type.
+ */
+int UtcDaliTypeRegistrySignalConnectorTypeP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistrySignalConnectorTypeN
+ * @since_Tizen 2.4
+ * @description Negative test for signal connector function.
+ */
+int UtcDaliTypeRegistrySignalConnectorTypeN(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_SIGNAL_CONNECTOR_TYPE_N);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryTypeActionP
+ * @since_Tizen 2.4
+ * @description checks the registeration an action function.
+ */
+int UtcDaliTypeRegistryTypeActionP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_TYPE_ACTION_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryTypeActionN
+ * @since_Tizen 2.4
+ * @description Negative check for registeration of an action function.
+ */
+int UtcDaliTypeRegistryTypeActionN(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_TYPE_ACTION_N);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP
+ * @since_Tizen 2.4
+ * @description Constructor registers the type creation function without CallingCreateOnInit
+ */
+int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_TYPE_REGISTRATION_NOT_CALLING_CREATE_ON_INIT_P);
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP
+ * @since_Tizen 2.4
+ * @description Constructor registers the type creation function wiht CallingCreateOnInit
+ */
+int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_TYPE_REGISTRATION_CALLING_CREATE_ON_INIT_P );
+ application.MainLoop();
+ return test_return_value;
+}
+
+/**
+ * @testcase UtcDaliTypeRegistryTypeRegistrationForNamedTypeP
+ * @since_Tizen 2.4
+ * @description Constructor registers the type creation function ForNamedType.
+ */
+int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void)
+{
+ DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+ Application application = Application::New( &gArgc, &gArgv );
+ CHECK_GL;
+ Type_Registry_TestApp testApp( application, TYPE_REGISTRY_TYPE_REGISTRATION_FOR_NAMED_TYPE_P );
+ application.MainLoop();
+ return test_return_value;
+}