utc-Dali-BitmapImage.cpp
utc-Dali-CameraActor.cpp
utc-Dali-Character.cpp
- utc-Dali-Constrainable.cpp
utc-Dali-Constraint.cpp
utc-Dali-Context.cpp
utc-Dali-CustomActor.cpp
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_constrainable_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_constrainable_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliConstrainableDownCast(void)
-{
- TestApplication application;
-
- Handle handle = Constrainable::New();
-
- Constrainable customHandle1 = Constrainable::DownCast( handle );
- DALI_TEST_CHECK( customHandle1 );
-
- Constrainable customHandle2 = DownCast< Constrainable >( handle );
- DALI_TEST_CHECK( customHandle2 );
- END_TEST;
-}
-
-int UtcDaliConstrainableDownCastNegative(void)
-{
- TestApplication application;
-
- Image image = ResourceImage::New( "temp" );
- Constrainable customHandle1 = Constrainable::DownCast( image );
- DALI_TEST_CHECK( ! customHandle1 );
-
- Constrainable empty;
- Constrainable customHandle2 = Constrainable::DownCast( empty );
- DALI_TEST_CHECK( ! customHandle2 );
- END_TEST;
-}
-
-int UtcDaliConstrainableCustomProperty(void)
-{
- TestApplication application;
-
- Constrainable handle = Constrainable::New();
-
- float startValue(1.0f);
- Property::Index index = handle.RegisterProperty( "test-property", startValue );
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
- application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
-
- handle.SetProperty( index, 5.0f );
-
- application.SendNotification();
- application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
- application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
- END_TEST;
-}
namespace
{
+/// Allows the creation of a BaseObject
+class BaseObjectType : public BaseObject
+{
+public:
+ BaseObjectType()
+ {
+ }
+};
+
Handle ImplicitCopyConstructor(Handle passedByValue)
{
// object + copy + passedByValue, ref count == 3
END_TEST;
}
+int UtcDaliHandleDownCastNegative(void)
+{
+ TestApplication application;
+
+ // BaseObject is NOT an Object, so this DownCast should fail
+ BaseHandle handle( new BaseObjectType );
+ Handle customHandle1 = Handle::DownCast( handle );
+ DALI_TEST_CHECK( ! customHandle1 );
+
+ // A DownCast on an empty handle will also fail
+ Handle empty;
+ Handle customHandle2 = Handle::DownCast( empty );
+ DALI_TEST_CHECK( ! customHandle2 );
+ END_TEST;
+}
+
int UtcDaliHandleCreateProperty(void)
{
TestApplication application;
}
END_TEST;
}
+
+int UtcDaliHandleCustomProperty(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ float startValue(1.0f);
+ Property::Index index = handle.RegisterProperty( "test-property", startValue );
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+ handle.SetProperty( index, 5.0f );
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ END_TEST;
+}
Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint )
{
- return Dali::ActiveConstraint( DoApplyConstraint( constraint, Dali::Constrainable() ) );
+ return Dali::ActiveConstraint( DoApplyConstraint( constraint, Dali::Handle() ) );
}
-Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject )
+Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
{
return Dali::ActiveConstraint( DoApplyConstraint( constraint, weightObject ) );
}
-ActiveConstraintBase* Object::DoApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject )
+ActiveConstraintBase* Object::DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
{
ActiveConstraintBase* activeConstraintImpl = constraint.CreateActiveConstraint();
DALI_ASSERT_DEBUG( NULL != activeConstraintImpl );
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/constrainable.h>
#include <dali/public-api/object/handle.h>
#include <dali/public-api/object/property.h>
#include <dali/public-api/object/property-index.h>
* @param[in] constraint The constraint to apply.
* @param[in] weightObject An object with a "weight" float property.
*/
- Dali::ActiveConstraint ApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject );
+ Dali::ActiveConstraint ApplyConstraint( Constraint& constraint, Dali::Handle weightObject );
/**
* Remove one constraint from a Object.
* @param[in] weightObject An object with a "weight" float property, or an empty handle.
* @return The new active-constraint which is owned by Object.
*/
- ActiveConstraintBase* DoApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject );
+ ActiveConstraintBase* DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject );
/**
* Helper to remove active constraints
}
Actor::Actor(const Actor& copy)
-: Constrainable(copy)
+: Handle(copy)
{
}
}
Actor::Actor(Internal::Actor* internal)
-: Constrainable(internal)
+: Handle(internal)
{
}
#include <dali/public-api/animation/active-constraint-declarations.h>
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/actors/draw-mode.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
#include <dali/public-api/signals/dali-signal.h>
namespace Dali
* | show | %SetVisible( true ) |
* | hide | %SetVisible( false ) |
*/
-class DALI_IMPORT_API Actor : public Constrainable
+class DALI_IMPORT_API Actor : public Handle
{
public:
#include <dali/public-api/object/any.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/constrainable.h>
#include <dali/public-api/object/handle.h>
#include <dali/public-api/object/object-registry.h>
#include <dali/public-api/object/property-conditions.h>
$(public_api_src_dir)/modeling/model-data.cpp \
$(public_api_src_dir)/object/any.cpp \
$(public_api_src_dir)/object/base-handle.cpp \
- $(public_api_src_dir)/object/constrainable.cpp \
$(public_api_src_dir)/object/handle.cpp \
$(public_api_src_dir)/object/base-object.cpp \
$(public_api_src_dir)/object/object-registry.cpp \
$(public_api_src_dir)/object/any.h \
$(public_api_src_dir)/object/base-handle.h \
$(public_api_src_dir)/object/base-object.h \
- $(public_api_src_dir)/object/constrainable.h \
$(public_api_src_dir)/object/handle.h \
$(public_api_src_dir)/object/object-registry.h \
$(public_api_src_dir)/object/property-conditions.h \
}
AnimatableMesh::AnimatableMesh(const AnimatableMesh& handle)
-: Constrainable(handle)
+: Handle(handle)
{
}
AnimatableMesh::AnimatableMesh( Internal::AnimatableMesh* internal )
-: Constrainable(internal)
+: Handle(internal)
{
}
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
#include <dali/public-api/geometry/animatable-vertex.h>
#include <dali/public-api/modeling/material.h>
* It is recommended that the vertices of the mesh remain in the bounds -0.5 - 0.5, which
* will match the actor size boundaries. The origin of the mesh matches the actor's position.
*/
-class DALI_IMPORT_API AnimatableMesh : public Constrainable
+class DALI_IMPORT_API AnimatableMesh : public Handle
{
public:
/**
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/object/constrainable.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/property-index.h>
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/animation/active-constraint.h>
-#include <dali/internal/event/common/object-impl.h>
-#include <dali/internal/event/animation/constraint-impl.h>
-#include <dali/internal/event/object/custom-object-internal.h>
-
-namespace Dali
-{
-
-Constrainable Constrainable::New()
-{
- return Constrainable( Internal::CustomObject::New() );
-}
-
-Constrainable::Constrainable(Dali::Internal::Object* handle)
-: Handle(handle)
-{
-}
-
-Constrainable::Constrainable()
-{
-}
-
-Constrainable Constrainable::DownCast( BaseHandle handle )
-{
- return Constrainable( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
-}
-
-Constrainable::~Constrainable()
-{
-}
-
-Constrainable::Constrainable(const Constrainable& handle)
-: Handle(handle)
-{
-}
-
-Constrainable& Constrainable::operator=(const Constrainable& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint )
-{
- return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
-}
-
-ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint, Constrainable weightObject )
-{
- return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
-}
-
-void Constrainable::RemoveConstraint(ActiveConstraint activeConstraint)
-{
- GetImplementation(*this).RemoveConstraint( activeConstraint );
-}
-
-void Constrainable::RemoveConstraints()
-{
- GetImplementation(*this).RemoveConstraints();
-}
-
-void Constrainable::RemoveConstraints( unsigned int tag )
-{
- GetImplementation(*this).RemoveConstraints( tag );
-}
-
-namespace WeightObject
-{
-
-const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
-
-Constrainable New()
-{
- Constrainable handle = Constrainable::New();
-
- handle.RegisterProperty( "weight", 0.0f );
-
- return handle;
-}
-
-} // namespace WeightObject
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_CONSTRAINABLE_H__
-#define __DALI_CONSTRAINABLE_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h>
-#include <dali/public-api/animation/active-constraint.h>
-#include <dali/public-api/animation/constraint.h>
-
-namespace Dali DALI_IMPORT_API
-{
-
-namespace Internal
-{
-class Object;
-}
-
-class Constraint;
-
-/**
- * @brief Dali::Constrainable is a handle to an internal property owning Dali object that
- * can have constraints applied to it.
- */
-class DALI_IMPORT_API Constrainable : public Handle
-{
-public:
-
- /**
- * @brief Create a constrainable object.
- *
- * @return A handle to a newly allocated object.
- */
- static Constrainable New();
-
- /**
- * @brief This constructor provides an uninitialized Dali::Constrainable.
- *
- * This should be initialized with a Dali New() method before use.
- * Methods called on an uninitialized Dali::Constrainable will assert.
- * @code
- * Constrainable handle; // uninitialized
- * handle.SomeMethod(); // unsafe! This will assert
- *
- * handle = SomeClass::New(); // now initialized
- * handle.SomeMethod(); // safe
- * @endcode
- */
- Constrainable();
-
- /**
- * @brief Downcast a handle to a custom object.
- *
- * @param[in] handle The handle to cast.
- * @return A handle to a custom object or an empty handle.
- */
- static Constrainable DownCast( BaseHandle handle );
-
- /**
- * @brief Dali::Constrainable is intended as a base class
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Constrainable();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- Constrainable(const Constrainable& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- Constrainable& operator=(const Constrainable& rhs);
-
- /**
- * @brief Constrain one of the properties of an Actor.
- *
- * @note The constraint will be copied by the Actor. This means that modifying the apply-time etc.
- * of the constraint, will not affect actors which are already being constrained.
- * @pre The Actor has been initialized.
- * @param[in] constraint The constraint to apply.
- * @return The active-constraint being applied to the actor.
- */
- ActiveConstraint ApplyConstraint( Constraint constraint );
-
- /**
- * @brief Constrain one of the properties of an Actor, using a custom weight property.
- *
- * This overload is intended to allow a single weight property to be shared by many constraints
- * e.g. call WeightObject::New() once, and pass the return value into every call to ApplyConstraint().
- * @pre The Actor has been initialized.
- * @param[in] constraint The constraint to apply.
- * @param[in] weightObject An object which is expected to have a float property named "weight".
- * @return The active-constraint being applied to the actor.
- */
- ActiveConstraint ApplyConstraint( Constraint constraint, Constrainable weightObject );
-
- /**
- * @brief Remove one constraint from an Object.
- *
- * @pre The Object has been intialized.
- * @param[in] activeConstraint The active-constraint to remove.
- */
- void RemoveConstraint(ActiveConstraint activeConstraint);
-
- /**
- * @brief Remove all constraints from an Object.
- *
- * @pre The object has been initialized.
- */
- void RemoveConstraints();
-
- /**
- * @brief Remove all the constraint from the Object with a matching tag.
- *
- * @pre The Object has been intialized.
- * @param[in] tag The tag of the constraints which will be removed
- */
- void RemoveConstraints( unsigned int tag );
-
-public:
-
- /**
- * @brief This constructor is used by Dali New() methods.
- *
- * @param [in] handle A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL Constrainable(Dali::Internal::Object* handle);
-};
-
-namespace WeightObject
-{
-
-DALI_IMPORT_API extern const Property::Index WEIGHT; ///< name "weight", type FLOAT
-
-/**
- * @brief Convenience function to create an object with a custom "weight" property.
- *
- * @return A handle to a newly allocated object.
- */
-DALI_IMPORT_API Constrainable New();
-
-} // namespace WeightObject
-
-} // namespace Dali
-
-#endif // __DALI_CONSTRAINABLE_H__
#include <dali/public-api/object/handle.h>
// INTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/object/property-conditions.h>
+#include <dali/public-api/object/property-index.h>
#include <dali/public-api/object/property-notification.h>
+#include <dali/internal/event/animation/constraint-impl.h>
#include <dali/internal/event/common/object-impl.h>
+#include <dali/internal/event/object/custom-object-internal.h>
#include <dali/integration-api/debug.h>
namespace Dali
{
-Handle::Handle(Dali::Internal::Object* handle)
- : BaseHandle(handle)
+Handle::Handle( Dali::Internal::Object* handle )
+: BaseHandle(handle)
{
}
+
Handle::Handle()
{
}
+Handle Handle::New()
+{
+ return Handle( Internal::CustomObject::New() );
+}
+
Handle::~Handle()
{
}
GetImplementation(*this).RemovePropertyNotifications();
}
+ActiveConstraint Handle::ApplyConstraint( Constraint constraint )
+{
+ return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
+}
+
+ActiveConstraint Handle::ApplyConstraint( Constraint constraint, Handle weightObject )
+{
+ return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
+}
+
+void Handle::RemoveConstraint(ActiveConstraint activeConstraint)
+{
+ GetImplementation(*this).RemoveConstraint( activeConstraint );
+}
+
+void Handle::RemoveConstraints()
+{
+ GetImplementation(*this).RemoveConstraints();
+}
+
+void Handle::RemoveConstraints( unsigned int tag )
+{
+ GetImplementation(*this).RemoveConstraints( tag );
+}
+
+namespace WeightObject
+{
+
+const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
+
+Handle New()
+{
+ Handle handle = Handle::New();
+
+ handle.RegisterProperty( "weight", 0.0f );
+
+ return handle;
+}
+
+} // namespace WeightObject
+
} // namespace Dali
namespace Dali
{
+class ActiveConstraint;
+class Constraint;
class PropertyNotification;
class PropertyCondition;
}
/**
- * @brief Dali::Handle is a handle to an internal property owning Dali object.
+ * @brief Dali::Handle is a handle to an internal property owning Dali object that can have constraints applied to it.
*/
class DALI_IMPORT_API Handle : public BaseHandle
{
Handle();
/**
+ * @brief Create a new object.
+ *
+ * @return A handle to a newly allocated object.
+ */
+ static Handle New();
+
+ /**
* @brief Dali::Handle is intended as a base class
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
*/
static Handle DownCast( BaseHandle handle );
-public:
-
/**
* @brief Query whether an handle supports a given capability.
*
*/
bool Supports( Capability capability ) const;
+ // Properties
+
/**
* @brief Query how many properties are provided by an handle.
*
*/
void RemovePropertyNotifications();
+ // Constraints
+
+ /**
+ * @brief Constrain one of the properties of an Actor.
+ *
+ * @note The constraint will be copied by the Actor. This means that modifying the apply-time etc.
+ * of the constraint, will not affect actors which are already being constrained.
+ * @pre The Actor has been initialized.
+ * @param[in] constraint The constraint to apply.
+ * @return The active-constraint being applied to the actor.
+ */
+ ActiveConstraint ApplyConstraint( Constraint constraint );
+
+ /**
+ * @brief Constrain one of the properties of an Actor, using a custom weight property.
+ *
+ * This overload is intended to allow a single weight property to be shared by many constraints
+ * e.g. call WeightObject::New() once, and pass the return value into every call to ApplyConstraint().
+ * @pre The Actor has been initialized.
+ * @param[in] constraint The constraint to apply.
+ * @param[in] weightObject An object which is expected to have a float property named "weight".
+ * @return The active-constraint being applied to the actor.
+ */
+ ActiveConstraint ApplyConstraint( Constraint constraint, Handle weightObject );
+
+ /**
+ * @brief Remove one constraint from an Object.
+ *
+ * @pre The Object has been initialized.
+ * @param[in] activeConstraint The active-constraint to remove.
+ */
+ void RemoveConstraint( ActiveConstraint activeConstraint );
+
+ /**
+ * @brief Remove all constraints from an Object.
+ *
+ * @pre The object has been initialized.
+ */
+ void RemoveConstraints();
+
+ /**
+ * @brief Remove all the constraint from the Object with a matching tag.
+ *
+ * @pre The Object has been intialized.
+ * @param[in] tag The tag of the constraints which will be removed
+ */
+ void RemoveConstraints( unsigned int tag );
};
+namespace WeightObject
+{
+
+DALI_IMPORT_API extern const Property::Index WEIGHT; ///< name "weight", type FLOAT
+
+/**
+ * @brief Convenience function to create an object with a custom "weight" property.
+ *
+ * @return A handle to a newly allocated object.
+ */
+DALI_IMPORT_API Handle New();
+
+} // namespace WeightObject
+
} // namespace Dali
#endif // __DALI_HANDLE_H__
}
RenderTask::RenderTask(const RenderTask& handle)
-: Constrainable(handle)
+: Handle(handle)
{
}
}
RenderTask::RenderTask( Internal::RenderTask* internal )
-: Constrainable(internal)
+: Handle(internal)
{
}
// INTERNAL INCLUDES
#include <dali/public-api/math/viewport.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
#include <dali/public-api/signals/dali-signal.h>
namespace Dali
* |--------------|-----------------------|
* | finished | @ref FinishedSignal() |
*/
-class DALI_IMPORT_API RenderTask : public Constrainable
+class DALI_IMPORT_API RenderTask : public Handle
{
public:
/**
}
ShaderEffect::ShaderEffect(Internal::ShaderEffect* internal)
-: Constrainable(internal)
+: Handle(internal)
{
}
}
ShaderEffect::ShaderEffect(const ShaderEffect& handle)
-: Constrainable(handle)
+: Handle(handle)
{
}
// INTERNAL INCLUDES
#include <dali/public-api/animation/active-constraint-declarations.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
namespace Dali
{
* with the uniform color "uColor" of the node
* </B>
*/
-class DALI_IMPORT_API ShaderEffect : public Constrainable
+class DALI_IMPORT_API ShaderEffect : public Handle
{
public:
/**