1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef TEST_UNITTEST_CORE_GESTURES_SWIPE_RECOGNIZER_TEST_UTILS_H
17 #define TEST_UNITTEST_CORE_GESTURES_SWIPE_RECOGNIZER_TEST_UTILS_H
18
19 #include "test/unittest/core/gestures/recognizer_test_utils.h"
20
21 namespace OHOS::Ace::NG {
22 namespace {
23 constexpr double SWIPE_MOVE_DISTANCE = 500.0;
24 constexpr double SWIPE_MOVE_STEP = 100.0;
25
26 enum class SwipeInputDirection {
27 VERTICAL = 0,
28 HORIZONTAL,
29 VERTICAL_HORIZONTAL,
30 HORIZONTAL_VERTICAL,
31 };
32
AdjustSpeed(double speed,ComparationResult compare)33 double AdjustSpeed(double speed, ComparationResult compare)
34 {
35 switch (compare) {
36 case ComparationResult::LESS:
37 return speed /= 2;
38 case ComparationResult::GREAT:
39 return speed *= 2;
40 default:
41 return speed;
42 }
43 }
44
45 } // namespace
46
47 } // namespace OHOS::Ace::NG
48
49 #endif // TEST_UNITTEST_CORE_GESTURES_PAN_RECOGNIZER_TEST_UTILS_H