1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "gtest/gtest.h"
17 
18 #include "draw/path.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace Rosen {
25 namespace Drawing {
26 class PathTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     void SetUp() override;
31     void TearDown() override;
32 };
33 
SetUpTestCase()34 void PathTest::SetUpTestCase() {}
TearDownTestCase()35 void PathTest::TearDownTestCase() {}
SetUp()36 void PathTest::SetUp() {}
TearDown()37 void PathTest::TearDown() {}
38 
39 /**
40  * @tc.name: CreateAndDestroy001
41  * @tc.desc:
42  * @tc.type: FUNC
43  * @tc.require: AR000GGNV3
44  * @tc.author:
45  */
46 HWTEST_F(PathTest, CreateAndDestroy001, TestSize.Level1)
47 {
48     auto path = std::make_unique<Path>();
49     ASSERT_TRUE(path != nullptr);
50 }
51 
52 /**
53  * @tc.name: BuildFromSVGString001
54  * @tc.desc: Test for Parsing the SVG format string and sets the Path.
55  * @tc.type: FUNC
56  * @tc.require: I715J0
57  */
58 HWTEST_F(PathTest, BuildFromSVGString001, TestSize.Level1)
59 {
60     auto path = std::make_unique<Path>();
61     ASSERT_TRUE(path != nullptr);
62     std::string str;
63     EXPECT_TRUE(path->BuildFromSVGString(str));
64 }
65 
66 /**
67  * @tc.name: BuildFromSVGString002
68  * @tc.desc: Test for Parsing the SVG format string and sets the Path.
69  * @tc.type: FUNC
70  * @tc.require: I715J0
71  */
72 HWTEST_F(PathTest, BuildFromSVGString002, TestSize.Level1)
73 {
74     auto path = std::make_unique<Path>();
75     ASSERT_TRUE(path != nullptr);
76     std::string str = "string";
77     EXPECT_FALSE(path->BuildFromSVGString(str));
78 }
79 
80 /**
81  * @tc.name: BuildFromSVGString003
82  * @tc.desc: Test for Parsing the SVG format string and sets the Path.
83  * @tc.type: FUNC
84  * @tc.require: I715J0
85  */
86 HWTEST_F(PathTest, BuildFromSVGString003, TestSize.Level1)
87 {
88     auto path = std::make_unique<Path>();
89     ASSERT_TRUE(path != nullptr);
90     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
91     EXPECT_TRUE(path->BuildFromSVGString(path->ConvertToSVGString()));
92 }
93 
94 /**
95  * @tc.name: ConvertToSVGString001
96  * @tc.desc: Test for Parsing into a string in SVG format that describes the Path.
97  * @tc.type: FUNC
98  * @tc.require: I715J0
99  */
100 HWTEST_F(PathTest, ConvertToSVGString001, TestSize.Level1)
101 {
102     auto path = std::make_unique<Path>();
103     ASSERT_TRUE(path != nullptr);
104     EXPECT_EQ(path->ConvertToSVGString(), "");
105 }
106 
107 /**
108  * @tc.name: ConvertToSVGString002
109  * @tc.desc: Test for Parsing into a string in SVG format that describes the Path.
110  * @tc.type: FUNC
111  * @tc.require: I715J0
112  */
113 HWTEST_F(PathTest, ConvertToSVGString002, TestSize.Level1)
114 {
115     auto path = std::make_unique<Path>();
116     ASSERT_TRUE(path != nullptr);
117     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
118     EXPECT_TRUE(path->ConvertToSVGString() != "");
119 }
120 
121 /**
122  * @tc.name: MoveTo001
123  * @tc.desc:
124  * @tc.type: FUNC
125  * @tc.require: AR000GGNV3
126  * @tc.author:
127  */
128 HWTEST_F(PathTest, MoveTo001, TestSize.Level1)
129 {
130     auto path = std::make_unique<Path>();
131     ASSERT_TRUE(path != nullptr);
132     path->MoveTo(5.0f, 4.5f);
133 }
134 
135 /**
136  * @tc.name: MoveTo002
137  * @tc.desc:
138  * @tc.type: FUNC
139  * @tc.require: AR000GGNV3
140  * @tc.author:
141  */
142 HWTEST_F(PathTest, MoveTo002, TestSize.Level1)
143 {
144     auto path = std::make_unique<Path>();
145     ASSERT_TRUE(path != nullptr);
146     path->MoveTo(4.5f, 5.0f);
147 }
148 
149 /**
150  * @tc.name: LineTo001
151  * @tc.desc:
152  * @tc.type: FUNC
153  * @tc.require: AR000GGNV3
154  * @tc.author:
155  */
156 HWTEST_F(PathTest, LineTo001, TestSize.Level1)
157 {
158     auto path = std::make_unique<Path>();
159     ASSERT_TRUE(path != nullptr);
160     path->LineTo(4.5f, 5.0f);
161 }
162 
163 /**
164  * @tc.name: LineTo002
165  * @tc.desc:
166  * @tc.type: FUNC
167  * @tc.require: AR000GGNV3
168  * @tc.author:
169  */
170 HWTEST_F(PathTest, LineTo002, TestSize.Level1)
171 {
172     auto path = std::make_unique<Path>();
173     ASSERT_TRUE(path != nullptr);
174     path->LineTo(1.0f, 3.0f);
175 }
176 
177 /**
178  * @tc.name: ArcTo001
179  * @tc.desc:
180  * @tc.type: FUNC
181  * @tc.require: AR000GGNV3
182  * @tc.author:
183  */
184 HWTEST_F(PathTest, ArcTo001, TestSize.Level1)
185 {
186     auto path = std::make_unique<Path>();
187     ASSERT_TRUE(path != nullptr);
188     path->ArcTo(1.0f, 3.0f, 2.2f, 2.3f, 0.0f, 5.0f);
189 }
190 
191 /**
192  * @tc.name: ArcTo002
193  * @tc.desc:
194  * @tc.type: FUNC
195  * @tc.require: AR000GGNV3
196  * @tc.author:
197  */
198 HWTEST_F(PathTest, ArcTo002, TestSize.Level1)
199 {
200     auto path = std::make_unique<Path>();
201     ASSERT_TRUE(path != nullptr);
202     path->ArcTo(1.0f, 3.0f, 2.5f, 2.4f, 1.0f, 3.0f);
203 }
204 
205 /**
206  * @tc.name: ArcTo003
207  * @tc.desc: Arc To Direction Test
208  * @tc.type: FUNC
209  * @tc.require: issuel#I6Q4ZH
210  */
211 HWTEST_F(PathTest, ArcTo003, TestSize.Level2)
212 {
213     Path path;
214     path.ArcTo(1.0f, 3.0f, 2.5f, PathDirection::CCW_DIRECTION, 1.0f, 3.0f);
215     ASSERT_TRUE(path.IsValid());
216 }
217 
218 /**
219  * @tc.name: ArcToWith6001
220  * @tc.desc:
221  * @tc.type: FUNC
222  * @tc.require: AR000GGNV3
223  * @tc.author:
224  */
225 HWTEST_F(PathTest, ArcToWith6001, TestSize.Level1)
226 {
227     auto path = std::make_unique<Path>();
228     ASSERT_TRUE(path != nullptr);
229     Point point1;
230     Point point2;
231     path->ArcTo(point1, point2, 2.5f, 2.4f);
232 }
233 
234 /**
235  * @tc.name: ArcToWith6002
236  * @tc.desc:
237  * @tc.type: FUNC
238  * @tc.require: AR000GGNV3
239  * @tc.author:
240  */
241 HWTEST_F(PathTest, ArcToWith6002, TestSize.Level1)
242 {
243     auto path = std::make_unique<Path>();
244     ASSERT_TRUE(path != nullptr);
245     Point point1;
246     Point point2;
247     path->ArcTo(point1, point2, 2.5f, 2.0f);
248 }
249 
250 /**
251  * @tc.name: CubicTo001
252  * @tc.desc:
253  * @tc.type: FUNC
254  * @tc.require: AR000GGNV3
255  * @tc.author:
256  */
257 HWTEST_F(PathTest, CubicTo001, TestSize.Level1)
258 {
259     auto path = std::make_unique<Path>();
260     ASSERT_TRUE(path != nullptr);
261     path->CubicTo(1.0f, 2.3f, 2.5f, 2.0f, 3.5f, 3.0f);
262 }
263 
264 /**
265  * @tc.name: CubicTo002
266  * @tc.desc:
267  * @tc.type: FUNC
268  * @tc.require: AR000GGNV3
269  * @tc.author:
270  */
271 HWTEST_F(PathTest, CubicTo002, TestSize.Level1)
272 {
273     auto path = std::make_unique<Path>();
274     ASSERT_TRUE(path != nullptr);
275     path->CubicTo(1.0f, 2.3f, 1.4f, 2.0f, 1.5f, 3.0f);
276 }
277 
278 /**
279  * @tc.name: CubicTo2001
280  * @tc.desc:
281  * @tc.type: FUNC
282  * @tc.require: AR000GGNV3
283  * @tc.author:
284  */
285 HWTEST_F(PathTest, CubicTo2001, TestSize.Level1)
286 {
287     auto path = std::make_unique<Path>();
288     ASSERT_TRUE(path != nullptr);
289     Point point1;
290     Point point2;
291     Point endPoint(2.3f, 1.5f);
292     path->CubicTo(point1, point2, endPoint);
293 }
294 
295 /**
296  * @tc.name: CubicTo2002
297  * @tc.desc:
298  * @tc.type: FUNC
299  * @tc.require: AR000GGNV3
300  * @tc.author:
301  */
302 HWTEST_F(PathTest, CubicTo2002, TestSize.Level1)
303 {
304     auto path = std::make_unique<Path>();
305     ASSERT_TRUE(path != nullptr);
306     Point point1(1.2f, 0.0f);
307     Point point2(1.3f, 1.0f);
308     Point endPoint(2.3f, 1.5f);
309     path->CubicTo(point1, point2, endPoint);
310 }
311 
312 /**
313  * @tc.name: QuadTo2001
314  * @tc.desc:
315  * @tc.type: FUNC
316  * @tc.require: AR000GGNV3
317  * @tc.author:
318  */
319 HWTEST_F(PathTest, QuadTo2001, TestSize.Level1)
320 {
321     auto path = std::make_unique<Path>();
322     ASSERT_TRUE(path != nullptr);
323     Point point1(1.2f, 0.0f);
324     Point endPoint(2.3f, 1.5f);
325     path->QuadTo(point1, endPoint);
326 }
327 
328 /**
329  * @tc.name: QuadTo2002
330  * @tc.desc:
331  * @tc.type: FUNC
332  * @tc.require: AR000GGNV3
333  * @tc.author:
334  */
335 HWTEST_F(PathTest, QuadTo2002, TestSize.Level1)
336 {
337     auto path = std::make_unique<Path>();
338     ASSERT_TRUE(path != nullptr);
339     Point point1(0.5f, 0.3f);
340     Point endPoint(3.5f, 3.3f);
341     path->QuadTo(point1, endPoint);
342 }
343 
344 /**
345  * @tc.name: QuadTo4001
346  * @tc.desc:
347  * @tc.type: FUNC
348  * @tc.require: AR000GGNV3
349  * @tc.author:
350  */
351 HWTEST_F(PathTest, QuadTo4001, TestSize.Level1)
352 {
353     auto path = std::make_unique<Path>();
354     ASSERT_TRUE(path != nullptr);
355     path->QuadTo(1.0f, 1.5f, 3.3f, 4.5f);
356 }
357 
358 /**
359  * @tc.name: QuadTo4002
360  * @tc.desc:
361  * @tc.type: FUNC
362  * @tc.require: AR000GGNV3
363  * @tc.author:
364  */
365 HWTEST_F(PathTest, QuadTo4002, TestSize.Level1)
366 {
367     auto path = std::make_unique<Path>();
368     ASSERT_TRUE(path != nullptr);
369     path->QuadTo(1.0f, 1.2f, 3.0f, 4.0f);
370 }
371 
372 /**
373  * @tc.name: AddRect2001
374  * @tc.desc:
375  * @tc.type: FUNC
376  * @tc.require: AR000GGNV3
377  * @tc.author:
378  */
379 HWTEST_F(PathTest, AddRect2001, TestSize.Level1)
380 {
381     auto path = std::make_unique<Path>();
382     ASSERT_TRUE(path != nullptr);
383     Rect rect;
384     path->AddRect(rect);
385 }
386 
387 /**
388  * @tc.name: AddRect2002
389  * @tc.desc:
390  * @tc.type: FUNC
391  * @tc.require: AR000GGNV3
392  * @tc.author:
393  */
394 HWTEST_F(PathTest, AddRect2002, TestSize.Level1)
395 {
396     auto path = std::make_unique<Path>();
397     ASSERT_TRUE(path != nullptr);
398     Rect rect;
399     path->AddRect(rect, PathDirection::CCW_DIRECTION);
400 }
401 
402 /**
403  * @tc.name: AddRect5001
404  * @tc.desc:
405  * @tc.type: FUNC
406  * @tc.require: AR000GGNV3
407  * @tc.author:
408  */
409 HWTEST_F(PathTest, AddRect5001, TestSize.Level1)
410 {
411     auto path = std::make_unique<Path>();
412     ASSERT_TRUE(path != nullptr);
413     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f, PathDirection::CCW_DIRECTION);
414 }
415 
416 /**
417  * @tc.name: AddRect5002
418  * @tc.desc:
419  * @tc.type: FUNC
420  * @tc.require: AR000GGNV3
421  * @tc.author:
422  */
423 HWTEST_F(PathTest, AddRect5002, TestSize.Level1)
424 {
425     auto path = std::make_unique<Path>();
426     ASSERT_TRUE(path != nullptr);
427     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
428 }
429 
430 /**
431  * @tc.name: AddOval001
432  * @tc.desc:
433  * @tc.type: FUNC
434  * @tc.require: AR000GGNV3
435  * @tc.author:
436  */
437 HWTEST_F(PathTest, AddOval001, TestSize.Level1)
438 {
439     auto path = std::make_unique<Path>();
440     ASSERT_TRUE(path != nullptr);
441     Rect oval;
442     path->AddOval(oval, PathDirection::CCW_DIRECTION);
443 }
444 
445 /**
446  * @tc.name: AddOval002
447  * @tc.desc:
448  * @tc.type: FUNC
449  * @tc.require: AR000GGNV3
450  * @tc.author:
451  */
452 HWTEST_F(PathTest, AddOval002, TestSize.Level1)
453 {
454     auto path = std::make_unique<Path>();
455     ASSERT_TRUE(path != nullptr);
456     Rect oval;
457     path->AddOval(oval);
458 }
459 
460 /**
461  * @tc.name: AddArc001
462  * @tc.desc:
463  * @tc.type: FUNC
464  * @tc.require: AR000GGNV3
465  * @tc.author:
466  */
467 HWTEST_F(PathTest, AddArc001, TestSize.Level1)
468 {
469     auto path = std::make_unique<Path>();
470     ASSERT_TRUE(path != nullptr);
471     Rect rect;
472     path->AddArc(rect, 1.0f, 2.0f);
473 }
474 
475 /**
476  * @tc.name: AddArc002
477  * @tc.desc:
478  * @tc.type: FUNC
479  * @tc.require: AR000GGNV3
480  * @tc.author:
481  */
482 HWTEST_F(PathTest, AddArc002, TestSize.Level1)
483 {
484     auto path = std::make_unique<Path>();
485     ASSERT_TRUE(path != nullptr);
486     Rect rect;
487     path->AddArc(rect, 2.0f, 1.0f);
488 }
489 
490 /**
491  * @tc.name: AddPoly001
492  * @tc.desc:
493  * @tc.type: FUNC
494  * @tc.require: AR000GGNV3
495  * @tc.author:
496  */
497 HWTEST_F(PathTest, AddPoly001, TestSize.Level1)
498 {
499     auto path = std::make_unique<Path>();
500     ASSERT_TRUE(path != nullptr);
501     std::vector<Point> points;
502     Point point1;
503     points.push_back(point1);
504     int size = points.size();
505     path->AddPoly(points, size, false);
506 }
507 
508 /**
509  * @tc.name: AddPoly002
510  * @tc.desc:
511  * @tc.type: FUNC
512  * @tc.require: AR000GGNV3
513  * @tc.author:
514  */
515 HWTEST_F(PathTest, AddPoly002, TestSize.Level1)
516 {
517     auto path = std::make_unique<Path>();
518     ASSERT_TRUE(path != nullptr);
519     std::vector<Point> points;
520     Point point1;
521     Point point2;
522     points.push_back(point1);
523     points.push_back(point2);
524     int size = points.size();
525     path->AddPoly(points, size, true);
526 }
527 
528 /**
529  * @tc.name: AddCircle001
530  * @tc.desc:
531  * @tc.type: FUNC
532  * @tc.require: AR000GGNV3
533  * @tc.author:
534  */
535 HWTEST_F(PathTest, AddCircle001, TestSize.Level1)
536 {
537     auto path = std::make_unique<Path>();
538     ASSERT_TRUE(path != nullptr);
539     path->AddCircle(1.0f, 0.5f, 0.5f);
540 }
541 
542 /**
543  * @tc.name: AddCircle002
544  * @tc.desc:
545  * @tc.type: FUNC
546  * @tc.require: AR000GGNV3
547  * @tc.author:
548  */
549 HWTEST_F(PathTest, AddCircle002, TestSize.Level1)
550 {
551     auto path = std::make_unique<Path>();
552     ASSERT_TRUE(path != nullptr);
553     path->AddCircle(1.0f, 0.5f, 0.5f, PathDirection::CCW_DIRECTION);
554 }
555 
556 /**
557  * @tc.name: AddRoundRect001
558  * @tc.desc:
559  * @tc.type: FUNC
560  * @tc.require: AR000GGNV3
561  * @tc.author:
562  */
563 HWTEST_F(PathTest, AddRoundRect001, TestSize.Level1)
564 {
565     auto path = std::make_unique<Path>();
566     ASSERT_TRUE(path != nullptr);
567     Rect rect;
568     path->AddRoundRect(rect, 0.5f, 0.5f, PathDirection::CCW_DIRECTION);
569 }
570 
571 /**
572  * @tc.name: AddRoundRect002
573  * @tc.desc:
574  * @tc.type: FUNC
575  * @tc.require: AR000GGNV3
576  * @tc.author:
577  */
578 HWTEST_F(PathTest, AddRoundRect002, TestSize.Level1)
579 {
580     auto path = std::make_unique<Path>();
581     ASSERT_TRUE(path != nullptr);
582     Rect rect;
583     path->AddRoundRect(rect, 0.5f, 0.5f);
584 }
585 
586 /**
587  * @tc.name: AddRoundRect003
588  * @tc.desc: Test for adding the circle rectangle to the Path.
589  * @tc.type: FUNC
590  * @tc.require: I715J0
591  */
592 HWTEST_F(PathTest, AddRoundRect003, TestSize.Level1)
593 {
594     auto path = std::make_unique<Path>();
595     ASSERT_TRUE(path != nullptr);
596     RoundRect roundRect;
597     path->AddRoundRect(roundRect, PathDirection::CCW_DIRECTION);
598 }
599 
600 /**
601  * @tc.name: AddRoundRect004
602  * @tc.desc: Test for adding the circle rectangle to the Path.
603  * @tc.type: FUNC
604  * @tc.require: I715J0
605  */
606 HWTEST_F(PathTest, AddRoundRect004, TestSize.Level1)
607 {
608     auto path = std::make_unique<Path>();
609     ASSERT_TRUE(path != nullptr);
610     RoundRect roundRect;
611     path->AddRoundRect(roundRect);
612 }
613 
614 /**
615  * @tc.name: AddRoundRect005
616  * @tc.desc: Test for adding the circle rectangle to the Path.
617  * @tc.type: FUNC
618  * @tc.require: I715J0
619  */
620 HWTEST_F(PathTest, AddRoundRect005, TestSize.Level1)
621 {
622     auto path = std::make_unique<Path>();
623     ASSERT_TRUE(path != nullptr);
624     Rect rect;
625     RoundRect roundRect(rect, 12.6f, 77.4f);
626     path->AddRoundRect(roundRect);
627 }
628 
629 /**
630  * @tc.name: AddPath3001
631  * @tc.desc:
632  * @tc.type: FUNC
633  * @tc.require: AR000GGNV3
634  * @tc.author:
635  */
636 HWTEST_F(PathTest, AddPath3001, TestSize.Level1)
637 {
638     auto path = std::make_unique<Path>();
639     ASSERT_TRUE(path != nullptr);
640     Path sourcePath;
641     path->AddPath(sourcePath, 0.5f, 0.5f);
642 }
643 
644 /**
645  * @tc.name: AddPath3002
646  * @tc.desc:
647  * @tc.type: FUNC
648  * @tc.require: AR000GGNV3
649  * @tc.author:
650  */
651 HWTEST_F(PathTest, AddPath3002, TestSize.Level1)
652 {
653     auto path = std::make_unique<Path>();
654     ASSERT_TRUE(path != nullptr);
655     Path sourcePath;
656     path->AddPath(sourcePath, 1.0f, 1.0f);
657 }
658 
659 /**
660  * @tc.name: AddPath1001
661  * @tc.desc:
662  * @tc.type: FUNC
663  * @tc.require: AR000GGNV3
664  * @tc.author:
665  */
666 HWTEST_F(PathTest, AddPath1001, TestSize.Level1)
667 {
668     auto path = std::make_unique<Path>();
669     ASSERT_TRUE(path != nullptr);
670     Path sourcePath;
671     path->AddPath(sourcePath);
672 }
673 
674 /**
675  * @tc.name: AddPath2001
676  * @tc.desc:
677  * @tc.type: FUNC
678  * @tc.require: AR000GGNV3
679  * @tc.author:
680  */
681 HWTEST_F(PathTest, AddPath2001, TestSize.Level1)
682 {
683     auto path = std::make_unique<Path>();
684     ASSERT_TRUE(path != nullptr);
685     Path path1;
686     Matrix matrix;
687     path->AddPath(path1, matrix);
688 }
689 
690 /**
691  * @tc.name: AddPath2002
692  * @tc.desc:
693  * @tc.type: FUNC
694  * @tc.require: AR000GGNV3
695  * @tc.author:
696  */
697 HWTEST_F(PathTest, AddPath2002, TestSize.Level1)
698 {
699     auto path = std::make_unique<Path>();
700     ASSERT_TRUE(path != nullptr);
701     Path path1;
702     Matrix matrix;
703     path->AddPath(path1, matrix);
704 }
705 
706 /**
707  * @tc.name: ReverseAddPath001
708  * @tc.desc: Test for adding the src from back forward to the Path.
709  * @tc.type: FUNC
710  * @tc.require: I715J0
711  */
712 HWTEST_F(PathTest, ReverseAddPath001, TestSize.Level1)
713 {
714     auto path = std::make_unique<Path>();
715     ASSERT_TRUE(path != nullptr);
716     Path path1;
717     path->ReverseAddPath(path1);
718 }
719 
720 /**
721  * @tc.name: ReverseAddPath002
722  * @tc.desc: Test for adding the src from back forward to the Path.
723  * @tc.type: FUNC
724  * @tc.require: I715J0
725  */
726 HWTEST_F(PathTest, ReverseAddPath002, TestSize.Level1)
727 {
728     auto path = std::make_unique<Path>();
729     ASSERT_TRUE(path != nullptr);
730     Path path2;
731     path2.AddRect(1.0f, 4.0f, 3.0f, 2.0f);
732     path->ReverseAddPath(path2);
733 }
734 
735 /**
736  * @tc.name: GetBounds001
737  * @tc.desc:
738  * @tc.type: FUNC
739  * @tc.require: AR000GGNV3
740  * @tc.author:
741  */
742 HWTEST_F(PathTest, GetBounds001, TestSize.Level1)
743 {
744     auto path = std::make_unique<Path>();
745     ASSERT_TRUE(path != nullptr);
746     auto rect = path->GetBounds();
747 }
748 
749 /**
750  * @tc.name: SetFillStyle001
751  * @tc.desc:
752  * @tc.type: FUNC
753  * @tc.require: AR000GGNV3
754  * @tc.author:
755  */
756 HWTEST_F(PathTest, SetFillStyle001, TestSize.Level1)
757 {
758     auto path = std::make_unique<Path>();
759     ASSERT_TRUE(path != nullptr);
760     path->SetFillStyle(PathFillType::WINDING);
761 }
762 
763 /**
764  * @tc.name: SetFillStyle002
765  * @tc.desc:
766  * @tc.type: FUNC
767  * @tc.require: AR000GGNV3
768  * @tc.author:
769  */
770 HWTEST_F(PathTest, SetFillStyle002, TestSize.Level1)
771 {
772     auto path = std::make_unique<Path>();
773     ASSERT_TRUE(path != nullptr);
774     path->SetFillStyle(PathFillType::INVERSE_WINDING);
775 }
776 
777 /**
778  * @tc.name: Interpolate001
779  * @tc.desc:
780  * @tc.type: FUNC
781  * @tc.require: AR000GGNV3
782  * @tc.author:
783  */
784 HWTEST_F(PathTest, Interpolate001, TestSize.Level1)
785 {
786     auto path = std::make_unique<Path>();
787     ASSERT_TRUE(path != nullptr);
788     Path ending;
789     Path out;
790     path->Interpolate(ending, 0.5f, out);
791 }
792 
793 /**
794  * @tc.name: Interpolate002
795  * @tc.desc:
796  * @tc.type: FUNC
797  * @tc.require: AR000GGNV3
798  * @tc.author:
799  */
800 HWTEST_F(PathTest, Interpolate002, TestSize.Level1)
801 {
802     auto path = std::make_unique<Path>();
803     ASSERT_TRUE(path != nullptr);
804     Path ending;
805     Path out;
806     path->Interpolate(ending, 0.2f, out);
807 }
808 
809 /**
810  * @tc.name: Transform001
811  * @tc.desc:
812  * @tc.type: FUNC
813  * @tc.require: AR000GGNV3
814  * @tc.author:
815  */
816 HWTEST_F(PathTest, Transform001, TestSize.Level1)
817 {
818     auto path = std::make_unique<Path>();
819     ASSERT_TRUE(path != nullptr);
820     Matrix matrix;
821     path->Transform(matrix);
822 }
823 
824 /**
825  * @tc.name: Offset001
826  * @tc.desc:
827  * @tc.type: FUNC
828  * @tc.require: AR000GGNV3
829  * @tc.author:
830  */
831 HWTEST_F(PathTest, Offset001, TestSize.Level1)
832 {
833     auto path = std::make_unique<Path>();
834     ASSERT_TRUE(path != nullptr);
835     path->Offset(1.0f, 2.3f);
836 }
837 
838 /**
839  * @tc.name: Offset002
840  * @tc.desc:
841  * @tc.type: FUNC
842  * @tc.require: AR000GGNV3
843  * @tc.author:
844  */
845 HWTEST_F(PathTest, Offset002, TestSize.Level1)
846 {
847     auto path = std::make_unique<Path>();
848     ASSERT_TRUE(path != nullptr);
849     path->Offset(2.3f, 1.0f);
850 }
851 
852 /**
853  * @tc.name: Op001
854  * @tc.desc:
855  * @tc.type: FUNC
856  * @tc.require: AR000GGNV3
857  * @tc.author:
858  */
859 HWTEST_F(PathTest, Op001, TestSize.Level1)
860 {
861     auto path = std::make_unique<Path>();
862     ASSERT_TRUE(path != nullptr);
863     Path path1;
864     Path path2;
865     path->Op(path1, path2, PathOp::INTERSECT);
866 }
867 
868 /**
869  * @tc.name: Op002
870  * @tc.desc:
871  * @tc.type: FUNC
872  * @tc.require: AR000GGNV3
873  * @tc.author:
874  */
875 HWTEST_F(PathTest, Op002, TestSize.Level1)
876 {
877     auto path = std::make_unique<Path>();
878     ASSERT_TRUE(path != nullptr);
879     Path path1;
880     Path path2;
881     path->Op(path1, path2, PathOp::UNION);
882 }
883 
884 /**
885  * @tc.name: IsValid001
886  * @tc.desc: Test for Checking whether the Path is valid.
887  * @tc.type: FUNC
888  * @tc.require: I715J0
889  */
890 HWTEST_F(PathTest, IsValid001, TestSize.Level1)
891 {
892     auto path = std::make_unique<Path>();
893     ASSERT_TRUE(path != nullptr);
894     EXPECT_FALSE(path->IsValid());
895 }
896 
897 /**
898  * @tc.name: IsValid002
899  * @tc.desc: Test for Checking whether the Path is valid.
900  * @tc.type: FUNC
901  * @tc.require: I715J0
902  */
903 HWTEST_F(PathTest, IsValid002, TestSize.Level1)
904 {
905     auto path = std::make_unique<Path>();
906     ASSERT_TRUE(path != nullptr);
907     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
908     EXPECT_TRUE(path->IsValid());
909 }
910 
911 /**
912  * @tc.name: Reset001
913  * @tc.desc:
914  * @tc.type: FUNC
915  * @tc.require: AR000GGNV3
916  * @tc.author:
917  */
918 HWTEST_F(PathTest, Reset001, TestSize.Level1)
919 {
920     auto path = std::make_unique<Path>();
921     ASSERT_TRUE(path != nullptr);
922     path->Reset();
923 }
924 
925 /**
926  * @tc.name: Close001
927  * @tc.desc:
928  * @tc.type: FUNC
929  * @tc.require: AR000GGNV3
930  * @tc.author:
931  */
932 HWTEST_F(PathTest, Close001, TestSize.Level1)
933 {
934     auto path = std::make_unique<Path>();
935     ASSERT_TRUE(path != nullptr);
936     path->Close();
937 }
938 
939 /**
940  * @tc.name: GetLength001
941  * @tc.desc: Test for geting the length of the current path object.
942  * @tc.type: FUNC
943  * @tc.require: I715J0
944  */
945 HWTEST_F(PathTest, GetLength001, TestSize.Level1)
946 {
947     auto path = std::make_unique<Path>();
948     ASSERT_TRUE(path != nullptr);
949     EXPECT_EQ(path->GetLength(false), 0);
950 }
951 
952 /**
953  * @tc.name: GetLength002
954  * @tc.desc: Test for geting the length of the current path object.
955  * @tc.type: FUNC
956  * @tc.require: I715J0
957  */
958 HWTEST_F(PathTest, GetLength002, TestSize.Level1)
959 {
960     auto path = std::make_unique<Path>();
961     ASSERT_TRUE(path != nullptr);
962     EXPECT_EQ(path->GetLength(true), 0);
963 }
964 
965 /**
966  * @tc.name: GetLength003
967  * @tc.desc: Test for geting the length of the current path object.
968  * @tc.type: FUNC
969  * @tc.require: I715J0
970  */
971 HWTEST_F(PathTest, GetLength003, TestSize.Level1)
972 {
973     auto path = std::make_unique<Path>();
974     ASSERT_TRUE(path != nullptr);
975     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
976     EXPECT_EQ(path->GetLength(true), 8);
977 }
978 
979 /**
980  * @tc.name: GetPositionAndTangent001
981  * @tc.desc: Test for geting the position and tangent of the distance from the starting position of the Path.
982  * @tc.type: FUNC
983  * @tc.require: I715J0
984  */
985 HWTEST_F(PathTest, GetPositionAndTangent001, TestSize.Level1)
986 {
987     auto path = std::make_unique<Path>();
988     ASSERT_TRUE(path != nullptr);
989     Point point1;
990     Point point2;
991     EXPECT_FALSE(path->GetPositionAndTangent(0, point1, point2, false));
992 }
993 
994 /**
995  * @tc.name: GetPositionAndTangent002
996  * @tc.desc: Test for geting the position and tangent of the distance from the starting position of the Path.
997  * @tc.type: FUNC
998  * @tc.require: I715J0
999  */
1000 HWTEST_F(PathTest, GetPositionAndTangent002, TestSize.Level1)
1001 {
1002     auto path = std::make_unique<Path>();
1003     ASSERT_TRUE(path != nullptr);
1004     Point point1;
1005     Point point2;
1006     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
1007     EXPECT_TRUE(path->GetPositionAndTangent(10, point1, point2, true));
1008 }
1009 
1010 /**
1011  * @tc.name: GetPositionAndTangent003
1012  * @tc.desc: Test for geting the position and tangent of the distance from the starting position of the Path.
1013  * @tc.type: FUNC
1014  * @tc.require: I715J0
1015  */
1016 HWTEST_F(PathTest, GetPositionAndTangent003, TestSize.Level1)
1017 {
1018     auto path = std::make_unique<Path>();
1019     ASSERT_TRUE(path != nullptr);
1020     Point point1(0.5f, 0.3f);
1021     Point point2(3.5f, 3.3f);
1022     path->AddRect(1.0f, 4.0f, 3.0f, 2.0f);
1023     EXPECT_TRUE(path->GetPositionAndTangent(0.1f, point1, point2, false));
1024 }
1025 
1026 /**
1027  * @tc.name: CopyConstruction001
1028  * @tc.desc: Bounds should be same by using copy construction
1029  * @tc.type: FUNC
1030  * @tc.require: issuelI6M9U9
1031  */
1032 HWTEST_F(PathTest, CopyConstruction001, TestSize.Level1)
1033 {
1034     Path path1;
1035     path1.MoveTo(1.0f, 2.0f);
1036     path1.LineTo(3.0f, 4.0f);
1037     Path path2 = path1;
1038     ASSERT_TRUE(path1.GetBounds() == path2.GetBounds());
1039 }
1040 
1041 /**
1042  * @tc.name: CopyConstruction002
1043  * @tc.desc: Deep clone by the copy construction should not modify the original object
1044  * @tc.type: FUNC
1045  * @tc.require: issuelI6M9U9
1046  */
1047 HWTEST_F(PathTest, CopyConstruction002, TestSize.Level1)
1048 {
1049     Path path1;
1050     path1.MoveTo(1.0f, 2.0f);
1051     path1.LineTo(3.0f, 4.0f);
1052     Path path2 = path1;
1053     path2.LineTo(10.0f, 10.0f);
1054     ASSERT_TRUE(path1.GetBounds() != path2.GetBounds());
1055 }
1056 
1057 /**
1058  * @tc.name: Assignment001
1059  * @tc.desc: Bounds should be same by using assignment method
1060  * @tc.type: FUNC
1061  * @tc.require: issuelI6M9U9
1062  */
1063 HWTEST_F(PathTest, Assignment001, TestSize.Level1)
1064 {
1065     Path path1;
1066     path1.MoveTo(1.0f, 2.0f);
1067     path1.LineTo(3.0f, 4.0f);
1068     Path path2;
1069     path2 = path1;
1070     ASSERT_TRUE(path1.GetBounds() == path2.GetBounds());
1071 }
1072 
1073 /**
1074  * @tc.name: Assignment002
1075  * @tc.desc: Deep clone by the assignment method should not modify the original object
1076  * @tc.type: FUNC
1077  * @tc.require: issuelI6M9U9
1078  */
1079 HWTEST_F(PathTest, Assignment002, TestSize.Level1)
1080 {
1081     Path path1;
1082     path1.MoveTo(1.0f, 2.0f);
1083     path1.LineTo(3.0f, 4.0f);
1084     Path path2;
1085     path2 = path1;
1086     path2.LineTo(10.0f, 10.0f);
1087     ASSERT_TRUE(path1.GetBounds() != path2.GetBounds());
1088 }
1089 } // namespace Drawing
1090 } // namespace Rosen
1091 } // namespace OHOS
1092