1 #ifndef DALI_TOOLKIT_TEST_DUMMY_VISUAL_H
2 #define DALI_TOOLKIT_TEST_DUMMY_VISUAL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/dali-toolkit.h>
23 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
24 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
26 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
29 #include <dali/public-api/common/intrusive-ptr.h>
42 typedef IntrusivePtr< DummyVisual > DummyVisualPtr;
45 * Dummy Visual that can be used for testing
46 * Cannot create an instance of an existing Visual, so use this dummy class for the implementation.
48 class DummyVisual : public Visual::Base
52 // Actions that the dummy visual can perform. These actions are called through the Visual::Base::DoAction API.
55 TEST_ACTION = 0, ///< Updates the action counter
60 // Constructor for DummyVisual
61 static DummyVisualPtr New( const Property::Map& properties );
63 // Prevent default methods being used.
64 DummyVisual( const DummyVisual& dummyVisual ) = delete;
65 DummyVisual( const DummyVisual&& dummyVisual ) = delete;
66 DummyVisual& operator=( const DummyVisual& dummyVisual ) = delete;
67 DummyVisual& operator=( const DummyVisual&& dummyVisual ) = delete;
69 // Get the Action counter, action counter incremented with every successful Action
70 unsigned int GetActionCounter() const;
71 // Reset the Action counter to 0;
72 void ResetActionCounter();
76 DummyVisual( VisualFactoryCache& factoryCache );
78 void OnInitialize() override;
79 void DoCreatePropertyMap( Property::Map& map ) const override;
80 void DoCreateInstancePropertyMap( Property::Map& map ) const override;
81 void DoSetProperties( const Property::Map& propertyMap ) override;
82 void OnSetTransform() override;
83 void DoSetOnScene( Actor& actor ) override;
84 void OnDoAction( const Property::Index actionName, const Property::Value& attributes ) override;
87 unsigned int mActionCounter;
94 } // namespace Toolkit
98 #endif // DALI_TOOLKIT_TEST_DUMMY_VISUAL_H