2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
26 void utc_dali_rotation_gesture_startup(void)
28 test_return_value = TET_UNDEF;
31 void utc_dali_rotation_gesture_cleanup(void)
33 test_return_value = TET_PASS;
36 // Positive test case for a method
37 int UtcDaliRotationGestureConstructor(void)
39 TestApplication application; // Reset all test adapter return codes
41 RotationGesture gesture(Gesture::Started);
42 DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
43 DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
44 DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
46 RotationGesture gesture2(Gesture::Continuing);
47 DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
48 DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
49 DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION);
51 RotationGesture gesture3(Gesture::Finished);
52 DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
53 DALI_TEST_EQUALS(0.0f, gesture3.rotation.radian, TEST_LOCATION);
54 DALI_TEST_EQUALS(Gesture::Rotation, gesture3.type, TEST_LOCATION);
56 // Test copy constructor
57 gesture3.rotation = 3.0f;
59 RotationGesture rotation(gesture3);
60 DALI_TEST_EQUALS(Gesture::Finished, rotation.state, TEST_LOCATION);
61 DALI_TEST_EQUALS(3.0f, rotation.rotation.radian, TEST_LOCATION);
62 DALI_TEST_EQUALS(Gesture::Rotation, rotation.type, TEST_LOCATION);
66 int UtcDaliRotationGestureAssignment(void)
68 // Test Assignment operator
69 RotationGesture gesture(Gesture::Started);
70 DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
71 DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
72 DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
74 RotationGesture gesture2(Gesture::Continuing);
75 DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
76 DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
77 DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION);
79 gesture2.rotation.radian = 3.0f;
82 DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
83 DALI_TEST_EQUALS(3.0f, gesture.rotation.radian, TEST_LOCATION);
84 DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
88 int UtcDaliRotationGestureDynamicAllocation(void)
90 RotationGesture* gesture = new RotationGesture( Gesture::Started );
91 DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
92 DALI_TEST_EQUALS(0.0f, gesture->rotation.radian, TEST_LOCATION);
93 DALI_TEST_EQUALS(Gesture::Rotation, gesture->type, TEST_LOCATION);