From 61f27618df847ef5712cdef79b454d62539b1722 Mon Sep 17 00:00:00 2001 From: dingpy Date: Sat, 13 Sep 2025 08:06:51 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dingpy Change-Id: I30f31cf4a38e900c1745a036292b0baeaef5502c --- surface/test/unittest/native_buffer_test.cpp | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/surface/test/unittest/native_buffer_test.cpp b/surface/test/unittest/native_buffer_test.cpp index a334c2ce27..d4e0a66d4c 100644 --- a/surface/test/unittest/native_buffer_test.cpp +++ b/surface/test/unittest/native_buffer_test.cpp @@ -707,6 +707,27 @@ TEST_F(NativeBufferTest, OHNativeBufferMapWaitFence003) EXPECT_EQ(OH_NativeBuffer_Unreference(nativeBuffer), OHOS::GSERROR_OK); } +/* + * Function: OHNativeBufferMapWaitFence004 + * Type: Function + * Rank: Important(2) + * EnvConditions: N/A + * CaseDescription: 1. call OH_NativeBuffer_Map_WaitFence by abnormal buffer input + * 2. check ret + */ +HWTEST_F(NativeBufferTest, OHNativeBufferMapWaitFence004, TestSize.Level0) +{ + sptr sBuffer = SurfaceBuffer::Create(); + OH_NativeBuffer* nativeBuffer = sBuffer->SurfaceBufferToNativeBuffer(); + void *virAddr = nullptr; + int32_t fenceFd = 1; + int32_t ret = OH_NativeBuffer_Map_WaitFence(nativeBuffer, fenceFd, &virAddr); + ASSERT_EQ(ret, OHOS::SURFACE_ERROR_UNKOWN); + ASSERT_EQ(virAddr, nullptr); + delete sBuffer; + sBuffer = nullptr; +} + /* * Function: OH_NativeBuffer_Unmap * Type: Function -- Gitee