*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
namespace
{
-
/*******************************************************************************
*
* Custom Actor
{
struct MyTestCustomActor : public CustomActorImpl
{
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
- MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
- { }
+ MyTestCustomActor()
+ : CustomActorImpl(ActorFlags())
+ {
+ }
virtual ~MyTestCustomActor()
- { }
+ {
+ }
void ResetCallStack()
{
}
// From CustomActorImpl
- virtual void OnStageConnection( int depth )
+ virtual void OnSceneConnection(int depth)
{
}
- virtual void OnStageDisconnection()
+ virtual void OnSceneDisconnection()
{
}
virtual void OnChildAdd(Actor& child)
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 Vector3 GetNaturalSize()
{
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
- virtual float GetHeightForWidth( float width )
+ virtual float GetHeightForWidth(float width)
{
return 0.0f;
}
- virtual float GetWidthForHeight( float height )
+ virtual float GetWidthForHeight(float height)
{
return 0.0f;
}
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
}
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, 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 void OnLayoutNegotiated(float size, Dimension::Type dimension)
{
}
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS)
{
return false;
}
public:
-
SignalType mSignal;
};
class MyTestCustomActor : public CustomActor
{
public:
-
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
MyTestCustomActor()
{
static MyTestCustomActor New()
{
Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
- return MyTestCustomActor( *p ); // takes ownership
+ return MyTestCustomActor(*p); // takes ownership
}
virtual ~MyTestCustomActor()
{
}
- static MyTestCustomActor DownCast( BaseHandle handle )
+ static MyTestCustomActor DownCast(BaseHandle handle)
{
MyTestCustomActor result;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if ( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
- if (impl)
+ if(impl)
{
result = MyTestCustomActor(customImpl.GetOwner());
}
SignalType& GetCustomSignal()
{
Dali::RefObject& obj = GetImplementation();
- return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
+ return static_cast<Impl::MyTestCustomActor&>(obj).mSignal;
}
MyTestCustomActor(Internal::CustomActor* internal)
{
}
- MyTestCustomActor( Impl::MyTestCustomActor& impl )
- : CustomActor( impl )
+ MyTestCustomActor(Impl::MyTestCustomActor& impl)
+ : CustomActor(impl)
{
}
};
-}
+} // namespace
int UtcDaliWeakHandleBaseConstructorVoid(void)
{
TestApplication application;
tet_infoline("Testing Dali::WeakHandleBase::WeakHandleBase(BaseHandle)");
- BaseHandle emptyHandle;
+ BaseHandle emptyHandle;
WeakHandleBase emptyObject(emptyHandle);
DALI_TEST_CHECK(!emptyObject.GetBaseHandle());
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Animation animation = Animation::New( 1.0f );
- WeakHandleBase animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandleBase animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase object( actor );
- DALI_TEST_CHECK( object.GetBaseHandle() == actor);
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandleBase object(actor);
+ DALI_TEST_CHECK(object.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase move = std::move( object );
- DALI_TEST_CHECK(move.GetBaseHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved
+ WeakHandleBase move = std::move(object);
+ DALI_TEST_CHECK(move.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase object( actor );
- DALI_TEST_CHECK( object.GetBaseHandle() == actor);
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandleBase object(actor);
+ DALI_TEST_CHECK(object.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
WeakHandleBase move;
- move = std::move( object );
- DALI_TEST_CHECK(move.GetBaseHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved
+ move = std::move(object);
+ DALI_TEST_CHECK(move.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved
END_TEST;
}
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(!(object == aDifferentWeakHandleBase));
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(object != aDifferentWeakHandleBase);
TestApplication application;
tet_infoline("Testing Dali::WeakHandleBase::GetBaseHandle()");
- Handle emptyHandle;
+ Handle emptyHandle;
WeakHandleBase emptyObject(emptyHandle);
DALI_TEST_CHECK(!emptyObject.GetBaseHandle());
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
WeakHandleBase theSameObject = WeakHandleBase(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == theSameObject.GetBaseHandle());
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(object.GetBaseHandle() != aDifferentWeakHandleBase.GetBaseHandle());
- Animation animation = Animation::New( 1.0f );
- WeakHandleBase animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandleBase animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation);
- WeakHandleBase theSameAnimationObject = WeakHandleBase( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle() );
+ WeakHandleBase theSameAnimationObject = WeakHandleBase(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle());
- Animation differentAnimation = Animation::New( 1.0f );
- WeakHandleBase aDifferentAnimationObject( differentAnimation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle() );
+ Animation differentAnimation = Animation::New(1.0f);
+ WeakHandleBase aDifferentAnimationObject(differentAnimation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle());
END_TEST;
}
int UtcDaliWeakHandleBaseReset(void)
{
TestApplication application;
- tet_infoline( "Testing Daku::WeakHandleBase::Reset()" );
+ tet_infoline("Testing Daku::WeakHandleBase::Reset()");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
TestApplication application;
tet_infoline("Testing Dali::WeakHandle::GetHandle()");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandle<Actor> object(actor);
DALI_TEST_CHECK(object.GetHandle() == actor);
- MyTestCustomActor customActor = MyTestCustomActor::New();
+ MyTestCustomActor customActor = MyTestCustomActor::New();
WeakHandle<MyTestCustomActor> customObject(customActor);
DALI_TEST_CHECK(customObject.GetHandle() == customActor);
DALI_TEST_CHECK(object.GetHandle() != customObject.GetHandle());
- Animation animation = Animation::New( 1.0f );
- WeakHandle<Animation> animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandle<Animation> animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetHandle() == animation);
animation.Reset();
- DALI_TEST_CHECK( animationObject.GetHandle() == Animation() );
+ DALI_TEST_CHECK(animationObject.GetHandle() == Animation());
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> object( actor );
- DALI_TEST_CHECK( object.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandle<Actor> object(actor);
+ DALI_TEST_CHECK(object.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> move = std::move( object );
- DALI_TEST_CHECK( move.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetHandle() ); // object moved
+ WeakHandle<Actor> move = std::move(object);
+ DALI_TEST_CHECK(move.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetHandle()); // object moved
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> object( actor );
- DALI_TEST_CHECK( object.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandle<Actor> object(actor);
+ DALI_TEST_CHECK(object.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
WeakHandle<Actor> move;
- move = std::move( object );
- DALI_TEST_CHECK( move.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetHandle() ); // object moved
+ move = std::move(object);
+ DALI_TEST_CHECK(move.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetHandle()); // object moved
END_TEST;
}
-