X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Fdummy-control.h;h=d991a82bd2693a4db0cf553b8f593c2ee067a536;hp=cf2d96548a6c82702f2ee99ac11f9bea3f9362a1;hb=d65d27692a440b8fb20b69668c32d365ee822320;hpb=30f6ca1e541089b19f2b349a8a12d8a5bcaf2f9e diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h index cf2d965..d991a82 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h @@ -1,25 +1,29 @@ #ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ #define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +/* + * Copyright (c) 2017 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 +// EXTERNAL INCLUDES +#include + namespace Dali { @@ -27,6 +31,12 @@ namespace Toolkit { class DummyControlImpl; +class TransitionData; + +namespace Visual +{ +class Base; +} /** * Control does not have a New method so use this dummy class for the handle. @@ -34,10 +44,27 @@ class DummyControlImpl; class DummyControl : public Control { public: + enum PropertyRange + { + PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0 + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property index + }; + + struct Property + { + enum Type + { + TEST_VISUAL = PROPERTY_START_INDEX, + TEST_VISUAL2, + FOREGROUND_VISUAL, + FOCUS_VISUAL, + LABEL_VISUAL + }; + }; DummyControl(); DummyControl(const DummyControl& control); - virtual ~DummyControl(); + ~DummyControl(); static DummyControl New( bool override = false ); @@ -46,14 +73,6 @@ public: DummyControl& operator=(const DummyControl& control); - // Used to test signal connections - void CustomSlot1( Actor actor, const Vector3& value ); - -public: - - bool mCustomSlot1Called; - Vector3 mCustomSlot1Value; - public: // Not intended for application developers DummyControl( DummyControlImpl& implementation ); @@ -61,22 +80,43 @@ public: // Not intended for application developers }; /** - * Cannot create an instance of ControlImpl, so use this dummy class for the implementation. - * This class does not override any of ControlImpl's behaviour. + * Cannot create an instance of Internal::Control, so use this dummy class for the implementation. + * This class does not override any of Internal::Control's behaviour. */ -class DummyControlImpl : public ControlImpl +class DummyControlImpl : public Toolkit::Internal::Control { public: static DummyControl New(); public: - inline void EnableGestureDetection(Gesture::Type type) { ControlImpl::EnableGestureDetection(type); } - inline void DisableGestureDetection(Gesture::Type type) { ControlImpl::DisableGestureDetection(type); } - inline PinchGestureDetector GetPinchGestureDetector() const { return ControlImpl::GetPinchGestureDetector(); } - inline PanGestureDetector GetPanGestureDetector() const { return ControlImpl::GetPanGestureDetector(); } - inline TapGestureDetector GetTapGestureDetector() const { return ControlImpl::GetTapGestureDetector(); } - inline LongPressGestureDetector GetLongPressGestureDetector() const { return ControlImpl::GetLongPressGestureDetector(); } + inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); } + inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); } + inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); } + inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); } + inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); } + inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); } + + void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual); + void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled ); + void UnregisterVisual( Property::Index index ); + void EnableVisual( Property::Index index, bool enabled ); + bool IsVisualEnabled( Property::Index index ); + int GetVisualCount(); + Toolkit::Visual::Base GetVisual( Property::Index index ); + Animation CreateTransition( const Toolkit::TransitionData& transition ); + void DoAction( Dali::Property::Index index, Dali::Property::Index action, const Dali::Property::Value attributes ); + + static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); + + static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex ); + + // Used to test signal connections + void CustomSlot1( Actor actor ); + + bool mCustomSlot1Called; + typedef std::vector VisualIndices; + VisualIndices mRegisteredVisualIndices; protected: @@ -85,49 +125,72 @@ protected: virtual ~DummyControlImpl(); }; +namespace Impl +{ + /** - * Cannot create an instance of ControlImpl, so use this dummy class for the implementation. - * This class DOES override ControlImpl's behaviour. + * Cannot create an instance of Internal::Control, so use this dummy class for the implementation. + * This class DOES override Internal::Control's behaviour. */ -class DummyControlImplOverride : public DummyControlImpl +class DummyControl : public Toolkit::DummyControlImpl { public: - static DummyControl New(); + typedef std::function RelayoutCallbackFunc; + + static Toolkit::DummyControl New(); + + void SetLayout( Property::Index visualIndex, Property::Map& map ); + + void SetRelayoutCallback( RelayoutCallbackFunc callback ); private: - DummyControlImplOverride(); + DummyControl(); - virtual ~DummyControlImplOverride(); + virtual ~DummyControl(); -private: // From ControlImpl +private: // From Internal::Control virtual void OnInitialize(); - virtual void OnStyleChange(StyleChange change); - virtual void OnPinch(PinchGesture pinch); - virtual void OnPan(PanGesture pan); - virtual void OnTap(TapGesture tap); - virtual void OnLongPress(LongPressGesture longPress); + virtual bool OnAccessibilityActivated(); + virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent ); + virtual bool OnAccessibilityValueChange( bool isIncrease ); + + virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ); + virtual void OnPinch(const PinchGesture& pinch); + virtual void OnPan(const PanGesture& pan); + virtual void OnTap(const TapGesture& tap); + virtual void OnLongPress(const LongPressGesture& longPress); + virtual Vector3 GetNaturalSize(); private: // From CustomActorImpl - virtual void OnStageConnection(); + 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); - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event); + virtual bool OnHoverEvent(const HoverEvent& event); + virtual bool OnWheelEvent(const WheelEvent& event); virtual bool OnKeyEvent(const KeyEvent& event); virtual void OnKeyInputFocusGained(); virtual void OnKeyInputFocusLost(); + virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); + + DALI_INTERNAL DummyControl( const DummyControl& ); + DALI_INTERNAL DummyControl& operator=( const DummyControl& ); public: bool initializeCalled; - bool styleChangeCalled; + bool activatedCalled; + bool onAccTouchedCalled; + bool onAccValueChangeCalled; + bool themeChangeCalled; + bool fontChangeCalled; bool pinchCalled; bool panCalled; bool tapCalled; @@ -139,12 +202,21 @@ public: bool sizeSetCalled; bool sizeAnimationCalled; bool touchEventCalled; - bool mouseWheelEventCalled; + bool hoverEventCalled; + bool wheelEventCalled; bool keyEventCalled; bool keyInputFocusGained; bool keyInputFocusLost; + static int constructorCount; + static int destructorCount; + + Property::Map mLayouts; + RelayoutCallbackFunc mRelayoutCallback; + }; +} // namespace Impl + } // namespace Toolkit } // namespace Dali