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