License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gesture-manager.cpp
1 /*
2  * Copyright (c) 2014 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 "test-gesture-manager.h"
19
20 namespace Dali
21 {
22
23 TestGestureManager::TestGestureManager()
24 {
25   Initialize();
26 }
27
28 /**
29  * Destructor
30  */
31 TestGestureManager::~TestGestureManager()
32 {
33 }
34
35 /**
36  * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type)
37  */
38 void TestGestureManager::Register(const Integration::GestureRequest& request)
39 {
40   mFunctionsCalled.Register = true;
41 }
42
43 /**
44  * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type)
45  */
46 void TestGestureManager::Unregister(const Integration::GestureRequest& request)
47 {
48   mFunctionsCalled.Unregister = true;
49 }
50
51 /**
52  * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type)
53  */
54 void TestGestureManager::Update(const Integration::GestureRequest& request)
55 {
56   mFunctionsCalled.Update = true;
57 }
58
59
60 /** Call this every test */
61 void TestGestureManager::Initialize()
62 {
63   mFunctionsCalled.Reset();
64 }
65
66 bool TestGestureManager::WasCalled(TestFuncEnum func)
67 {
68   switch(func)
69   {
70     case RegisterType:             return mFunctionsCalled.Register;
71     case UnregisterType:           return mFunctionsCalled.Unregister;
72     case UpdateType:               return mFunctionsCalled.Update;
73   }
74   return false;
75 }
76
77 void TestGestureManager::ResetCallStatistics(TestFuncEnum func)
78 {
79   switch(func)
80   {
81     case RegisterType:             mFunctionsCalled.Register = false; break;
82     case UnregisterType:           mFunctionsCalled.Unregister = false; break;
83     case UpdateType:               mFunctionsCalled.Update = false; break;
84   }
85 }
86
87 TestGestureManager::TestFunctions::TestFunctions()
88 : Register(false),
89   Unregister(false),
90   Update(false)
91 {
92 }
93
94 void TestGestureManager::TestFunctions::Reset()
95 {
96   Register = false;
97   Unregister = false;
98   Update = false;
99 }
100
101
102
103 } // namespace Dali