• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 #include "gtest/gtest.h"
17 
18 #include "drawing_error_code.h"
19 #include "drawing_path.h"
20 #include "drawing_point.h"
21 #include "drawing_rect.h"
22 #include "drawing_region.h"
23 
24 using namespace testing;
25 using namespace testing::ext;
26 
27 namespace OHOS {
28 namespace Rosen {
29 namespace Drawing {
30 class DrawingNativeRegionTest : public testing::Test {};
31 
32 /*
33  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0100
34  * @tc.name: testRegionCreateNormal
35  * @tc.desc: test for testRegionCreateNormal.
36  * @tc.size  : SmallTest
37  * @tc.type  : Function
38  * @tc.level : Level 0
39  */
40 HWTEST_F(DrawingNativeRegionTest, testRegionCreateNormal, TestSize.Level0) {
41     // 1. OH_Drawing_RegionCreate
42     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
43     EXPECT_NE(region, nullptr);
44     OH_Drawing_RegionDestroy(region);
45 }
46 
47 /*
48  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0101
49  * @tc.name: testRegionCreateMoreTimes
50  * @tc.desc: test for testRegionCreateMoreTimes.
51  * @tc.size  : SmallTest
52  * @tc.type  : Function
53  * @tc.level : Level 1
54  */
55 HWTEST_F(DrawingNativeRegionTest, testRegionCreateMoreTimes, TestSize.Level1) {
56     // 1. OH_Drawing_RegionCreate
57     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
58     EXPECT_NE(region, nullptr);
59 
60     // 2. Create another region object using OH_Drawing_RegionCreate
61     OH_Drawing_Region *region2 = OH_Drawing_RegionCreate();
62     EXPECT_NE(region2, nullptr);
63 
64     OH_Drawing_RegionDestroy(region);
65     OH_Drawing_RegionDestroy(region2);
66 }
67 
68 /*
69  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0200
70  * @tc.name: testRegionDestroyNormal
71  * @tc.desc: test for testRegionDestroyNormal.
72  * @tc.size  : SmallTest
73  * @tc.type  : Function
74  * @tc.level : Level 0
75  */
76 HWTEST_F(DrawingNativeRegionTest, testRegionDestroyNormal, TestSize.Level0) {
77     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject
78     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
79     EXPECT_NE(regionObject, nullptr);
80     // 2. OH_Drawing_RegionDestroy takes regionObject as input
81     OH_Drawing_RegionDestroy(regionObject);
82 }
83 
84 /*
85  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0201
86  * @tc.name: testRegionDestroyNull
87  * @tc.desc: test for testRegionDestroyNull.
88  * @tc.size  : SmallTest
89  * @tc.type  : Function
90  * @tc.level : Level 1
91  */
92 HWTEST_F(DrawingNativeRegionTest, testRegionDestroyNull, TestSize.Level1) {
93     // 1. OH_Drawing_RegionDestroy takes nullptr as input
94     OH_Drawing_RegionDestroy(nullptr);
95 }
96 
97 /*
98  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0300
99  * @tc.name: testRegionContainsInRange
100  * @tc.desc: test for testRegionContainsInRange.
101  * @tc.size  : SmallTest
102  * @tc.type  : Function
103  * @tc.level : Level 0
104  */
105 HWTEST_F(DrawingNativeRegionTest, testRegionContainsInRange, TestSize.Level0) {
106     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject, the call is successful and the return value is
107     // not nullptr
108     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
109     EXPECT_NE(regionObject, nullptr);
110 
111     // 2. OH_Drawing_RegionContains takes regionObject as input, x: a value within the range, y: a value within the
112     // range, the call is successful and the return value is true
113     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
114     OH_Drawing_RegionSetRect(regionObject, rect);
115     bool ret = OH_Drawing_RegionContains(regionObject, 100, 100);
116     EXPECT_TRUE(ret);
117 
118     OH_Drawing_RegionDestroy(regionObject);
119     OH_Drawing_RectDestroy(rect);
120 }
121 
122 /*
123  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0301
124  * @tc.name: testRegionContainsXvalueNotInRange
125  * @tc.desc: test for testRegionContainsXvalueNotInRange.
126  * @tc.size  : SmallTest
127  * @tc.type  : Function
128  * @tc.level : Level 1
129  */
130 HWTEST_F(DrawingNativeRegionTest, testRegionContainsXvalueNotInRange, TestSize.Level1) {
131     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject
132     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
133     EXPECT_NE(regionObject, nullptr);
134     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
135     OH_Drawing_RegionSetRect(regionObject, rect);
136 
137     // 2. OH_Drawing_RegionContains takes regionObject as input, x: a value not within the range, y: a value within the
138     // range
139     bool ret = OH_Drawing_RegionContains(regionObject, 300, 100);
140     EXPECT_FALSE(ret);
141 
142     OH_Drawing_RegionDestroy(regionObject);
143     OH_Drawing_RectDestroy(rect);
144 }
145 
146 /*
147  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0302
148  * @tc.name: testRegionContainsYvalueNotInRange
149  * @tc.desc: test for testRegionContainsYvalueNotInRange.
150  * @tc.size  : SmallTest
151  * @tc.type  : Function
152  * @tc.level : Level 1
153  */
154 HWTEST_F(DrawingNativeRegionTest, testRegionContainsYvalueNotInRange, TestSize.Level1) {
155     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject
156     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
157     EXPECT_NE(regionObject, nullptr);
158     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
159     OH_Drawing_RegionSetRect(regionObject, rect);
160 
161     // 2. OH_Drawing_RegionContains takes regionObject as input, x: a value within the range, y: a value not within the
162     // range
163     bool ret = OH_Drawing_RegionContains(regionObject, 100, 300);
164     EXPECT_FALSE(ret);
165 
166     OH_Drawing_RegionDestroy(regionObject);
167     OH_Drawing_RectDestroy(rect);
168 }
169 
170 /*
171  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0303
172  * @tc.name: testRegionContainsAllNotInRange
173  * @tc.desc: test for testRegionContainsAllNotInRange.
174  * @tc.size  : SmallTest
175  * @tc.type  : Function
176  * @tc.level : Level 1
177  */
178 HWTEST_F(DrawingNativeRegionTest, testRegionContainsAllNotInRange, TestSize.Level1) {
179     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject
180     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
181     EXPECT_NE(regionObject, nullptr);
182     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
183     OH_Drawing_RegionSetRect(regionObject, rect);
184 
185     // 2. OH_Drawing_RegionContains takes regionObject as input, x: a value not within the range, y: a value not within
186     // the range
187     bool ret = OH_Drawing_RegionContains(regionObject, 300, 300);
188     EXPECT_FALSE(ret);
189 
190     OH_Drawing_RegionDestroy(regionObject);
191     OH_Drawing_RectDestroy(rect);
192 }
193 
194 /*
195  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0304
196  * @tc.name: testRegionContainsRegionNull
197  * @tc.desc: test for testRegionContainsRegionNull.
198  * @tc.size  : SmallTest
199  * @tc.type  : Function
200  * @tc.level : Level 1
201  */
202 HWTEST_F(DrawingNativeRegionTest, testRegionContainsRegionNull, TestSize.Level1) {
203     // 1. OH_Drawing_RegionContains takes nullptr as input, x: a value within the range, y: a value within the range
204     OH_Drawing_RegionContains(nullptr, 100, 100);
205     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
206 }
207 
208 /*
209  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0400
210  * @tc.name: testRegionOpNormal
211  * @tc.desc: test for testRegionOpNormal.
212  * @tc.size  : SmallTest
213  * @tc.type  : Function
214  * @tc.level : Level 0
215  */
216 HWTEST_F(DrawingNativeRegionTest, testRegionOpNormal, TestSize.Level0) {
217     // 1. OH_Drawing_RegionCreate returns a pointer value regionObject
218     OH_Drawing_Region *regionObject = OH_Drawing_RegionCreate();
219     EXPECT_NE(regionObject, nullptr);
220     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
221     OH_Drawing_RegionSetRect(regionObject, rect);
222     // 2. OH_Drawing_RegionCreate returns a pointer value dst
223     OH_Drawing_Region *dst = OH_Drawing_RegionCreate();
224     EXPECT_NE(dst, nullptr);
225     OH_Drawing_RegionSetRect(dst, rect);
226     // 3. OH_Drawing_RegionOp takes regionObject, dst, and op: perform OH_Drawing_RegionOpMode operations in sequence
227     OH_Drawing_RegionOpMode modes[] = {
228         REGION_OP_MODE_DIFFERENCE, REGION_OP_MODE_INTERSECT,          REGION_OP_MODE_UNION,
229         REGION_OP_MODE_XOR,        REGION_OP_MODE_REVERSE_DIFFERENCE, REGION_OP_MODE_REPLACE,
230     };
231     for (OH_Drawing_RegionOpMode mode : modes) {
232         OH_Drawing_RegionOp(regionObject, dst, mode);
233     }
234 
235     OH_Drawing_RegionDestroy(regionObject);
236     OH_Drawing_RectDestroy(rect);
237     OH_Drawing_RegionDestroy(dst);
238 }
239 
240 /*
241  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0401
242  * @tc.name: testRegionOpRegionNull
243  * @tc.desc: test for testRegionOpRegionNull.
244  * @tc.size  : SmallTest
245  * @tc.type  : Function
246  * @tc.level : Level 1
247  */
248 HWTEST_F(DrawingNativeRegionTest, testRegionOpRegionNull, TestSize.Level1) {
249     // 1. OH_Drawing_RegionCreate returns a pointer value dst
250     OH_Drawing_Region *dst = OH_Drawing_RegionCreate();
251     EXPECT_NE(dst, nullptr);
252     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
253     OH_Drawing_RegionSetRect(dst, rect);
254     // 2. OH_Drawing_RegionOp takes nullptr as input for region, dst as input, and op: REGION_OP_MODE_DIFFERENCE,
255     // returns OH_DRAWING_ERROR_INVALID_PARAMETER
256     OH_Drawing_RegionOp(nullptr, dst, REGION_OP_MODE_DIFFERENCE);
257     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
258 
259     OH_Drawing_RectDestroy(rect);
260     OH_Drawing_RegionDestroy(dst);
261 }
262 
263 /*
264  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0402
265  * @tc.name: testRegionOpRegionDstNull
266  * @tc.desc: test for testRegionOpRegionDstNull.
267  * @tc.size  : SmallTest
268  * @tc.type  : Function
269  * @tc.level : Level 1
270  */
271 HWTEST_F(DrawingNativeRegionTest, testRegionOpRegionDstNull, TestSize.Level1) {
272     // 1. OH_Drawing_RegionCreate returns a pointer value region
273     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
274     EXPECT_NE(region, nullptr);
275     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
276     OH_Drawing_RegionSetRect(region, rect);
277     // 2. OH_Drawing_RegionOp takes region as input, dst: nullptr, op: REGION_OP_MODE_DIFFERENCE
278     OH_Drawing_RegionOp(region, nullptr, REGION_OP_MODE_DIFFERENCE);
279     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
280 
281     OH_Drawing_RectDestroy(rect);
282     OH_Drawing_RegionDestroy(region);
283 }
284 
285 /*
286  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0500
287  * @tc.name: testRegionSetRectResultTrue
288  * @tc.desc: test for testRegionSetRectResultTrue.
289  * @tc.size  : SmallTest
290  * @tc.type  : Function
291  * @tc.level : Level 0
292  */
293 HWTEST_F(DrawingNativeRegionTest, testRegionSetRectResultTrue, TestSize.Level0) {
294     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
295     EXPECT_NE(region, nullptr);
296     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
297     // 1. OH_Drawing_RegionSetRect takes correct region and rect object pointers as input
298     bool ret = OH_Drawing_RegionSetRect(region, rect);
299     EXPECT_TRUE(ret);
300 
301     OH_Drawing_RectDestroy(rect);
302     OH_Drawing_RegionDestroy(region);
303 }
304 
305 /*
306  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0501
307  * @tc.name: testRegionSetRectRegionNull
308  * @tc.desc: test for testRegionSetRectRegionNull.
309  * @tc.size  : SmallTest
310  * @tc.type  : Function
311  * @tc.level : Level 1
312  */
313 HWTEST_F(DrawingNativeRegionTest, testRegionSetRectRegionNull, TestSize.Level1) {
314     // 1. OH_Drawing_RegionSetRect takes a correct rect object pointer as input, region is nullptr, returns
315     // OH_DRAWING_ERROR_INVALID_PARAMETER
316     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 256.0f, 256.0f);
317     OH_Drawing_RegionSetRect(nullptr, rect);
318     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
319     OH_Drawing_RectDestroy(rect);
320 }
321 
322 /*
323  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0502
324  * @tc.name: testRegionSetRectRectNull
325  * @tc.desc: test for testRegionSetRectRectNull.
326  * @tc.size  : SmallTest
327  * @tc.type  : Function
328  * @tc.level : Level 1
329  */
330 HWTEST_F(DrawingNativeRegionTest, testRegionSetRectRectNull, TestSize.Level1) {
331     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
332     // 1. OH_Drawing_RegionSetRect takes a correct region object pointer as input, rect is nullptr
333     OH_Drawing_RegionSetRect(region, nullptr);
334     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
335     OH_Drawing_RegionDestroy(region);
336 }
337 
338 /*
339  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0503
340  * @tc.name: testRegionSetRectResultFalse
341  * @tc.desc: test for testRegionSetRectResultFalse.
342  * @tc.size  : SmallTest
343  * @tc.type  : Function
344  * @tc.level : Level 1
345  */
346 HWTEST_F(DrawingNativeRegionTest, testRegionSetRectResultFalse, TestSize.Level1) {
347     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
348     EXPECT_NE(region, nullptr);
349     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 0.0f, 0.0f);
350 
351     // 1. OH_Drawing_RegionSetRect takes correct region and rect object pointers as input
352     bool ret = OH_Drawing_RegionSetRect(region, rect);
353     EXPECT_FALSE(ret);
354 
355     OH_Drawing_RectDestroy(rect);
356     OH_Drawing_RegionDestroy(region);
357 }
358 
359 /*
360  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0600
361  * @tc.name: testRegionSetPathResultTrue
362  * @tc.desc: test for testRegionSetPathResultTrue.
363  * @tc.size  : SmallTest
364  * @tc.type  : Function
365  * @tc.level : Level 0
366  */
367 HWTEST_F(DrawingNativeRegionTest, testRegionSetPathResultTrue, TestSize.Level0) {
368     OH_Drawing_Path *path = OH_Drawing_PathCreate();
369     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
370     OH_Drawing_Region *clip = OH_Drawing_RegionCreate();
371     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(150.0f, 180.0f, 200.0f, 200.0f);
372     OH_Drawing_RegionSetRect(clip, rect);
373     OH_Drawing_PathAddRect(path, 100.0f, 100.0f, 256.0f, 256.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
374 
375     // 1. OH_Drawing_RegionSetPath takes correct region, path, and clip object pointers as input
376     EXPECT_TRUE(OH_Drawing_RegionSetPath(region, path, clip));
377 
378     OH_Drawing_PathDestroy(path);
379     OH_Drawing_RegionDestroy(region);
380     OH_Drawing_RegionDestroy(clip);
381     OH_Drawing_RectDestroy(rect);
382 }
383 
384 /*
385  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0601
386  * @tc.name: testRegionSetPathRegionNull
387  * @tc.desc: test for testRegionSetPathRegionNull.
388  * @tc.size  : SmallTest
389  * @tc.type  : Function
390  * @tc.level : Level 1
391  */
392 HWTEST_F(DrawingNativeRegionTest, testRegionSetPathRegionNull, TestSize.Level1) {
393     OH_Drawing_Path *path = OH_Drawing_PathCreate();
394     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
395     OH_Drawing_Region *clip = OH_Drawing_RegionCreate();
396     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(150.0f, 180.0f, 200.0f, 200.0f);
397     OH_Drawing_RegionSetRect(clip, rect);
398 
399     // 1. OH_Drawing_RegionSetPath takes correct path and clip object pointers as input, region is nullptr
400     OH_Drawing_RegionSetPath(nullptr, path, clip);
401     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
402 
403     OH_Drawing_PathDestroy(path);
404     OH_Drawing_RegionDestroy(region);
405     OH_Drawing_RegionDestroy(clip);
406     OH_Drawing_RectDestroy(rect);
407 }
408 
409 /*
410  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0602
411  * @tc.name: testRegionSetPathPathNull
412  * @tc.desc: test for testRegionSetPathPathNull.
413  * @tc.size  : SmallTest
414  * @tc.type  : Function
415  * @tc.level : Level 1
416  */
417 HWTEST_F(DrawingNativeRegionTest, testRegionSetPathPathNull, TestSize.Level1) {
418     OH_Drawing_Path *path = OH_Drawing_PathCreate();
419     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
420     OH_Drawing_Region *clip = OH_Drawing_RegionCreate();
421     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(150.0f, 180.0f, 200.0f, 200.0f);
422     OH_Drawing_RegionSetRect(clip, rect);
423 
424     // 1. OH_Drawing_RegionSetPath takes correct region and clip object pointers as input, path is nullptr
425     OH_Drawing_RegionSetPath(region, nullptr, clip);
426     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
427 
428     OH_Drawing_PathDestroy(path);
429     OH_Drawing_RegionDestroy(region);
430     OH_Drawing_RegionDestroy(clip);
431     OH_Drawing_RectDestroy(rect);
432 }
433 
434 /*
435  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0603
436  * @tc.name: testRegionSetPathClipNull
437  * @tc.desc: test for testRegionSetPathClipNull.
438  * @tc.size  : SmallTest
439  * @tc.type  : Function
440  * @tc.level : Level 1
441  */
442 HWTEST_F(DrawingNativeRegionTest, testRegionSetPathClipNull, TestSize.Level1) {
443     OH_Drawing_Path *path = OH_Drawing_PathCreate();
444     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
445     OH_Drawing_Region *clip = OH_Drawing_RegionCreate();
446     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(150.0f, 180.0f, 200.0f, 200.0f);
447     OH_Drawing_RegionSetRect(clip, rect);
448 
449     // 1. OH_Drawing_RegionSetPath takes correct region, path object pointers as input, and clip is nullptr
450     OH_Drawing_RegionSetPath(region, path, nullptr);
451     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_DRAWING_ERROR_INVALID_PARAMETER);
452 
453     OH_Drawing_PathDestroy(path);
454     OH_Drawing_RegionDestroy(region);
455     OH_Drawing_RegionDestroy(clip);
456     OH_Drawing_RectDestroy(rect);
457 }
458 
459 /*
460  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_REGION_0604
461  * @tc.name: testRegionSetPathResultFalse
462  * @tc.desc: test for testRegionSetPathResultFalse.
463  * @tc.size  : SmallTest
464  * @tc.type  : Function
465  * @tc.level : Level 1
466  */
467 HWTEST_F(DrawingNativeRegionTest, testRegionSetPathResultFalse, TestSize.Level1) {
468     OH_Drawing_Path *path = OH_Drawing_PathCreate();
469     OH_Drawing_Region *region = OH_Drawing_RegionCreate();
470     OH_Drawing_Region *clip = OH_Drawing_RegionCreate();
471     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 0.0f, 0.0f);
472     OH_Drawing_RegionSetRect(clip, rect);
473 
474     // 1. OH_Drawing_RegionSetPath takes correct region, path, and clip object pointers as input
475     bool ret = OH_Drawing_RegionSetPath(region, path, clip);
476     EXPECT_FALSE(ret);
477 
478     OH_Drawing_PathDestroy(path);
479     OH_Drawing_RegionDestroy(region);
480     OH_Drawing_RegionDestroy(clip);
481     OH_Drawing_RectDestroy(rect);
482 }
483 
484 } // namespace Drawing
485 } // namespace Rosen
486 } // namespace OHOS