• 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 "DrawingNativePathCommon.h"
17 #include "drawing_color.h"
18 #include "drawing_color_filter.h"
19 #include "drawing_filter.h"
20 #include "drawing_image.h"
21 #include "drawing_matrix.h"
22 #include "drawing_path.h"
23 #include "drawing_path_effect.h"
24 #include "drawing_pen.h"
25 #include "drawing_point.h"
26 #include "drawing_rect.h"
27 #include "drawing_region.h"
28 #include "drawing_round_rect.h"
29 #include "utils/scalar.h"
30 #include "gtest/gtest.h"
31 
32 using namespace testing;
33 using namespace testing::ext;
34 
35 namespace OHOS {
36 namespace Rosen {
37 namespace Drawing {
38 class DrawingNativePathPart2Test : public testing::Test {
39     protected:
40     // 在每个测试用例执行前调用
SetUp()41     void SetUp() override
42     {
43         // 设置代码
44         std::cout << "DrawingNativePathPart2Test Setup code called before each test case." << std::endl;
45         OH_Drawing_ErrorCodeReset();
46         std::cout << "DrawingNativePathPart2Test errorCodeReset before each test case." << std::endl;
47     }
TearDown()48     void TearDown() override
49     {
50         std::cout << "DrawingNativePathPart2Test Setup code called after each test case." << std::endl;
51         OH_Drawing_ErrorCodeReset();
52         std::cout << "DrawingNativePathPart2Test errorCodeReset after each test case." << std::endl;
53     }
54 };
55 /*
56  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1900
57  * @tc.name: testPathAddArcNormal
58  * @tc.desc: Test for adding an arc to a path with normal parameters.
59  * @tc.size  : SmallTest
60  * @tc.type  : Function
61  * @tc.level : Level 0
62  */
63 HWTEST_F(DrawingNativePathPart2Test, testPathAddArcNormal, TestSize.Level0) {
64     // 1. Create a path object using OH_Drawing_PathCreate.
65     OH_Drawing_Path *path = OH_Drawing_PathCreate();
66     // add assert
67     EXPECT_NE(path, nullptr);
68     // 2. Create a rectangle object using OH_Drawing_RectCreate.
69     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
70     // add assert
71     EXPECT_NE(rect, nullptr);
72     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
73     OH_Drawing_PathMoveTo(path, 0, 0);
74     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
75     OH_Drawing_PathLineTo(path, 100, 100);
76     // 5. Add an arc to the path using OH_Drawing_PathAddArc, which serves as the starting point of the new contour.
77     OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
78     // add assert
79     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
80     // 6. Free the memory.
81     OH_Drawing_PathDestroy(path);
82     OH_Drawing_RectDestroy(rect);
83 }
84 
85 /*
86  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1901
87  * @tc.name: testPathAddArcNull
88  * @tc.desc: Test for adding an arc to a path with NULL or invalid parameters.
89  * @tc.size  : SmallTest
90  * @tc.type  : Function
91  * @tc.level : Level 3
92  */
93 HWTEST_F(DrawingNativePathPart2Test, testPathAddArcNull, TestSize.Level3) {
94     // 1. Create a path object using OH_Drawing_PathCreate.
95     OH_Drawing_Path *path = OH_Drawing_PathCreate();
96     // add assert
97     EXPECT_NE(path, nullptr);
98     // 2. Create a rectangle object using OH_Drawing_RectCreate.
99     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
100     // add assert
101     EXPECT_NE(rect, nullptr);
102     // 3. Call OH_Drawing_PathAddArc with a nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
103     // error code.
104     OH_Drawing_PathAddArc(nullptr, rect, 0.0, 0.0);
105     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
106     OH_Drawing_ErrorCodeReset();
107     // 4. Call OH_Drawing_PathAddArc with a nullptr as the second parameter, expecting
108     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
109     OH_Drawing_PathAddArc(path, nullptr, 0.0, 0.0);
110     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
111     // 5. Call OH_Drawing_PathAddArc with 0.0 as the third parameter, expecting failure without crash.
112     OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
113     // 6. Call OH_Drawing_PathAddArc with 0.0 as the fourth parameter, expecting failure without crash.
114     OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
115     // 7. Free the memory.
116     OH_Drawing_PathDestroy(path);
117     OH_Drawing_RectDestroy(rect);
118 }
119 
120 /*
121  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1902
122  * @tc.name: testPathAddArcAbnormal
123  * @tc.desc: Test for adding an arc to a path with abnormal data types as parameters.
124  * @tc.size  : SmallTest
125  * @tc.type  : Function
126  * @tc.level : Level 3
127  */
128 HWTEST_F(DrawingNativePathPart2Test, testPathAddArcAbnormal, TestSize.Level3) {
129     // 1. Create a path object using OH_Drawing_PathCreate.
130     OH_Drawing_Path *path = OH_Drawing_PathCreate();
131     // add assert
132     EXPECT_NE(path, nullptr);
133     // 2. Create a rectangle object using OH_Drawing_RectCreate.
134     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
135     // add assert
136     EXPECT_NE(rect, nullptr);
137     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
138     OH_Drawing_PathMoveTo(path, 0, 0);
139     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
140     OH_Drawing_PathLineTo(path, 100, 100);
141     // 5. Add an arc to the path using OH_Drawing_PathAddArc, passing an integer or character type as the third
142     // parameter.
143     OH_Drawing_PathAddArc(path, rect, 30, 30.0f);
144     // 6. Add an arc to the path using OH_Drawing_PathAddArc, passing an integer or character type as the fourth
145     // parameter.
146     OH_Drawing_PathAddArc(path, rect, 30.0f, 30);
147     // 7. Free the memory.
148     OH_Drawing_PathDestroy(path);
149 }
150 
151 /*
152  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1903
153  * @tc.name: testPathAddArcMaximal
154  * @tc.desc: Test for adding an arc to a path with maximal values as parameters.
155  * @tc.size  : SmallTest
156  * @tc.type  : Function
157  * @tc.level : Level 3
158  */
159 HWTEST_F(DrawingNativePathPart2Test, testPathAddArcMaximal, TestSize.Level3) {
160     // 1. Create a path object using OH_Drawing_PathCreate.
161     OH_Drawing_Path *path = OH_Drawing_PathCreate();
162     // add assert
163     EXPECT_NE(path, nullptr);
164     // 2. Create a rectangle object using OH_Drawing_RectCreate.
165     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
166     // add assert
167     EXPECT_NE(rect, nullptr);
168     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
169     OH_Drawing_PathMoveTo(path, 0, 0);
170     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
171     OH_Drawing_PathLineTo(path, 100, 100);
172     // 5. Add an arc to the path using OH_Drawing_PathAddArc, passing FLT_MAX + 1 as the third parameter, which will
173     // fail without crashing.
174     OH_Drawing_PathAddArc(path, rect, FLT_MAX + 1, 0.0);
175     // 6. Add an arc to the path using OH_Drawing_PathAddArc, passing FLT_MAX + 1 as the fourth parameter, which will
176     // fail without crashing.
177     OH_Drawing_PathAddArc(path, rect, 0.0, FLT_MAX + 1);
178     // 7. Free the memory.
179     OH_Drawing_PathDestroy(path);
180     OH_Drawing_RectDestroy(rect);
181 }
182 
183 /*
184  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2000
185  * @tc.name: testPathAddPathNormal
186  * @tc.desc: Test for adding a path to another path with normal parameters.
187  * @tc.size  : SmallTest
188  * @tc.type  : Function
189  * @tc.level : Level 0
190  */
191 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathNormal, TestSize.Level0) {
192     // 1. Create a path object using OH_Drawing_PathCreate.
193     OH_Drawing_Path *path = OH_Drawing_PathCreate();
194     // add assert
195     EXPECT_NE(path, nullptr);
196     // 2. Create a path object using OH_Drawing_PathCreate.
197     OH_Drawing_Path *src = OH_Drawing_PathCreate();
198     // add assert
199     EXPECT_NE(src, nullptr);
200     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
201     OH_Drawing_PathMoveTo(src, 0, 0);
202     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
203     // path src).
204     OH_Drawing_PathLineTo(src, 100, 100);
205     // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPath.
206     OH_Drawing_PathAddPath(path, src, nullptr);
207     // add assert
208     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
209     // 6. Free the memory.
210     OH_Drawing_PathDestroy(path);
211     OH_Drawing_PathDestroy(src);
212 }
213 
214 /*
215  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2001
216  * @tc.name: testPathAddPathNull
217  * @tc.desc: Test for adding a path to another path with NULL or invalid parameters.
218  * @tc.size  : SmallTest
219  * @tc.type  : Function
220  * @tc.level : Level 3
221  */
222 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathNull, TestSize.Level3) {
223     // 1. Create a path object using OH_Drawing_PathCreate.
224     OH_Drawing_Path *path = OH_Drawing_PathCreate();
225     // add assert
226     EXPECT_NE(path, nullptr);
227     // 2. Create a path object using OH_Drawing_PathCreate.
228     OH_Drawing_Path *src = OH_Drawing_PathCreate();
229     // add assert
230     EXPECT_NE(src, nullptr);
231     // 3. Call OH_Drawing_PathAddPath with a nullptr as the first parameter, expecting
232     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
233     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
234     OH_Drawing_MatrixSetMatrix(matrix, 5, 4, 0, 0, -1, 0, 0, 0, 1);
235     OH_Drawing_PathAddPath(nullptr, src, matrix);
236     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
237     OH_Drawing_ErrorCodeReset();
238     // 4. Call OH_Drawing_PathAddPath with a nullptr as the second parameter, expecting
239     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
240     OH_Drawing_PathAddPath(path, nullptr, matrix);
241     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
242     // 5. Call OH_Drawing_PathAddPath with a nullptr as the third parameter, expecting failure without crash.
243     OH_Drawing_PathAddPath(path, src, nullptr);
244     // 6. Free the memory.
245     OH_Drawing_PathDestroy(path);
246     OH_Drawing_PathDestroy(src);
247     OH_Drawing_MatrixDestroy(matrix);
248 }
249 
250 /*
251  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2100
252  * @tc.name: testPathAddPathWithMatrixAndModeNormal
253  * @tc.desc: Test for adding a path to another path with matrix and mode transformations using normal parameters.
254  * @tc.size  : SmallTest
255  * @tc.type  : Function
256  * @tc.level : Level 0
257  */
258 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithMatrixAndModeNormal, TestSize.Level0) {
259     // 1. Create a path object using OH_Drawing_PathCreate.
260     OH_Drawing_Path *path = OH_Drawing_PathCreate();
261     // add assert
262     EXPECT_NE(path, nullptr);
263     // 2. Create a path object using OH_Drawing_PathCreate.
264     OH_Drawing_Path *src = OH_Drawing_PathCreate();
265     // add assert
266     EXPECT_NE(src, nullptr);
267     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
268     OH_Drawing_PathMoveTo(src, 0, 0);
269     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
270     // path src).
271     OH_Drawing_PathLineTo(src, 100, 100);
272     // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPathWithMatrixAndMode. The fourth
273     // parameter enumerates calling this interface.
274     OH_Drawing_PathAddMode modes[] = {PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND};
275     for (int i = 0; i < 2; i++) {
276         OH_Drawing_ErrorCodeReset();
277         OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
278         // add assert
279         EXPECT_NE(matrix, nullptr);
280         OH_Drawing_MatrixSetMatrix(matrix, 5, 4, 0, 0, -1, 0, 0, 0, 1);
281         OH_Drawing_PathAddPathWithMatrixAndMode(path, src, matrix, modes[i]);
282         // add assert
283         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
284         OH_Drawing_MatrixDestroy(matrix);
285     }
286     // 6. Free the memory.
287     OH_Drawing_PathDestroy(path);
288     OH_Drawing_PathDestroy(src);
289 }
290 
291 /*
292  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2101
293  * @tc.name: testPathAddPathWithMatrixAndModeNull
294  * @tc.desc: Test for adding a path to another path with matrix and mode transformations using NULL or invalid
295  * parameters.
296  * @tc.size  : SmallTest
297  * @tc.type  : Function
298  * @tc.level : Level 3
299  */
300 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithMatrixAndModeNull, TestSize.Level3) {
301     // 1. Create a path object using OH_Drawing_PathCreate.
302     OH_Drawing_Path *path = OH_Drawing_PathCreate();
303     // add assert
304     EXPECT_NE(path, nullptr);
305     // 2. Create a path object using OH_Drawing_PathCreate.
306     OH_Drawing_Path *src = OH_Drawing_PathCreate();
307     // add assert
308     EXPECT_NE(src, nullptr);
309     // 3. Call OH_Drawing_PathAddPathWithMatrixAndMode with a nullptr as the first parameter, expecting
310     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
311     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
312     // add assert
313     EXPECT_NE(matrix, nullptr);
314     OH_Drawing_MatrixSetMatrix(matrix, 5, 4, 0, 0, -1, 0, 0, 0, 1);
315     OH_Drawing_PathAddPathWithMatrixAndMode(nullptr, src, matrix, PATH_ADD_MODE_APPEND);
316     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
317     OH_Drawing_ErrorCodeReset();
318     // 4. Call OH_Drawing_PathAddPathWithMatrixAndMode with a nullptr as the second parameter, expecting
319     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
320     OH_Drawing_PathAddPathWithMatrixAndMode(path, nullptr, matrix, PATH_ADD_MODE_APPEND);
321     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
322     // 5. Call OH_Drawing_PathAddPathWithMatrixAndMode with a nullptr as the third parameter, expecting failure without
323     // crash.
324     OH_Drawing_PathAddPathWithMatrixAndMode(path, src, nullptr, PATH_ADD_MODE_APPEND);
325     // 6. Free the memory.
326     OH_Drawing_PathDestroy(path);
327     OH_Drawing_PathDestroy(src);
328     OH_Drawing_MatrixDestroy(matrix);
329 }
330 
331 /*
332  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2200
333  * @tc.name: testPathAddPathWithModeNormal
334  * @tc.desc: Test for adding a path to another path with mode transformations using normal parameters.
335  * @tc.size  : SmallTest
336  * @tc.type  : Function
337  * @tc.level : Level 0
338  */
339 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithModeNormal, TestSize.Level0) {
340     // 1. Create a path object using OH_Drawing_PathCreate.
341     OH_Drawing_Path *path = OH_Drawing_PathCreate();
342     // add assert
343     EXPECT_NE(path, nullptr);
344     // 2. Create a path object using OH_Drawing_PathCreate.
345     OH_Drawing_Path *src = OH_Drawing_PathCreate();
346     // add assert
347     EXPECT_NE(src, nullptr);
348     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
349     OH_Drawing_PathMoveTo(src, 0, 0);
350     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
351     // path src).
352     OH_Drawing_PathLineTo(src, 100, 100);
353     // 5. Add the source path to the current path using OH_Drawing_PathAddPathWithMode. The third parameter enumerates
354     // calling this interface.
355     OH_Drawing_PathAddMode modes[] = {PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND};
356     for (int i = 0; i < 2; i++) {
357         OH_Drawing_ErrorCodeReset();
358         OH_Drawing_PathAddPathWithMode(path, src, modes[i]);
359         // add assert
360         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
361     }
362     // 6. Free the memory.
363     OH_Drawing_PathDestroy(path);
364 }
365 
366 /*
367  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2201
368  * @tc.name: testPathAddPathWithModeNull
369  * @tc.desc: Test for adding a path to another path with mode transformations using NULL or invalid parameters.
370  * @tc.size  : SmallTest
371  * @tc.type  : Function
372  * @tc.level : Level 3
373  */
374 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithModeNull, TestSize.Level3) {
375     // 1. Create a path object using OH_Drawing_PathCreate.
376     OH_Drawing_Path *path = OH_Drawing_PathCreate();
377     // add assert
378     EXPECT_NE(path, nullptr);
379     // 2. Create a path object using OH_Drawing_PathCreate.
380     OH_Drawing_Path *src = OH_Drawing_PathCreate();
381     // add assert
382     EXPECT_NE(src, nullptr);
383     // 3. Call OH_Drawing_PathAddPathWithMode with a nullptr as the first parameter, expecting
384     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
385     OH_Drawing_PathAddPathWithMode(nullptr, src, PATH_ADD_MODE_APPEND);
386     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
387     OH_Drawing_ErrorCodeReset();
388     // 4. Call OH_Drawing_PathAddPathWithMode with a nullptr as the second parameter, expecting
389     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
390     OH_Drawing_PathAddPathWithMode(path, nullptr, PATH_ADD_MODE_APPEND);
391     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
392     // 5. Free the memory.
393     OH_Drawing_PathDestroy(path);
394     OH_Drawing_PathDestroy(src);
395 }
396 
397 /*
398  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2300
399  * @tc.name: testPathAddPathWithOffsetAndModeNormal
400  * @tc.desc: Test for adding a path to another path with offset and mode transformations using normal parameters.
401  * @tc.size  : SmallTest
402  * @tc.type  : Function
403  * @tc.level : Level 0
404  */
405 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithOffsetAndModeNormal, TestSize.Level0) {
406     // 1. Create a path object using OH_Drawing_PathCreate.
407     OH_Drawing_Path *path = OH_Drawing_PathCreate();
408     // add assert
409     EXPECT_NE(path, nullptr);
410     // 2. Create a path object using OH_Drawing_PathCreate.
411     OH_Drawing_Path *src = OH_Drawing_PathCreate();
412     // add assert
413     EXPECT_NE(src, nullptr);
414     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
415     OH_Drawing_PathMoveTo(src, 0, 0);
416     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
417     // path src).
418     OH_Drawing_PathLineTo(src, 100, 100);
419     // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPathWithOffsetAndMode. The fifth
420     // parameter enumerates calling this interface.
421     OH_Drawing_PathAddMode modes[] = {PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND};
422     for (int i = 0; i < 2; i++) {
423         OH_Drawing_ErrorCodeReset();
424         OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0, 10.0, modes[i]);
425         // add assert
426         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
427     }
428     // 6. Free the memory.
429     OH_Drawing_PathDestroy(path);
430     OH_Drawing_PathDestroy(src);
431 }
432 
433 /*
434  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2301
435  * @tc.name: testPathAddPathWithOffsetAndModeNull
436  * @tc.desc: Test for adding a path to another path with offset and mode transformations using NULL or invalid
437  * parameters.
438  * @tc.size  : SmallTest
439  * @tc.type  : Function
440  * @tc.level : Level 3
441  */
442 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithOffsetAndModeNull, TestSize.Level3) {
443     // 1. Create a path object using OH_Drawing_PathCreate.
444     OH_Drawing_Path *path = OH_Drawing_PathCreate();
445     // add assert
446     EXPECT_NE(path, nullptr);
447     // 2. Create a path object using OH_Drawing_PathCreate.
448     OH_Drawing_Path *src = OH_Drawing_PathCreate();
449     // add assert
450     EXPECT_NE(src, nullptr);
451     // 3. Call OH_Drawing_PathAddPathWithOffsetAndMode with a nullptr as the first parameter, expecting
452     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
453     OH_Drawing_PathAddPathWithOffsetAndMode(nullptr, src, 10.0, 10.0, PATH_ADD_MODE_APPEND);
454     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
455     OH_Drawing_ErrorCodeReset();
456     // 4. Call OH_Drawing_PathAddPathWithOffsetAndMode with a nullptr as the second parameter, expecting
457     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
458     OH_Drawing_PathAddPathWithOffsetAndMode(path, nullptr, 10.0, 10.0, PATH_ADD_MODE_APPEND);
459     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
460     // 5. Call OH_Drawing_PathAddPathWithOffsetAndMode with 0.00 as the third parameter, expecting failure without
461     // crash.
462     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 0.0, 10.0, PATH_ADD_MODE_APPEND);
463     // 6. Call OH_Drawing_PathAddPathWithOffsetAndMode with 0.00 as the fourth parameter, expecting failure without
464     // crash.
465     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0, 0.0, PATH_ADD_MODE_APPEND);
466     // 7. Free the memory.
467     OH_Drawing_PathDestroy(path);
468     OH_Drawing_PathDestroy(src);
469 }
470 
471 /*
472  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2302
473  * @tc.name: testPathAddPathWithOffsetAndModeAbnormal
474  * @tc.desc: Test for adding a path to another path with offset and mode transformations using abnormal parameters.
475  * @tc.size  : SmallTest
476  * @tc.type  : Function
477  * @tc.level : Level 3
478  */
479 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithOffsetAndModeAbnormal, TestSize.Level3) {
480     // 1. Create a path object using OH_Drawing_PathCreate.
481     OH_Drawing_Path *path = OH_Drawing_PathCreate();
482     // add assert
483     EXPECT_NE(path, nullptr);
484     // 2. Create a path object using OH_Drawing_PathCreate.
485     OH_Drawing_Path *src = OH_Drawing_PathCreate();
486     // add assert
487     EXPECT_NE(src, nullptr);
488     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
489     OH_Drawing_PathMoveTo(src, 0, 0);
490     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
491     // path src).
492     OH_Drawing_PathLineTo(src, 100, 100);
493     // 5. Call OH_Drawing_PathAddPathWithOffsetAndMode with an integer as the third parameter, expecting successful
494     // call.
495     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10, 10.0f, PATH_ADD_MODE_APPEND);
496     // 6. Call OH_Drawing_PathAddPathWithOffsetAndMode with an integer as the fourth parameter, expecting successful
497     // call.
498     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0f, 10, PATH_ADD_MODE_APPEND);
499     // 7. Free the memory.
500     OH_Drawing_PathDestroy(path);
501     OH_Drawing_PathDestroy(src);
502 }
503 
504 /*
505  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2303
506  * @tc.name: testPathAddPathWithOffsetAndModeMaximal
507  * @tc.desc: Test for adding a path to another path with offset and mode transformations using maximal values.
508  * @tc.size  : SmallTest
509  * @tc.type  : Function
510  * @tc.level : Level 3
511  */
512 HWTEST_F(DrawingNativePathPart2Test, testPathAddPathWithOffsetAndModeMaximal, TestSize.Level3) {
513     // 1. Create a path object using OH_Drawing_PathCreate.
514     OH_Drawing_Path *path = OH_Drawing_PathCreate();
515     // add assert
516     EXPECT_NE(path, nullptr);
517     // 2. Create a path object using OH_Drawing_PathCreate.
518     OH_Drawing_Path *src = OH_Drawing_PathCreate();
519     // add assert
520     EXPECT_NE(src, nullptr);
521     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
522     OH_Drawing_PathMoveTo(src, 0, 0);
523     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo (create the source
524     // path src).
525     OH_Drawing_PathLineTo(src, 100, 100);
526     // 5. Call OH_Drawing_PathAddPathWithOffsetAndMode with the third parameter as FLT_MAX + 1, without crashing.
527     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, FLT_MAX + 1, 10.0f, PATH_ADD_MODE_APPEND);
528     // 6. Call OH_Drawing_PathAddPathWithOffsetAndMode with the fourth parameter as FLT_MAX + 1, without crashing.
529     OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0f, FLT_MAX + 1, PATH_ADD_MODE_APPEND);
530     // 7. Free the memory.
531     OH_Drawing_PathDestroy(path);
532 }
533 
534 /*
535  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2400
536  * @tc.name: testPathAddOvalNormal
537  * @tc.desc: Test for adding an oval to a path using normal parameters.
538  * @tc.size  : SmallTest
539  * @tc.type  : Function
540  * @tc.level : Level 0
541  */
542 HWTEST_F(DrawingNativePathPart2Test, testPathAddOvalNormal, TestSize.Level0) {
543     // 1. Create a path object using OH_Drawing_PathCreate.
544     OH_Drawing_Path *path = OH_Drawing_PathCreate();
545     // add assert
546     EXPECT_NE(path, nullptr);
547     // 2. Create a rectangle object using OH_Drawing_RectCreate.
548     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
549     // add assert
550     EXPECT_NE(rect, nullptr);
551     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
552     OH_Drawing_PathMoveTo(path, 0, 0);
553     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
554     OH_Drawing_PathLineTo(path, 100, 100);
555     // 5. Add an oval to the path with the specified direction using OH_Drawing_PathAddOval. The third parameter
556     // enumerates calling this interface.
557     OH_Drawing_PathDirection directions[] = {PATH_DIRECTION_CW, PATH_DIRECTION_CCW};
558     for (int i = 0; i < 2; i++) {
559         OH_Drawing_ErrorCodeReset();
560         OH_Drawing_PathAddOval(path, rect, directions[i]);
561         // add assert
562         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
563     }
564     // 6. Free the memory.
565     OH_Drawing_PathDestroy(path);
566     OH_Drawing_RectDestroy(rect);
567 }
568 
569 /*
570  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2401
571  * @tc.name: testPathAddOvalNull
572  * @tc.desc: Test for adding an oval to a path using NULL or invalid parameters.
573  * @tc.size  : SmallTest
574  * @tc.type  : Function
575  * @tc.level : Level 3
576  */
577 HWTEST_F(DrawingNativePathPart2Test, testPathAddOvalNull, TestSize.Level3) {
578     // 1. Create a path object using OH_Drawing_PathCreate.
579     OH_Drawing_Path *path = OH_Drawing_PathCreate();
580     // add assert
581     EXPECT_NE(path, nullptr);
582     // 2. Create a rectangle object using OH_Drawing_RectCreate.
583     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
584     // add assert
585     EXPECT_NE(rect, nullptr);
586     // 3. Call OH_Drawing_PathAddOval with a nullptr as the first parameter, expecting
587     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
588     OH_Drawing_PathAddOval(nullptr, rect, PATH_DIRECTION_CW);
589     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
590     OH_Drawing_ErrorCodeReset();
591     // 4. Call OH_Drawing_PathAddOval with a nullptr as the second parameter, expecting
592     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
593     OH_Drawing_PathAddOval(path, nullptr, PATH_DIRECTION_CW);
594     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
595     // 5. Free the memory.
596     OH_Drawing_PathDestroy(path);
597     OH_Drawing_RectDestroy(rect);
598 }
599 
600 /*
601  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2500
602  * @tc.name: testPathAddPolygonNormal
603  * @tc.desc: Test for adding a polygon to a path with the fourth parameter set to true.
604  * @tc.size  : SmallTest
605  * @tc.type  : Function
606  * @tc.level : Level 0
607  */
608 HWTEST_F(DrawingNativePathPart2Test, testPathAddPolygonNormal, TestSize.Level0) {
609     // 1. Create a path object using OH_Drawing_PathCreate.
610     OH_Drawing_Path *path = OH_Drawing_PathCreate();
611     // add assert
612     EXPECT_NE(path, nullptr);
613     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
614     OH_Drawing_PathMoveTo(path, 0, 0);
615     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
616     OH_Drawing_PathLineTo(path, 100, 100);
617     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
618     OH_Drawing_PathLineTo(path, 100, 0);
619     // 5. Add a polygon to the path. Set the fourth parameter to true.
620     OH_Drawing_Point2D point1 = {0, 0};
621     OH_Drawing_Point2D point2 = {100, 0};
622     OH_Drawing_Point2D point3 = {100, 100};
623     OH_Drawing_Point2D point4 = {0, 100};
624     OH_Drawing_Point2D points[4] = {point1, point2, point3, point4};
625     OH_Drawing_PathAddPolygon(path, points, 4, true);
626     // add assert
627     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
628     // 6. Free the memory.
629     OH_Drawing_PathDestroy(path);
630 }
631 
632 /*
633  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2501
634  * @tc.name: testPathAddPolygonNormal2
635  * @tc.desc: Test for adding a polygon to a path with the fourth parameter set to false.
636  * @tc.size  : SmallTest
637  * @tc.type  : Function
638  * @tc.level : Level 0
639  */
640 HWTEST_F(DrawingNativePathPart2Test, testPathAddPolygonNormal2, TestSize.Level0) {
641     // 1. Create a path object using OH_Drawing_PathCreate.
642     OH_Drawing_Path *path = OH_Drawing_PathCreate();
643     // add assert
644     EXPECT_NE(path, nullptr);
645     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
646     OH_Drawing_PathMoveTo(path, 0, 0);
647     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
648     OH_Drawing_PathLineTo(path, 100, 100);
649     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
650     OH_Drawing_PathLineTo(path, 100, 0);
651     // 5. Add a polygon to the path. Set the fourth parameter to false.
652     OH_Drawing_Point2D point1 = {0, 0};
653     OH_Drawing_Point2D point2 = {100, 0};
654     OH_Drawing_Point2D point3 = {100, 100};
655     OH_Drawing_Point2D point4 = {0, 100};
656     OH_Drawing_Point2D points[4] = {point1, point2, point3, point4};
657     OH_Drawing_PathAddPolygon(path, points, 4, false);
658     // add assert
659     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
660     // 6. Free the memory.
661     OH_Drawing_PathDestroy(path);
662 }
663 
664 /*
665  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2502
666  * @tc.name: testPathAddPolygonNull
667  * @tc.desc: Test for adding a polygon to a path using NULL or invalid parameters.
668  * @tc.size  : SmallTest
669  * @tc.type  : Function
670  * @tc.level : Level 3
671  */
672 HWTEST_F(DrawingNativePathPart2Test, testPathAddPolygonNull, TestSize.Level3) {
673     // 1. Create a path object using OH_Drawing_PathCreate.
674     OH_Drawing_Path *path = OH_Drawing_PathCreate();
675     // add assert
676     EXPECT_NE(path, nullptr);
677     OH_Drawing_Point2D point1 = {0, 0};
678     OH_Drawing_Point2D point2 = {100, 0};
679     OH_Drawing_Point2D point3 = {100, 100};
680     OH_Drawing_Point2D point4 = {0, 100};
681     OH_Drawing_Point2D points[4] = {point1, point2, point3, point4};
682     // 2. Call OH_Drawing_PathAddPolygon with a nullptr as the first parameter, expecting
683     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
684     OH_Drawing_PathAddPolygon(nullptr, points, 4, true);
685     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
686     OH_Drawing_ErrorCodeReset();
687     // 3. Call OH_Drawing_PathAddPolygon with a nullptr as the second parameter, expecting
688     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
689     OH_Drawing_PathAddPolygon(path, nullptr, 4, true);
690     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
691     OH_Drawing_ErrorCodeReset();
692     // 4. Call OH_Drawing_PathAddPolygon with the third parameter as 0, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
693     // error code.
694     OH_Drawing_PathAddPolygon(path, points, 0, true);
695     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
696     // 5. Free the memory.
697     OH_Drawing_PathDestroy(path);
698 }
699 
700 /*
701  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2503
702  * @tc.name: testPathAddPolygonAbnormal
703  * @tc.desc: Test for adding a polygon to a path using abnormal parameters.
704  * @tc.size  : SmallTest
705  * @tc.type  : Function
706  * @tc.level : Level 3
707  */
708 HWTEST_F(DrawingNativePathPart2Test, testPathAddPolygonAbnormal, TestSize.Level3) {
709     // 1. Create a path object using OH_Drawing_PathCreate.
710     OH_Drawing_Path *path = OH_Drawing_PathCreate();
711     // add assert
712     EXPECT_NE(path, nullptr);
713     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
714     OH_Drawing_PathMoveTo(path, 0, 0);
715     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
716     OH_Drawing_PathLineTo(path, 100, 100);
717     // 4. Add a polygon to the path with the second parameter's x-coordinate as an integer or character type, which will
718     // succeed.
719     OH_Drawing_Point2D point1 = {0, 0};
720     OH_Drawing_Point2D point2 = {100, 0};
721     OH_Drawing_Point2D point3 = {100, 100};
722     OH_Drawing_Point2D point4 = {0, 100};
723     OH_Drawing_Point2D points[4] = {point1, point2, point3, point4};
724     OH_Drawing_PathAddPolygon(path, points, 4, true);
725     // add assert
726     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
727     // 5. Add a polygon to the path with the second parameter's y-coordinate as an integer or character type, which will
728     // succeed.
729     OH_Drawing_PathAddPolygon(path, points, 4, true);
730     // add assert
731     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
732     // 6. Add a polygon to the path with the third parameter as a float or character type, which will succeed.
733     OH_Drawing_PathAddPolygon(path, points, 4.0f, true);
734     // add assert
735     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
736     // 7. Free the memory.
737     OH_Drawing_PathDestroy(path);
738 }
739 
740 /*
741  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2504
742  * @tc.name: testPathAddPolygonMaximal
743  * @tc.desc: Test for adding a polygon to a path using maximal values.
744  * @tc.size  : SmallTest
745  * @tc.type  : Function
746  * @tc.level : Level 3
747  */
748 HWTEST_F(DrawingNativePathPart2Test, testPathAddPolygonMaximal, TestSize.Level3) {
749     // 1. Create a path object using OH_Drawing_PathCreate.
750     OH_Drawing_Path *path = OH_Drawing_PathCreate();
751     // add assert
752     EXPECT_NE(path, nullptr);
753     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
754     OH_Drawing_PathMoveTo(path, 0, 0);
755     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
756     OH_Drawing_PathLineTo(path, 100, 100);
757     // 4. Add a polygon to the path with the second parameter's x-coordinate set to FLT_MAX + 1, no crash occurs.
758     OH_Drawing_Point2D point1 = {FLT_MAX + 1, 0};
759     OH_Drawing_Point2D point2 = {FLT_MAX + 1, 0};
760     OH_Drawing_Point2D point3 = {FLT_MAX + 1, 100};
761     OH_Drawing_Point2D point4 = {FLT_MAX + 1, 100};
762     OH_Drawing_Point2D points[4] = {point1, point2, point3, point4};
763     OH_Drawing_PathAddPolygon(path, points, 4, true);
764     // add assert
765     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
766     // 5. Add a polygon to the path with the second parameter's y-coordinate set to FLT_MAX + 1, no crash occurs.
767     OH_Drawing_Point2D point5 = {0, FLT_MAX + 1};
768     OH_Drawing_Point2D point6 = {100, FLT_MAX + 1};
769     OH_Drawing_Point2D point7 = {100, FLT_MAX + 1};
770     OH_Drawing_Point2D point8 = {0, FLT_MAX + 1};
771     OH_Drawing_Point2D points2[4] = {point5, point6, point7, point8};
772     OH_Drawing_PathAddPolygon(path, points2, 4, true);
773     // add assert
774     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
775     // 6. Free the memory.
776     OH_Drawing_PathDestroy(path);
777 }
778 
779 /*
780  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2600
781  * @tc.name: testPathAddCircleNormal
782  * @tc.desc: Test for adding a circle to a path using normal parameters.
783  * @tc.size  : SmallTest
784  * @tc.type  : Function
785  * @tc.level : Level 0
786  */
787 HWTEST_F(DrawingNativePathPart2Test, testPathAddCircleNormal, TestSize.Level0) {
788     // 1. Create a path object using OH_Drawing_PathCreate.
789     OH_Drawing_Path *path = OH_Drawing_PathCreate();
790     // add assert
791     EXPECT_NE(path, nullptr);
792     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
793     OH_Drawing_PathMoveTo(path, 0, 0);
794     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
795     OH_Drawing_PathLineTo(path, 100, 100);
796     // 4. Add a circle to the path with the specified direction.
797     OH_Drawing_PathAddCircle(path, 50, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
798     // add assert
799     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
800     OH_Drawing_PathAddCircle(path, 50, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
801     // add assert
802     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
803     // 5. Free the memory.
804     OH_Drawing_PathDestroy(path);
805 }
806 
807 /*
808  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2601
809  * @tc.name: testPathAddCircleNull
810  * @tc.desc: Test for adding a circle to a path using NULL or invalid parameters.
811  * @tc.size  : SmallTest
812  * @tc.type  : Function
813  * @tc.level : Level 3
814  */
815 HWTEST_F(DrawingNativePathPart2Test, testPathAddCircleNull, TestSize.Level3) {
816     // 1. Create a path object using OH_Drawing_PathCreate.
817     OH_Drawing_Path *path = OH_Drawing_PathCreate();
818     // add assert
819     EXPECT_NE(path, nullptr);
820     // 2. Call OH_Drawing_PathAddCircle with a nullptr as the first parameter, expecting
821     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
822     OH_Drawing_PathAddCircle(nullptr, 50, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
823     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
824     // 3. Call OH_Drawing_PathAddCircle with the second parameter as 0.00, which will fail without crashing.
825     OH_Drawing_PathAddCircle(path, 0.00, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
826     // 4. Call OH_Drawing_PathAddCircle with the third parameter as 0.00, which will fail without crashing.
827     OH_Drawing_PathAddCircle(path, 50, 0.00, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
828     // 5. Call OH_Drawing_PathAddCircle with the fourth parameter less than or equal to 0.00, expecting
829     // OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE error code.
830     OH_Drawing_PathAddCircle(path, 50, 50, 0.00, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
831     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE);
832     // 6. Free the memory.
833     OH_Drawing_PathDestroy(path);
834 }
835 
836 /*
837  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2602
838  * @tc.name: testPathAddCircleAbnormal
839  * @tc.desc: Test for adding a circle to a path using abnormal parameters.
840  * @tc.size  : SmallTest
841  * @tc.type  : Function
842  * @tc.level : Level 3
843  */
844 HWTEST_F(DrawingNativePathPart2Test, testPathAddCircleAbnormal, TestSize.Level3) {
845     // 1. Create a path object using OH_Drawing_PathCreate.
846     OH_Drawing_Path *path = OH_Drawing_PathCreate();
847     // add assert
848     EXPECT_NE(path, nullptr);
849     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
850     OH_Drawing_PathMoveTo(path, 0, 0);
851     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
852     OH_Drawing_PathLineTo(path, 100, 100);
853     // 4. Add a circle to the path with the second parameter as an integer, which will succeed.
854     OH_Drawing_PathAddCircle(path, 50, 50.0f, 10.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
855     // add assert
856     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
857     // 5. Add a circle to the path with the third parameter as an integer, which will succeed.
858     OH_Drawing_PathAddCircle(path, 50.0f, 50, 10.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
859     // add assert
860     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
861     // 6. Add a circle to the path with the fourth parameter as an integer, which will succeed.
862     OH_Drawing_PathAddCircle(path, 50.0f, 50.0f, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
863     // add assert
864     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
865     // 7. Free the memory.
866     OH_Drawing_PathDestroy(path);
867 }
868 
869 /*
870  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2603
871  * @tc.name: testPathAddCircleMaximal
872  * @tc.desc: Test for adding a circle to a path using maximal values.
873  * @tc.size  : SmallTest
874  * @tc.type  : Function
875  * @tc.level : Level 3
876  */
877 HWTEST_F(DrawingNativePathPart2Test, testPathAddCircleMaximal, TestSize.Level3) {
878     // 1. Create a path object using OH_Drawing_PathCreate.
879     OH_Drawing_Path *path = OH_Drawing_PathCreate();
880     // add assert
881     EXPECT_NE(path, nullptr);
882     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
883     OH_Drawing_PathMoveTo(path, 0, 0);
884     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
885     OH_Drawing_PathLineTo(path, 100, 100);
886     // 4. Add a circle to the path with the second parameter set to FLT_MAX + 1, no crash occurs.
887     OH_Drawing_PathAddCircle(path, FLT_MAX + 1, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
888     // 5. Add a circle to the path with the third parameter set to FLT_MAX + 1, no crash occurs.
889     OH_Drawing_PathAddCircle(path, 50, FLT_MAX + 1, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
890     // 6. Add a circle to the path with the fourth parameter set to FLT_MAX + 1, no crash occurs.
891     OH_Drawing_PathAddCircle(path, 50, 50, FLT_MAX + 1, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
892     // 7. Free the memory.
893     OH_Drawing_PathDestroy(path);
894 }
895 
896 /*
897  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2700
898  * @tc.name: testPathBuildFromSvgStringNormal
899  * @tc.desc: Test for building a path from an SVG string using normal parameters.
900  * @tc.size  : SmallTest
901  * @tc.type  : Function
902  * @tc.level : Level 0
903  */
904 HWTEST_F(DrawingNativePathPart2Test, testPathBuildFromSvgStringNormal, TestSize.Level0) {
905     // 1. Create a path object using OH_Drawing_PathCreate.
906     OH_Drawing_Path *path = OH_Drawing_PathCreate();
907     // add assert
908     EXPECT_NE(path, nullptr);
909     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
910     OH_Drawing_PathMoveTo(path, 0, 0);
911     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
912     OH_Drawing_PathLineTo(path, 100, 100);
913     // 4. Parse the path represented by the SVG string using OH_Drawing_PathBuildFromSvgString.
914     const char *svgString = "M 0 0 L 100 100";
915     bool svgResult = OH_Drawing_PathBuildFromSvgString(path, svgString);
916     // add assert
917     EXPECT_EQ(svgResult, true);
918     // add assert
919     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
920     // 5. Free the memory.
921     OH_Drawing_PathDestroy(path);
922 }
923 
924 /*
925  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2701
926  * @tc.name: testPathBuildFromSvgStringNull
927  * @tc.desc: Test for building a path from an SVG string using NULL or invalid parameters.
928  * @tc.size  : SmallTest
929  * @tc.type  : Function
930  * @tc.level : Level 3
931  */
932 HWTEST_F(DrawingNativePathPart2Test, testPathBuildFromSvgStringNull, TestSize.Level3) {
933     // 1. Create a path object using OH_Drawing_PathCreate.
934     OH_Drawing_Path *path = OH_Drawing_PathCreate();
935     // add assert
936     EXPECT_NE(path, nullptr);
937     // 2. Call OH_Drawing_PathBuildFromSvgString with a nullptr as the first parameter, expecting
938     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
939     OH_Drawing_PathBuildFromSvgString(nullptr, "M 0 0 L 100 100");
940     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
941     OH_Drawing_ErrorCodeReset();
942     // 3. Call OH_Drawing_PathBuildFromSvgString with a nullptr as the second parameter, expecting
943     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
944     OH_Drawing_PathBuildFromSvgString(path, nullptr);
945     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
946     // 4. Free the memory.
947     OH_Drawing_PathDestroy(path);
948 }
949 
950 /*
951  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2800
952  * @tc.name: testPathContainsNormal
953  * @tc.desc: Test for checking if a path contains a specified point using normal parameters.
954  * @tc.size  : SmallTest
955  * @tc.type  : Function
956  * @tc.level : Level 0
957  */
958 HWTEST_F(DrawingNativePathPart2Test, testPathContainsNormal, TestSize.Level0) {
959     // 1. Create a path object using OH_Drawing_PathCreate.
960     OH_Drawing_Path *path = OH_Drawing_PathCreate();
961     // add assert
962     EXPECT_NE(path, nullptr);
963     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
964     OH_Drawing_PathMoveTo(path, 0, 0);
965     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
966     OH_Drawing_PathLineTo(path, 100, 100);
967     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
968     OH_Drawing_PathLineTo(path, 100, 0);
969     // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
970     OH_Drawing_PathLineTo(path, 0, 0);
971     // 6. Close the path using OH_Drawing_PathClose.
972     OH_Drawing_PathClose(path);
973     // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
974     EXPECT_EQ(OH_Drawing_PathContains(path, 50, 50), true);
975     // add assert
976     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
977     // 8. Free the memory.
978     OH_Drawing_PathDestroy(path);
979 }
980 
981 /*
982  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2801
983  * @tc.name: testPathContainsNull
984  * @tc.desc: Test for checking if a path contains a specified point using NULL or invalid parameters.
985  * @tc.size  : SmallTest
986  * @tc.type  : Function
987  * @tc.level : Level 3
988  */
989 HWTEST_F(DrawingNativePathPart2Test, testPathContainsNull, TestSize.Level3) {
990     // 1. Create a path object using OH_Drawing_PathCreate.
991     OH_Drawing_Path *path = OH_Drawing_PathCreate();
992     // add assert
993     EXPECT_NE(path, nullptr);
994     // 2. Call OH_Drawing_PathContains with a nullptr as the first parameter, expecting
995     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
996     OH_Drawing_PathContains(nullptr, 50, 50);
997     // add assert
998     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
999     // 3. Call OH_Drawing_PathContains with the second parameter as 0.00, the call fails without crashing.
1000     OH_Drawing_PathContains(path, 0.0, 50);
1001     // 4. Call OH_Drawing_PathContains with the third parameter as 0.00, the call fails without crashing.
1002     OH_Drawing_PathContains(path, 50, 0.0);
1003     // 5. Free the memory.
1004     OH_Drawing_PathDestroy(path);
1005 }
1006 
1007 /*
1008  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2802
1009  * @tc.name: testPathContainsAbnormal
1010  * @tc.desc: Test for checking if a path contains a specified point using abnormal parameters.
1011  * @tc.size  : SmallTest
1012  * @tc.type  : Function
1013  * @tc.level : Level 3
1014  */
1015 HWTEST_F(DrawingNativePathPart2Test, testPathContainsAbnormal, TestSize.Level3) {
1016     // 1. Create a path object using OH_Drawing_PathCreate.
1017     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1018     // add assert
1019     EXPECT_NE(path, nullptr);
1020     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1021     OH_Drawing_PathMoveTo(path, 0, 0);
1022     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1023     OH_Drawing_PathLineTo(path, 100, 100);
1024     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1025     OH_Drawing_PathLineTo(path, 100, 0);
1026     // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1027     OH_Drawing_PathLineTo(path, 0, 0);
1028     // 6. Close the path using OH_Drawing_PathClose.
1029     OH_Drawing_PathClose(path);
1030     // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
1031     OH_Drawing_PathContains(path, 50, 50.0f);
1032     // 8. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
1033     OH_Drawing_PathContains(path, 50.0f, 50);
1034     // 9. Free the memory.
1035     OH_Drawing_PathDestroy(path);
1036 }
1037 
1038 /*
1039  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2803
1040  * @tc.name: testPathContainsMaximal
1041  * @tc.desc: Test for checking if a path contains a specified point using maximal values.
1042  * @tc.size  : SmallTest
1043  * @tc.type  : Function
1044  * @tc.level : Level 3
1045  */
1046 HWTEST_F(DrawingNativePathPart2Test, testPathContainsMaximal, TestSize.Level3) {
1047     // 1. Create a path object using OH_Drawing_PathCreate.
1048     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1049     // add assert
1050     EXPECT_NE(path, nullptr);
1051     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1052     OH_Drawing_PathMoveTo(path, 0, 0);
1053     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1054     OH_Drawing_PathLineTo(path, 100, 0);
1055     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1056     OH_Drawing_PathLineTo(path, 100, 100);
1057     // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1058     OH_Drawing_PathLineTo(path, 0, 100);
1059     // 6. Close the path using OH_Drawing_PathClose.
1060     OH_Drawing_PathClose(path);
1061     // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains with the second
1062     // parameter as FLT_MAX + 1.
1063     OH_Drawing_PathContains(path, FLT_MAX + 1, 50);
1064     // 8. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains with the third
1065     // parameter as FLT_MAX + 1.
1066     OH_Drawing_PathContains(path, 50, FLT_MAX + 1);
1067     // 9. Free the memory.
1068     OH_Drawing_PathDestroy(path);
1069 }
1070 
1071 /*
1072  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2900
1073  * @tc.name: testPathTransformNormal
1074  * @tc.desc: Test for transforming a path using normal parameters.
1075  * @tc.size  : SmallTest
1076  * @tc.type  : Function
1077  * @tc.level : Level 0
1078  */
1079 HWTEST_F(DrawingNativePathPart2Test, testPathTransformNormal, TestSize.Level0) {
1080     // 1. Create a path object using OH_Drawing_PathCreate.
1081     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1082     // add assert
1083     EXPECT_NE(path, nullptr);
1084     // 2. Create a matrix object using OH_Drawing_MatrixCreate.
1085     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
1086     // add assert
1087     EXPECT_NE(matrix, nullptr);
1088     OH_Drawing_MatrixSetMatrix(matrix, 1, 0, 0, 0, -1, 0, 0, 0, 1);
1089     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1090     OH_Drawing_PathMoveTo(path, 0, 0);
1091     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1092     OH_Drawing_PathLineTo(path, 100, 100);
1093     // 5. Transform the path using OH_Drawing_PathTransform.
1094     OH_Drawing_PathTransform(path, matrix);
1095     // add assert
1096     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1097     // 6. Free the memory.
1098     OH_Drawing_PathDestroy(path);
1099     OH_Drawing_MatrixDestroy(matrix);
1100 }
1101 
1102 /*
1103  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_2901
1104  * @tc.name: testPathTransformNull
1105  * @tc.desc: Test for transforming a path using NULL or invalid parameters.
1106  * @tc.size  : SmallTest
1107  * @tc.type  : Function
1108  * @tc.level : Level 3
1109  */
1110 HWTEST_F(DrawingNativePathPart2Test, testPathTransformNull, TestSize.Level3) {
1111     // 1. Create a path object using OH_Drawing_PathCreate.
1112     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1113     // add assert
1114     EXPECT_NE(path, nullptr);
1115     // 2. Create a matrix object using OH_Drawing_MatrixCreate.
1116     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
1117     // add assert
1118     EXPECT_NE(matrix, nullptr);
1119     OH_Drawing_MatrixSetMatrix(matrix, 1, 0, 0, 0, -1, 0, 0, 0, 1);
1120     // 3. Call OH_Drawing_PathTransform with a nullptr as the first parameter, expecting
1121     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1122     OH_Drawing_PathTransform(nullptr, matrix);
1123     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1124     OH_Drawing_ErrorCodeReset();
1125     // 4. Call OH_Drawing_PathTransform with a nullptr as the second parameter, expecting
1126     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1127     OH_Drawing_PathTransform(path, nullptr);
1128     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1129     // 5. Free the memory.
1130     OH_Drawing_PathDestroy(path);
1131     OH_Drawing_MatrixDestroy(matrix);
1132 }
1133 
1134 /*
1135  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3000
1136  * @tc.name: testPathTransformWithPerspectiveClipNormal
1137  * @tc.desc: Test for transforming a path with perspective clip using normal parameters.
1138  * @tc.size  : SmallTest
1139  * @tc.type  : Function
1140  * @tc.level : Level 0
1141  */
1142 HWTEST_F(DrawingNativePathPart2Test, testPathTransformWithPerspectiveClipNormal, TestSize.Level0) {
1143     // 1. Create a path object src using OH_Drawing_PathCreate.
1144     OH_Drawing_Path *src = OH_Drawing_PathCreate();
1145     // add assert
1146     EXPECT_NE(src, nullptr);
1147     // 2. Create a matrix object using OH_Drawing_MatrixCreate.
1148     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
1149     // add assert
1150     EXPECT_NE(matrix, nullptr);
1151     OH_Drawing_MatrixSetMatrix(matrix, 1, 0, 0, 0, -1, 0, 0, 0, 1);
1152     // 3. Create a path object dst using OH_Drawing_PathCreate.
1153     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1154     // 4. Set the starting point of the path using OH_Drawing_PathMoveTo.
1155     OH_Drawing_PathMoveTo(src, 0, 0);
1156     // 5. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1157     OH_Drawing_PathLineTo(src, 100, 100);
1158     // 6. Transform the path using OH_Drawing_PathTransformWithPerspectiveClip, with the fourth parameter set to true.
1159     OH_Drawing_PathTransformWithPerspectiveClip(src, matrix, dst, true);
1160     // add assert
1161     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1162     // 7. Free the memory.
1163     OH_Drawing_PathDestroy(src);
1164     OH_Drawing_PathDestroy(dst);
1165     OH_Drawing_MatrixDestroy(matrix);
1166 }
1167 
1168 /*
1169  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3001
1170  * @tc.name: testPathTransformWithPerspectiveClipNormal2
1171  * @tc.desc: Test for transforming a path with perspective clip using normal parameters with false perspective clip.
1172  * @tc.size  : SmallTest
1173  * @tc.type  : Function
1174  * @tc.level : Level 0
1175  */
1176 HWTEST_F(DrawingNativePathPart2Test, testPathTransformWithPerspectiveClipNormal2, TestSize.Level0) {
1177     // 1. Create a path object src using OH_Drawing_PathCreate.
1178     OH_Drawing_Path *src = OH_Drawing_PathCreate();
1179     // add assert
1180     EXPECT_NE(src, nullptr);
1181     // 2. Create a matrix object using OH_Drawing_MatrixCreate.
1182     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
1183     // add assert
1184     EXPECT_NE(matrix, nullptr);
1185     // 3. Create a path object dst using OH_Drawing_PathCreate.
1186     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1187     // add assert
1188     EXPECT_NE(dst, nullptr);
1189     // 4. Set the starting point of the path using OH_Drawing_PathMoveTo.
1190     OH_Drawing_PathMoveTo(src, 0, 0);
1191     // 5. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1192     OH_Drawing_PathLineTo(src, 100, 100);
1193     // 6. Transform the path using OH_Drawing_PathTransformWithPerspectiveClip, with the fourth parameter set to false.
1194     OH_Drawing_PathTransformWithPerspectiveClip(src, matrix, dst, false);
1195     // add assert
1196     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1197     // 7. Free the memory.
1198     OH_Drawing_PathDestroy(src);
1199     OH_Drawing_PathDestroy(dst);
1200     OH_Drawing_MatrixDestroy(matrix);
1201 }
1202 
1203 /*
1204  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3002
1205  * @tc.name: testPathTransformWithPerspectiveClipNull
1206  * @tc.desc: Test for transforming a path with perspective clip using NULL or invalid parameters.
1207  * @tc.size  : SmallTest
1208  * @tc.type  : Function
1209  * @tc.level : Level 3
1210  */
1211 HWTEST_F(DrawingNativePathPart2Test, testPathTransformWithPerspectiveClipNull, TestSize.Level3) {
1212     // 1. Create a path object src using OH_Drawing_PathCreate.
1213     OH_Drawing_Path *src = OH_Drawing_PathCreate();
1214     // add assert
1215     EXPECT_NE(src, nullptr);
1216     // 2. Create a matrix object using OH_Drawing_MatrixCreate.
1217     OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
1218     // add assert
1219     EXPECT_NE(matrix, nullptr);
1220     // 3. Create a path object dst using OH_Drawing_PathCreate.
1221     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1222     // add assert
1223     EXPECT_NE(dst, nullptr);
1224     // 4. Call OH_Drawing_PathTransformWithPerspectiveClip with a nullptr as the first parameter, expecting
1225     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1226     OH_Drawing_PathTransformWithPerspectiveClip(nullptr, matrix, dst, true);
1227     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1228     OH_Drawing_ErrorCodeReset();
1229     // 5. Call OH_Drawing_PathTransformWithPerspectiveClip with a nullptr as the second parameter, expecting
1230     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1231     OH_Drawing_PathTransformWithPerspectiveClip(src, nullptr, dst, true);
1232     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1233     // 6. Call OH_Drawing_PathTransformWithPerspectiveClip with a nullptr as the third parameter, no crash.
1234     OH_Drawing_PathTransformWithPerspectiveClip(src, matrix, nullptr, true);
1235     // 7. Free the memory.
1236     OH_Drawing_PathDestroy(src);
1237     OH_Drawing_PathDestroy(dst);
1238     OH_Drawing_MatrixDestroy(matrix);
1239 }
1240 
1241 /*
1242  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3100
1243  * @tc.name: testPathSetFillTypeNormal
1244  * @tc.desc: Test for setting fill type of a path using normal parameters.
1245  * @tc.size  : SmallTest
1246  * @tc.type  : Function
1247  * @tc.level : Level 0
1248  */
1249 HWTEST_F(DrawingNativePathPart2Test, testPathSetFillTypeNormal, TestSize.Level0) {
1250     // 1. Create a path object using OH_Drawing_PathCreate.
1251     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1252     // add assert
1253     EXPECT_NE(path, nullptr);
1254     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1255     OH_Drawing_PathMoveTo(path, 0, 0);
1256     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1257     OH_Drawing_PathLineTo(path, 100, 100);
1258     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1259     OH_Drawing_PathLineTo(path, 100, 0);
1260     // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1261     OH_Drawing_PathLineTo(path, 0, 0);
1262     // 6. Close the path using OH_Drawing_PathClose.
1263     OH_Drawing_PathClose(path);
1264     // 7. Set the fill type of the path using OH_Drawing_PathSetFillType, with the second parameter iterating through
1265     // the enumeration.
1266     OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_WINDING);
1267     // add assert
1268     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1269     OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_EVEN_ODD);
1270     // add assert
1271     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1272     OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_INVERSE_WINDING);
1273     // add assert
1274     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1275     OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_INVERSE_EVEN_ODD);
1276     // add assert
1277     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1278     // 8. Free the memory.
1279     OH_Drawing_PathDestroy(path);
1280 }
1281 
1282 /*
1283  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3101
1284  * @tc.name: testPathSetFillTypeNull
1285  * @tc.desc: Test for setting fill type of a path using NULL or invalid parameters.
1286  * @tc.size  : SmallTest
1287  * @tc.type  : Function
1288  * @tc.level : Level 3
1289  */
1290 HWTEST_F(DrawingNativePathPart2Test, testPathSetFillTypeNull, TestSize.Level3) {
1291     // 1. Create a path object using OH_Drawing_PathCreate.
1292     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1293     // add assert
1294     EXPECT_NE(path, nullptr);
1295     // 2. Call OH_Drawing_PathSetFillType with a nullptr as the first parameter, expecting
1296     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1297     OH_Drawing_PathSetFillType(nullptr, OH_Drawing_PathFillType::PATH_FILL_TYPE_WINDING);
1298     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1299     // 3. Call OH_Drawing_PathSetFillType with a value that is not within the enumeration range as the second parameter,
1300     // expecting OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE error code.
1301     OH_Drawing_PathSetFillType(path, static_cast<OH_Drawing_PathFillType>(-1));
1302     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE);
1303     // 4. Free the memory.
1304     OH_Drawing_PathDestroy(path);
1305 }
1306 
1307 /*
1308  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3102
1309  * @tc.name: testPathSetFillTypeMultipleCalls
1310  * @tc.desc: Test for setting fill type of a path with multiple calls.
1311  * @tc.size  : SmallTest
1312  * @tc.type  : Function
1313  * @tc.level : Level 3
1314  */
1315 HWTEST_F(DrawingNativePathPart2Test, testPathSetFillTypeMultipleCalls, TestSize.Level3) {
1316     // 1. Create a path object using OH_Drawing_PathCreate.
1317     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1318     // add assert
1319     EXPECT_NE(path, nullptr);
1320     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1321     OH_Drawing_PathMoveTo(path, 0, 0);
1322     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1323     OH_Drawing_PathLineTo(path, 100, 100);
1324     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1325     OH_Drawing_PathLineTo(path, 100, 0);
1326     // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1327     OH_Drawing_PathLineTo(path, 0, 0);
1328     // 6. Close the path using OH_Drawing_PathClose.
1329     OH_Drawing_PathClose(path);
1330     // 7. Call OH_Drawing_PathSetFillType in a loop 10 times, iterating through the enumeration to set different fill
1331     // rules for the path.
1332     for (int i = 0; i < 10; i++) {
1333         OH_Drawing_PathSetFillType(path, static_cast<OH_Drawing_PathFillType>(i));
1334     }
1335     // 8. Free the memory.
1336     OH_Drawing_PathDestroy(path);
1337 }
1338 
1339 /*
1340  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3200
1341  * @tc.name: testPathGetLengthNormal
1342  * @tc.desc: Test for getting the length of a path using normal parameters with detailed length.
1343  * @tc.size  : SmallTest
1344  * @tc.type  : Function
1345  * @tc.level : Level 0
1346  */
1347 HWTEST_F(DrawingNativePathPart2Test, testPathGetLengthNormal, TestSize.Level0) {
1348     // 1. Create a path object using OH_Drawing_PathCreate.
1349     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1350     // add assert
1351     EXPECT_NE(path, nullptr);
1352     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1353     OH_Drawing_PathMoveTo(path, 0, 0);
1354     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1355     OH_Drawing_PathLineTo(path, 100, 100);
1356     // 4. Get the length of the current path by calling OH_Drawing_PathGetLength, with the second parameter set to true.
1357     float length = OH_Drawing_PathGetLength(path, true);
1358     EXPECT_NE(length, 0.0f);
1359     // 5. Free the memory.
1360     OH_Drawing_PathDestroy(path);
1361 }
1362 
1363 /*
1364  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3201
1365  * @tc.name: testPathGetLengthNormal2
1366  * @tc.desc: Test for getting the length of a path using normal parameters without detailed length.
1367  * @tc.size  : SmallTest
1368  * @tc.type  : Function
1369  * @tc.level : Level 0
1370  */
1371 HWTEST_F(DrawingNativePathPart2Test, testPathGetLengthNormal2, TestSize.Level0) {
1372     // 1. Create a path object using OH_Drawing_PathCreate.
1373     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1374     // add assert
1375     EXPECT_NE(path, nullptr);
1376     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1377     OH_Drawing_PathMoveTo(path, 0, 0);
1378     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1379     OH_Drawing_PathLineTo(path, 100, 100);
1380     // 4. Get the length of the current path by calling OH_Drawing_PathGetLength, with the second parameter set to
1381     // false.
1382     float length = OH_Drawing_PathGetLength(path, false);
1383     EXPECT_NE(length, 0.0f);
1384     // 5. Free the memory.
1385     OH_Drawing_PathDestroy(path);
1386 }
1387 
1388 /*
1389  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3202
1390  * @tc.name: testPathGetLengthNull
1391  * @tc.desc: Test for getting the length of a path using NULL or invalid parameters.
1392  * @tc.size  : SmallTest
1393  * @tc.type  : Function
1394  * @tc.level : Level 3
1395  */
1396 HWTEST_F(DrawingNativePathPart2Test, testPathGetLengthNull, TestSize.Level3) {
1397     // 1. Create a path object using OH_Drawing_PathCreate.
1398     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1399     // add assert
1400     EXPECT_NE(path, nullptr);
1401     // 2. Call OH_Drawing_PathGetLength with a nullptr as the first parameter, expecting
1402     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1403     OH_Drawing_PathGetLength(nullptr, true);
1404     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1405     // 3. Free the memory.
1406     OH_Drawing_PathDestroy(path);
1407 }
1408 
1409 /*
1410  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3300
1411  * @tc.name: testPathGetBoundsNormal
1412  * @tc.desc: Test for getting the bounds of a path using normal parameters.
1413  * @tc.size  : SmallTest
1414  * @tc.type  : Function
1415  * @tc.level : Level 0
1416  */
1417 HWTEST_F(DrawingNativePathPart2Test, testPathGetBoundsNormal, TestSize.Level0) {
1418     // 1. Create a path object using OH_Drawing_PathCreate.
1419     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1420     // add assert
1421     EXPECT_NE(path, nullptr);
1422     // 2. Create a rectangle object using OH_Drawing_RectCreate.
1423     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
1424     // add assert
1425     EXPECT_NE(rect, nullptr);
1426     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1427     OH_Drawing_PathMoveTo(path, 0, 0);
1428     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1429     OH_Drawing_PathLineTo(path, 100, 100);
1430     // 5. Get the minimum bounding box that contains the path by calling OH_Drawing_PathGetBounds.
1431     OH_Drawing_PathGetBounds(path, rect);
1432     // add assert
1433     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1434     // 6. Free the memory.
1435     OH_Drawing_PathDestroy(path);
1436     OH_Drawing_RectDestroy(rect);
1437 }
1438 
1439 /*
1440  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3301
1441  * @tc.name: testPathGetBoundsNull
1442  * @tc.desc: Test for getting the bounds of a path using NULL or invalid parameters.
1443  * @tc.size  : SmallTest
1444  * @tc.type  : Function
1445  * @tc.level : Level 3
1446  */
1447 HWTEST_F(DrawingNativePathPart2Test, testPathGetBoundsNull, TestSize.Level3) {
1448     // 1. Create a path object using OH_Drawing_PathCreate.
1449     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1450     // add assert
1451     EXPECT_NE(path, nullptr);
1452     // 2. Create a rectangle object using OH_Drawing_RectCreate.
1453     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 0, 100, 100);
1454     // add assert
1455     EXPECT_NE(rect, nullptr);
1456     // 3. Call OH_Drawing_PathGetBounds with a nullptr as the first parameter, expecting
1457     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1458     OH_Drawing_PathGetBounds(nullptr, rect);
1459     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1460     OH_Drawing_ErrorCodeReset();
1461     // 4. Call OH_Drawing_PathGetBounds with a nullptr as the second parameter, expecting
1462     // OH_DRAWING_ERROR_INVALID_PARAMETER error code.
1463     OH_Drawing_PathGetBounds(path, nullptr);
1464     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1465     // 5. Free the memory.
1466     OH_Drawing_PathDestroy(path);
1467     OH_Drawing_RectDestroy(rect);
1468 }
1469 
1470 /*
1471  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3400
1472  * @tc.name: testPathCloseNormal
1473  * @tc.desc: test for testPathCloseNormal.
1474  * @tc.size  : SmallTest
1475  * @tc.type  : Function
1476  * @tc.level : Level 0
1477  */
1478 HWTEST_F(DrawingNativePathPart2Test, testPathCloseNormal, TestSize.Level0) {
1479     // 1. Create a path object using OH_Drawing_PathCreate.
1480     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1481     // add assert
1482     EXPECT_NE(path, nullptr);
1483     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1484     OH_Drawing_PathMoveTo(path, 0, 0);
1485     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1486     OH_Drawing_PathLineTo(path, 100, 100);
1487     // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1488     OH_Drawing_PathLineTo(path, 100, 0);
1489     // 5. Close the path by adding a line segment from the last point of the path to the starting point.
1490     OH_Drawing_PathClose(path);
1491     // add assert
1492     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1493     // 6. Free the memory.
1494     OH_Drawing_PathDestroy(path);
1495 }
1496 
1497 /*
1498  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3401
1499  * @tc.name: testPathCloseNull
1500  * @tc.desc: Test for closing a path using NULL or invalid parameters.
1501  * @tc.size  : SmallTest
1502  * @tc.type  : Function
1503  * @tc.level : Level 3
1504  */
1505 HWTEST_F(DrawingNativePathPart2Test, testPathCloseNull, TestSize.Level3) {
1506     // 1. Create a path object using OH_Drawing_PathCreate.
1507     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1508     // add assert
1509     EXPECT_NE(path, nullptr);
1510     // 2. Call OH_Drawing_PathClose with nullptr as the parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER error
1511     // code.
1512     OH_Drawing_PathClose(nullptr);
1513     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1514     // 3. Free the memory.
1515     OH_Drawing_PathDestroy(path);
1516 }
1517 
1518 /*
1519  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3500
1520  * @tc.name: testPathOffsetNormal
1521  * @tc.desc: Test for offsetting a path using normal parameters.
1522  * @tc.size  : SmallTest
1523  * @tc.type  : Function
1524  * @tc.level : Level 0
1525  */
1526 HWTEST_F(DrawingNativePathPart2Test, testPathOffsetNormal, TestSize.Level0) {
1527     // 1. Create a path object using OH_Drawing_PathCreate.
1528     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1529     // add assert
1530     EXPECT_NE(path, nullptr);
1531     // 2. Create a path object using OH_Drawing_PathCreate.
1532     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1533     // add assert
1534     EXPECT_NE(dst, nullptr);
1535     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1536     OH_Drawing_PathMoveTo(path, 0, 0);
1537     // add assert
1538     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1539     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1540     OH_Drawing_PathLineTo(path, 100, 100);
1541     // add assert
1542     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1543     // 5. Offset all points in the path by a certain distance along the x and y axes, and store the result in the
1544     // destination path object using OH_Drawing_PathOffset.
1545     OH_Drawing_PathOffset(path, dst, 10, 10);
1546     // add assert
1547     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1548     // 6. Free the memory.
1549     OH_Drawing_PathDestroy(path);
1550     OH_Drawing_PathDestroy(dst);
1551 }
1552 
1553 /*
1554  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3501
1555  * @tc.name: testPathOffsetNull
1556  * @tc.desc: Test for offsetting a path using NULL or invalid parameters.
1557  * @tc.size  : SmallTest
1558  * @tc.type  : Function
1559  * @tc.level : Level 3
1560  */
1561 HWTEST_F(DrawingNativePathPart2Test, testPathOffsetNull, TestSize.Level3) {
1562     // 1. Create a path object using OH_Drawing_PathCreate.
1563     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1564     // add assert
1565     EXPECT_NE(path, nullptr);
1566     // 2. Create a path object using OH_Drawing_PathCreate.
1567     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1568     // add assert
1569     EXPECT_NE(dst, nullptr);
1570     // 3. Call OH_Drawing_PathOffset with a nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
1571     // error code.
1572     OH_Drawing_PathOffset(nullptr, dst, 10, 10);
1573     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1574     // 4. Call OH_Drawing_PathOffset with a nullptr as the second parameter, expecting failure without crashing.
1575     OH_Drawing_PathOffset(path, nullptr, 10, 10);
1576     // 5. Call OH_Drawing_PathOffset with 0.00 as the third parameter, expecting failure without crashing.
1577     OH_Drawing_PathOffset(path, dst, 0.00, 10);
1578     // 6. Call OH_Drawing_PathOffset with 0.00 as the fourth parameter, expecting failure without crashing.
1579     OH_Drawing_PathOffset(path, dst, 10, 0.00);
1580     // 7. Free the memory.
1581     OH_Drawing_PathDestroy(path);
1582     OH_Drawing_PathDestroy(dst);
1583 }
1584 
1585 /*
1586  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3502
1587  * @tc.name: testPathOffsetAbnormal
1588  * @tc.desc: Test for offsetting a path with abnormal parameters (non-float values).
1589  * @tc.size  : SmallTest
1590  * @tc.type  : Function
1591  * @tc.level : Level 3
1592  */
1593 HWTEST_F(DrawingNativePathPart2Test, testPathOffsetAbnormal, TestSize.Level3) {
1594     // 1. Create a path object using OH_Drawing_PathCreate.
1595     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1596     // add assert
1597     EXPECT_NE(path, nullptr);
1598     // 2. Create a path object using OH_Drawing_PathCreate.
1599     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1600     // add assert
1601     EXPECT_NE(dst, nullptr);
1602     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1603     OH_Drawing_PathMoveTo(path, 0, 0);
1604     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1605     OH_Drawing_PathLineTo(path, 100, 100);
1606     // 5. Call OH_Drawing_PathOffset with an integer as the third parameter.
1607     OH_Drawing_PathOffset(path, dst, 10, 10.0f);
1608     // 6. Call OH_Drawing_PathOffset with an integer as the fourth parameter.
1609     OH_Drawing_PathOffset(path, dst, 10.0f, 10);
1610     // 7. Free the memory.
1611     OH_Drawing_PathDestroy(path);
1612     OH_Drawing_PathDestroy(dst);
1613 }
1614 
1615 /*
1616  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3503
1617  * @tc.name: testPathOffsetMaximal
1618  * @tc.desc: Test for offsetting a path with maximal values.
1619  * @tc.size  : SmallTest
1620  * @tc.type  : Function
1621  * @tc.level : Level 3
1622  */
1623 HWTEST_F(DrawingNativePathPart2Test, testPathOffsetMaximal, TestSize.Level3) {
1624     // 1. Create a path object using OH_Drawing_PathCreate.
1625     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1626     // add assert
1627     EXPECT_NE(path, nullptr);
1628     // 2. Create a path object using OH_Drawing_PathCreate.
1629     OH_Drawing_Path *dst = OH_Drawing_PathCreate();
1630     // add assert
1631     EXPECT_NE(dst, nullptr);
1632     // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1633     OH_Drawing_PathMoveTo(path, 0, 0);
1634     // 4. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1635     OH_Drawing_PathLineTo(path, 100, 100);
1636     // 5. Call OH_Drawing_PathOffset with the third parameter set to the maximum value FLT_MAX + 1.
1637     OH_Drawing_PathOffset(path, dst, FLT_MAX + 1, 10.0f);
1638     // 6. Call OH_Drawing_PathOffset with the fourth parameter set to the maximum value FLT_MAX + 1.
1639     OH_Drawing_PathOffset(path, dst, 10.0f, FLT_MAX + 1);
1640     // 7. Free the memory.
1641     OH_Drawing_PathDestroy(path);
1642     OH_Drawing_PathDestroy(dst);
1643 }
1644 
1645 /*
1646  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3600
1647  * @tc.name: testPathResetNormal
1648  * @tc.desc: Test for resetting a path using normal parameters.
1649  * @tc.size  : SmallTest
1650  * @tc.type  : Function
1651  * @tc.level : Level 0
1652  */
1653 HWTEST_F(DrawingNativePathPart2Test, testPathResetNormal, TestSize.Level0) {
1654     // 1. Create a path object using OH_Drawing_PathCreate.
1655     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1656     // add assert
1657     EXPECT_NE(path, nullptr);
1658     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1659     OH_Drawing_PathMoveTo(path, 0, 0);
1660     // add assert
1661     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1662     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1663     OH_Drawing_PathLineTo(path, 100, 100);
1664     // add assert
1665     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1666     // 4. Reset the custom path data using OH_Drawing_PathReset.
1667     OH_Drawing_PathReset(path);
1668     // add assert
1669     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1670     // 5. Free the memory.
1671     OH_Drawing_PathDestroy(path);
1672 }
1673 
1674 /*
1675  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3601
1676  * @tc.name: testPathResetNull
1677  * @tc.desc: Test for resetting a path using NULL or invalid parameters.
1678  * @tc.size  : SmallTest
1679  * @tc.type  : Function
1680  * @tc.level : Level 3
1681  */
1682 HWTEST_F(DrawingNativePathPart2Test, testPathResetNull, TestSize.Level3) {
1683     // 1. Create a path object using OH_Drawing_PathCreate.
1684     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1685     // add assert
1686     EXPECT_NE(path, nullptr);
1687     // 2. Call OH_Drawing_PathReset with nullptr as the parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER error
1688     // code.
1689     OH_Drawing_PathReset(nullptr);
1690     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1691     // 3. Free the memory.
1692     OH_Drawing_PathDestroy(path);
1693 }
1694 
1695 /*
1696  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_3602
1697  * @tc.name: testPathResetMultipleCalls
1698  * @tc.desc: Test for resetting a path with multiple calls.
1699  * @tc.size  : SmallTest
1700  * @tc.type  : Function
1701  * @tc.level : Level 3
1702  */
1703 HWTEST_F(DrawingNativePathPart2Test, testPathResetMultipleCalls, TestSize.Level3) {
1704     // 1. Create a path object using OH_Drawing_PathCreate.
1705     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1706     // add assert
1707     EXPECT_NE(path, nullptr);
1708     // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1709     OH_Drawing_PathMoveTo(path, 0, 0);
1710     // 3. Add a line segment from the starting point to the target point using OH_Drawing_PathLineTo.
1711     OH_Drawing_PathLineTo(path, 100, 100);
1712     // 4. Reset the custom path data using OH_Drawing_PathReset.
1713     OH_Drawing_PathReset(path);
1714     // 5. Loop through steps 2 to 4 for 10 times to verify success.
1715     for (int i = 0; i < 10; i++) {
1716         OH_Drawing_PathMoveTo(path, 0, 0);
1717         OH_Drawing_PathLineTo(path, 100, 100);
1718         OH_Drawing_PathReset(path);
1719     }
1720     // 6. Free the memory.
1721     OH_Drawing_PathDestroy(path);
1722 }
1723 
1724 } // namespace Drawing
1725 } // namespace Rosen
1726 } // namespace OHOS