X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Fdummy-control.h;h=6f79c364f4f04ff85bde7852aa5d55f5d0abc416;hb=HEAD;hp=d4b8b18444f17043995ceae9a893bdd9fc9d83c0;hpb=ec1cd006ed99fe40e444e90c8b3e6eb01ca2bc8b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 d4b8b18..2908ad1 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,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ -#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ +#ifndef DALI_TOOLKIT_TEST_DUMMY_CONTROL_H +#define DALI_TOOLKIT_TEST_DUMMY_CONTROL_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -21,13 +21,20 @@ // INTERNAL INCLUDES #include +// EXTERNAL INCLUDES +#include + namespace Dali { - 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. @@ -38,7 +45,7 @@ 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 + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property index }; struct Property @@ -57,17 +64,15 @@ public: DummyControl(const DummyControl& control); ~DummyControl(); - static DummyControl New( bool override = false ); - - static DummyControl DownCast( BaseHandle handle ); + static DummyControl New(bool override = false); + static DummyControl DownCast(BaseHandle handle); DummyControl& operator=(const DummyControl& control); public: // Not intended for application developers - - DummyControl( DummyControlImpl& implementation ); - DummyControl( Dali::Internal::CustomActor* internal ); + DummyControl(DummyControlImpl& implementation); + DummyControl(Dali::Internal::CustomActor* internal); }; /** @@ -77,47 +82,64 @@ public: // Not intended for application developers class DummyControlImpl : public Toolkit::Internal::Control { public: - static DummyControl New(); public: - 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 ); - - static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); - - static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex ); + inline void EnableGestureDetection(GestureType::Value type) + { + Internal::Control::EnableGestureDetection(type); + } + inline void DisableGestureDetection(GestureType::Value 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 RegisterVisual(Property::Index index, Toolkit::Visual::Base visual, int depthIndex); + 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 ); + void CustomSlot1(Actor actor); - bool mCustomSlot1Called; + bool mCustomSlot1Called; typedef std::vector VisualIndices; - VisualIndices mRegisteredVisualIndices; + VisualIndices mRegisteredVisualIndices; protected: - DummyControlImpl(); - virtual ~DummyControlImpl(); + ~DummyControlImpl() override; }; namespace Impl { - /** * Cannot create an instance of Internal::Control, so use this dummy class for the implementation. * This class DOES override Internal::Control's behaviour. @@ -125,75 +147,72 @@ namespace Impl class DummyControl : public Toolkit::DummyControlImpl { public: + typedef std::function RelayoutCallbackFunc; static Toolkit::DummyControl New(); - void SetLayout( Property::Index visualIndex, Property::Map& map ); + void SetLayout(Property::Index visualIndex, Property::Map& map); -private: + void SetRelayoutCallback(RelayoutCallbackFunc callback); +private: DummyControl(); - virtual ~DummyControl(); + ~DummyControl() override; private: // From Internal::Control - - virtual void OnInitialize(); - 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); + void OnInitialize() override; + bool OnAccessibilityActivated() override; + bool OnAccessibilityValueChange(bool isIncrease) override; + + void OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change) override; + void OnPinch(const PinchGesture& pinch) override; + void OnPan(const PanGesture& pan) override; + void OnTap(const TapGesture& tap) override; + void OnLongPress(const LongPressGesture& longPress) override; + Vector3 GetNaturalSize() override; + bool OnKeyEvent(const KeyEvent& event) override; private: // 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); - 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& ); + void OnSceneConnection(int depth) override; + void OnSceneDisconnection() override; + void OnChildAdd(Actor& child) override; + void OnChildRemove(Actor& child) override; + void OnSizeSet(const Vector3& targetSize) override; + void OnSizeAnimation(Animation& animation, const Vector3& targetSize) override; + void OnKeyInputFocusGained() override; + void OnKeyInputFocusLost() override; + void OnRelayout(const Vector2& size, RelayoutContainer& container) override; + + DALI_INTERNAL DummyControl(const DummyControl&); + DALI_INTERNAL DummyControl& operator=(const DummyControl&); public: - - bool initializeCalled; - bool activatedCalled; - bool onAccTouchedCalled; - bool onAccValueChangeCalled; - bool themeChangeCalled; - bool fontChangeCalled; - bool pinchCalled; - bool panCalled; - bool tapCalled; - bool longPressCalled; - bool stageConnectionCalled; - bool stageDisconnectionCalled; - bool childAddCalled; - bool childRemoveCalled; - bool sizeSetCalled; - bool sizeAnimationCalled; - bool touchEventCalled; - bool hoverEventCalled; - bool wheelEventCalled; - bool keyEventCalled; - bool keyInputFocusGained; - bool keyInputFocusLost; - - Property::Map mLayouts; + bool initializeCalled; + bool activatedCalled; + bool onAccValueChangeCalled; + bool themeChangeCalled; + bool fontChangeCalled; + bool pinchCalled; + bool panCalled; + bool tapCalled; + bool longPressCalled; + bool stageConnectionCalled; + bool stageDisconnectionCalled; + bool childAddCalled; + bool childRemoveCalled; + bool sizeSetCalled; + bool sizeAnimationCalled; + bool hoverEventCalled; + bool wheelEventCalled; + bool keyEventCalled; + bool keyInputFocusGained; + bool keyInputFocusLost; + static int constructorCount; + static int destructorCount; + + Property::Map mLayouts; + RelayoutCallbackFunc mRelayoutCallback; }; } // namespace Impl @@ -202,4 +221,4 @@ public: } // namespace Dali -#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ +#endif // DALI_TOOLKIT_TEST_DUMMY_CONTROL_H