[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / dali-toolkit-test-utils / dummy-visual.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "dummy-visual.h"
19
20 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
21
22 namespace Dali
23 {
24
25 namespace Toolkit
26 {
27
28 namespace Internal
29 {
30
31 DummyVisualPtr DummyVisual::New( const Property::Map& properties )
32 {
33   VisualFactoryCache* factoryCache = new VisualFactoryCache(false);
34
35   DummyVisualPtr dummyVisualPtr( new DummyVisual( *factoryCache ) );
36   dummyVisualPtr->Initialize();
37   return dummyVisualPtr;
38 }
39
40 DummyVisual::DummyVisual( VisualFactoryCache& factoryCache )
41 : Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::Type::COLOR ),
42   mActionCounter( 0 )
43 {
44 }
45
46 void DummyVisual::OnInitialize()
47 {
48   // Implement if required
49 }
50
51 void DummyVisual::DoCreatePropertyMap( Property::Map& map ) const
52 {
53   // Implement if required
54 }
55
56 void DummyVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
57 {
58   // Implement if required
59 }
60
61 void DummyVisual::DoSetProperties( const Property::Map& propertyMap )
62 {
63   // Implement if required
64 }
65
66 void DummyVisual::OnSetTransform()
67 {
68   // Implement if required
69 }
70
71 void DummyVisual::DoSetOnScene( Actor& actor )
72 {
73   // Implement if required
74 }
75
76 void DummyVisual::OnDoAction( const Property::Index actionName, const Property::Value& attributes )
77 {
78   if ( DummyVisual::TEST_ACTION == actionName )
79   {
80     mActionCounter++;  // GetActionCounter can be used to test for this.
81   }
82   // Further Actions can be added here
83 }
84
85 unsigned int DummyVisual::GetActionCounter() const
86 {
87   return mActionCounter;
88 }
89
90 void DummyVisual::ResetActionCounter()
91 {
92   mActionCounter = 0;
93 }
94
95 } // Internal
96
97 } // namespace Toolkit
98
99 } // namespace Dali