X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Fdummy-control.cpp;h=f44fa7199b896cfd04614dd94c2addf9728e6130;hb=dcee19c07c4f38251b88ca0ad849c9a666cf20eb;hp=8e1473ea7c4652340406f49307baf085586646b3;hpb=d5e3ed5f5b1c8fdba3ae97ead8729620f54b3836;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp index 8e1473e..f44fa71 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -17,7 +17,10 @@ #include "dummy-control.h" -#include +#include +#include +#include +#include namespace Dali { @@ -26,14 +29,11 @@ namespace Toolkit { DummyControl::DummyControl() -: mCustomSlot1Called(false) { } DummyControl::DummyControl(const DummyControl& control) -: Control( control ), - mCustomSlot1Called(false), - mCustomSlot1Value(Vector3::ZERO) +: Control( control ) { } @@ -53,10 +53,20 @@ DummyControl& DummyControl::operator=(const DummyControl& control) } // Used to test signal connections -void DummyControl::CustomSlot1( Actor actor, const Vector3& value ) +void DummyControlImpl::CustomSlot1( Actor actor ) { mCustomSlot1Called = true; - mCustomSlot1Value = value; +} + +namespace { + +BaseHandle Create() +{ + return DummyControlImpl::New(); +} + +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::DummyControl, Toolkit::Control, Create ); +DALI_TYPE_REGISTRATION_END() } DummyControl DummyControlImpl::New() @@ -68,7 +78,8 @@ DummyControl DummyControlImpl::New() } DummyControlImpl::DummyControlImpl() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ) +: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), + mCustomSlot1Called(false) { } @@ -76,6 +87,54 @@ DummyControlImpl::~DummyControlImpl() { } +void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual ) +{ + Control::RegisterVisual( index, visual ); + + VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index ); + if( iter == mRegisteredVisualIndices.end() ) + { + mRegisteredVisualIndices.push_back(index); + } +} + +void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled ) +{ + Control::RegisterVisual( index, visual, enabled ); + + VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index ); + if( iter == mRegisteredVisualIndices.end() ) + { + mRegisteredVisualIndices.push_back(index); + } +} + +void DummyControlImpl::UnregisterVisual( Property::Index index ) +{ + Control::UnregisterVisual( index ); +} + +Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index ) +{ + return Control::GetVisual( index ); +} + +void DummyControlImpl::EnableVisual( Property::Index index, bool enabled ) +{ + Control::EnableVisual( index, enabled ); +} + +bool DummyControlImpl::IsVisualEnabled( Property::Index index ) +{ + return Control::IsVisualEnabled( index ); +} + + +Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition ) +{ + return Control::CreateTransition( transition ); +} + DummyControl DummyControlImplOverride::New() { IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride; @@ -88,8 +147,11 @@ DummyControl DummyControlImplOverride::New() DummyControlImplOverride::DummyControlImplOverride() : DummyControlImpl(), initializeCalled(false), - themeChangeCalled( false ), - fontChangeCalled( false ), + activatedCalled(false), + onAccTouchedCalled(false), + onAccValueChangeCalled(false), + themeChangeCalled(false), + fontChangeCalled(false), pinchCalled(false), panCalled(false), tapCalled(false), @@ -101,7 +163,8 @@ DummyControlImplOverride::DummyControlImplOverride() sizeSetCalled(false), sizeAnimationCalled(false), touchEventCalled(false), - mouseWheelEventCalled(false), + hoverEventCalled(false), + wheelEventCalled(false), keyEventCalled(false), keyInputFocusGained(false), keyInputFocusLost(false) @@ -112,24 +175,53 @@ DummyControlImplOverride::~DummyControlImplOverride() { } void DummyControlImplOverride::OnInitialize() { initializeCalled = true; } -void DummyControlImplOverride::OnThemeChange(StyleManager change) { themeChangeCalled = true;} -void DummyControlImplOverride::OnFontChange(bool defaultFontChange, bool defaultFontSizeChange) { fontChangeCalled = true; } -void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; } -void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; } -void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; } -void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; } -void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; } -void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; } +bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; } +bool DummyControlImplOverride::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; } +bool DummyControlImplOverride::OnAccessibilityValueChange( bool isIncrease ) +{ + onAccValueChangeCalled = true; return true; +} + +void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) +{ + themeChangeCalled = change == StyleChange::THEME_CHANGE; + fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE; +} +void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; } +void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; } +void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; } +void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; } +void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; } +void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); } void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; } void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; } -void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; } -void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; } +void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; } +void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; } bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; } -bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; } +bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; } +bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; } bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;} void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; } void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; } +void DummyControlImplOverride::OnRelayout( const Vector2& size, RelayoutContainer& container ) +{ + Property::Map transformMap; + transformMap + .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) ) + .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) ) + .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER ) + .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER ) + .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO ); + + for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter ) + { + Visual::Base visual = GetVisual(*iter); + visual.SetTransformAndSize( transformMap, size ); + } +} + + DummyControl DummyControl::New( bool override ) { DummyControl control; @@ -147,16 +239,12 @@ DummyControl DummyControl::New( bool override ) } DummyControl::DummyControl( DummyControlImpl& implementation ) -: Control( implementation ), - mCustomSlot1Called(false), - mCustomSlot1Value(Vector3::ZERO) +: Control( implementation ) { } DummyControl::DummyControl( Dali::Internal::CustomActor* internal ) -: Control( internal ), - mCustomSlot1Called(false), - mCustomSlot1Value(Vector3::ZERO) +: Control( internal ) { VerifyCustomActorPointer(internal); }