Lines Matching refs:path

42  * @tc.desc: Test for adding an arc to a path with normal parameters.
48 // 1. Create a path object using OH_Drawing_PathCreate.
49 OH_Drawing_Path *path = OH_Drawing_PathCreate();
52 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
53 OH_Drawing_PathMoveTo(path, 0, 0);
55 OH_Drawing_PathLineTo(path, 100, 100);
56 // 5. Add an arc to the path using OH_Drawing_PathAddArc, which serves as the starting point of the new contour.
57 OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
59 OH_Drawing_PathDestroy(path);
66 * @tc.desc: Test for adding an arc to a path with NULL or invalid parameters.
72 // 1. Create a path object using OH_Drawing_PathCreate.
73 OH_Drawing_Path *path = OH_Drawing_PathCreate();
82 OH_Drawing_PathAddArc(path, nullptr, 0.0, 0.0);
85 OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
87 OH_Drawing_PathAddArc(path, rect, 0.0, 0.0);
89 OH_Drawing_PathDestroy(path);
96 * @tc.desc: Test for adding an arc to a path with abnormal data types as parameters.
102 // 1. Create a path object using OH_Drawing_PathCreate.
103 OH_Drawing_Path *path = OH_Drawing_PathCreate();
106 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
107 OH_Drawing_PathMoveTo(path, 0, 0);
109 OH_Drawing_PathLineTo(path, 100, 100);
110 // 5. Add an arc to the path using OH_Drawing_PathAddArc, passing an integer or character type as the third
112 OH_Drawing_PathAddArc(path, rect, 30, 30.0f);
113 // 6. Add an arc to the path using OH_Drawing_PathAddArc, passing an integer or character type as the fourth
115 OH_Drawing_PathAddArc(path, rect, 30.0f, 30);
117 OH_Drawing_PathDestroy(path);
123 * @tc.desc: Test for adding an arc to a path with maximal values as parameters.
129 // 1. Create a path object using OH_Drawing_PathCreate.
130 OH_Drawing_Path *path = OH_Drawing_PathCreate();
133 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
134 OH_Drawing_PathMoveTo(path, 0, 0);
136 OH_Drawing_PathLineTo(path, 100, 100);
137 // 5. Add an arc to the path using OH_Drawing_PathAddArc, passing FLT_MAX + 1 as the third parameter, which will
139 OH_Drawing_PathAddArc(path, rect, FLT_MAX + 1, 0.0);
140 // 6. Add an arc to the path using OH_Drawing_PathAddArc, passing FLT_MAX + 1 as the fourth parameter, which will
142 OH_Drawing_PathAddArc(path, rect, 0.0, FLT_MAX + 1);
144 OH_Drawing_PathDestroy(path);
151 * @tc.desc: Test for adding a path to another path with normal parameters.
157 // 1. Create a path object using OH_Drawing_PathCreate.
158 OH_Drawing_Path *path = OH_Drawing_PathCreate();
159 // 2. Create a path object using OH_Drawing_PathCreate.
161 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
164 // path src).
166 // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPath.
167 OH_Drawing_PathAddPath(path, src, nullptr);
169 OH_Drawing_PathDestroy(path);
176 * @tc.desc: Test for adding a path to another path with NULL or invalid parameters.
182 // 1. Create a path object using OH_Drawing_PathCreate.
183 OH_Drawing_Path *path = OH_Drawing_PathCreate();
184 // 2. Create a path object using OH_Drawing_PathCreate.
194 OH_Drawing_PathAddPath(path, nullptr, matrix);
197 OH_Drawing_PathAddPath(path, src, nullptr);
199 OH_Drawing_PathDestroy(path);
207 * @tc.desc: Test for adding a path to another path with matrix and mode transformations using normal parameters.
213 // 1. Create a path object using OH_Drawing_PathCreate.
214 OH_Drawing_Path *path = OH_Drawing_PathCreate();
215 // 2. Create a path object using OH_Drawing_PathCreate.
217 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
220 // path src).
222 // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPathWithMatrixAndMode. The fourth
228 OH_Drawing_PathAddPathWithMatrixAndMode(path, src, matrix, modes[i]);
232 OH_Drawing_PathDestroy(path);
239 * @tc.desc: Test for adding a path to another path with matrix and mode transformations using NULL or invalid
246 // 1. Create a path object using OH_Drawing_PathCreate.
247 OH_Drawing_Path *path = OH_Drawing_PathCreate();
248 // 2. Create a path object using OH_Drawing_PathCreate.
258 OH_Drawing_PathAddPathWithMatrixAndMode(path, nullptr, matrix, PATH_ADD_MODE_APPEND);
262 OH_Drawing_PathAddPathWithMatrixAndMode(path, src, nullptr, PATH_ADD_MODE_APPEND);
264 OH_Drawing_PathDestroy(path);
272 * @tc.desc: Test for adding a path to another path with mode transformations using normal parameters.
278 // 1. Create a path object using OH_Drawing_PathCreate.
279 OH_Drawing_Path *path = OH_Drawing_PathCreate();
280 // 2. Create a path object using OH_Drawing_PathCreate.
282 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
285 // path src).
287 // 5. Add the source path to the current path using OH_Drawing_PathAddPathWithMode. The third parameter enumerates
291 OH_Drawing_PathAddPathWithMode(path, src, modes[i]);
294 OH_Drawing_PathDestroy(path);
300 * @tc.desc: Test for adding a path to another path with mode transformations using NULL or invalid parameters.
306 // 1. Create a path object using OH_Drawing_PathCreate.
307 OH_Drawing_Path *path = OH_Drawing_PathCreate();
308 // 2. Create a path object using OH_Drawing_PathCreate.
316 OH_Drawing_PathAddPathWithMode(path, nullptr, PATH_ADD_MODE_APPEND);
319 OH_Drawing_PathDestroy(path);
326 * @tc.desc: Test for adding a path to another path with offset and mode transformations using normal parameters.
332 // 1. Create a path object using OH_Drawing_PathCreate.
333 OH_Drawing_Path *path = OH_Drawing_PathCreate();
334 // 2. Create a path object using OH_Drawing_PathCreate.
336 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
339 // path src).
341 // 5. Add the transformed source path to the current path using OH_Drawing_PathAddPathWithOffsetAndMode. The fifth
345 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0, 10.0, modes[i]);
348 OH_Drawing_PathDestroy(path);
355 * @tc.desc: Test for adding a path to another path with offset and mode transformations using NULL or invalid
362 // 1. Create a path object using OH_Drawing_PathCreate.
363 OH_Drawing_Path *path = OH_Drawing_PathCreate();
364 // 2. Create a path object using OH_Drawing_PathCreate.
372 OH_Drawing_PathAddPathWithOffsetAndMode(path, nullptr, 10.0, 10.0, PATH_ADD_MODE_APPEND);
376 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 0.0, 10.0, PATH_ADD_MODE_APPEND);
379 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0, 0.0, PATH_ADD_MODE_APPEND);
381 OH_Drawing_PathDestroy(path);
388 * @tc.desc: Test for adding a path to another path with offset and mode transformations using abnormal parameters.
394 // 1. Create a path object using OH_Drawing_PathCreate.
395 OH_Drawing_Path *path = OH_Drawing_PathCreate();
396 // 2. Create a path object using OH_Drawing_PathCreate.
398 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
401 // path src).
405 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10, 10.0f, PATH_ADD_MODE_APPEND);
408 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0f, 10, PATH_ADD_MODE_APPEND);
410 OH_Drawing_PathDestroy(path);
417 * @tc.desc: Test for adding a path to another path with offset and mode transformations using maximal values.
423 // 1. Create a path object using OH_Drawing_PathCreate.
424 OH_Drawing_Path *path = OH_Drawing_PathCreate();
425 // 2. Create a path object using OH_Drawing_PathCreate.
427 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
430 // path src).
433 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, FLT_MAX + 1, 10.0f, PATH_ADD_MODE_APPEND);
435 OH_Drawing_PathAddPathWithOffsetAndMode(path, src, 10.0f, FLT_MAX + 1, PATH_ADD_MODE_APPEND);
437 OH_Drawing_PathDestroy(path);
443 * @tc.desc: Test for adding an oval to a path using normal parameters.
449 // 1. Create a path object using OH_Drawing_PathCreate.
450 OH_Drawing_Path *path = OH_Drawing_PathCreate();
453 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
454 OH_Drawing_PathMoveTo(path, 0, 0);
456 OH_Drawing_PathLineTo(path, 100, 100);
457 // 5. Add an oval to the path with the specified direction using OH_Drawing_PathAddOval. The third parameter
461 OH_Drawing_PathAddOval(path, rect, directions[i]);
464 OH_Drawing_PathDestroy(path);
471 * @tc.desc: Test for adding an oval to a path using NULL or invalid parameters.
477 // 1. Create a path object using OH_Drawing_PathCreate.
478 OH_Drawing_Path *path = OH_Drawing_PathCreate();
487 OH_Drawing_PathAddOval(path, nullptr, PATH_DIRECTION_CW);
490 OH_Drawing_PathDestroy(path);
497 * @tc.desc: Test for adding a polygon to a path with the fourth parameter set to true.
503 // 1. Create a path object using OH_Drawing_PathCreate.
504 OH_Drawing_Path *path = OH_Drawing_PathCreate();
505 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
506 OH_Drawing_PathMoveTo(path, 0, 0);
508 OH_Drawing_PathLineTo(path, 100, 100);
510 OH_Drawing_PathLineTo(path, 100, 0);
511 // 5. Add a polygon to the path. Set the fourth parameter to true.
517 OH_Drawing_PathAddPolygon(path, points, 4, true);
519 OH_Drawing_PathDestroy(path);
525 * @tc.desc: Test for adding a polygon to a path with the fourth parameter set to false.
531 // 1. Create a path object using OH_Drawing_PathCreate.
532 OH_Drawing_Path *path = OH_Drawing_PathCreate();
533 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
534 OH_Drawing_PathMoveTo(path, 0, 0);
536 OH_Drawing_PathLineTo(path, 100, 100);
538 OH_Drawing_PathLineTo(path, 100, 0);
539 // 5. Add a polygon to the path. Set the fourth parameter to false.
545 OH_Drawing_PathAddPolygon(path, points, 4, false);
547 OH_Drawing_PathDestroy(path);
553 * @tc.desc: Test for adding a polygon to a path using NULL or invalid parameters.
559 // 1. Create a path object using OH_Drawing_PathCreate.
560 OH_Drawing_Path *path = OH_Drawing_PathCreate();
572 OH_Drawing_PathAddPolygon(path, nullptr, 4, true);
576 OH_Drawing_PathAddPolygon(path, points, 0, true);
579 OH_Drawing_PathDestroy(path);
585 * @tc.desc: Test for adding a polygon to a path using abnormal parameters.
591 // 1. Create a path object using OH_Drawing_PathCreate.
592 OH_Drawing_Path *path = OH_Drawing_PathCreate();
593 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
594 OH_Drawing_PathMoveTo(path, 0, 0);
596 OH_Drawing_PathLineTo(path, 100, 100);
597 // 4. Add a polygon to the path with the second parameter's x-coordinate as an integer or character type, which will
604 OH_Drawing_PathAddPolygon(path, points, 4, true);
605 // 5. Add a polygon to the path with the second parameter's y-coordinate as an integer or character type, which will
607 OH_Drawing_PathAddPolygon(path, points, 4, true);
608 // 6. Add a polygon to the path with the third parameter as a float or character type, which will succeed.
609 OH_Drawing_PathAddPolygon(path, points, 4.0f, true);
611 OH_Drawing_PathDestroy(path);
617 * @tc.desc: Test for adding a polygon to a path using maximal values.
623 // 1. Create a path object using OH_Drawing_PathCreate.
624 OH_Drawing_Path *path = OH_Drawing_PathCreate();
625 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
626 OH_Drawing_PathMoveTo(path, 0, 0);
628 OH_Drawing_PathLineTo(path, 100, 100);
629 // 4. Add a polygon to the path with the second parameter's x-coordinate set to FLT_MAX + 1, no crash occurs.
635 OH_Drawing_PathAddPolygon(path, points, 4, true);
636 // 5. Add a polygon to the path with the second parameter's y-coordinate set to FLT_MAX + 1, no crash occurs.
642 OH_Drawing_PathAddPolygon(path, points2, 4, true);
644 OH_Drawing_PathDestroy(path);
650 * @tc.desc: Test for adding a circle to a path using normal parameters.
656 // 1. Create a path object using OH_Drawing_PathCreate.
657 OH_Drawing_Path *path = OH_Drawing_PathCreate();
658 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
659 OH_Drawing_PathMoveTo(path, 0, 0);
661 OH_Drawing_PathLineTo(path, 100, 100);
662 // 4. Add a circle to the path with the specified direction.
663 OH_Drawing_PathAddCircle(path, 50, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
664 OH_Drawing_PathAddCircle(path, 50, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CW);
666 OH_Drawing_PathDestroy(path);
672 * @tc.desc: Test for adding a circle to a path using NULL or invalid parameters.
678 // 1. Create a path object using OH_Drawing_PathCreate.
679 OH_Drawing_Path *path = OH_Drawing_PathCreate();
685 OH_Drawing_PathAddCircle(path, 0.00, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
687 OH_Drawing_PathAddCircle(path, 50, 0.00, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
690 OH_Drawing_PathAddCircle(path, 50, 50, 0.00, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
693 OH_Drawing_PathDestroy(path);
699 * @tc.desc: Test for adding a circle to a path using abnormal parameters.
705 // 1. Create a path object using OH_Drawing_PathCreate.
706 OH_Drawing_Path *path = OH_Drawing_PathCreate();
707 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
708 OH_Drawing_PathMoveTo(path, 0, 0);
710 OH_Drawing_PathLineTo(path, 100, 100);
711 // 4. Add a circle to the path with the second parameter as an integer, which will succeed.
712 OH_Drawing_PathAddCircle(path, 50, 50.0f, 10.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
713 // 5. Add a circle to the path with the third parameter as an integer, which will succeed.
714 OH_Drawing_PathAddCircle(path, 50.0f, 50, 10.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
715 // 6. Add a circle to the path with the fourth parameter as an integer, which will succeed.
716 OH_Drawing_PathAddCircle(path, 50.0f, 50.0f, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
718 OH_Drawing_PathDestroy(path);
724 * @tc.desc: Test for adding a circle to a path using maximal values.
730 // 1. Create a path object using OH_Drawing_PathCreate.
731 OH_Drawing_Path *path = OH_Drawing_PathCreate();
732 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
733 OH_Drawing_PathMoveTo(path, 0, 0);
735 OH_Drawing_PathLineTo(path, 100, 100);
736 // 4. Add a circle to the path with the second parameter set to FLT_MAX + 1, no crash occurs.
737 OH_Drawing_PathAddCircle(path, FLT_MAX + 1, 50, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
738 // 5. Add a circle to the path with the third parameter set to FLT_MAX + 1, no crash occurs.
739 OH_Drawing_PathAddCircle(path, 50, FLT_MAX + 1, 10, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
740 // 6. Add a circle to the path with the fourth parameter set to FLT_MAX + 1, no crash occurs.
741 OH_Drawing_PathAddCircle(path, 50, 50, FLT_MAX + 1, OH_Drawing_PathDirection::PATH_DIRECTION_CCW);
743 OH_Drawing_PathDestroy(path);
749 * @tc.desc: Test for building a path from an SVG string using normal parameters.
755 // 1. Create a path object using OH_Drawing_PathCreate.
756 OH_Drawing_Path *path = OH_Drawing_PathCreate();
757 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
758 OH_Drawing_PathMoveTo(path, 0, 0);
760 OH_Drawing_PathLineTo(path, 100, 100);
761 // 4. Parse the path represented by the SVG string using OH_Drawing_PathBuildFromSvgString.
763 OH_Drawing_PathBuildFromSvgString(path, svgString);
765 OH_Drawing_PathDestroy(path);
771 * @tc.desc: Test for building a path from an SVG string using NULL or invalid parameters.
777 // 1. Create a path object using OH_Drawing_PathCreate.
778 OH_Drawing_Path *path = OH_Drawing_PathCreate();
785 OH_Drawing_PathBuildFromSvgString(path, nullptr);
788 OH_Drawing_PathDestroy(path);
794 * @tc.desc: Test for checking if a path contains a specified point using normal parameters.
800 // 1. Create a path object using OH_Drawing_PathCreate.
801 OH_Drawing_Path *path = OH_Drawing_PathCreate();
802 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
803 OH_Drawing_PathMoveTo(path, 0, 0);
805 OH_Drawing_PathLineTo(path, 100, 100);
806 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
807 OH_Drawing_PathLineTo(path, 100, 0);
808 // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
809 OH_Drawing_PathLineTo(path, 0, 0);
810 // 6. Close the path using OH_Drawing_PathClose.
811 OH_Drawing_PathClose(path);
812 // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
813 EXPECT_EQ(OH_Drawing_PathContains(path, 50, 50), true);
815 OH_Drawing_PathDestroy(path);
821 * @tc.desc: Test for checking if a path contains a specified point using NULL or invalid parameters.
827 // 1. Create a path object using OH_Drawing_PathCreate.
828 OH_Drawing_Path *path = OH_Drawing_PathCreate();
833 OH_Drawing_PathContains(path, 0.0, 50);
835 OH_Drawing_PathContains(path, 50, 0.0);
837 OH_Drawing_PathDestroy(path);
843 * @tc.desc: Test for checking if a path contains a specified point using abnormal parameters.
849 // 1. Create a path object using OH_Drawing_PathCreate.
850 OH_Drawing_Path *path = OH_Drawing_PathCreate();
851 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
852 OH_Drawing_PathMoveTo(path, 0, 0);
854 OH_Drawing_PathLineTo(path, 100, 100);
855 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
856 OH_Drawing_PathLineTo(path, 100, 0);
857 // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
858 OH_Drawing_PathLineTo(path, 0, 0);
859 // 6. Close the path using OH_Drawing_PathClose.
860 OH_Drawing_PathClose(path);
861 // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
862 OH_Drawing_PathContains(path, 50, 50.0f);
863 // 8. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains.
864 OH_Drawing_PathContains(path, 50.0f, 50);
866 OH_Drawing_PathDestroy(path);
872 * @tc.desc: Test for checking if a path contains a specified point using maximal values.
878 // 1. Create a path object using OH_Drawing_PathCreate.
879 OH_Drawing_Path *path = OH_Drawing_PathCreate();
880 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
881 OH_Drawing_PathMoveTo(path, 0, 0);
883 OH_Drawing_PathLineTo(path, 100, 0);
884 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
885 OH_Drawing_PathLineTo(path, 100, 100);
886 // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
887 OH_Drawing_PathLineTo(path, 0, 100);
888 // 6. Close the path using OH_Drawing_PathClose.
889 OH_Drawing_PathClose(path);
890 // 7. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains with the second
892 OH_Drawing_PathContains(path, FLT_MAX + 1, 50);
893 // 8. Check if the specified coordinates are contained in the path using OH_Drawing_PathContains with the third
895 OH_Drawing_PathContains(path, 50, FLT_MAX + 1);
897 OH_Drawing_PathDestroy(path);
903 * @tc.desc: Test for transforming a path using normal parameters.
909 // 1. Create a path object using OH_Drawing_PathCreate.
910 OH_Drawing_Path *path = OH_Drawing_PathCreate();
914 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
915 OH_Drawing_PathMoveTo(path, 0, 0);
917 OH_Drawing_PathLineTo(path, 100, 100);
918 // 5. Transform the path using OH_Drawing_PathTransform.
919 OH_Drawing_PathTransform(path, matrix);
921 OH_Drawing_PathDestroy(path);
928 * @tc.desc: Test for transforming a path using NULL or invalid parameters.
934 // 1. Create a path object using OH_Drawing_PathCreate.
935 OH_Drawing_Path *path = OH_Drawing_PathCreate();
945 OH_Drawing_PathTransform(path, nullptr);
948 OH_Drawing_PathDestroy(path);
955 * @tc.desc: Test for transforming a path with perspective clip using normal parameters.
961 // 1. Create a path object src using OH_Drawing_PathCreate.
966 // 3. Create a path object dst using OH_Drawing_PathCreate.
968 // 4. Set the starting point of the path using OH_Drawing_PathMoveTo.
972 // 6. Transform the path using OH_Drawing_PathTransformWithPerspectiveClip, with the fourth parameter set to true.
983 * @tc.desc: Test for transforming a path with perspective clip using normal parameters with false perspective clip.
989 // 1. Create a path object src using OH_Drawing_PathCreate.
993 // 3. Create a path object dst using OH_Drawing_PathCreate.
995 // 4. Set the starting point of the path using OH_Drawing_PathMoveTo.
999 // 6. Transform the path using OH_Drawing_PathTransformWithPerspectiveClip, with the fourth parameter set to false.
1010 * @tc.desc: Test for transforming a path with perspective clip using NULL or invalid parameters.
1016 // 1. Create a path object src using OH_Drawing_PathCreate.
1020 // 3. Create a path object dst using OH_Drawing_PathCreate.
1041 * @tc.desc: Test for setting fill type of a path using normal parameters.
1047 // 1. Create a path object using OH_Drawing_PathCreate.
1048 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1049 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1050 OH_Drawing_PathMoveTo(path, 0, 0);
1052 OH_Drawing_PathLineTo(path, 100, 100);
1053 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1054 OH_Drawing_PathLineTo(path, 100, 0);
1055 // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1056 OH_Drawing_PathLineTo(path, 0, 0);
1057 // 6. Close the path using OH_Drawing_PathClose.
1058 OH_Drawing_PathClose(path);
1059 // 7. Set the fill type of the path using OH_Drawing_PathSetFillType, with the second parameter iterating through
1061 OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_WINDING);
1062 OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_EVEN_ODD);
1063 OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_INVERSE_WINDING);
1064 OH_Drawing_PathSetFillType(path, OH_Drawing_PathFillType::PATH_FILL_TYPE_INVERSE_EVEN_ODD);
1066 OH_Drawing_PathDestroy(path);
1072 * @tc.desc: Test for setting fill type of a path using NULL or invalid parameters.
1078 // 1. Create a path object using OH_Drawing_PathCreate.
1079 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1086 OH_Drawing_PathSetFillType(path, static_cast<OH_Drawing_PathFillType>(-1));
1089 OH_Drawing_PathDestroy(path);
1095 * @tc.desc: Test for setting fill type of a path with multiple calls.
1101 // 1. Create a path object using OH_Drawing_PathCreate.
1102 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1103 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1104 OH_Drawing_PathMoveTo(path, 0, 0);
1106 OH_Drawing_PathLineTo(path, 100, 100);
1107 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1108 OH_Drawing_PathLineTo(path, 100, 0);
1109 // 5. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1110 OH_Drawing_PathLineTo(path, 0, 0);
1111 // 6. Close the path using OH_Drawing_PathClose.
1112 OH_Drawing_PathClose(path);
1114 // rules for the path.
1116 OH_Drawing_PathSetFillType(path, static_cast<OH_Drawing_PathFillType>(i));
1119 OH_Drawing_PathDestroy(path);
1125 * @tc.desc: Test for getting the length of a path using normal parameters with detailed length.
1131 // 1. Create a path object using OH_Drawing_PathCreate.
1132 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1133 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1134 OH_Drawing_PathMoveTo(path, 0, 0);
1136 OH_Drawing_PathLineTo(path, 100, 100);
1137 // 4. Get the length of the current path by calling OH_Drawing_PathGetLength, with the second parameter set to true.
1138 float length = OH_Drawing_PathGetLength(path, true);
1141 OH_Drawing_PathDestroy(path);
1147 * @tc.desc: Test for getting the length of a path using normal parameters without detailed length.
1153 // 1. Create a path object using OH_Drawing_PathCreate.
1154 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1155 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1156 OH_Drawing_PathMoveTo(path, 0, 0);
1158 OH_Drawing_PathLineTo(path, 100, 100);
1159 // 4. Get the length of the current path by calling OH_Drawing_PathGetLength, with the second parameter set to
1161 float length = OH_Drawing_PathGetLength(path, false);
1164 OH_Drawing_PathDestroy(path);
1170 * @tc.desc: Test for getting the length of a path using NULL or invalid parameters.
1176 // 1. Create a path object using OH_Drawing_PathCreate.
1177 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1183 OH_Drawing_PathDestroy(path);
1189 * @tc.desc: Test for getting the bounds of a path using normal parameters.
1195 // 1. Create a path object using OH_Drawing_PathCreate.
1196 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1199 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1200 OH_Drawing_PathMoveTo(path, 0, 0);
1202 OH_Drawing_PathLineTo(path, 100, 100);
1203 // 5. Get the minimum bounding box that contains the path by calling OH_Drawing_PathGetBounds.
1204 OH_Drawing_PathGetBounds(path, rect);
1206 OH_Drawing_PathDestroy(path);
1213 * @tc.desc: Test for getting the bounds of a path using NULL or invalid parameters.
1219 // 1. Create a path object using OH_Drawing_PathCreate.
1220 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1229 OH_Drawing_PathGetBounds(path, nullptr);
1232 OH_Drawing_PathDestroy(path);
1245 // 1. Create a path object using OH_Drawing_PathCreate.
1246 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1247 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1248 OH_Drawing_PathMoveTo(path, 0, 0);
1250 OH_Drawing_PathLineTo(path, 100, 100);
1251 // 4. Add a line segment from the last point of the path to the target point using OH_Drawing_PathLineTo.
1252 OH_Drawing_PathLineTo(path, 100, 0);
1253 // 5. Close the path by adding a line segment from the last point of the path to the starting point.
1254 OH_Drawing_PathClose(path);
1256 OH_Drawing_PathDestroy(path);
1262 * @tc.desc: Test for closing a path using NULL or invalid parameters.
1268 // 1. Create a path object using OH_Drawing_PathCreate.
1269 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1275 OH_Drawing_PathDestroy(path);
1281 * @tc.desc: Test for offsetting a path using normal parameters.
1287 // 1. Create a path object using OH_Drawing_PathCreate.
1288 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1289 // 2. Create a path object using OH_Drawing_PathCreate.
1291 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1292 OH_Drawing_PathMoveTo(path, 0, 0);
1294 OH_Drawing_PathLineTo(path, 100, 100);
1295 // 5. Offset all points in the path by a certain distance along the x and y axes, and store the result in the
1296 // destination path object using OH_Drawing_PathOffset.
1297 OH_Drawing_PathOffset(path, dst, 10, 10);
1299 OH_Drawing_PathDestroy(path);
1305 * @tc.desc: Test for offsetting a path using NULL or invalid parameters.
1311 // 1. Create a path object using OH_Drawing_PathCreate.
1312 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1313 // 2. Create a path object using OH_Drawing_PathCreate.
1320 OH_Drawing_PathOffset(path, nullptr, 10, 10);
1322 OH_Drawing_PathOffset(path, dst, 0.00, 10);
1324 OH_Drawing_PathOffset(path, dst, 10, 0.00);
1326 OH_Drawing_PathDestroy(path);
1333 * @tc.desc: Test for offsetting a path with abnormal parameters (non-float values).
1339 // 1. Create a path object using OH_Drawing_PathCreate.
1340 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1341 // 2. Create a path object using OH_Drawing_PathCreate.
1343 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1344 OH_Drawing_PathMoveTo(path, 0, 0);
1346 OH_Drawing_PathLineTo(path, 100, 100);
1348 OH_Drawing_PathOffset(path, dst, 10, 10.0f);
1350 OH_Drawing_PathOffset(path, dst, 10.0f, 10);
1352 OH_Drawing_PathDestroy(path);
1359 * @tc.desc: Test for offsetting a path with maximal values.
1365 // 1. Create a path object using OH_Drawing_PathCreate.
1366 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1367 // 2. Create a path object using OH_Drawing_PathCreate.
1369 // 3. Set the starting point of the path using OH_Drawing_PathMoveTo.
1370 OH_Drawing_PathMoveTo(path, 0, 0);
1372 OH_Drawing_PathLineTo(path, 100, 100);
1374 OH_Drawing_PathOffset(path, dst, FLT_MAX + 1, 10.0f);
1376 OH_Drawing_PathOffset(path, dst, 10.0f, FLT_MAX + 1);
1378 OH_Drawing_PathDestroy(path);
1385 * @tc.desc: Test for resetting a path using normal parameters.
1391 // 1. Create a path object using OH_Drawing_PathCreate.
1392 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1393 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1394 OH_Drawing_PathMoveTo(path, 0, 0);
1396 OH_Drawing_PathLineTo(path, 100, 100);
1397 // 4. Reset the custom path data using OH_Drawing_PathReset.
1398 OH_Drawing_PathReset(path);
1400 OH_Drawing_PathDestroy(path);
1406 * @tc.desc: Test for resetting a path using NULL or invalid parameters.
1412 // 1. Create a path object using OH_Drawing_PathCreate.
1413 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1419 OH_Drawing_PathDestroy(path);
1425 * @tc.desc: Test for resetting a path with multiple calls.
1431 // 1. Create a path object using OH_Drawing_PathCreate.
1432 OH_Drawing_Path *path = OH_Drawing_PathCreate();
1433 // 2. Set the starting point of the path using OH_Drawing_PathMoveTo.
1434 OH_Drawing_PathMoveTo(path, 0, 0);
1436 OH_Drawing_PathLineTo(path, 100, 100);
1437 // 4. Reset the custom path data using OH_Drawing_PathReset.
1438 OH_Drawing_PathReset(path);
1441 OH_Drawing_PathMoveTo(path, 0, 0);
1442 OH_Drawing_PathLineTo(path, 100, 100);
1443 OH_Drawing_PathReset(path);
1446 OH_Drawing_PathDestroy(path);