From 86f47728bf478613402e1f520b4cdd53527e5867 Mon Sep 17 00:00:00 2001 From: BaoYang Date: Sat, 1 Nov 2025 10:31:05 +0800 Subject: [PATCH] add tdd Signed-off-by: BaoYang Change-Id: I7dd121b6b54f958596a8ee52be8d7fde951ceff3 --- .../test/unittest/src/sec_comp_info_helper_test.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp b/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp index 4df1aed..29786d2 100644 --- a/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp +++ b/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp @@ -185,10 +185,17 @@ HWTEST_F(SecCompInfoHelperTest, ParseComponent004, TestSize.Level0) rect.width_ = g_testWidth; rect.height_ = g_testHeight; - rect.x_ = g_curScreenWidth - g_testWidth; + rect.x_ = g_curScreenWidth - g_testWidth + 1; // reach the threshold ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, screenInfo, message, scale)); rect.x_ = g_testWidth; - rect.y_ = g_curScreenHeight - g_testHeight; + rect.y_ = g_curScreenHeight - g_testHeight + 1; // reach the threshold + + ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, screenInfo, message, scale)); + + rect.x_ = g_curScreenWidth - g_testWidth + 1.1; // exceed the threshold + ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, screenInfo, message, scale)); + rect.x_ = g_testWidth; + rect.y_ = g_curScreenHeight - g_testHeight + 1.1; // exceed the threshold ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, screenInfo, message, scale)); rect.y_ = g_testHeight;