2 * Copyright (c) 2019 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/devel-api/events/gesture-devel.h>
23 #include <dali/devel-api/events/rotation-gesture.h>
24 #include <dali-test-suite-utils.h>
28 void utc_dali_rotation_gesture_startup(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_rotation_gesture_cleanup(void)
35 test_return_value = TET_PASS;
38 // Positive test case for a method
39 int UtcDaliRotationGestureConstructor(void)
41 TestApplication application; // Reset all test adapter return codes
43 RotationGesture gesture(Gesture::Started);
44 DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
45 DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
46 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION);
48 RotationGesture gesture2(Gesture::Continuing);
49 DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
50 DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
51 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture2.type ), TEST_LOCATION);
53 RotationGesture gesture3(Gesture::Finished);
54 DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
55 DALI_TEST_EQUALS(0.0f, gesture3.rotation.radian, TEST_LOCATION);
56 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture3.type ), TEST_LOCATION);
58 // Test copy constructor
59 gesture3.rotation = 3.0f;
61 RotationGesture rotation(gesture3);
62 DALI_TEST_EQUALS(Gesture::Finished, rotation.state, TEST_LOCATION);
63 DALI_TEST_EQUALS(3.0f, rotation.rotation.radian, TEST_LOCATION);
64 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( rotation.type ), TEST_LOCATION);
68 int UtcDaliRotationGestureAssignment(void)
70 // Test Assignment operator
71 RotationGesture gesture(Gesture::Started);
72 DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
73 DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
74 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION);
76 RotationGesture gesture2(Gesture::Continuing);
77 DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
78 DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
79 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture2.type ), TEST_LOCATION);
81 gesture2.rotation.radian = 3.0f;
84 DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
85 DALI_TEST_EQUALS(3.0f, gesture.rotation.radian, TEST_LOCATION);
86 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION);
90 int UtcDaliRotationGestureDynamicAllocation(void)
92 RotationGesture* gesture = new RotationGesture( Gesture::Started );
93 DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
94 DALI_TEST_EQUALS(0.0f, gesture->rotation.radian, TEST_LOCATION);
95 DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture->type ), TEST_LOCATION);