Dali 3D User Interface Engine
utc-Dali-PanGesture.cpp
Go to the documentation of this file.
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 <iostream>
19 
20 #include <stdlib.h>
22 #include <dali-test-suite-utils.h>
23 
24 using namespace Dali;
25 
27 {
29 }
30 
32 {
34 }
35 
36 
37 
39 {
40  TestApplication application; // Reset all test adapter return codes
41 
42  PanGesture gesture;
46 
47  PanGesture gesture2(Gesture::Started);
51 
56 
57  PanGesture gesture4(Gesture::Finished);
61 
62  // Test copy constructor
63  gesture4.numberOfTouches = 3u;
64 
65  PanGesture pan(gesture4);
69  END_TEST;
70 }
71 
73 {
74  // Test Assignment operator
79 
84 
85  gesture2.numberOfTouches = 3u;
86 
87  gesture = gesture2;
91  END_TEST;
92 }
93 
95 {
97  DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
98 
99  gesture.velocity = Vector2(3.0f, -4.0f);
100 
101  DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION);
102  END_TEST;
103 }
104 
106 {
107  PanGesture gesture(Gesture::Started);
108  DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION);
109 
110  gesture.displacement = Vector2(-30.0f, -40.0f);
111 
112  DALI_TEST_EQUALS(50.0f, gesture.GetDistance(), TEST_LOCATION);
113  END_TEST;
114 }
115 
117 {
118  PanGesture gesture(Gesture::Started);
120 
121  gesture.screenVelocity = Vector2(3.0f, -4.0f);
122 
124  END_TEST;
125 }
126 
128 {
129  PanGesture gesture(Gesture::Started);
131 
132  gesture.screenDisplacement = Vector2(-30.0f, -40.0f);
133 
135  END_TEST;
136 }
137 
139 {
140  PanGesture* gesture = new PanGesture( Gesture::Started );
144  delete gesture;
145 
146  END_TEST;
147 }
Dali Docs Home
Read more about Dali