• 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 DrawingNativePathTest : public testing::Test {
39     protected:
40     // 在每个测试用例执行前调用
SetUp()41     void SetUp() override
42     {
43         // 设置代码
44         std::cout << "DrawingNativePathTest Setup code called before each test case." << std::endl;
45         OH_Drawing_ErrorCodeReset();
46         std::cout << "DrawingNativePathTest errorCodeReset before each test case." << std::endl;
47     }
TearDown()48     void TearDown() override
49     {
50         std::cout << "DrawingNativePathTest Setup code called after each test case." << std::endl;
51         OH_Drawing_ErrorCodeReset();
52         std::cout << "DrawingNativePathTest errorCodeReset after each test case." << std::endl;
53     }
54 };
55 /*
56  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0100
57  * @tc.name: testPathCreateNormal
58  * @tc.desc: Test for creating a path object with normal parameters.
59  * @tc.size  : SmallTest
60  * @tc.type  : Function
61  * @tc.level : Level 0
62  */
63 HWTEST_F(DrawingNativePathTest, testPathCreateNormal, TestSize.Level0) {
64     // 1. Call OH_Drawing_PathCreate to create a path object
65     OH_Drawing_Path *path = OH_Drawing_PathCreate();
66     EXPECT_NE(path, nullptr);
67     // 2. Free memory
68     OH_Drawing_PathDestroy(path);
69 }
70 
71 /*
72  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0200
73  * @tc.name: testPathCopyNormal
74  * @tc.desc: Test for copying a path with normal parameters and checking the copied path length.
75  * @tc.size  : SmallTest
76  * @tc.type  : Function
77  * @tc.level : Level 0
78  */
79 HWTEST_F(DrawingNativePathTest, testPathCopyNormal, TestSize.Level0) {
80     // 1. Create a path object 1 by calling OH_Drawing_PathCreate
81     OH_Drawing_Path *path1 = OH_Drawing_PathCreate();
82     EXPECT_NE(path1, nullptr);
83     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
84     OH_Drawing_PathMoveTo(path1, 0, 0);
85     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
86     OH_Drawing_PathLineTo(path1, 100, 100);
87     // 4. Add a line segment from the last point of the path to the target point to the path by calling
88     // OH_Drawing_PathLineTo
89     OH_Drawing_PathLineTo(path1, 200, 200);
90     // 5. Add a line segment from the last point of the path to the target point to the path by calling
91     // OH_Drawing_PathLineTo
92     OH_Drawing_PathLineTo(path1, 300, 300);
93     // 6. Close the path by calling OH_Drawing_PathClose
94     OH_Drawing_PathClose(path1);
95     // 7. Copy path 1 to path 2 by calling OH_Drawing_PathCopy
96     OH_Drawing_Path *path2 = OH_Drawing_PathCopy(path1);
97     // add assert
98     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
99     // add assert
100     EXPECT_NE(path2, nullptr);
101     // 8. Get the length of path 2 by calling OH_Drawing_PathGetLength
102     bool isEqual = IsScalarAlmostEqual(OH_Drawing_PathGetLength(path1, false), OH_Drawing_PathGetLength(path2, false));
103     EXPECT_TRUE(isEqual);
104     // 9. Free memory
105     OH_Drawing_PathDestroy(path1);
106 }
107 
108 /*
109  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0201
110  * @tc.name: testPathCopyNull
111  * @tc.desc: Test for copying a path with NULL parameters.
112  * @tc.size  : SmallTest
113  * @tc.type  : Function
114  * @tc.level : Level 3
115  */
116 HWTEST_F(DrawingNativePathTest, testPathCopyNull, TestSize.Level3) {
117     // 1. Create a path object by calling OH_Drawing_PathCreate
118     OH_Drawing_Path *path = OH_Drawing_PathCreate();
119     // add assert
120     EXPECT_NE(path, nullptr);
121     // 2. Copy a path with nullptr as the parameter
122     OH_Drawing_Path *path2 = OH_Drawing_PathCopy(nullptr);
123     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
124     // 3. Free memory
125     OH_Drawing_PathDestroy(path);
126     OH_Drawing_PathDestroy(path2);
127 }
128 
129 /*
130  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0202
131  * @tc.name: testPathCopyInputDestroyed
132  * @tc.desc: Test for copying a path and checking if the copied path is affected after the original path is destroyed.
133  * @tc.size  : SmallTest
134  * @tc.type  : Function
135  * @tc.level : Level 3
136  */
137 HWTEST_F(DrawingNativePathTest, testPathCopyInputDestroyed, TestSize.Level3) {
138     // 1. Create a path object 1 by calling OH_Drawing_PathCreate
139     OH_Drawing_Path *path1 = OH_Drawing_PathCreate();
140     EXPECT_NE(path1, nullptr);
141     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
142     OH_Drawing_PathMoveTo(path1, 0, 0);
143     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
144     OH_Drawing_PathLineTo(path1, 100, 100);
145     // 4. Add a line segment from the last point of the path to the target point to the path by calling
146     // OH_Drawing_PathLineTo
147     OH_Drawing_PathLineTo(path1, 200, 200);
148     // 5. Add a line segment from the last point of the path to the target point to the path by calling
149     // OH_Drawing_PathLineTo
150     OH_Drawing_PathLineTo(path1, 300, 300);
151     // 6. Close the path by calling OH_Drawing_PathClose
152     OH_Drawing_PathClose(path1);
153     // 7. Copy path 1 to path 2 by calling OH_Drawing_PathCopy
154     OH_Drawing_Path *path2 = OH_Drawing_PathCopy(path1);
155     // add assert
156     EXPECT_NE(path2, nullptr);
157     // 8. Destroy path 1 by calling OH_Drawing_PathDestroy
158     OH_Drawing_PathDestroy(path1);
159     // 9. Get the length of path 2 by calling OH_Drawing_PathGetLength, if the return value is not 0, it means
160     // destroying path 1 does not affect path 2
161     EXPECT_NE(OH_Drawing_PathGetLength(path2, false), 0);
162     // 10. Free memory
163     OH_Drawing_PathDestroy(path2);
164 }
165 
166 /*
167  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0300
168  * @tc.name: testPathDestroyNormal
169  * @tc.desc: Test for creating and destroying a path object with normal parameters.
170  * @tc.size  : SmallTest
171  * @tc.type  : Function
172  * @tc.level : Level 0
173  */
174 HWTEST_F(DrawingNativePathTest, testPathDestroyNormal, TestSize.Level0) {
175     // 1. Call OH_Drawing_PathCreate to create a path object
176     OH_Drawing_Path *path = OH_Drawing_PathCreate();
177     // add assert
178     EXPECT_NE(path, nullptr);
179     // 2. Free memory by calling OH_Drawing_PathDestroy
180     OH_Drawing_PathDestroy(path);
181 }
182 
183 /*
184  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0301
185  * @tc.name: testPathDestroyNull
186  * @tc.desc: Test for destroying a path object with NULL parameters.
187  * @tc.size  : SmallTest
188  * @tc.type  : Function
189  * @tc.level : Level 3
190  */
191 HWTEST_F(DrawingNativePathTest, testPathDestroyNull, TestSize.Level3) {
192     OH_Drawing_PathDestroy(nullptr);
193     EXPECT_TRUE(true);
194 }
195 
196 /*
197  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0400
198  * @tc.name: testPathMoveToNormal
199  * @tc.desc: Test for moving a path to a normal position with valid parameters.
200  * @tc.size  : SmallTest
201  * @tc.type  : Function
202  * @tc.level : Level 0
203  */
204 HWTEST_F(DrawingNativePathTest, testPathMoveToNormal, TestSize.Level0) {
205     // 1. Create a path object by calling OH_Drawing_PathCreate
206     OH_Drawing_Path *path = OH_Drawing_PathCreate();
207     // add assert
208     EXPECT_NE(path, nullptr);
209     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
210     OH_Drawing_PathMoveTo(path, 0, 0);
211     // add assert
212     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
213     // 3. Free memory by calling OH_Drawing_PathDestroy
214     OH_Drawing_PathDestroy(path);
215 }
216 
217 /*
218  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0401
219  * @tc.name: testPathMoveToNull
220  * @tc.desc: Test for moving a path with NULL or invalid parameters.
221  * @tc.size  : SmallTest
222  * @tc.type  : Function
223  * @tc.level : Level 3
224  */
225 HWTEST_F(DrawingNativePathTest, testPathMoveToNull, TestSize.Level3) {
226     // 1. Create a path object by calling OH_Drawing_PathCreate
227     OH_Drawing_Path *path = OH_Drawing_PathCreate();
228     // add assert
229     EXPECT_NE(path, nullptr);
230     // 2. Call OH_Drawing_PathMoveTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
231     // error code
232     OH_Drawing_PathMoveTo(nullptr, 1, 1);
233     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
234     // 3. Call OH_Drawing_PathMoveTo with 0.00 as the second parameter
235     OH_Drawing_PathMoveTo(path, 0.00, 1);
236     // 4. Call OH_Drawing_PathMoveTo with 0.00 as the third parameter
237     OH_Drawing_PathMoveTo(path, 1, 0.00);
238     // 5. Free memory
239     OH_Drawing_PathDestroy(path);
240 }
241 
242 /*
243  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0402
244  * @tc.name: testPathMoveToAbnormal
245  * @tc.desc: Test for moving a path with abnormal data types as parameters.
246  * @tc.size  : SmallTest
247  * @tc.type  : Function
248  * @tc.level : Level 3
249  */
250 HWTEST_F(DrawingNativePathTest, testPathMoveToAbnormal, TestSize.Level3) {
251     // 1. Create a path object by calling OH_Drawing_PathCreate
252     OH_Drawing_Path *path = OH_Drawing_PathCreate();
253     // add assert
254     EXPECT_NE(path, nullptr);
255     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo with an integer or character type as the
256     // second parameter
257     OH_Drawing_PathMoveTo(path, 2, 1.0f);
258     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo with an integer or character type as the
259     // third parameter
260     OH_Drawing_PathMoveTo(path, 1.0f, 2);
261     // 4. Free memory by calling OH_Drawing_PathDestroy
262     OH_Drawing_PathDestroy(path);
263 }
264 
265 /*
266  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0403
267  * @tc.name: testPathMoveToMaximal
268  * @tc.desc: Test for moving a path with maximal values as parameters.
269  * @tc.size  : SmallTest
270  * @tc.type  : Function
271  * @tc.level : Level 3
272  */
273 HWTEST_F(DrawingNativePathTest, testPathMoveToMaximal, TestSize.Level3) {
274     // 1. Create a path object by calling OH_Drawing_PathCreate
275     OH_Drawing_Path *path = OH_Drawing_PathCreate();
276     // add assert
277     EXPECT_NE(path, nullptr);
278     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo with the second parameter as the maximum
279     // value of FLT_MAX + 1, no crash
280     OH_Drawing_PathMoveTo(path, FLT_MAX + 1, 1.0);
281     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo with the third parameter as the maximum
282     // value of FLT_MAX + 1, no crash
283     OH_Drawing_PathMoveTo(path, 1.0, FLT_MAX + 1);
284     // 4. Free memory
285     OH_Drawing_PathDestroy(path);
286 }
287 
288 /*
289  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0500
290  * @tc.name: testPathLineToNormal
291  * @tc.desc: Test for adding a line to a path with normal parameters.
292  * @tc.size  : SmallTest
293  * @tc.type  : Function
294  * @tc.level : Level 0
295  */
296 HWTEST_F(DrawingNativePathTest, testPathLineToNormal, TestSize.Level0) {
297     // 1. Create a path object by calling OH_Drawing_PathCreate
298     OH_Drawing_Path *path = OH_Drawing_PathCreate();
299     // add assert
300     EXPECT_NE(path, nullptr);
301     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
302     OH_Drawing_PathMoveTo(path, 0, 0);
303     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
304     OH_Drawing_PathLineTo(path, 100, 100);
305     // add assert
306     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
307     // 4. Free memory by calling OH_Drawing_PathDestroy
308     OH_Drawing_PathDestroy(path);
309 }
310 
311 /*
312  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0501
313  * @tc.name: testPathLineToNull
314  * @tc.desc: Test for adding a line to a path with NULL or invalid parameters.
315  * @tc.size  : SmallTest
316  * @tc.type  : Function
317  * @tc.level : Level 3
318  */
319 HWTEST_F(DrawingNativePathTest, testPathLineToNull, TestSize.Level3) {
320     // 1. Create a path object by calling OH_Drawing_PathCreate
321     OH_Drawing_Path *path = OH_Drawing_PathCreate();
322     // add assert
323     EXPECT_NE(path, nullptr);
324     // 2. Call OH_Drawing_PathLineTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
325     // error code
326     OH_Drawing_PathLineTo(nullptr, 1, 1);
327     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
328     // 3. Call OH_Drawing_PathLineTo with 0.00 as the second parameter, no crash
329     OH_Drawing_PathLineTo(path, 0.00, 1);
330     // 4. Call OH_Drawing_PathLineTo with 0.00 as the third parameter, no crash
331     OH_Drawing_PathLineTo(path, 1, 0.00);
332     // 5. Free memory
333     OH_Drawing_PathDestroy(path);
334 }
335 
336 /*
337  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0502
338  * @tc.name: testPathLineToAbnormal
339  * @tc.desc: Test for moving a path with abnormal data types as parameters.
340  * @tc.size  : SmallTest
341  * @tc.type  : Function
342  * @tc.level : Level 3
343  */
344 HWTEST_F(DrawingNativePathTest, testPathLineToAbnormal, TestSize.Level3) {
345     // 1. Create a path object by calling OH_Drawing_PathCreate
346     OH_Drawing_Path *path = OH_Drawing_PathCreate();
347     // add assert
348     EXPECT_NE(path, nullptr);
349     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
350     OH_Drawing_PathMoveTo(path, 0, 0);
351     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
352     // with an integer or character type as the second parameter
353     OH_Drawing_PathLineTo(path, 2, 1.0f);
354     // 4. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
355     // with an integer or character type as the third parameter
356     OH_Drawing_PathLineTo(path, 1.0f, 2);
357     // 5. Free memory by calling OH_Drawing_PathDestroy
358     OH_Drawing_PathDestroy(path);
359 }
360 
361 /*
362  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0503
363  * @tc.name: testPathLineToMaximal
364  * @tc.desc: Test for moving a path with maximal values as parameters.
365  * @tc.size  : SmallTest
366  * @tc.type  : Function
367  * @tc.level : Level 3
368  */
369 HWTEST_F(DrawingNativePathTest, testPathLineToMaximal, TestSize.Level3) {
370     // 1. Create a path object by calling OH_Drawing_PathCreate
371     OH_Drawing_Path *path = OH_Drawing_PathCreate();
372     // add assert
373     EXPECT_NE(path, nullptr);
374     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
375     OH_Drawing_PathMoveTo(path, 0, 0);
376     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
377     // with the second parameter as the maximum value of FLT_MAX + 1, no crash
378     OH_Drawing_PathLineTo(path, FLT_MAX + 1, 1.0);
379     // 4. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
380     // with the third parameter as the maximum value of FLT_MAX + 1, no crash
381     OH_Drawing_PathLineTo(path, 1.0, FLT_MAX + 1);
382     // 5. Free memory by calling OH_Drawing_PathDestroy
383     OH_Drawing_PathDestroy(path);
384 }
385 
386 /*
387  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0600
388  * @tc.name: testPathArcToNormal
389  * @tc.desc: Test for adding an arc to a path with normal parameters.
390  * @tc.size  : SmallTest
391  * @tc.type  : Function
392  * @tc.level : Level 0
393  */
394 HWTEST_F(DrawingNativePathTest, testPathArcToNormal, TestSize.Level0) {
395     // 1. Create a path object by calling OH_Drawing_PathCreate
396     OH_Drawing_Path *path = OH_Drawing_PathCreate();
397     // add assert
398     EXPECT_NE(path, nullptr);
399     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
400     OH_Drawing_PathMoveTo(path, 0, 0);
401     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
402     OH_Drawing_PathLineTo(path, 100, 100);
403     // 4. Add a line segment from the last point of the path to the target point to the path by calling
404     // OH_Drawing_PathLineTo
405     OH_Drawing_PathLineTo(path, 200, 200);
406     // 5. Add a line segment from the last point of the path to the target point to the path by calling
407     // OH_Drawing_PathLineTo
408     OH_Drawing_PathLineTo(path, 300, 300);
409     // 6. Close the path by calling OH_Drawing_PathClose
410     OH_Drawing_PathClose(path);
411     // 7. Add an arc to the path by calling OH_Drawing_PathArcTo
412     OH_Drawing_PathArcTo(path, 10, 10, 20, 0, 0, 90);
413     // add assert
414     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
415     // 8. Free memory by calling OH_Drawing_PathDestroy
416     OH_Drawing_PathDestroy(path);
417 }
418 
419 /*
420  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0601
421  * @tc.name: testPathArcToNull
422  * @tc.desc: Test for adding an arc to a path with NULL or invalid parameters.
423  * @tc.size  : SmallTest
424  * @tc.type  : Function
425  * @tc.level : Level 3
426  */
427 HWTEST_F(DrawingNativePathTest, testPathArcToNull, TestSize.Level3) {
428     // 1. Create a path object by calling OH_Drawing_PathCreate
429     OH_Drawing_Path *path = OH_Drawing_PathCreate();
430     // add assert
431     EXPECT_NE(path, nullptr);
432     // 2. Call OH_Drawing_PathArcTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
433     // error code
434     OH_Drawing_PathArcTo(nullptr, 10, 10, 20, 0, 0, 90);
435     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
436     // 3. Call OH_Drawing_PathArcTo with 0.00 as the second parameter, no crash
437     OH_Drawing_PathArcTo(path, 0.00, 10, 20, 0, 0, 90);
438     // 4. Call OH_Drawing_PathArcTo with 0.00 as the third parameter, no crash
439     OH_Drawing_PathArcTo(path, 10, 0.00, 20, 0, 0, 90);
440     // 5. Call OH_Drawing_PathArcTo with 0.00 as the fourth parameter, no crash
441     OH_Drawing_PathArcTo(path, 10, 10, 0.00, 0, 0, 90);
442     // 6. Call OH_Drawing_PathArcTo with 0.00 as the fifth parameter, no crash
443     OH_Drawing_PathArcTo(path, 10, 10, 20, 0.00, 0, 90);
444     // 7. Call OH_Drawing_PathArcTo with 0.00 as the sixth parameter, no crash
445     OH_Drawing_PathArcTo(path, 10, 10, 20, 0, 0.00, 90);
446     // 8. Call OH_Drawing_PathArcTo with 0.00 as the seventh parameter, no crash
447     OH_Drawing_PathArcTo(path, 10, 10, 20, 0, 0, 0.00);
448     // 9. Free memory
449     OH_Drawing_PathDestroy(path);
450 }
451 
452 /*
453  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0602
454  * @tc.name: testPathArcToAbnormal
455  * @tc.desc: Test for adding an arc to a path with abnormal data types as parameters.
456  * @tc.size  : SmallTest
457  * @tc.type  : Function
458  * @tc.level : Level 3
459  */
460 HWTEST_F(DrawingNativePathTest, testPathArcToAbnormal, TestSize.Level3) {
461     // 1. Create a path object by calling OH_Drawing_PathCreate
462     OH_Drawing_Path *path = OH_Drawing_PathCreate();
463     // add assert
464     EXPECT_NE(path, nullptr);
465     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
466     OH_Drawing_PathMoveTo(path, 0, 0);
467     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
468     OH_Drawing_PathLineTo(path, 100, 100);
469     // 4. Add a line segment from the last point of the path to the target point to the path by calling
470     // OH_Drawing_PathLineTo
471     OH_Drawing_PathLineTo(path, 200, 200);
472     // 5. Add a line segment from the last point of the path to the target point to the path by calling
473     // OH_Drawing_PathLineTo
474     OH_Drawing_PathLineTo(path, 300, 300);
475     // 6. Close the path by calling OH_Drawing_PathClose
476     OH_Drawing_PathClose(path);
477     // 7. Add an arc to the path by calling OH_Drawing_PathArcTo with integer parameters
478     OH_Drawing_PathArcTo(path, 10, 10, 20, 20, 20, 90);
479     // 8. Free memory by calling OH_Drawing_PathDestroy
480     OH_Drawing_PathDestroy(path);
481 }
482 
483 /*
484  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0603
485  * @tc.name: testPathArcToMaximal
486  * @tc.desc: Test for adding an arc to a path with maximal values as parameters.
487  * @tc.size  : SmallTest
488  * @tc.type  : Function
489  * @tc.level : Level 3
490  */
491 HWTEST_F(DrawingNativePathTest, testPathArcToMaximal, TestSize.Level3) {
492     // 1. Create a path object by calling OH_Drawing_PathCreate
493     OH_Drawing_Path *path = OH_Drawing_PathCreate();
494     // add assert
495     EXPECT_NE(path, nullptr);
496     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
497     OH_Drawing_PathMoveTo(path, 0, 0);
498     // 3. Add a line segment from the starting point to the target point to the path by calling OH_Drawing_PathLineTo
499     OH_Drawing_PathLineTo(path, 100, 100);
500     // 4. Add a line segment from the last point of the path to the target point to the path by calling
501     // OH_Drawing_PathLineTo
502     OH_Drawing_PathLineTo(path, 200, 200);
503     // 5. Add a line segment from the last point of the path to the target point to the path by calling
504     // OH_Drawing_PathLineTo
505     OH_Drawing_PathLineTo(path, 300, 300);
506     // 6. Close the path by calling OH_Drawing_PathClose
507     OH_Drawing_PathClose(path);
508     // 7. Add an arc to the path by calling OH_Drawing_PathArcTo with the second parameter as the maximum value of
509     // FLT_MAX + 1, no crash
510     OH_Drawing_PathArcTo(path, FLT_MAX + 1, 10, 20, 0, 0, 90);
511     // 8. Add an arc to the path by calling OH_Drawing_PathArcTo with the third parameter as the maximum value of
512     // FLT_MAX + 1, no crash
513     OH_Drawing_PathArcTo(path, 10, FLT_MAX + 1, 20, 0, 0, 90);
514     // 9. Add an arc to the path by calling OH_Drawing_PathArcTo with the fourth parameter as the maximum value of
515     // FLT_MAX + 1, no crash
516     OH_Drawing_PathArcTo(path, 10, 10, FLT_MAX + 1, 0, 0, 90);
517     // 10. Add an arc to the path by calling OH_Drawing_PathArcTo with the fifth parameter as the maximum value of
518     // FLT_MAX + 1, no crash
519     OH_Drawing_PathArcTo(path, 10, 10, 20, FLT_MAX + 1, 0, 90);
520     // 11. Add an arc to the path by calling OH_Drawing_PathArcTo with the sixth parameter as the maximum value of
521     // FLT_MAX + 1, no crash
522     OH_Drawing_PathArcTo(path, 10, 10, 20, 0, FLT_MAX + 1, 90);
523     // 12. Add an arc to the path by calling OH_Drawing_PathArcTo with the seventh parameter as the maximum value of
524     // FLT_MAX + 1, no crash
525     OH_Drawing_PathArcTo(path, 10, 10, 20, 0, 0, FLT_MAX + 1);
526     // 13. Free memory
527     OH_Drawing_PathDestroy(path);
528 }
529 
530 /*
531  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0700
532  * @tc.name: testPathQuadToNormal
533  * @tc.desc: Test for adding a quadratic Bezier curve to a path with normal parameters.
534  * @tc.size  : SmallTest
535  * @tc.type  : Function
536  * @tc.level : Level 0
537  */
538 HWTEST_F(DrawingNativePathTest, testPathQuadToNormal, TestSize.Level0) {
539     // 1. Create a path object by calling OH_Drawing_PathCreate
540     OH_Drawing_Path *path = OH_Drawing_PathCreate();
541     // add assert
542     EXPECT_NE(path, nullptr);
543     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
544     OH_Drawing_PathMoveTo(path, 0, 0);
545     // add assert
546     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
547     // 3. Add a quadratic Bezier curve from the last point of the path to the target point by calling
548     // OH_Drawing_PathQuadTo
549     OH_Drawing_PathQuadTo(path, 100, 100, 200, 200);
550     // add assert
551     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
552     // 4. Free memory by calling OH_Drawing_PathDestroy
553     OH_Drawing_PathDestroy(path);
554 }
555 
556 /*
557  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0701
558  * @tc.name: testPathQuadToNull
559  * @tc.desc: Test for adding a quadratic Bezier curve to a path with NULL or invalid parameters.
560  * @tc.size  : SmallTest
561  * @tc.type  : Function
562  * @tc.level : Level 3
563  */
564 HWTEST_F(DrawingNativePathTest, testPathQuadToNull, TestSize.Level3) {
565     // 1. Create a path object by calling OH_Drawing_PathCreate
566     OH_Drawing_Path *path = OH_Drawing_PathCreate();
567     // add assert
568     EXPECT_NE(path, nullptr);
569     // 2. Call OH_Drawing_PathQuadTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
570     // error code
571     OH_Drawing_PathQuadTo(nullptr, 100, 100, 200, 200);
572     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
573     // 3. Call OH_Drawing_PathQuadTo with 0.00 as the second parameter, no crash
574     OH_Drawing_PathQuadTo(path, 0.00, 100, 200, 200);
575     // 4. Call OH_Drawing_PathQuadTo with 0.00 as the third parameter, no crash
576     OH_Drawing_PathQuadTo(path, 100, 0.00, 200, 200);
577     // 5. Call OH_Drawing_PathQuadTo with 0.00 as the fourth parameter, no crash
578     OH_Drawing_PathQuadTo(path, 100, 100, 0.00, 200);
579     // 6. Call OH_Drawing_PathQuadTo with 0.00 as the fifth parameter, no crash
580     OH_Drawing_PathQuadTo(path, 100, 100, 200, 0.00);
581     // 7. Free memory
582     OH_Drawing_PathDestroy(path);
583 }
584 
585 /*
586  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0702
587  * @tc.name: testPathQuadToAbnormal
588  * @tc.desc: Test for adding a quadratic Bezier curve to a path with abnormal data types as parameters.
589  * @tc.size  : SmallTest
590  * @tc.type  : Function
591  * @tc.level : Level 3
592  */
593 HWTEST_F(DrawingNativePathTest, testPathQuadToAbnormal, TestSize.Level3) {
594     // 1. Create a path object by calling OH_Drawing_PathCreate
595     OH_Drawing_Path *path = OH_Drawing_PathCreate();
596     // add assert
597     EXPECT_NE(path, nullptr);
598     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
599     OH_Drawing_PathMoveTo(path, 0, 0);
600     // 3. Add a quadratic Bezier curve to the path with the second parameter as an integer
601     OH_Drawing_PathQuadTo(path, 100, 100.0f, 200.0f, 200.0f);
602     // 4. Add a quadratic Bezier curve to the path with the third parameter as an integer
603     OH_Drawing_PathQuadTo(path, 100.0f, 100, 200.0f, 200.0f);
604     // 5. Add a quadratic Bezier curve to the path with the fourth parameter as an integer
605     OH_Drawing_PathQuadTo(path, 100.0f, 100.0f, 200, 200.0f);
606     // 6. Add a quadratic Bezier curve to the path with the fifth parameter as an integer
607     OH_Drawing_PathQuadTo(path, 100.0f, 100.0f, 200.0f, 200);
608     // 7. Free memory by calling OH_Drawing_PathDestroy
609     OH_Drawing_PathDestroy(path);
610 }
611 
612 /*
613  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0703
614  * @tc.name: testPathQuadToMaximal
615  * @tc.desc: Test for adding a quadratic Bezier curve to a path with maximal values as parameters.
616  * @tc.size  : SmallTest
617  * @tc.type  : Function
618  * @tc.level : Level 3
619  */
620 HWTEST_F(DrawingNativePathTest, testPathQuadToMaximal, TestSize.Level3) {
621     // 1. Create a path object by calling OH_Drawing_PathCreate
622     OH_Drawing_Path *path = OH_Drawing_PathCreate();
623     // add assert
624     EXPECT_NE(path, nullptr);
625     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
626     OH_Drawing_PathMoveTo(path, 0, 0);
627     // 3. Call OH_Drawing_PathQuadTo with the second parameter as the maximum value of FLT_MAX + 1, no crash
628     OH_Drawing_PathQuadTo(path, FLT_MAX + 1, 100, 200, 200);
629     // 4. Call OH_Drawing_PathQuadTo with the third parameter as the maximum value of FLT_MAX + 1, no crash
630     OH_Drawing_PathQuadTo(path, 100, FLT_MAX + 1, 200, 200);
631     // 5. Call OH_Drawing_PathQuadTo with the fourth parameter as the maximum value of FLT_MAX + 1, no crash
632     OH_Drawing_PathQuadTo(path, 100, 100, FLT_MAX + 1, 200);
633     // 6. Call OH_Drawing_PathQuadTo with the fifth parameter as the maximum value of FLT_MAX + 1, no crash
634     OH_Drawing_PathQuadTo(path, 100, 100, 200, FLT_MAX + 1);
635     // 7. Free memory by calling OH_Drawing_PathDestroy
636     OH_Drawing_PathDestroy(path);
637 }
638 
639 /*
640  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0800
641  * @tc.name: testPathConicToNormal
642  * @tc.desc: Test for adding a conic curve to a path with normal parameters.
643  * @tc.size  : SmallTest
644  * @tc.type  : Function
645  * @tc.level : Level 0
646  */
647 HWTEST_F(DrawingNativePathTest, testPathConicToNormal, TestSize.Level0) {
648     // 1. Create a path object by calling OH_Drawing_PathCreate
649     OH_Drawing_Path *path = OH_Drawing_PathCreate();
650     // add assert
651     EXPECT_NE(path, nullptr);
652     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
653     OH_Drawing_PathMoveTo(path, 0, 0);
654     // 3. Add a line segment from the last point of the path to the target point by calling OH_Drawing_PathLineTo
655     OH_Drawing_PathLineTo(path, 100, 100);
656     // 4. Add a quadratic Bezier curve to the path by calling OH_Drawing_PathConicTo
657     OH_Drawing_PathConicTo(path, 50, 50, 100, 100, 0.5);
658     // add assert
659     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
660     // 5. Free memory by calling OH_Drawing_PathDestroy
661     OH_Drawing_PathDestroy(path);
662 }
663 
664 /*
665  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0801
666  * @tc.name: testPathConicToNull
667  * @tc.desc: Test for adding a conic curve to a path with NULL or invalid parameters.
668  * @tc.size  : SmallTest
669  * @tc.type  : Function
670  * @tc.level : Level 3
671  */
672 HWTEST_F(DrawingNativePathTest, testPathConicToNull, TestSize.Level3) {
673     // 1. Create a path object by calling OH_Drawing_PathCreate
674     OH_Drawing_Path *path = OH_Drawing_PathCreate();
675     // add assert
676     EXPECT_NE(path, nullptr);
677     // 2. Call OH_Drawing_PathConicTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
678     // error code
679     OH_Drawing_PathConicTo(nullptr, 50, 50, 100, 100, 0.5);
680     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
681     // 3. Call OH_Drawing_PathConicTo with 0.00 as the second parameter, no crash
682     OH_Drawing_PathConicTo(path, 0.00, 50, 100, 100, 0.5);
683     // 4. Call OH_Drawing_PathConicTo with 0.00 as the third parameter, no crash
684     OH_Drawing_PathConicTo(path, 50, 0.00, 100, 100, 0.5);
685     // 5. Call OH_Drawing_PathConicTo with 0.00 as the fourth parameter, no crash
686     OH_Drawing_PathConicTo(path, 50, 50, 0.00, 100, 0.5);
687     // 6. Call OH_Drawing_PathConicTo with 0.00 as the fifth parameter, no crash
688     OH_Drawing_PathConicTo(path, 50, 50, 100, 0.00, 0.5);
689     // 7. Call OH_Drawing_PathConicTo with 0.00 as the sixth parameter, no crash
690     OH_Drawing_PathConicTo(path, 50, 50, 100, 100, 0.00);
691     // 8. Free memory by calling OH_Drawing_PathDestroy
692     OH_Drawing_PathDestroy(path);
693 }
694 
695 /*
696  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0802
697  * @tc.name: testPathConicToAbnormal
698  * @tc.desc: Test for adding a conic curve to a path with abnormal data types as parameters.
699  * @tc.size  : SmallTest
700  * @tc.type  : Function
701  * @tc.level : Level 3
702  */
703 HWTEST_F(DrawingNativePathTest, testPathConicToAbnormal, TestSize.Level3) {
704     // 1. Create a path object by calling OH_Drawing_PathCreate
705     OH_Drawing_Path *path = OH_Drawing_PathCreate();
706     // add assert
707     EXPECT_NE(path, nullptr);
708     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
709     OH_Drawing_PathMoveTo(path, 0, 0);
710     // 3. Add a line segment from the last point of the path to the target point by calling OH_Drawing_PathLineTo
711     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
712     // 4. Add a conic curve to the path with the second parameter as an integer or character type
713     OH_Drawing_PathConicTo(path, 50, 50.0f, 100.0f, 100.0f, 0.5f);
714     // 5. Add a conic curve to the path with the third parameter as an integer or character type
715     OH_Drawing_PathConicTo(path, 50.0f, 50, 100.0f, 100.0f, 0.5f);
716     // 6. Add a conic curve to the path with the fourth parameter as an integer or character type
717     OH_Drawing_PathConicTo(path, 50.0f, 50.0f, 100, 100.0f, 0.5f);
718     // 7. Add a conic curve to the path with the fifth parameter as an integer or character type
719     OH_Drawing_PathConicTo(path, 50.0f, 50.0f, 100.0f, 100, 0.5f);
720     // 8. Add a conic curve to the path with the sixth parameter as an integer or character type
721     OH_Drawing_PathConicTo(path, 50.0f, 50.0f, 100.0f, 100.0f, 1);
722     // 9. Free memory by calling OH_Drawing_PathDestroy
723     OH_Drawing_PathDestroy(path);
724 }
725 
726 /*
727  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0803
728  * @tc.name: testPathConicToMaximal
729  * @tc.desc: Test for adding a conic curve to a path with maximal values as parameters.
730  * @tc.size  : SmallTest
731  * @tc.type  : Function
732  * @tc.level : Level 3
733  */
734 HWTEST_F(DrawingNativePathTest, testPathConicToMaximal, TestSize.Level3) {
735     // 1. Create a path object by calling OH_Drawing_PathCreate
736     OH_Drawing_Path *path = OH_Drawing_PathCreate();
737     // add assert
738     EXPECT_NE(path, nullptr);
739     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
740     OH_Drawing_PathMoveTo(path, 0, 0);
741     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
742     OH_Drawing_PathLineTo(path, 100, 100);
743     // 4. Call OH_Drawing_PathConicTo with the second parameter as the maximum value of FLT_MAX + 1, no crash
744     OH_Drawing_PathConicTo(path, FLT_MAX + 1, 50, 100, 100, 0.5);
745     // 5. Call OH_Drawing_PathConicTo with the third parameter as the maximum value of FLT_MAX + 1, no crash
746     OH_Drawing_PathConicTo(path, 50, FLT_MAX + 1, 100, 100, 0.5);
747     // 6. Call OH_Drawing_PathConicTo with the fourth parameter as the maximum value of FLT_MAX + 1, no crash
748     OH_Drawing_PathConicTo(path, 50, 50, FLT_MAX + 1, 100, 0.5);
749     // 7. Call OH_Drawing_PathConicTo with the fifth parameter as the maximum value of FLT_MAX + 1, no crash
750     OH_Drawing_PathConicTo(path, 50, 50, 100, FLT_MAX + 1, 0.5);
751     // 8. Call OH_Drawing_PathConicTo with the sixth parameter as the maximum value of FLT_MAX + 1, no crash
752     OH_Drawing_PathConicTo(path, 50, 50, 100, 100, FLT_MAX + 1);
753     // 9. Free memory by calling OH_Drawing_PathDestroy
754     OH_Drawing_PathDestroy(path);
755 }
756 
757 /*
758  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0900
759  * @tc.name: testPathCubicToNormal
760  * @tc.desc: Test for adding a cubic Bezier curve to a path with normal parameters.
761  * @tc.size  : SmallTest
762  * @tc.type  : Function
763  * @tc.level : Level 0
764  */
765 HWTEST_F(DrawingNativePathTest, testPathCubicToNormal, TestSize.Level0) {
766     // 1. Create a path object by calling OH_Drawing_PathCreate
767     OH_Drawing_Path *path = OH_Drawing_PathCreate();
768     // add assert
769     EXPECT_NE(path, nullptr);
770     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
771     OH_Drawing_PathMoveTo(path, 0, 0);
772     // 3. Add a cubic Bezier curve from the last point of the path to the target point by calling OH_Drawing_PathCubicTo
773     OH_Drawing_PathCubicTo(path, 100, 100, 200, 200, 300, 300);
774     // add assert
775     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
776     // 4. Free memory by calling OH_Drawing_PathDestroy
777     OH_Drawing_PathDestroy(path);
778 }
779 
780 /*
781  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0901
782  * @tc.name: testPathCubicToNull
783  * @tc.desc: Test for adding a cubic Bezier curve to a path with NULL or invalid parameters.
784  * @tc.size  : SmallTest
785  * @tc.type  : Function
786  * @tc.level : Level 3
787  */
788 HWTEST_F(DrawingNativePathTest, testPathCubicToNull, TestSize.Level3) {
789     // 1. Create a path object by calling OH_Drawing_PathCreate
790     OH_Drawing_Path *path = OH_Drawing_PathCreate();
791     // add assert
792     EXPECT_NE(path, nullptr);
793     // 2. Call OH_Drawing_PathCubicTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
794     // error code
795     OH_Drawing_PathCubicTo(nullptr, 100, 100, 200, 200, 300, 300);
796     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
797     // 3. Call OH_Drawing_PathCubicTo with 0.00 as the second parameter, no crash
798     OH_Drawing_PathCubicTo(path, 0.00, 100, 200, 200, 300, 300);
799     // 4. Call OH_Drawing_PathCubicTo with 0.00 as the third parameter, no crash
800     OH_Drawing_PathCubicTo(path, 100, 0.00, 200, 200, 300, 300);
801     // 5. Call OH_Drawing_PathCubicTo with 0.00 as the fourth parameter, no crash
802     OH_Drawing_PathCubicTo(path, 100, 100, 0.00, 200, 300, 300);
803     // 6. Call OH_Drawing_PathCubicTo with 0.00 as the fifth parameter, no crash
804     OH_Drawing_PathCubicTo(path, 100, 100, 200, 0.00, 300, 300);
805     // 7. Call OH_Drawing_PathCubicTo with 0.00 as the sixth parameter, no crash
806     OH_Drawing_PathCubicTo(path, 100, 100, 200, 200, 0.00, 300);
807     // 8. Call OH_Drawing_PathCubicTo with 0.00 as the seventh parameter, no crash
808     OH_Drawing_PathCubicTo(path, 100, 100, 200, 200, 300, 0.00);
809     // 9. Free memory by calling OH_Drawing_PathDestroy
810     OH_Drawing_PathDestroy(path);
811 }
812 
813 /*
814  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0902
815  * @tc.name: testPathCubicToAbnormal
816  * @tc.desc: Test for adding a cubic Bezier curve to a path with abnormal data types as parameters.
817  * @tc.size  : SmallTest
818  * @tc.type  : Function
819  * @tc.level : Level 3
820  */
821 HWTEST_F(DrawingNativePathTest, testPathCubicToAbnormal, TestSize.Level3) {
822     // 1. Create a path object by calling OH_Drawing_PathCreate
823     OH_Drawing_Path *path = OH_Drawing_PathCreate();
824     // add assert
825     EXPECT_NE(path, nullptr);
826     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
827     OH_Drawing_PathMoveTo(path, 0, 0);
828     // 3. Add a cubic Bezier curve to the path with the second parameter as an integer
829     OH_Drawing_PathCubicTo(path, 100, 100.0f, 200.0f, 200.0f, 300.0f, 300.0f);
830     // 4. Add a cubic Bezier curve to the path with the third parameter as an integer
831     OH_Drawing_PathCubicTo(path, 100.0f, 100, 200.0f, 200.0f, 300.0f, 300.0f);
832     // 5. Add a cubic Bezier curve to the path with the fourth parameter as an integer
833     OH_Drawing_PathCubicTo(path, 100.0f, 100.0f, 200, 200.0f, 300.0f, 300.0f);
834     // 6. Add a cubic Bezier curve to the path with the fifth parameter as an integer
835     OH_Drawing_PathCubicTo(path, 100.0f, 100.0f, 200.0f, 200, 300.0f, 300.0f);
836     // 7. Add a cubic Bezier curve to the path with the sixth parameter as an integer
837     OH_Drawing_PathCubicTo(path, 100.0f, 100.0f, 200.0f, 200.0f, 300, 300.0f);
838     // 8. Add a cubic Bezier curve to the path with the seventh parameter as an integer
839     OH_Drawing_PathCubicTo(path, 100.0f, 100.0f, 200.0f, 200.0f, 300.0f, 300);
840     // 9. Free memory by calling OH_Drawing_PathDestroy
841     OH_Drawing_PathDestroy(path);
842 }
843 
844 /*
845  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_0903
846  * @tc.name: testPathCubicToMaximal
847  * @tc.desc: Test for adding a cubic Bezier curve to a path with maximal values as parameters.
848  * @tc.size  : SmallTest
849  * @tc.type  : Function
850  * @tc.level : Level 3
851  */
852 HWTEST_F(DrawingNativePathTest, testPathCubicToMaximal, TestSize.Level3) {
853     // 1. Create a path object by calling OH_Drawing_PathCreate
854     OH_Drawing_Path *path = OH_Drawing_PathCreate();
855     // add assert
856     EXPECT_NE(path, nullptr);
857     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
858     OH_Drawing_PathMoveTo(path, 0, 0);
859     // 3. Call OH_Drawing_PathCubicTo with the second parameter as the maximum value of FLT_MAX + 1, no crash
860     OH_Drawing_PathCubicTo(path, FLT_MAX + 1, 100, 200, 200, 300, 300);
861     // 4. Call OH_Drawing_PathCubicTo with the third parameter as the maximum value of FLT_MAX + 1, no crash
862     OH_Drawing_PathCubicTo(path, 100, FLT_MAX + 1, 200, 200, 300, 300);
863     // 5. Call OH_Drawing_PathCubicTo with the fourth parameter as the maximum value of FLT_MAX + 1, no crash
864     OH_Drawing_PathCubicTo(path, 100, 100, FLT_MAX + 1, 200, 300, 300);
865     // 6. Call OH_Drawing_PathCubicTo with the fifth parameter as the maximum value of FLT_MAX + 1, no crash
866     OH_Drawing_PathCubicTo(path, 100, 100, 200, FLT_MAX + 1, 300, 300);
867     // 7. Call OH_Drawing_PathCubicTo with the sixth parameter as the maximum value of FLT_MAX + 1, no crash
868     OH_Drawing_PathCubicTo(path, 100, 100, 200, 200, FLT_MAX + 1, 300);
869     // 8. Call OH_Drawing_PathCubicTo with the seventh parameter as the maximum value of FLT_MAX + 1, no crash
870     OH_Drawing_PathCubicTo(path, 100, 100, 200, 200, 300, FLT_MAX + 1);
871     // 9. Free memory by calling OH_Drawing_PathDestroy
872     OH_Drawing_PathDestroy(path);
873 }
874 
875 /*
876  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1000
877  * @tc.name: testPathRMoveToNormal
878  * @tc.desc: Test for setting a relative move to a path with normal parameters.
879  * @tc.size  : SmallTest
880  * @tc.type  : Function
881  * @tc.level : Level 0
882  */
883 HWTEST_F(DrawingNativePathTest, testPathRMoveToNormal, TestSize.Level0) {
884     // 1. Create a path object by calling OH_Drawing_PathCreate
885     OH_Drawing_Path *path = OH_Drawing_PathCreate();
886     // add assert
887     EXPECT_NE(path, nullptr);
888     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
889     OH_Drawing_PathMoveTo(path, 0, 0);
890     // add assert
891     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
892     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
893     OH_Drawing_PathLineTo(path, 100, 100);
894     // add assert
895     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
896     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
897     OH_Drawing_PathRMoveTo(path, 100, 100);
898     // add assert
899     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
900     // 5. Free memory by calling OH_Drawing_PathDestroy
901     OH_Drawing_PathDestroy(path);
902 }
903 
904 /*
905  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1001
906  * @tc.name: testPathRMoveToNull
907  * @tc.desc: Test for setting a relative move to a path with NULL or invalid parameters.
908  * @tc.size  : SmallTest
909  * @tc.type  : Function
910  * @tc.level : Level 3
911  */
912 HWTEST_F(DrawingNativePathTest, testPathRMoveToNull, TestSize.Level3) {
913     // 1. Create a path object by calling OH_Drawing_PathCreate
914     OH_Drawing_Path *path = OH_Drawing_PathCreate();
915     // add assert
916     EXPECT_NE(path, nullptr);
917     // 2. Call OH_Drawing_PathRMoveTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
918     // error code
919     OH_Drawing_PathRMoveTo(nullptr, 100, 100);
920     // add assert
921     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
922     // 3. Call OH_Drawing_PathRMoveTo with 0.00 as the second parameter, no crash
923     OH_Drawing_PathRMoveTo(path, 0.00, 100);
924     // 4. Call OH_Drawing_PathRMoveTo with 0.00 as the third parameter, no crash
925     OH_Drawing_PathRMoveTo(path, 100, 0.00);
926     // 5. Free memory by calling OH_Drawing_PathDestroy
927     OH_Drawing_PathDestroy(path);
928 }
929 
930 /*
931  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1002
932  * @tc.name: testPathRMoveToAbnormal
933  * @tc.desc: Test for setting a relative move to a path with abnormal data types as parameters.
934  * @tc.size  : SmallTest
935  * @tc.type  : Function
936  * @tc.level : Level 3
937  */
938 HWTEST_F(DrawingNativePathTest, testPathRMoveToAbnormal, TestSize.Level3) {
939     // 1. Create a path object by calling OH_Drawing_PathCreate
940     OH_Drawing_Path *path = OH_Drawing_PathCreate();
941     // add assert
942     EXPECT_NE(path, nullptr);
943     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
944     OH_Drawing_PathMoveTo(path, 0, 0);
945     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
946     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
947     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
948     OH_Drawing_PathRMoveTo(path, 100, 100.0f);
949     // 5. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
950     OH_Drawing_PathRMoveTo(path, 100.0f, 100);
951     // 6. Free memory by calling OH_Drawing_PathDestroy
952     OH_Drawing_PathDestroy(path);
953 }
954 
955 /*
956  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1003
957  * @tc.name: testPathRMoveToMaximal
958  * @tc.desc: Test for setting a relative move to a path with maximal values as parameters.
959  * @tc.size  : SmallTest
960  * @tc.type  : Function
961  * @tc.level : Level 3
962  */
963 HWTEST_F(DrawingNativePathTest, testPathRMoveToMaximal, TestSize.Level3) {
964     // 1. Create a path object by calling OH_Drawing_PathCreate
965     OH_Drawing_Path *path = OH_Drawing_PathCreate();
966     // add assert
967     EXPECT_NE(path, nullptr);
968     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
969     OH_Drawing_PathMoveTo(path, 0, 0);
970     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
971     OH_Drawing_PathLineTo(path, 100, 100);
972     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
973     OH_Drawing_PathRMoveTo(path, FLT_MAX + 1, 100);
974     // 5. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
975     OH_Drawing_PathRMoveTo(path, 100, FLT_MAX + 1);
976     // 6. Free memory by calling OH_Drawing_PathDestroy
977     OH_Drawing_PathDestroy(path);
978 }
979 
980 /*
981  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1100
982  * @tc.name: testPathRLineToNormal
983  * @tc.desc: Test for adding a relative line to a path with normal parameters.
984  * @tc.size  : SmallTest
985  * @tc.type  : Function
986  * @tc.level : Level 0
987  */
988 HWTEST_F(DrawingNativePathTest, testPathRLineToNormal, TestSize.Level0) {
989     // 1. Create a path object by calling OH_Drawing_PathCreate
990     OH_Drawing_Path *path = OH_Drawing_PathCreate();
991     // add assert
992     EXPECT_NE(path, nullptr);
993     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
994     OH_Drawing_PathMoveTo(path, 0, 0);
995     // add assert
996     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
997     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
998     OH_Drawing_PathLineTo(path, 100, 100);
999     // add assert
1000     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1001     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1002     OH_Drawing_PathRMoveTo(path, 100, 100);
1003     // add assert
1004     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1005     // 5. Add a relative line to the path from the current endpoint to the target point by calling
1006     // OH_Drawing_PathRLineTo
1007     OH_Drawing_PathRLineTo(path, 100, 100);
1008     // add assert
1009     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1010     // 6. Free memory by calling OH_Drawing_PathDestroy
1011     OH_Drawing_PathDestroy(path);
1012 }
1013 
1014 /*
1015  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1101
1016  * @tc.name: testPathRLineToNull
1017  * @tc.desc: Test for adding a relative line to a path with NULL or invalid parameters.
1018  * @tc.size  : SmallTest
1019  * @tc.type  : Function
1020  * @tc.level : Level 3
1021  */
1022 HWTEST_F(DrawingNativePathTest, testPathRLineToNull, TestSize.Level3) {
1023     // 1. Create a path object by calling OH_Drawing_PathCreate
1024     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1025     // add assert
1026     EXPECT_NE(path, nullptr);
1027     // 2. Call OH_Drawing_PathRLineTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
1028     // error code
1029     OH_Drawing_PathRLineTo(nullptr, 100, 100);
1030     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1031     // 3. Call OH_Drawing_PathRLineTo with 0.00 as the second parameter, no crash
1032     OH_Drawing_PathRLineTo(path, 0.00, 100);
1033     // 4. Call OH_Drawing_PathRLineTo with 0.00 as the third parameter, no crash
1034     OH_Drawing_PathRLineTo(path, 100, 0.00);
1035     // 5. Free memory by calling OH_Drawing_PathDestroy
1036     OH_Drawing_PathDestroy(path);
1037 }
1038 
1039 /*
1040  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1102
1041  * @tc.name: testPathRLineToAbnormal
1042  * @tc.desc: Test for adding a relative line to a path with abnormal data types as parameters.
1043  * @tc.size  : SmallTest
1044  * @tc.type  : Function
1045  * @tc.level : Level 3
1046  */
1047 HWTEST_F(DrawingNativePathTest, testPathRLineToAbnormal, TestSize.Level3) {
1048     // 1. Create a path object by calling OH_Drawing_PathCreate
1049     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1050     // add assert
1051     EXPECT_NE(path, nullptr);
1052     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1053     OH_Drawing_PathMoveTo(path, 0, 0);
1054     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1055     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1056     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1057     OH_Drawing_PathRMoveTo(path, 100, 100);
1058     // 5. Add a relative line to the path from the current endpoint to the target point by calling
1059     // OH_Drawing_PathRLineTo
1060     OH_Drawing_PathRLineTo(path, 100.0f, 100);
1061     // 6. Add a relative line to the path from the current endpoint to the target point by calling
1062     // OH_Drawing_PathRLineTo
1063     OH_Drawing_PathRLineTo(path, 100, 100.0f);
1064     // 7. Free memory by calling OH_Drawing_PathDestroy
1065     OH_Drawing_PathDestroy(path);
1066 }
1067 
1068 /*
1069  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1103
1070  * @tc.name: testPathRLineToMaximal
1071  * @tc.desc: Test for adding a relative line to a path with maximal values as parameters.
1072  * @tc.size  : SmallTest
1073  * @tc.type  : Function
1074  * @tc.level : Level 3
1075  */
1076 HWTEST_F(DrawingNativePathTest, testPathRLineToMaximal, TestSize.Level3) {
1077     // 1. Create a path object by calling OH_Drawing_PathCreate
1078     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1079     // add assert
1080     EXPECT_NE(path, nullptr);
1081     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1082     OH_Drawing_PathMoveTo(path, 0, 0);
1083     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1084     OH_Drawing_PathLineTo(path, 100, 100);
1085     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1086     OH_Drawing_PathRMoveTo(path, 100, 100);
1087     // 5. Add a relative line to the path from the current endpoint to the target point by calling
1088     // OH_Drawing_PathRLineTo
1089     OH_Drawing_PathRLineTo(path, FLT_MAX + 1, 100);
1090     // 6. Add a relative line to the path from the current endpoint to the target point by calling
1091     // OH_Drawing_PathRLineTo
1092     OH_Drawing_PathRLineTo(path, 100, FLT_MAX + 1);
1093     // 7. Free memory by calling OH_Drawing_PathDestroy
1094     OH_Drawing_PathDestroy(path);
1095 }
1096 
1097 /*
1098  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1200
1099  * @tc.name: testPathRQuadToNormal
1100  * @tc.desc: Test for adding a relative quadratic Bezier curve to a path with normal parameters.
1101  * @tc.size  : SmallTest
1102  * @tc.type  : Function
1103  * @tc.level : Level 0
1104  */
1105 HWTEST_F(DrawingNativePathTest, testPathRQuadToNormal, TestSize.Level0) {
1106     // 1. Create a path object by calling OH_Drawing_PathCreate
1107     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1108     // add assert
1109     EXPECT_NE(path, nullptr);
1110     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1111     OH_Drawing_PathMoveTo(path, 0, 0);
1112     // add assert
1113     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1114     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1115     OH_Drawing_PathLineTo(path, 100, 100);
1116     // add assert
1117     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1118     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1119     OH_Drawing_PathRMoveTo(path, 100, 100);
1120     // add assert
1121     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1122     // 5. Add a relative quadratic Bezier curve to the path from the current endpoint to the target point by calling
1123     // OH_Drawing_PathRQuadTo
1124     OH_Drawing_PathRQuadTo(path, 100, 100, 200, 200);
1125     // add assert
1126     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1127     // 6. Free memory by calling OH_Drawing_PathDestroy
1128     OH_Drawing_PathDestroy(path);
1129 }
1130 
1131 /*
1132  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1201
1133  * @tc.name: testPathRQuadToNull
1134  * @tc.desc: Test for adding a relative quadratic Bezier curve to a path with NULL or invalid parameters.
1135  * @tc.size  : SmallTest
1136  * @tc.type  : Function
1137  * @tc.level : Level 3
1138  */
1139 HWTEST_F(DrawingNativePathTest, testPathRQuadToNull, TestSize.Level3) {
1140     // 1. Create a path object by calling OH_Drawing_PathCreate
1141     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1142     // add assert
1143     EXPECT_NE(path, nullptr);
1144     // 2. Call OH_Drawing_PathRQuadTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
1145     // error code
1146     OH_Drawing_PathRQuadTo(nullptr, 0, 0, 0, 0);
1147     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1148     // 3. Call OH_Drawing_PathRQuadTo with 0.00 as the second parameter, no crash
1149     OH_Drawing_PathRQuadTo(path, 0.00, 100, 100, 300);
1150     // 4. Call OH_Drawing_PathRQuadTo with 0.00 as the third parameter, no crash
1151     OH_Drawing_PathRQuadTo(path, 100, 0.00, 100, 300);
1152     // 5. Call OH_Drawing_PathRQuadTo with 0.00 as the fourth parameter, no crash
1153     OH_Drawing_PathRQuadTo(path, 100, 100, 0.00, 300);
1154     // 6. Call OH_Drawing_PathRQuadTo with 0.00 as the fifth parameter, no crash
1155     OH_Drawing_PathRQuadTo(path, 100, 100, 100, 0.00);
1156     // 7. Free memory by calling OH_Drawing_PathDestroy
1157     OH_Drawing_PathDestroy(path);
1158 }
1159 
1160 /*
1161  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1202
1162  * @tc.name: testPathRQuadToAbnormal
1163  * @tc.desc: Test for adding a relative quadratic Bezier curve to a path with abnormal data types as parameters.
1164  * @tc.size  : SmallTest
1165  * @tc.type  : Function
1166  * @tc.level : Level 3
1167  */
1168 HWTEST_F(DrawingNativePathTest, testPathRQuadToAbnormal, TestSize.Level3) {
1169     // 1. Create a path object by calling OH_Drawing_PathCreate
1170     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1171     // add assert
1172     EXPECT_NE(path, nullptr);
1173     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1174     OH_Drawing_PathMoveTo(path, 0, 0);
1175     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1176     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1177     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1178     OH_Drawing_PathRMoveTo(path, 100, 100);
1179     // 5. Call OH_Drawing_PathRQuadTo with an integer or character type as the second parameter
1180     OH_Drawing_PathRQuadTo(path, 100, 100.0f, 100.0f, 300.0f);
1181     // 6. Call OH_Drawing_PathRQuadTo with an integer or character type as the third parameter
1182     OH_Drawing_PathRQuadTo(path, 100.0f, 100, 100.0f, 300.0f);
1183     // 7. Call OH_Drawing_PathRQuadTo with an integer or character type as the fourth parameter
1184     OH_Drawing_PathRQuadTo(path, 100.0f, 100.0f, 100, 300.0f);
1185     // 8. Call OH_Drawing_PathRQuadTo with an integer or character type as the fifth parameter
1186     OH_Drawing_PathRQuadTo(path, 100.0f, 100.0f, 100.0f, 300);
1187     // 9. Free memory
1188     OH_Drawing_PathDestroy(path);
1189 }
1190 
1191 /*
1192  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1203
1193  * @tc.name: testPathRQuadToMaximal
1194  * @tc.desc: Test for adding a relative quadratic Bezier curve to a path with maximal values as parameters.
1195  * @tc.size  : SmallTest
1196  * @tc.type  : Function
1197  * @tc.level : Level 3
1198  */
1199 HWTEST_F(DrawingNativePathTest, testPathRQuadToMaximal, TestSize.Level3) {
1200     // 1. Create a path object by calling OH_Drawing_PathCreate
1201     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1202     // add assert
1203     EXPECT_NE(path, nullptr);
1204     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1205     OH_Drawing_PathMoveTo(path, 0, 0);
1206     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1207     OH_Drawing_PathLineTo(path, 100, 100);
1208     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1209     OH_Drawing_PathRMoveTo(path, 100, 100);
1210     // 5. Call OH_Drawing_PathRQuadTo with a second parameter of FLT_MAX + 1
1211     OH_Drawing_PathRQuadTo(path, FLT_MAX + 1, 100, 100, 300);
1212     // 6. Call OH_Drawing_PathRQuadTo with a third parameter of FLT_MAX + 1
1213     OH_Drawing_PathRQuadTo(path, 100, FLT_MAX + 1, 100, 300);
1214     // 7. Call OH_Drawing_PathRQuadTo with a fourth parameter of FLT_MAX + 1
1215     OH_Drawing_PathRQuadTo(path, 100, 100, FLT_MAX + 1, 300);
1216     // 8. Call OH_Drawing_PathRQuadTo with a fifth parameter of FLT_MAX + 1
1217     OH_Drawing_PathRQuadTo(path, 100, 100, 100, FLT_MAX + 1);
1218     // 9. Free memory by calling OH_Drawing_PathDestroy
1219     OH_Drawing_PathDestroy(path);
1220 }
1221 
1222 /*
1223  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1300
1224  * @tc.name: testPathRConicToNormal
1225  * @tc.desc: Test for adding a relative conic curve to a path with normal parameters.
1226  * @tc.size  : SmallTest
1227  * @tc.type  : Function
1228  * @tc.level : Level 0
1229  */
1230 HWTEST_F(DrawingNativePathTest, testPathRConicToNormal, TestSize.Level0) {
1231     // 1. Create a path object by calling OH_Drawing_PathCreate
1232     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1233     // add assert
1234     EXPECT_NE(path, nullptr);
1235     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1236     OH_Drawing_PathMoveTo(path, 0, 0);
1237     // add assert
1238     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1239     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1240     OH_Drawing_PathLineTo(path, 100, 100);
1241     // add assert
1242     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1243     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1244     OH_Drawing_PathRMoveTo(path, 100, 100);
1245     // add assert
1246     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1247     // 5. Add a relative conic curve to the path from the current endpoint to the target point by calling
1248     // OH_Drawing_PathRConicTo
1249     OH_Drawing_PathRConicTo(path, 100, 100, 100, 300, 5);
1250     // add assert
1251     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1252     // 6. Free memory by calling OH_Drawing_PathDestroy
1253     OH_Drawing_PathDestroy(path);
1254 }
1255 
1256 /*
1257  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1301
1258  * @tc.name: testPathRConicToNull
1259  * @tc.desc: Test for adding a relative conic curve to a path with NULL or invalid parameters.
1260  * @tc.size  : SmallTest
1261  * @tc.type  : Function
1262  * @tc.level : Level 3
1263  */
1264 HWTEST_F(DrawingNativePathTest, testPathRConicToNull, TestSize.Level3) {
1265     // 1. Create a path object by calling OH_Drawing_PathCreate
1266     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1267     // add assert
1268     EXPECT_NE(path, nullptr);
1269     // 2. Call OH_Drawing_PathRConicTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
1270     // error code
1271     OH_Drawing_PathRConicTo(nullptr, 100, 100, 100, 300, 5);
1272     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1273     // 3. Call OH_Drawing_PathRConicTo with 0.00 as the second parameter, no crash
1274     OH_Drawing_PathRConicTo(path, 0.00, 100, 100, 300, 5);
1275     // 4. Call OH_Drawing_PathRConicTo with 0.00 as the third parameter, no crash
1276     OH_Drawing_PathRConicTo(path, 100, 0.00, 100, 300, 5);
1277     // 5. Call OH_Drawing_PathRConicTo with 0.00 as the fourth parameter, no crash
1278     OH_Drawing_PathRConicTo(path, 100, 100, 0.00, 300, 5);
1279     // 6. Call OH_Drawing_PathRConicTo with 0.00 as the fifth parameter, no crash
1280     OH_Drawing_PathRConicTo(path, 100, 100, 100, 0.00, 5);
1281     // 7. Call OH_Drawing_PathRConicTo with 0.00 as the sixth parameter, no crash
1282     OH_Drawing_PathRConicTo(path, 100, 100, 100, 300, 0.00);
1283     // 8. Free memory by calling OH_Drawing_PathDestroy
1284     OH_Drawing_PathDestroy(path);
1285 }
1286 
1287 /*
1288  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1302
1289  * @tc.name: testPathRConicToAbnormal
1290  * @tc.desc: Test for adding a relative conic curve to a path with abnormal data types as parameters.
1291  * @tc.size  : SmallTest
1292  * @tc.type  : Function
1293  * @tc.level : Level 3
1294  */
1295 HWTEST_F(DrawingNativePathTest, testPathRConicToAbnormal, TestSize.Level3) {
1296     // 1. Create a path object by calling OH_Drawing_PathCreate
1297     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1298     // add assert
1299     EXPECT_NE(path, nullptr);
1300     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1301     OH_Drawing_PathMoveTo(path, 0, 0);
1302     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1303     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1304     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1305     OH_Drawing_PathRMoveTo(path, 100, 100);
1306     // 5. Call OH_Drawing_PathRConicTo with an integer as the second parameter
1307     OH_Drawing_PathRConicTo(path, 100, 100.0f, 100.0f, 300.0f, 5.0f);
1308     // 6. Call OH_Drawing_PathRConicTo with an integer as the third parameter
1309     OH_Drawing_PathRConicTo(path, 100.0f, 100, 100.0f, 300.0f, 5.0f);
1310     // 7. Call OH_Drawing_PathRConicTo with an integer as the fourth parameter
1311     OH_Drawing_PathRConicTo(path, 100.0f, 100.0f, 100, 300.0f, 5.0f);
1312     // 8. Call OH_Drawing_PathRConicTo with an integer as the fifth parameter
1313     OH_Drawing_PathRConicTo(path, 100.0f, 100.0f, 100.0f, 300, 5.0f);
1314     // 9. Call OH_Drawing_PathRConicTo with an integer as the sixth parameter
1315     OH_Drawing_PathRConicTo(path, 100.0f, 100.0f, 100.0f, 300.0f, 5);
1316     // 10. Free memory by calling OH_Drawing_PathDestroy
1317     OH_Drawing_PathDestroy(path);
1318 }
1319 
1320 /*
1321  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1303
1322  * @tc.name: testPathRConicToMaximal
1323  * @tc.desc: Test for adding a relative conic curve to a path with maximal values as parameters.
1324  * @tc.size  : SmallTest
1325  * @tc.type  : Function
1326  * @tc.level : Level 3
1327  */
1328 HWTEST_F(DrawingNativePathTest, testPathRConicToMaximal, TestSize.Level3) {
1329     // 1. Create a path object by calling OH_Drawing_PathCreate
1330     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1331     // add assert
1332     EXPECT_NE(path, nullptr);
1333     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1334     OH_Drawing_PathMoveTo(path, 0, 0);
1335     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1336     OH_Drawing_PathLineTo(path, 100, 100);
1337     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1338     OH_Drawing_PathRMoveTo(path, 100, 100);
1339     // 5. Call OH_Drawing_PathRConicTo with a second parameter of FLT_MAX + 1, no crash
1340     OH_Drawing_PathRConicTo(path, FLT_MAX + 1, 100, 100, 300, 5);
1341     // 6. Call OH_Drawing_PathRConicTo with a third parameter of FLT_MAX + 1, no crash
1342     OH_Drawing_PathRConicTo(path, 100, FLT_MAX + 1, 100, 300, 5);
1343     // 7. Call OH_Drawing_PathRConicTo with a fourth parameter of FLT_MAX + 1, no crash
1344     OH_Drawing_PathRConicTo(path, 100, 100, FLT_MAX + 1, 300, 5);
1345     // 8. Call OH_Drawing_PathRConicTo with a fifth parameter of FLT_MAX + 1, no crash
1346     OH_Drawing_PathRConicTo(path, 100, 100, 100, FLT_MAX + 1, 5);
1347     // 9. Call OH_Drawing_PathRConicTo with a sixth parameter of FLT_MAX + 1, no crash
1348     OH_Drawing_PathRConicTo(path, 100, 100, 100, 300, FLT_MAX + 1);
1349     // 10. Free memory by calling OH_Drawing_PathDestroy
1350     OH_Drawing_PathDestroy(path);
1351 }
1352 
1353 /*
1354  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1400
1355  * @tc.name: testPathRCubicToNormal
1356  * @tc.desc: Test for adding a relative cubic Bezier curve to a path with normal parameters.
1357  * @tc.size  : SmallTest
1358  * @tc.type  : Function
1359  * @tc.level : Level 0
1360  */
1361 HWTEST_F(DrawingNativePathTest, testPathRCubicToNormal, TestSize.Level0) {
1362     // 1. Create a path object by calling OH_Drawing_PathCreate
1363     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1364     // add assert
1365     EXPECT_NE(path, nullptr);
1366     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1367     OH_Drawing_PathMoveTo(path, 0, 0);
1368     // add assert
1369     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1370     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1371     OH_Drawing_PathLineTo(path, 100, 100);
1372     // add assert
1373     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1374     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1375     OH_Drawing_PathRMoveTo(path, 100, 100);
1376     // add assert
1377     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1378     // 5. Add a relative cubic Bezier curve to the path from the current endpoint to the target point by calling
1379     // OH_Drawing_PathRCubicTo
1380     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 200, 300, 300);
1381     // add assert
1382     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1383     // 6. Free memory by calling OH_Drawing_PathDestroy
1384     OH_Drawing_PathDestroy(path);
1385 }
1386 
1387 /*
1388  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1401
1389  * @tc.name: testPathRCubicToNull
1390  * @tc.desc: Test for adding a relative cubic Bezier curve to a path with NULL or invalid parameters.
1391  * @tc.size  : SmallTest
1392  * @tc.type  : Function
1393  * @tc.level : Level 3
1394  */
1395 HWTEST_F(DrawingNativePathTest, testPathRCubicToNull, TestSize.Level3) {
1396     // 1. Create a path object by calling OH_Drawing_PathCreate
1397     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1398     // add assert
1399     EXPECT_NE(path, nullptr);
1400     // 2. Call OH_Drawing_PathRCubicTo with nullptr as the first parameter, expecting OH_DRAWING_ERROR_INVALID_PARAMETER
1401     // error code
1402     OH_Drawing_PathRCubicTo(nullptr, 100, 100, 200, 200, 300, 300);
1403     // add assert
1404     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1405     // 3. Call OH_Drawing_PathRCubicTo with 0.00 as the second parameter, no crash
1406     OH_Drawing_PathRCubicTo(path, 0.00, 100, 200, 200, 300, 300);
1407     // 4. Call OH_Drawing_PathRCubicTo with 0.00 as the third parameter, no crash
1408     OH_Drawing_PathRCubicTo(path, 100, 0.00, 200, 200, 300, 300);
1409     // 5. Call OH_Drawing_PathRCubicTo with 0.00 as the fourth parameter, no crash
1410     OH_Drawing_PathRCubicTo(path, 100, 100, 0.00, 200, 300, 300);
1411     // 6. Call OH_Drawing_PathRCubicTo with 0.00 as the fifth parameter, no crash
1412     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 0.00, 300, 300);
1413     // 7. Call OH_Drawing_PathRCubicTo with 0.00 as the sixth parameter, no crash
1414     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 200, 0.00, 300);
1415     // 8. Call OH_Drawing_PathRCubicTo with 0.00 as the seventh parameter, no crash
1416     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 200, 300, 0.00);
1417     // 9. Free memory by calling OH_Drawing_PathDestroy
1418     OH_Drawing_PathDestroy(path);
1419 }
1420 
1421 /*
1422  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1402
1423  * @tc.name: testPathRCubicToAbnormal
1424  * @tc.desc: Test for adding a relative cubic Bezier curve to a path with abnormal data types as parameters.
1425  * @tc.size  : SmallTest
1426  * @tc.type  : Function
1427  * @tc.level : Level 3
1428  */
1429 HWTEST_F(DrawingNativePathTest, testPathRCubicToAbnormal, TestSize.Level3) {
1430     // 1. Create a path object by calling OH_Drawing_PathCreate
1431     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1432     // add assert
1433     EXPECT_NE(path, nullptr);
1434     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1435     OH_Drawing_PathMoveTo(path, 0, 0);
1436     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1437     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1438     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1439     OH_Drawing_PathRMoveTo(path, 100, 100);
1440     // 5. Call OH_Drawing_PathRCubicTo with an integer as the second parameter
1441     OH_Drawing_PathRCubicTo(path, 100, 100.0f, 200.0f, 200.0f, 300.0f, 300.0f);
1442     // 6. Call OH_Drawing_PathRCubicTo with an integer as the third parameter
1443     OH_Drawing_PathRCubicTo(path, 100.0f, 100, 200.0f, 200.0f, 300.0f, 300.0f);
1444     // 7. Call OH_Drawing_PathRCubicTo with an integer as the fourth parameter
1445     OH_Drawing_PathRCubicTo(path, 100.0f, 100.0f, 200, 200.0f, 300.0f, 300.0f);
1446     // 8. Call OH_Drawing_PathRCubicTo with an integer as the fifth parameter
1447     OH_Drawing_PathRCubicTo(path, 100.0f, 100.0f, 200.0f, 200, 300.0f, 300.0f);
1448     // 9. Call OH_Drawing_PathRCubicTo with an integer as the sixth parameter
1449     OH_Drawing_PathRCubicTo(path, 100.0f, 100.0f, 200.0f, 200.0f, 300, 300.0f);
1450     // 10. Call OH_Drawing_PathRCubicTo with an integer as the seventh parameter
1451     OH_Drawing_PathRCubicTo(path, 100.0f, 100.0f, 200.0f, 200.0f, 300.0f, 300);
1452     // 11. Free memory
1453     OH_Drawing_PathDestroy(path);
1454 }
1455 
1456 /*
1457  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1403
1458  * @tc.name: testPathRCubicToMaximal
1459  * @tc.desc: Test for adding a relative cubic Bezier curve to a path with maximal values as parameters.
1460  * @tc.size  : SmallTest
1461  * @tc.type  : Function
1462  * @tc.level : Level 3
1463  */
1464 HWTEST_F(DrawingNativePathTest, testPathRCubicToMaximal, TestSize.Level3) {
1465     // 1. Create a path object by calling OH_Drawing_PathCreate
1466     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1467     // add assert
1468     EXPECT_NE(path, nullptr);
1469     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1470     OH_Drawing_PathMoveTo(path, 0, 0);
1471     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1472     OH_Drawing_PathLineTo(path, 100, 100);
1473     // 4. Set a relative move to the path starting from the current endpoint by calling OH_Drawing_PathRMoveTo
1474     OH_Drawing_PathRMoveTo(path, 100, 100);
1475     // 5. Call OH_Drawing_PathRCubicTo with the second parameter as the maximum value FLT_MAX+1, no crash
1476     OH_Drawing_PathRCubicTo(path, FLT_MAX + 1, 100, 200, 200, 300, 300);
1477     // 6. Call OH_Drawing_PathRCubicTo with the third parameter as the maximum value FLT_MAX+1, no crash
1478     OH_Drawing_PathRCubicTo(path, 100, FLT_MAX + 1, 200, 200, 300, 300);
1479     // 7. Call OH_Drawing_PathRCubicTo with the fourth parameter as the maximum value FLT_MAX+1, no crash
1480     OH_Drawing_PathRCubicTo(path, 100, 100, FLT_MAX + 1, 200, 300, 300);
1481     // 8. Call OH_Drawing_PathRCubicTo with the fifth parameter as the maximum value FLT_MAX+1, no crash
1482     OH_Drawing_PathRCubicTo(path, 100, 100, 200, FLT_MAX + 1, 300, 300);
1483     // 9. Call OH_Drawing_PathRCubicTo with the sixth parameter as the maximum value FLT_MAX+1, no crash
1484     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 200, FLT_MAX + 1, 300);
1485     // 10. Call OH_Drawing_PathRCubicTo with the seventh parameter as the maximum value FLT_MAX+1, no crash
1486     OH_Drawing_PathRCubicTo(path, 100, 100, 200, 200, 300, FLT_MAX + 1);
1487     // 11. Free memory
1488     OH_Drawing_PathDestroy(path);
1489 }
1490 
1491 /*
1492  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1500
1493  * @tc.name: testPathAddRectNormal
1494  * @tc.desc: Test for adding a rectangle to a path with normal parameters.
1495  * @tc.size  : SmallTest
1496  * @tc.type  : Function
1497  * @tc.level : Level 0
1498  */
1499 HWTEST_F(DrawingNativePathTest, testPathAddRectNormal, TestSize.Level0) {
1500     // 1. Create a path object by calling OH_Drawing_PathCreate
1501     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1502     // add assert
1503     EXPECT_NE(path, nullptr);
1504     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1505     OH_Drawing_PathMoveTo(path, 0, 0);
1506     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1507     OH_Drawing_PathLineTo(path, 100, 100);
1508     // 4. Add a rectangle outline to the path with the specified direction by calling OH_Drawing_PathAddRect. Iterate
1509     // through the enum to call this interface.
1510     OH_Drawing_PathAddRect(path, 100, 100, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1511     // add assert
1512     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1513     // 5. Free memory
1514     OH_Drawing_PathDestroy(path);
1515 }
1516 
1517 /*
1518  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1501
1519  * @tc.name: testPathAddRectNull
1520  * @tc.desc: Test for adding a rectangle to a path with NULL or invalid parameters.
1521  * @tc.size  : SmallTest
1522  * @tc.type  : Function
1523  * @tc.level : Level 3
1524  */
1525 HWTEST_F(DrawingNativePathTest, testPathAddRectNull, TestSize.Level3) {
1526     // 1. Create a path object by calling OH_Drawing_PathCreate
1527     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1528     // add assert
1529     EXPECT_NE(path, nullptr);
1530     // 2. Call OH_Drawing_PathAddRect with the first parameter as nullptr, expect OH_DRAWING_ERROR_INVALID_PARAMETER
1531     OH_Drawing_PathAddRect(nullptr, 100, 100, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1532     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1533     // 3. Call OH_Drawing_PathAddRect with 0.00 as the second parameter, no crash
1534     OH_Drawing_PathAddRect(path, 0.00, 100, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1535     // 4. Call OH_Drawing_PathAddRect with 0.00 as the third parameter, no crash
1536     OH_Drawing_PathAddRect(path, 100, 0.00, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1537     // 5. Call OH_Drawing_PathAddRect with 0.00 as the fourth parameter, no crash
1538     OH_Drawing_PathAddRect(path, 100, 100, 0.00, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1539     // 6. Call OH_Drawing_PathAddRect with 0.00 as the fifth parameter, no crash
1540     OH_Drawing_PathAddRect(path, 100, 100, 200, 0.00, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1541     // 7. Free memory
1542     OH_Drawing_PathDestroy(path);
1543 }
1544 
1545 /*
1546  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1502
1547  * @tc.name: testPathAddRectAbnormal
1548  * @tc.desc: Test for adding a rectangle to a path with abnormal data types as parameters.
1549  * @tc.size  : SmallTest
1550  * @tc.type  : Function
1551  * @tc.level : Level 3
1552  */
1553 HWTEST_F(DrawingNativePathTest, testPathAddRectAbnormal, TestSize.Level3) {
1554     // 1. Create a path object by calling OH_Drawing_PathCreate
1555     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1556     // add assert
1557     EXPECT_NE(path, nullptr);
1558     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1559     OH_Drawing_PathMoveTo(path, 0, 0);
1560     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1561     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1562     // 4. Call OH_Drawing_PathAddRect with an integer as the second parameter
1563     OH_Drawing_PathAddRect(path, 100, 100.0f, 200.0f, 200.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1564     // 5. Call OH_Drawing_PathAddRect with an integer as the third parameter
1565     OH_Drawing_PathAddRect(path, 100.0f, 100, 200.0f, 200.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1566     // 6. Call OH_Drawing_PathAddRect with an integer as the fourth parameter
1567     OH_Drawing_PathAddRect(path, 100.0f, 100.0f, 200, 200.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1568     // 7. Call OH_Drawing_PathAddRect with an integer as the fifth parameter
1569     OH_Drawing_PathAddRect(path, 100.0f, 100.0f, 200.0f, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1570     // 8. Free memory
1571     OH_Drawing_PathDestroy(path);
1572 }
1573 
1574 /*
1575  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1503
1576  * @tc.name: testPathAddRectMaximal
1577  * @tc.desc: Test for adding a rectangle to a path with maximal values as parameters.
1578  * @tc.size  : SmallTest
1579  * @tc.type  : Function
1580  * @tc.level : Level 3
1581  */
1582 HWTEST_F(DrawingNativePathTest, testPathAddRectMaximal, TestSize.Level3) {
1583     // 1. Create a path object by calling OH_Drawing_PathCreate
1584     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1585     // add assert
1586     EXPECT_NE(path, nullptr);
1587     // 2. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1588     OH_Drawing_PathMoveTo(path, 0, 0);
1589     // 3. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1590     OH_Drawing_PathLineTo(path, 100, 100);
1591     // 4. Call OH_Drawing_PathAddRect with the second parameter as the maximum value FLT_MAX+1, no crash
1592     OH_Drawing_PathAddRect(path, FLT_MAX + 1, 100, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1593     // 5. Call OH_Drawing_PathAddRect with the third parameter as the maximum value FLT_MAX+1, no crash
1594     OH_Drawing_PathAddRect(path, 100, FLT_MAX + 1, 200, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1595     // 6. Call OH_Drawing_PathAddRect with the fourth parameter as the maximum value FLT_MAX+1, no crash
1596     OH_Drawing_PathAddRect(path, 100, 100, FLT_MAX + 1, 200, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1597     // 7. Call OH_Drawing_PathAddRect with the fifth parameter as the maximum value FLT_MAX+1, no crash
1598     OH_Drawing_PathAddRect(path, 100, 100, 200, FLT_MAX + 1, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1599     // 8. Free memory
1600     OH_Drawing_PathDestroy(path);
1601 }
1602 
1603 /*
1604  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1600
1605  * @tc.name: testPathAddRectWithInitialCornerNormal
1606  * @tc.desc: Test for adding a rectangle to a path with initial corner and normal parameters.
1607  * @tc.size  : SmallTest
1608  * @tc.type  : Function
1609  * @tc.level : Level 0
1610  */
1611 HWTEST_F(DrawingNativePathTest, testPathAddRectWithInitialCornerNormal, TestSize.Level0) {
1612     // 1. Create a path object by calling OH_Drawing_PathCreate
1613     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1614     // add assert
1615     EXPECT_NE(path, nullptr);
1616     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1617     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1618     // add assert
1619     EXPECT_NE(rect, nullptr);
1620     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1621     OH_Drawing_PathMoveTo(path, 0, 0);
1622     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1623     OH_Drawing_PathLineTo(path, 100, 100);
1624     // 5. Add a rectangle outline to the path with the specified direction by calling
1625     // OH_Drawing_PathAddRectWithInitialCorner. Iterate through the enum to call this interface.
1626     OH_Drawing_PathAddRectWithInitialCorner(path, rect, OH_Drawing_PathDirection::PATH_DIRECTION_CW, 0);
1627     // add assert
1628     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1629     // 6. Free memory
1630     OH_Drawing_PathDestroy(path);
1631     OH_Drawing_RectDestroy(rect);
1632 }
1633 
1634 /*
1635  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1601
1636  * @tc.name: testPathAddRectWithInitialCornerNull
1637  * @tc.desc: Test for adding a rectangle to a path with initial corner and NULL or invalid parameters.
1638  * @tc.size  : SmallTest
1639  * @tc.type  : Function
1640  * @tc.level : Level 3
1641  */
1642 HWTEST_F(DrawingNativePathTest, testPathAddRectWithInitialCornerNull, TestSize.Level3) {
1643     // 1. Create a path object by calling OH_Drawing_PathCreate
1644     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1645     // add assert
1646     EXPECT_NE(path, nullptr);
1647     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1648     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1649     // add assert
1650     EXPECT_NE(rect, nullptr);
1651     // 3. Call OH_Drawing_PathAddRectWithInitialCorner with the first parameter as nullptr, expect
1652     // OH_DRAWING_ERROR_INVALID_PARAMETER
1653     OH_Drawing_PathAddRectWithInitialCorner(nullptr, rect, OH_Drawing_PathDirection::PATH_DIRECTION_CW, 0);
1654     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1655     OH_Drawing_ErrorCodeReset();
1656     // 4. Call OH_Drawing_PathAddRectWithInitialCorner with the second parameter as nullptr, expect
1657     // OH_DRAWING_ERROR_INVALID_PARAMETER
1658     OH_Drawing_PathAddRectWithInitialCorner(path, nullptr, OH_Drawing_PathDirection::PATH_DIRECTION_CW, 0);
1659     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1660     // 5. Call OH_Drawing_PathAddRectWithInitialCorner with the fourth parameter as 0
1661     OH_Drawing_PathAddRectWithInitialCorner(path, rect, OH_Drawing_PathDirection::PATH_DIRECTION_CW, 0);
1662     // 6. Free memory
1663     OH_Drawing_PathDestroy(path);
1664     OH_Drawing_RectDestroy(rect);
1665 }
1666 
1667 /*
1668  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1602
1669  * @tc.name: testPathAddRectWithInitialCornerAbnormal
1670  * @tc.desc: Test for adding a rectangle to a path with initial corner and abnormal data types as parameters.
1671  * @tc.size  : SmallTest
1672  * @tc.type  : Function
1673  * @tc.level : Level 3
1674  */
1675 HWTEST_F(DrawingNativePathTest, testPathAddRectWithInitialCornerAbnormal, TestSize.Level3) {
1676     // 1. Create a path object by calling OH_Drawing_PathCreate
1677     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1678     // add assert
1679     EXPECT_NE(path, nullptr);
1680     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1681     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1682     // add assert
1683     EXPECT_NE(rect, nullptr);
1684     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1685     OH_Drawing_PathMoveTo(path, 0, 0);
1686     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1687     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1688     // 5. Call OH_Drawing_PathAddRectWithInitialCorner with the fourth parameter as a float or a character
1689     OH_Drawing_PathAddRectWithInitialCorner(path, rect, OH_Drawing_PathDirection::PATH_DIRECTION_CW, 5.0f);
1690     // 6. Free memory
1691     OH_Drawing_PathDestroy(path);
1692     OH_Drawing_RectDestroy(rect);
1693 }
1694 
1695 /*
1696  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1603
1697  * @tc.name: testPathAddRectWithInitialCornerMaximal
1698  * @tc.desc: Test for adding a rectangle to a path with initial corner and maximal values as parameters.
1699  * @tc.size  : SmallTest
1700  * @tc.type  : Function
1701  * @tc.level : Level 3
1702  */
1703 HWTEST_F(DrawingNativePathTest, testPathAddRectWithInitialCornerMaximal, TestSize.Level3) {
1704     // 1. Create a path object by calling OH_Drawing_PathCreate
1705     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1706     // add assert
1707     EXPECT_NE(path, nullptr);
1708     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1709     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1710     // add assert
1711     EXPECT_NE(rect, nullptr);
1712     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1713     OH_Drawing_PathMoveTo(path, 0, 0);
1714     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1715     OH_Drawing_PathLineTo(path, 100, 100);
1716     // 5. Call OH_Drawing_PathAddRectWithInitialCorner with the fourth parameter as the maximum value INT32_MAX, no
1717     // crash
1718     OH_Drawing_PathAddRectWithInitialCorner(path, rect, OH_Drawing_PathDirection::PATH_DIRECTION_CW, INT32_MAX);
1719     // 6. Free memory
1720     OH_Drawing_PathDestroy(path);
1721 }
1722 
1723 /*
1724  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1700
1725  * @tc.name: testPathAddRoundRectNormal
1726  * @tc.desc: Test for adding a round rectangle to a path with normal parameters.
1727  * @tc.size  : SmallTest
1728  * @tc.type  : Function
1729  * @tc.level : Level 0
1730  */
1731 HWTEST_F(DrawingNativePathTest, testPathAddRoundRectNormal, TestSize.Level0) {
1732     // 1. Create a path object by calling OH_Drawing_PathCreate
1733     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1734     // add assert
1735     EXPECT_NE(path, nullptr);
1736     // 2. Create a rounded rectangle object by calling OH_Drawing_RoundRectCreate
1737     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1738     // add assert
1739     EXPECT_NE(rect, nullptr);
1740     OH_Drawing_RoundRect *roundRect = OH_Drawing_RoundRectCreate(rect, 20, 20);
1741     // add assert
1742     EXPECT_NE(roundRect, nullptr);
1743     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1744     OH_Drawing_PathMoveTo(path, 0, 0);
1745     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1746     OH_Drawing_PathLineTo(path, 100, 100);
1747     // 5. Add the rounded rectangle outline to the path with the specified direction by calling
1748     // OH_Drawing_PathAddRoundRect. Iterate through the enum to call this interface.
1749     OH_Drawing_PathDirection directions[] = {
1750         PATH_DIRECTION_CW,
1751         PATH_DIRECTION_CCW,
1752     };
1753     for (int i = 0; i < sizeof(directions) / sizeof(directions[0]); i++) {
1754         OH_Drawing_ErrorCodeReset();
1755         OH_Drawing_PathAddRoundRect(path, roundRect, directions[i]);
1756         // add assert
1757         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1758     }
1759     // 6. Free memory
1760     OH_Drawing_PathDestroy(path);
1761     OH_Drawing_RoundRectDestroy(roundRect);
1762     OH_Drawing_RectDestroy(rect);
1763 }
1764 
1765 /*
1766  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1701
1767  * @tc.name: testPathAddRoundRectNull
1768  * @tc.desc: Test for adding a round rectangle to a path with NULL or invalid parameters.
1769  * @tc.size  : SmallTest
1770  * @tc.type  : Function
1771  * @tc.level : Level 3
1772  */
1773 HWTEST_F(DrawingNativePathTest, testPathAddRoundRectNull, TestSize.Level3) {
1774     // 1. Create a path object by calling OH_Drawing_PathCreate
1775     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1776     // add assert
1777     EXPECT_NE(path, nullptr);
1778     // 2. Create a rounded rectangle object by calling OH_Drawing_RoundRectCreate
1779     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1780     // add assert
1781     EXPECT_NE(rect, nullptr);
1782     OH_Drawing_RoundRect *roundRect = OH_Drawing_RoundRectCreate(rect, 20, 20);
1783     // add assert
1784     EXPECT_NE(roundRect, nullptr);
1785     // 3. Call OH_Drawing_PathAddRoundRect with the first parameter as nullptr, expect
1786     // OH_DRAWING_ERROR_INVALID_PARAMETER
1787     OH_Drawing_PathAddRoundRect(nullptr, roundRect, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1788     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1789     OH_Drawing_ErrorCodeReset();
1790     // 4. Call OH_Drawing_PathAddRoundRect with the second parameter as nullptr, expect
1791     // OH_DRAWING_ERROR_INVALID_PARAMETER
1792     OH_Drawing_PathAddRoundRect(path, nullptr, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1793     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1794     // 5. Free memory
1795     OH_Drawing_PathDestroy(path);
1796     OH_Drawing_RoundRectDestroy(roundRect);
1797     OH_Drawing_RectDestroy(rect);
1798 }
1799 
1800 /*
1801  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1800
1802  * @tc.name: testPathAddOvalWithInitialPointNormal
1803  * @tc.desc: Test for adding an oval to a path with initial point and normal parameters.
1804  * @tc.size  : SmallTest
1805  * @tc.type  : Function
1806  * @tc.level : Level 0
1807  */
1808 HWTEST_F(DrawingNativePathTest, testPathAddOvalWithInitialPointNormal, TestSize.Level0) {
1809     // 1. Create a path object by calling OH_Drawing_PathCreate
1810     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1811     // add assert
1812     EXPECT_NE(path, nullptr);
1813     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1814     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1815     // add assert
1816     EXPECT_NE(rect, nullptr);
1817     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1818     OH_Drawing_PathMoveTo(path, 0, 0);
1819     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1820     OH_Drawing_PathLineTo(path, 100, 100);
1821     // 5. Add an oval to the path, where the rectangle object is the bounding rectangle of the oval. Iterate through the
1822     // enum to call this interface.
1823     OH_Drawing_PathDirection directions[] = {
1824         PATH_DIRECTION_CW,
1825         PATH_DIRECTION_CCW,
1826     };
1827     for (int i = 0; i < sizeof(directions) / sizeof(directions[0]); i++) {
1828         OH_Drawing_ErrorCodeReset();
1829         OH_Drawing_PathAddOvalWithInitialPoint(path, rect, 10, directions[i]);
1830         // add assert
1831         EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
1832     }
1833     // 6. Free memory
1834     OH_Drawing_PathDestroy(path);
1835     OH_Drawing_RectDestroy(rect);
1836 }
1837 
1838 /*
1839  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1801
1840  * @tc.name: testPathAddOvalWithInitialPointNull
1841  * @tc.desc: Test for adding an oval to a path with initial point and NULL or invalid parameters.
1842  * @tc.size  : SmallTest
1843  * @tc.type  : Function
1844  * @tc.level : Level 3
1845  */
1846 HWTEST_F(DrawingNativePathTest, testPathAddOvalWithInitialPointNull, TestSize.Level3) {
1847     // 1. Create a path object by calling OH_Drawing_PathCreate
1848     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1849     // add assert
1850     EXPECT_NE(path, nullptr);
1851     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1852     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1853     // add assert
1854     EXPECT_NE(rect, nullptr);
1855     // 3. Call OH_Drawing_PathAddOvalWithInitialPoint with the first parameter as nullptr, expect
1856     // OH_DRAWING_ERROR_INVALID_PARAMETER
1857     OH_Drawing_PathAddOvalWithInitialPoint(nullptr, rect, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1858     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1859     OH_Drawing_ErrorCodeReset();
1860     // 4. Call OH_Drawing_PathAddOvalWithInitialPoint with the second parameter as nullptr, expect
1861     // OH_DRAWING_ERROR_INVALID_PARAMETER
1862     OH_Drawing_PathAddOvalWithInitialPoint(path, nullptr, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1863     EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
1864     // 5. Call OH_Drawing_PathAddOvalWithInitialPoint with the third parameter as 0, no crash
1865     OH_Drawing_PathAddOvalWithInitialPoint(path, rect, 0, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1866     // 6. Free memory
1867     OH_Drawing_PathDestroy(path);
1868     OH_Drawing_RectDestroy(rect);
1869 }
1870 
1871 /*
1872  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1802
1873  * @tc.name: testPathAddOvalWithInitialPointAbnormal
1874  * @tc.desc: Test for adding an oval to a path with initial point and abnormal data types as parameters.
1875  * @tc.size  : SmallTest
1876  * @tc.type  : Function
1877  * @tc.level : Level 3
1878  */
1879 HWTEST_F(DrawingNativePathTest, testPathAddOvalWithInitialPointAbnormal, TestSize.Level3) {
1880     // 1. Create a path object by calling OH_Drawing_PathCreate
1881     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1882     // add assert
1883     EXPECT_NE(path, nullptr);
1884     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1885     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1886     // add assert
1887     EXPECT_NE(rect, nullptr);
1888     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1889     OH_Drawing_PathMoveTo(path, 0, 0);
1890     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1891     OH_Drawing_PathLineTo(path, 100.0f, 100.0f);
1892     // 5. Call OH_Drawing_PathAddOvalWithInitialPoint with the third parameter as a float or a character
1893     OH_Drawing_PathAddOvalWithInitialPoint(path, rect, 5.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1894     // 6. Free memory
1895     OH_Drawing_PathDestroy(path);
1896     OH_Drawing_RectDestroy(rect);
1897 }
1898 
1899 /*
1900  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PATH_1803
1901  * @tc.name: testPathAddOvalWithInitialPointMaximal
1902  * @tc.desc: Test for adding an oval to a path with initial point and maximal values as parameters.
1903  * @tc.size  : SmallTest
1904  * @tc.type  : Function
1905  * @tc.level : Level 3
1906  */
1907 HWTEST_F(DrawingNativePathTest, testPathAddOvalWithInitialPointMaximal, TestSize.Level3) {
1908     // 1. Create a path object by calling OH_Drawing_PathCreate
1909     OH_Drawing_Path *path = OH_Drawing_PathCreate();
1910     // add assert
1911     EXPECT_NE(path, nullptr);
1912     // 2. Create a rectangle object by calling OH_Drawing_RectCreate
1913     OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
1914     // add assert
1915     EXPECT_NE(rect, nullptr);
1916     // 3. Set the starting point of the path by calling OH_Drawing_PathMoveTo
1917     OH_Drawing_PathMoveTo(path, 0, 0);
1918     // 4. Add a line segment from the starting point of the path to the target point by calling OH_Drawing_PathLineTo
1919     OH_Drawing_PathLineTo(path, 100, 100);
1920     // 5. Call OH_Drawing_PathAddOvalWithInitialPoint with the third parameter as the maximum value UINT32_MAX + 1, no
1921     // crash
1922     OH_Drawing_PathAddOvalWithInitialPoint(path, rect, UINT32_MAX + 1, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
1923     // 6. Free memory
1924     OH_Drawing_PathDestroy(path);
1925     OH_Drawing_RectDestroy(rect);
1926 }
1927 
1928 } // namespace Drawing
1929 } // namespace Rosen
1930 } // namespace OHOS