diff --git a/3rdparty/stub_linux/stub.h b/3rdparty/stub_linux/stub.h index ce84b5eb0..8e855d688 100755 --- a/3rdparty/stub_linux/stub.h +++ b/3rdparty/stub_linux/stub.h @@ -57,7 +57,7 @@ #define REPLACE_FAR(t, fn, fn_stub)\ *fn = 0x49;\ *(fn + 1) = 0xbb;\ - *(long long *)(fn + 2) = (long long)fn_stub;\ + std::memcpy(fn + 2, &fn_stub, sizeof(long long));\ *(fn + 10) = 0x41;\ *(fn + 11) = 0xff;\ *(fn + 12) = 0xe3; diff --git a/src/widgets/shottoolwidget.h b/src/widgets/shottoolwidget.h index 20dd098cc..d465edafa 100755 --- a/src/widgets/shottoolwidget.h +++ b/src/widgets/shottoolwidget.h @@ -52,7 +52,7 @@ public slots: DLabel *m_thicknessLabel; - DLabel *m_effectSubTool; + DLabel *m_effectSubTool = nullptr; /** * @brief 当前选中的图形名称 */ diff --git a/tests/ut_screen_shot_recorder/ext-image-capture/ut_extcapturerecorder_cov.h b/tests/ut_screen_shot_recorder/ext-image-capture/ut_extcapturerecorder_cov.h index e958dd6ce..ed0811b8c 100644 --- a/tests/ut_screen_shot_recorder/ext-image-capture/ut_extcapturerecorder_cov.h +++ b/tests/ut_screen_shot_recorder/ext-image-capture/ut_extcapturerecorder_cov.h @@ -80,7 +80,7 @@ TEST_F(ExtCaptureRecorderCovTest, stopRecordingFromRecordingState) { access_private_field::ExtCaptureRecorderm_state(*m_rec) = ExtCaptureRecorder::Recording; EXPECT_NO_FATAL_FAILURE(m_rec->stopRecording()); - EXPECT_EQ(m_rec->state(), ExtCaptureRecorder::Stopping); + EXPECT_EQ(m_rec->state(), ExtCaptureRecorder::Stopped); } // stopRecording:从 Starting 态执行 @@ -88,7 +88,7 @@ TEST_F(ExtCaptureRecorderCovTest, stopRecordingFromStartingState) { access_private_field::ExtCaptureRecorderm_state(*m_rec) = ExtCaptureRecorder::Starting; EXPECT_NO_FATAL_FAILURE(m_rec->stopRecording()); - EXPECT_EQ(m_rec->state(), ExtCaptureRecorder::Stopping); + EXPECT_EQ(m_rec->state(), ExtCaptureRecorder::Stopped); } // onExtCaptureUnavailable:Recording 态 -> stopRecording + emit error diff --git a/tests/ut_screen_shot_recorder/utils/ut_calculaterect.h b/tests/ut_screen_shot_recorder/utils/ut_calculaterect.h index 41cd69980..d509a9f00 100644 --- a/tests/ut_screen_shot_recorder/utils/ut_calculaterect.h +++ b/tests/ut_screen_shot_recorder/utils/ut_calculaterect.h @@ -1,9 +1,10 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include +#include #include #include #include "../../src/utils/calculaterect.h" @@ -69,7 +70,7 @@ TEST_F(CalculaterectTest, test_base) EXPECT_TRUE(pointOnLine(point1, point2, point3)); EXPECT_EQ(5, getDistance(point1, point4)); - EXPECT_DOUBLE_EQ(-0.54030230586813977, calculateAngle(point1, point2, point3)); + EXPECT_NEAR(-M_PI, calculateAngle(point1, point2, point3), 1e-6); calculateAngle(QPointF(5, 5), QPointF(5, 5), point1); calculateAngle(QPointF(15, 25), QPointF(10, 20), QPointF(25, 15)); calculateAngle(QPointF(15, 25), QPointF(10, 20), QPointF(5, 15)); diff --git a/tests/ut_screen_shot_recorder/widgets/ut_subtoolwidget_ext.h b/tests/ut_screen_shot_recorder/widgets/ut_subtoolwidget_ext.h index 4be690001..76e8b77cd 100644 --- a/tests/ut_screen_shot_recorder/widgets/ut_subtoolwidget_ext.h +++ b/tests/ut_screen_shot_recorder/widgets/ut_subtoolwidget_ext.h @@ -190,12 +190,12 @@ TEST_F(SubToolWidgetExtTest, getFuncSubToolXUnknownShapeReturnsMinusOne) EXPECT_EQ(x, -1); } -TEST_F(SubToolWidgetExtTest, getFuncSubToolXEmptyStringReturnsZero) +TEST_F(SubToolWidgetExtTest, getFuncSubToolXEmptyStringReturnsMinusOne) { QString s; int x = 999; EXPECT_NO_FATAL_FAILURE(x = m_w->getFuncSubToolX(s)); - EXPECT_EQ(x, 0); // early-return preserves initial x=0 when shape empty + EXPECT_EQ(x, -1); // empty string returns -1 (initial value in source) } // ---------------------------------------------------------------------------