From d722d30472c7ed8a6471e56ee9d872777e0c987b Mon Sep 17 00:00:00 2001 From: runner Date: Tue, 9 Sep 2025 14:35:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E8=A7=A6=E6=8E=A7=E6=9D=BF=E5=A4=9A=E6=8C=87=E5=B9=B3=E6=BB=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: runner --- .../src/touchpad_transform_processor.cpp | 2 +- service/touch_event_normalize/test/BUILD.gn | 1 - .../touchpad_transform_processor_test_ex.cpp | 113 ------------------ 3 files changed, 1 insertion(+), 115 deletions(-) delete mode 100644 service/touch_event_normalize/test/src/touchpad_transform_processor_test_ex.cpp diff --git a/service/touch_event_normalize/src/touchpad_transform_processor.cpp b/service/touch_event_normalize/src/touchpad_transform_processor.cpp index a1a36268c8..40484f716f 100644 --- a/service/touch_event_normalize/src/touchpad_transform_processor.cpp +++ b/service/touch_event_normalize/src/touchpad_transform_processor.cpp @@ -466,7 +466,7 @@ void TouchPadTransformProcessor::SmoothMultifingerSwipeData(std::vector& coordDelta /= historyFingerCount; } for (int32_t i = 0; i < fingerCount; ++i) { - if (fingerCoords[i].x == 0 && fingerCoords[i].y == 0 && !swipeHistory_[i].empty()) { + if (fingerCoords[i].x == 0 && fingerCoords[i].y == 0) { bool isEmpty = swipeHistory_[i].empty(); fingerCoords[i] = isEmpty ? coordDelta : (swipeHistory_[i].back() + coordDelta); swipeHistory_[i].push_back(fingerCoords[i]); diff --git a/service/touch_event_normalize/test/BUILD.gn b/service/touch_event_normalize/test/BUILD.gn index 25e5004707..58c84c0db3 100644 --- a/service/touch_event_normalize/test/BUILD.gn +++ b/service/touch_event_normalize/test/BUILD.gn @@ -37,7 +37,6 @@ ohos_unittest("TouchEventNormalizeTest") { "src/touch_gesture_detector_test.cpp", "src/touch_transform_processor_test.cpp", "src/touchpad_transform_processor_test.cpp", - "src/touchpad_transform_processor_test_ex.cpp", ] deps = [ diff --git a/service/touch_event_normalize/test/src/touchpad_transform_processor_test_ex.cpp b/service/touch_event_normalize/test/src/touchpad_transform_processor_test_ex.cpp deleted file mode 100644 index 8d46d1b63a..0000000000 --- a/service/touch_event_normalize/test/src/touchpad_transform_processor_test_ex.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "define_multimodal.h" -#include "general_touchpad.h" -#include "touchpad_transform_processor.h" - -#include -#include -#include - -#undef MMI_LOG_TAG -#define MMI_LOG_TAG "TouchPadTransformProcessorTestEx" - -namespace OHOS { -namespace MMI { -namespace { -using namespace testing::ext; -} // namespace -class TouchPadTransformProcessorTestEx : public testing::Test { -public: - static void SetUpTestCase(void); - static void TearDownTestCase(void); - void SetUp(); - void TearDown(); -}; - -void TouchPadTransformProcessorTestEx::SetUpTestCase() -{ -} - -void TouchPadTransformProcessorTestEx::TearDownTestCase() -{ -} - -void TouchPadTransformProcessorTestEx::SetUp() -{ -} - -void TouchPadTransformProcessorTestEx::TearDown() -{ -} - -/** - * @tc.name: TouchPadTransformProcessorTestEx_SmoothMultifingerSwipeData_001 - * @tc.desc: Test SmoothMultifingerSwipeData - * @tc.type: FUNC - * @tc.require: - */ -HWTEST_F(TouchPadTransformProcessorTestEx, TouchPadTransformProcessorTestEx_SmoothMultifingerSwipeData_001, - TestSize.Level1) -{ - CALL_TEST_DEBUG; - int32_t deviceId = 1; - TouchPadTransformProcessor processor(deviceId); - vector fingerCoords = {{1, 1}, {0, 0}}; - int32_t fingerCount = 2; - // pre add swipeHistory_ - processor.swipeHistory_.push_back({{1, 1}, {2, 2}}); - processor.swipeHistory_.push_back({}); - processor.SmoothMultifingerSwipeData(fingerCoords, fingerCount); - EXPECT_EQ(fingerCoords[1].x, 0); - EXPECT_EQ(fingerCoords[1].y, 0); -} - -/** - * @tc.name: TouchPadTransformProcessorTestEx_SmoothMultifingerSwipeData_002 - * @tc.desc: Test SmoothMultifingerSwipeData - * @tc.type: FUNC - * @tc.require: - */ -HWTEST_F(TouchPadTransformProcessorTestEx, TouchPadTransformProcessorTestEx_SmoothMultifingerSwipeData_002, - TestSize.Level1) -{ - CALL_TEST_DEBUG; - int32_t deviceId = 1; - TouchPadTransformProcessor processor(deviceId); - - std::vector fingerCoords = {{1, 1}, {2, 2}, {3, 3}}; - std::vector fingerCoordsZero = {{1, 1}, {0, 0}, {3, 3}}; - int32_t fingerCount = 3; - for (int i = 0; i < 3; ++i) { - processor.SmoothMultifingerSwipeData(fingerCoords, fingerCount); - } - EXPECT_EQ(processor.swipeHistory_[0].size(), 3); - EXPECT_EQ(processor.swipeHistory_[1].size(), 3); - EXPECT_EQ(processor.swipeHistory_[2].size(), 3); - - processor.SmoothMultifingerSwipeData(fingerCoordsZero, fingerCount); - EXPECT_EQ(fingerCoordsZero[0].x, 1); - EXPECT_EQ(fingerCoordsZero[0].y, 1); - EXPECT_EQ(fingerCoordsZero[1].x, 2); - EXPECT_EQ(fingerCoordsZero[1].y, 2); - EXPECT_EQ(fingerCoordsZero[2].x, 3); - EXPECT_EQ(fingerCoordsZero[2].y, 3); -} -} // namespace MMI -} // namespace OHOS \ No newline at end of file -- Gitee