1 /*
2  * Copyright (c) 2022 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, Hardware
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 "utils/point.h"
19 #include "utils/scalar.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace Rosen {
26 namespace Drawing {
27 class PointTest : public testing::Test {
28 public:
29     static void SetUpTestCase();
30     static void TearDownTestCase();
31     void SetUp() override;
32     void TearDown() override;
33 };
34 
SetUpTestCase()35 void PointTest::SetUpTestCase() {}
TearDownTestCase()36 void PointTest::TearDownTestCase() {}
SetUp()37 void PointTest::SetUp() {}
TearDown()38 void PointTest::TearDown() {}
39 
40 /**
41  * @tc.name: PointPointFCreateAndDestroy001
42  * @tc.desc:
43  * @tc.type: FUNC
44  * @tc.require:AR000GGNV3
45  * @tc.author:
46  */
47 HWTEST_F(PointTest, PointPointFCreateAndDestroy001, TestSize.Level1)
48 {
49     std::unique_ptr<PointF> pointf = std::make_unique<PointF>();
50     EXPECT_EQ(0.0f, pointf->GetX());
51     EXPECT_EQ(0.0f, pointf->GetY());
52 }
53 
54 /**
55  * @tc.name: PointPointFCreateAndDestroy002
56  * @tc.desc:
57  * @tc.type: FUNC
58  * @tc.require:AR000GGNV3
59  * @tc.author:
60  */
61 HWTEST_F(PointTest, PointPointFCreateAndDestroy002, TestSize.Level1)
62 {
63     PointF pointf1;
64     pointf1.SetX(1.0f);
65     PointF pointf2(pointf1);
66     EXPECT_EQ(pointf1.GetX(), pointf2.GetX());
67 }
68 
69 /**
70  * @tc.name: PointPointFCreateAndDestroy003
71  * @tc.desc:
72  * @tc.type: FUNC
73  * @tc.require:AR000GGNV3
74  * @tc.author:
75  */
76 HWTEST_F(PointTest, PointPointFCreateAndDestroy003, TestSize.Level1)
77 {
78     PointF pointf1;
79     pointf1.SetX(2.0f);
80     PointF pointf2(pointf1);
81     EXPECT_EQ(pointf1.GetX(), pointf2.GetX());
82 }
83 
84 /**
85  * @tc.name: PointPointFCreateAndDestroy004
86  * @tc.desc:
87  * @tc.type: FUNC
88  * @tc.require:AR000GGNV3
89  * @tc.author:
90  */
91 HWTEST_F(PointTest, PointPointFCreateAndDestroy004, TestSize.Level1)
92 {
93     std::unique_ptr<PointF> pointf = std::make_unique<PointF>(1.0f, 2.0f);
94     EXPECT_EQ(1.0f, pointf->GetX());
95     EXPECT_EQ(2.0f, pointf->GetY());
96 }
97 
98 /**
99  * @tc.name: PointPointFCreateAndDestroy005
100  * @tc.desc:
101  * @tc.type: FUNC
102  * @tc.require:AR000GGNV3
103  * @tc.author:
104  */
105 HWTEST_F(PointTest, PointPointFCreateAndDestroy005, TestSize.Level1)
106 {
107     std::unique_ptr<PointF> pointf = std::make_unique<PointF>(2.0f, 1.0f);
108     EXPECT_EQ(2.0f, pointf->GetX());
109     EXPECT_EQ(1.0f, pointf->GetY());
110 }
111 
112 /**
113  * @tc.name: PointPointFSetAndGetX001
114  * @tc.desc:
115  * @tc.type: FUNC
116  * @tc.require:AR000GGNV3
117  * @tc.author:
118  */
119 HWTEST_F(PointTest, PointPointFSetAndGetX001, TestSize.Level1)
120 {
121     std::unique_ptr<PointF> pointf = std::make_unique<PointF>();
122     pointf->SetX(1.0f);
123     EXPECT_EQ(1.0f, pointf->GetX());
124 }
125 
126 /**
127  * @tc.name: PointPointFSetAndGetX002
128  * @tc.desc:
129  * @tc.type: FUNC
130  * @tc.require:AR000GGNV3
131  * @tc.author:
132  */
133 HWTEST_F(PointTest, PointPointFSetAndGetX002, TestSize.Level1)
134 {
135     std::unique_ptr<PointF> pointf = std::make_unique<PointF>();
136     pointf->SetX(2.0f);
137     EXPECT_EQ(2.0f, pointf->GetX());
138 }
139 
140 /**
141  * @tc.name: PointPointFSetAndGetY001
142  * @tc.desc:
143  * @tc.type: FUNC
144  * @tc.require:AR000GGNV3
145  * @tc.author:
146  */
147 HWTEST_F(PointTest, PointPointFSetAndGetY001, TestSize.Level1)
148 {
149     std::unique_ptr<PointF> pointf = std::make_unique<PointF>();
150     pointf->SetY(1.0f);
151     EXPECT_EQ(1.0f, pointf->GetY());
152 }
153 
154 /**
155  * @tc.name: PointPointFSetAndGetY002
156  * @tc.desc:
157  * @tc.type: FUNC
158  * @tc.require:AR000GGNV3
159  * @tc.author:
160  */
161 HWTEST_F(PointTest, PointPointFSetAndGetY002, TestSize.Level1)
162 {
163     std::unique_ptr<PointF> pointf = std::make_unique<PointF>();
164     pointf->SetY(2.0f);
165     EXPECT_EQ(2.0f, pointf->GetY());
166 }
167 
168 /**
169  * @tc.name: PointPointFAddEqual001
170  * @tc.desc:
171  * @tc.type: FUNC
172  * @tc.require:AR000GGNV3
173  * @tc.author:
174  */
175 HWTEST_F(PointTest, PointPointFAddEqual001, TestSize.Level1)
176 {
177     PointF pointf1;
178     PointF pointf2(1.0f, 2.0f);
179     pointf1 += pointf2;
180     EXPECT_EQ(1.0f, pointf1.GetX());
181     EXPECT_EQ(2.0f, pointf1.GetY());
182 }
183 
184 /**
185  * @tc.name: PointPointFAddEqual002
186  * @tc.desc:
187  * @tc.type: FUNC
188  * @tc.require:AR000GGNV3
189  * @tc.author:
190  */
191 HWTEST_F(PointTest, PointPointFAddEqual002, TestSize.Level1)
192 {
193     PointF pointf1;
194     PointF pointf2(2.0f, 1.0f);
195     pointf1 += pointf2;
196     EXPECT_EQ(2.0f, pointf1.GetX());
197     EXPECT_EQ(1.0f, pointf1.GetY());
198 }
199 
200 /**
201  * @tc.name: PointPointFMinusEqual001
202  * @tc.desc:
203  * @tc.type: FUNC
204  * @tc.require:AR000GGNV3
205  * @tc.author:
206  */
207 HWTEST_F(PointTest, PointPointFMinusEqual001, TestSize.Level1)
208 {
209     PointF pointf1;
210     PointF pointf2(1.0f, 2.0f);
211     pointf1 -= pointf2;
212     EXPECT_EQ(-1.0f, pointf1.GetX());
213     EXPECT_EQ(-2.0f, pointf1.GetY());
214 }
215 
216 /**
217  * @tc.name: PointPointFMinusEqual002
218  * @tc.desc:
219  * @tc.type: FUNC
220  * @tc.require:AR000GGNV3
221  * @tc.author:
222  */
223 HWTEST_F(PointTest, PointPointFMinusEqual002, TestSize.Level1)
224 {
225     PointF pointf1;
226     PointF pointf2(2.0f, 1.0f);
227     pointf1 -= pointf2;
228     EXPECT_EQ(-2.0f, pointf1.GetX());
229     EXPECT_EQ(-1.0f, pointf1.GetY());
230 }
231 
232 /**
233  * @tc.name: PointPointFMultiplyEqual001
234  * @tc.desc:
235  * @tc.type: FUNC
236  * @tc.require:AR000GGNV3
237  * @tc.author:
238  */
239 HWTEST_F(PointTest, PointPointFMultiplyEqual001, TestSize.Level1)
240 {
241     PointF pointf1(2.0f, 3.0f);
242     pointf1 *= 2.0f;
243     EXPECT_EQ(4.0f, pointf1.GetX());
244     EXPECT_EQ(6.0f, pointf1.GetY());
245 }
246 
247 /**
248  * @tc.name: PointPointFMultiplyEqual002
249  * @tc.desc:
250  * @tc.type: FUNC
251  * @tc.require:AR000GGNV3
252  * @tc.author:
253  */
254 HWTEST_F(PointTest, PointPointFMultiplyEqual002, TestSize.Level1)
255 {
256     PointF pointf1(4.0f, 5.0f);
257     pointf1 *= 2;
258     EXPECT_EQ(8.0f, pointf1.GetX());
259     EXPECT_EQ(10.0f, pointf1.GetY());
260 }
261 
262 /**
263  * @tc.name: PointPointFDevidEqual001
264  * @tc.desc:
265  * @tc.type: FUNC
266  * @tc.require:AR000GGNV3
267  * @tc.author:
268  */
269 HWTEST_F(PointTest, PointPointFDevidEqual001, TestSize.Level1)
270 {
271     PointF pointf1(4.0f, 6.0f);
272     pointf1 /= 2.0f;
273     EXPECT_EQ(2.0f, pointf1.GetX());
274     EXPECT_EQ(3.0f, pointf1.GetY());
275 }
276 
277 /**
278  * @tc.name: PointPointFDevidEqual002
279  * @tc.desc:
280  * @tc.type: FUNC
281  * @tc.require:AR000GGNV3
282  * @tc.author:
283  */
284 HWTEST_F(PointTest, PointPointFDevidEqual002, TestSize.Level1)
285 {
286     PointF pointf1(6.0f, 8.0f);
287     pointf1 /= 2;
288     EXPECT_EQ(3.0f, pointf1.GetX());
289     EXPECT_EQ(4.0f, pointf1.GetY());
290 }
291 
292 /**
293  * @tc.name: PointPointFAdd001
294  * @tc.desc:
295  * @tc.type: FUNC
296  * @tc.require:AR000GGNV3
297  * @tc.author:
298  */
299 HWTEST_F(PointTest, PointPointFAdd001, TestSize.Level1)
300 {
301     PointF pointf1(1.0f, 2.0f);
302     PointF pointf2(2.0f, 1.0f);
303     PointF pointf3 = pointf1 + pointf2;
304     EXPECT_EQ(3.0f, pointf3.GetX());
305     EXPECT_EQ(3.0f, pointf3.GetY());
306 }
307 
308 /**
309  * @tc.name: PointPointFAdd002
310  * @tc.desc:
311  * @tc.type: FUNC
312  * @tc.require:AR000GGNV3
313  * @tc.author:
314  */
315 HWTEST_F(PointTest, PointPointFAdd002, TestSize.Level1)
316 {
317     PointF pointf1(2.0f, 3.0f);
318     PointF pointf2(4.0f, 5.0f);
319     PointF pointf3 = pointf1 + pointf2;
320     EXPECT_EQ(6.0f, pointf3.GetX());
321     EXPECT_EQ(8.0f, pointf3.GetY());
322 }
323 
324 /**
325  * @tc.name: PointPointFMinus001
326  * @tc.desc:
327  * @tc.type: FUNC
328  * @tc.require:AR000GGNV3
329  * @tc.author:
330  */
331 HWTEST_F(PointTest, PointPointFMinus001, TestSize.Level1)
332 {
333     PointF pointf1(1.0f, 2.0f);
334     PointF pointf2(2.0f, 1.0f);
335     PointF pointf3 = pointf1 - pointf2;
336     EXPECT_EQ(-1.0f, pointf3.GetX());
337     EXPECT_EQ(1.0f, pointf3.GetY());
338 }
339 
340 /**
341  * @tc.name: PointPointFMinus002
342  * @tc.desc:
343  * @tc.type: FUNC
344  * @tc.require:AR000GGNV3
345  * @tc.author:
346  */
347 HWTEST_F(PointTest, PointPointFMinus002, TestSize.Level1)
348 {
349     PointF pointf1(1.0f, 2.0f);
350     PointF pointf2(3.0f, 4.0f);
351     PointF pointf3 = pointf1 - pointf2;
352     EXPECT_EQ(-2.0f, pointf3.GetX());
353     EXPECT_EQ(-2.0f, pointf3.GetY());
354 }
355 
356 /**
357  * @tc.name: PointPointFMultiply001
358  * @tc.desc:
359  * @tc.type: FUNC
360  * @tc.require:AR000GGNV3
361  * @tc.author:
362  */
363 HWTEST_F(PointTest, PointPointFMultiply001, TestSize.Level1)
364 {
365     PointF pointf1(1.0f, 2.0f);
366     PointF pointf2 = 3.0f * pointf1;
367     EXPECT_EQ(3.0f, pointf2.GetX());
368     EXPECT_EQ(6.0f, pointf2.GetY());
369 }
370 
371 /**
372  * @tc.name: PointPointFMultiply002
373  * @tc.desc:
374  * @tc.type: FUNC
375  * @tc.require:AR000GGNV3
376  * @tc.author:
377  */
378 HWTEST_F(PointTest, PointPointFMultiply002, TestSize.Level1)
379 {
380     PointF pointf1(1.0f, 2.0f);
381     PointF pointf2 = 4.0f * pointf1;
382     EXPECT_EQ(4.0f, pointf2.GetX());
383     EXPECT_EQ(8.0f, pointf2.GetY());
384 }
385 
386 /**
387  * @tc.name: PointPointFMultiply003
388  * @tc.desc:
389  * @tc.type: FUNC
390  * @tc.require:AR000GGNV3
391  * @tc.author:
392  */
393 HWTEST_F(PointTest, PointPointFMultiply003, TestSize.Level1)
394 {
395     PointF pointf1(1.0f, 2.0f);
396     PointF pointf2 = pointf1 * 3.0f;
397     EXPECT_EQ(3.0f, pointf2.GetX());
398     EXPECT_EQ(6.0f, pointf2.GetY());
399 }
400 
401 /**
402  * @tc.name: PointPointFMultiply004
403  * @tc.desc:
404  * @tc.type: FUNC
405  * @tc.require:AR000GGNV3
406  * @tc.author:
407  */
408 HWTEST_F(PointTest, PointPointFMultiply004, TestSize.Level1)
409 {
410     PointF pointf1(1.0f, 2.0f);
411     PointF pointf2 = pointf1 * 4.0f;
412     EXPECT_EQ(4.0f, pointf2.GetX());
413     EXPECT_EQ(8.0f, pointf2.GetY());
414 }
415 
416 /**
417  * @tc.name: PointPointFDevide001
418  * @tc.desc:
419  * @tc.type: FUNC
420  * @tc.require:AR000GGNV3
421  * @tc.author:
422  */
423 HWTEST_F(PointTest, PointPointFDevide001, TestSize.Level1)
424 {
425     PointF pointf1(1.0f, 2.0f);
426     PointF pointf2 = pointf1 / 1.0f;
427     EXPECT_EQ(1.0f, pointf2.GetX());
428     EXPECT_EQ(2.0f, pointf2.GetY());
429 }
430 
431 /**
432  * @tc.name: PointPointFDevide002
433  * @tc.desc:
434  * @tc.type: FUNC
435  * @tc.require:AR000GGNV3
436  * @tc.author:
437  */
438 HWTEST_F(PointTest, PointPointFDevide002, TestSize.Level1)
439 {
440     PointF pointf1(4.0f, 8.0f);
441     PointF pointf2 = pointf1 / 2.0f;
442     EXPECT_EQ(2.0f, pointf2.GetX());
443     EXPECT_EQ(4.0f, pointf2.GetY());
444 }
445 
446 /**
447  * @tc.name: PointPointFPositive001
448  * @tc.desc:
449  * @tc.type: FUNC
450  * @tc.require:AR000GGNV3
451  * @tc.author:
452  */
453 HWTEST_F(PointTest, PointPointFPositive001, TestSize.Level1)
454 {
455     PointF pointf1(1.0f, 2.0f);
456     PointF pointf2 = +pointf1;
457     EXPECT_EQ(1.0f, pointf2.GetX());
458     EXPECT_EQ(2.0f, pointf2.GetY());
459 }
460 
461 /**
462  * @tc.name: PointPointFPositive002
463  * @tc.desc:
464  * @tc.type: FUNC
465  * @tc.require:AR000GGNV3
466  * @tc.author:
467  */
468 HWTEST_F(PointTest, PointPointFPositive002, TestSize.Level1)
469 {
470     PointF pointf1(3.0f, 4.0f);
471     PointF pointf2 = +pointf1;
472     EXPECT_EQ(3.0f, pointf2.GetX());
473     EXPECT_EQ(4.0f, pointf2.GetY());
474 }
475 
476 /**
477  * @tc.name: PointPointFNegative001
478  * @tc.desc:
479  * @tc.type: FUNC
480  * @tc.require:AR000GGNV3
481  * @tc.author:
482  */
483 HWTEST_F(PointTest, PointPointFNegative001, TestSize.Level1)
484 {
485     PointF pointf1(1.0f, 2.0f);
486     PointF pointf2 = -pointf1;
487     EXPECT_EQ(-1.0f, pointf2.GetX());
488     EXPECT_EQ(-2.0f, pointf2.GetY());
489 }
490 
491 /**
492  * @tc.name: PointPointFNegative002
493  * @tc.desc:
494  * @tc.type: FUNC
495  * @tc.require:AR000GGNV3
496  * @tc.author:
497  */
498 HWTEST_F(PointTest, PointPointFNegative002, TestSize.Level1)
499 {
500     PointF pointf1(2.0f, 3.0f);
501     PointF pointf2 = -pointf1;
502     EXPECT_EQ(-2.0f, pointf2.GetX());
503     EXPECT_EQ(-3.0f, pointf2.GetY());
504 }
505 
506 /**
507  * @tc.name: PointPointFEqual001
508  * @tc.desc:
509  * @tc.type: FUNC
510  * @tc.require:AR000GGNV3
511  * @tc.author:
512  */
513 HWTEST_F(PointTest, PointPointFEqual001, TestSize.Level1)
514 {
515     PointF pointf1(1.0f, 2.0f);
516     PointF pointf2(1.0f, 2.0f);
517     EXPECT_TRUE(pointf1 == pointf2);
518 }
519 
520 /**
521  * @tc.name: PointPointFEqual002
522  * @tc.desc:
523  * @tc.type: FUNC
524  * @tc.require:AR000GGNV3
525  * @tc.author:
526  */
527 HWTEST_F(PointTest, PointPointFEqual002, TestSize.Level1)
528 {
529     PointF pointf1(1.0f, 2.0f);
530     PointF pointf2(2.0f, 3.0f);
531     EXPECT_FALSE(pointf1 == pointf2);
532 }
533 
534 /**
535  * @tc.name: PointPointFNotEqual001
536  * @tc.desc:
537  * @tc.type: FUNC
538  * @tc.require:AR000GGNV3
539  * @tc.author:
540  */
541 HWTEST_F(PointTest, PointPointFNotEqual001, TestSize.Level1)
542 {
543     PointF pointf1(1.0f, 2.0f);
544     PointF pointf2(2.0f, 3.0f);
545     EXPECT_TRUE(pointf1 != pointf2);
546 }
547 
548 /**
549  * @tc.name: PointPointFNotEqual002
550  * @tc.desc:
551  * @tc.type: FUNC
552  * @tc.require:AR000GGNV3
553  * @tc.author:
554  */
555 HWTEST_F(PointTest, PointPointFNotEqual002, TestSize.Level1)
556 {
557     PointF pointf1(1.0f, 2.0f);
558     PointF pointf2(1.0f, 2.0f);
559     EXPECT_FALSE(pointf1 != pointf2);
560 }
561 
562 /**
563  * @tc.name: PointPointICreateAndDestroy001
564  * @tc.desc:
565  * @tc.type: FUNC
566  * @tc.require:AR000GGNV3
567  * @tc.author:
568  */
569 HWTEST_F(PointTest, PointPointICreateAndDestroy001, TestSize.Level1)
570 {
571     PointI pointi1;
572     pointi1.SetX(1.0f);
573     PointI pointi2(pointi1);
574     EXPECT_EQ(pointi1.GetX(), pointi2.GetX());
575 }
576 
577 /**
578  * @tc.name: PointPointICreateAndDestroy002
579  * @tc.desc:
580  * @tc.type: FUNC
581  * @tc.require:AR000GGNV3
582  * @tc.author:
583  */
584 HWTEST_F(PointTest, PointPointICreateAndDestroy002, TestSize.Level1)
585 {
586     PointI pointi1;
587     pointi1.SetX(2.0f);
588     PointI pointi2(pointi1);
589     EXPECT_EQ(pointi1.GetX(), pointi2.GetX());
590 }
591 
592 /**
593  * @tc.name: PointPointICreateAndDestroy003
594  * @tc.desc:
595  * @tc.type: FUNC
596  * @tc.require:AR000GGNV3
597  * @tc.author:
598  */
599 HWTEST_F(PointTest, PointPointICreateAndDestroy003, TestSize.Level1)
600 {
601     std::unique_ptr<PointI> pointi = std::make_unique<PointI>(1.0f, 2.0f);
602     EXPECT_EQ(1.0f, pointi->GetX());
603     EXPECT_EQ(2.0f, pointi->GetY());
604 }
605 
606 /**
607  * @tc.name: PointPointICreateAndDestroy004
608  * @tc.desc:
609  * @tc.type: FUNC
610  * @tc.require:AR000GGNV3
611  * @tc.author:
612  */
613 HWTEST_F(PointTest, PointPointICreateAndDestroy004, TestSize.Level1)
614 {
615     std::unique_ptr<PointI> pointi = std::make_unique<PointI>(2.0f, 1.0f);
616     EXPECT_EQ(2.0f, pointi->GetX());
617     EXPECT_EQ(1.0f, pointi->GetY());
618 }
619 
620 /**
621  * @tc.name: PointPointICreateAndDestroy005
622  * @tc.desc:
623  * @tc.type: FUNC
624  * @tc.require:AR000GGNV3
625  * @tc.author:
626  */
627 HWTEST_F(PointTest, PointPointINotEqual005, TestSize.Level1)
628 {
629     std::unique_ptr<PointI> pointi = std::make_unique<PointI>();
630     EXPECT_EQ(0.0f, pointi->GetX());
631     EXPECT_EQ(0.0f, pointi->GetY());
632 }
633 
634 /**
635  * @tc.name: PointPointISetAndGetX001
636  * @tc.desc:
637  * @tc.type: FUNC
638  * @tc.require:AR000GGNV3
639  * @tc.author:
640  */
641 HWTEST_F(PointTest, PointPointISetAndGetX001, TestSize.Level1)
642 {
643     std::unique_ptr<PointI> pointi = std::make_unique<PointI>();
644     pointi->SetX(1.0f);
645     EXPECT_EQ(1.0f, pointi->GetX());
646 }
647 
648 /**
649  * @tc.name: PointPointISetAndGetX002
650  * @tc.desc:
651  * @tc.type: FUNC
652  * @tc.require:AR000GGNV3
653  * @tc.author:
654  */
655 HWTEST_F(PointTest, PointPointISetAndGetX002, TestSize.Level1)
656 {
657     std::unique_ptr<PointI> pointi = std::make_unique<PointI>();
658     pointi->SetX(2.0f);
659     EXPECT_EQ(2.0f, pointi->GetX());
660 }
661 
662 /**
663  * @tc.name: PointPointISetAndGetY001
664  * @tc.desc:
665  * @tc.type: FUNC
666  * @tc.require:AR000GGNV3
667  * @tc.author:
668  */
669 HWTEST_F(PointTest, PointPointISetAndGetY001, TestSize.Level1)
670 {
671     std::unique_ptr<PointI> pointi = std::make_unique<PointI>();
672     pointi->SetY(1.0f);
673     EXPECT_EQ(1.0f, pointi->GetY());
674 }
675 
676 /**
677  * @tc.name: PointPointISetAndGetY002
678  * @tc.desc:
679  * @tc.type: FUNC
680  * @tc.require:AR000GGNV3
681  * @tc.author:
682  */
683 HWTEST_F(PointTest, PointPointISetAndGetY002, TestSize.Level1)
684 {
685     std::unique_ptr<PointI> pointi = std::make_unique<PointI>();
686     pointi->SetY(2.0f);
687     EXPECT_EQ(2.0f, pointi->GetY());
688 }
689 
690 /**
691  * @tc.name: PointPointIAddEqual001
692  * @tc.desc:
693  * @tc.type: FUNC
694  * @tc.require:AR000GGNV3
695  * @tc.author:
696  */
697 HWTEST_F(PointTest, PointPointIAddEqual001, TestSize.Level1)
698 {
699     PointI pointi1;
700     PointI pointi2(1.0f, 2.0f);
701     pointi1 += pointi2;
702     EXPECT_EQ(1.0f, pointi1.GetX());
703     EXPECT_EQ(2.0f, pointi1.GetY());
704 }
705 
706 /**
707  * @tc.name: PointPointIAddEqual002
708  * @tc.desc:
709  * @tc.type: FUNC
710  * @tc.require:AR000GGNV3
711  * @tc.author:
712  */
713 HWTEST_F(PointTest, PointPointIAddEqual002, TestSize.Level1)
714 {
715     PointI pointi1;
716     PointI pointi2(2.0f, 1.0f);
717     pointi1 += pointi2;
718     EXPECT_EQ(2.0f, pointi1.GetX());
719     EXPECT_EQ(1.0f, pointi1.GetY());
720 }
721 
722 /**
723  * @tc.name: PointPointIMinusEqual001
724  * @tc.desc:
725  * @tc.type: FUNC
726  * @tc.require:AR000GGNV3
727  * @tc.author:
728  */
729 HWTEST_F(PointTest, PointPointIMinusEqual001, TestSize.Level1)
730 {
731     PointI pointi1;
732     PointI pointi2(1.0f, 2.0f);
733     pointi1 -= pointi2;
734     EXPECT_EQ(-1.0f, pointi1.GetX());
735     EXPECT_EQ(-2.0f, pointi1.GetY());
736 }
737 
738 /**
739  * @tc.name: PointPointIMinusEqual002
740  * @tc.desc:
741  * @tc.type: FUNC
742  * @tc.require:AR000GGNV3
743  * @tc.author:
744  */
745 HWTEST_F(PointTest, PointPointIMinusEqual002, TestSize.Level1)
746 {
747     PointI pointi1;
748     PointI pointi2(2.0f, 1.0f);
749     pointi1 -= pointi2;
750     EXPECT_EQ(-2.0f, pointi1.GetX());
751     EXPECT_EQ(-1.0f, pointi1.GetY());
752 }
753 
754 /**
755  * @tc.name: PointPointIMultiplyEqual001
756  * @tc.desc:
757  * @tc.type: FUNC
758  * @tc.require:AR000GGNV3
759  * @tc.author:
760  */
761 HWTEST_F(PointTest, PointPointIMultiplyEqual001, TestSize.Level1)
762 {
763     PointI pointi1(2.0f, 3.0f);
764     pointi1 *= 2;
765     EXPECT_EQ(4.0f, pointi1.GetX());
766     EXPECT_EQ(6.0f, pointi1.GetY());
767 }
768 
769 /**
770  * @tc.name: PointPointIMultiplyEqual002
771  * @tc.desc:
772  * @tc.type: FUNC
773  * @tc.require:AR000GGNV3
774  * @tc.author:
775  */
776 HWTEST_F(PointTest, PointPointIMultiplyEqual002, TestSize.Level1)
777 {
778     PointI pointi1(4.0f, 5.0f);
779     pointi1 *= 2.0f;
780     EXPECT_EQ(8.0f, pointi1.GetX());
781     EXPECT_EQ(10.0f, pointi1.GetY());
782 }
783 
784 /**
785  * @tc.name: PointPointIDevideEqual001
786  * @tc.desc:
787  * @tc.type: FUNC
788  * @tc.require:AR000GGNV3
789  * @tc.author:
790  */
791 HWTEST_F(PointTest, PointPointIDevideEqual001, TestSize.Level1)
792 {
793     PointI pointi1(4.0f, 6.0f);
794     pointi1 /= 2.0f;
795     EXPECT_EQ(2.0f, pointi1.GetX());
796     EXPECT_EQ(3.0f, pointi1.GetY());
797 }
798 
799 /**
800  * @tc.name: PointPointIDevideEqual002
801  * @tc.desc:
802  * @tc.type: FUNC
803  * @tc.require:AR000GGNV3
804  * @tc.author:
805  */
806 HWTEST_F(PointTest, PointPointIDevideEqual002, TestSize.Level1)
807 {
808     PointI pointi1(6.0f, 8.0f);
809     pointi1 /= 2.0f;
810     EXPECT_EQ(3.0f, pointi1.GetX());
811     EXPECT_EQ(4.0f, pointi1.GetY());
812 }
813 
814 /**
815  * @tc.name: PointPointIAdd001
816  * @tc.desc:
817  * @tc.type: FUNC
818  * @tc.require:AR000GGNV3
819  * @tc.author:
820  */
821 HWTEST_F(PointTest, PointPointIAdd001, TestSize.Level1)
822 {
823     PointI pointi1(1.0f, 2.0f);
824     PointI pointi2(2.0f, 1.0f);
825     PointI pointi3 = pointi1 + pointi2;
826     EXPECT_EQ(3.0f, pointi3.GetX());
827     EXPECT_EQ(3.0f, pointi3.GetY());
828 }
829 
830 /**
831  * @tc.name: PointPointIAdd002
832  * @tc.desc:
833  * @tc.type: FUNC
834  * @tc.require:AR000GGNV3
835  * @tc.author:
836  */
837 HWTEST_F(PointTest, PointPointIAdd002, TestSize.Level1)
838 {
839     PointI pointi1(2.0f, 3.0f);
840     PointI pointi2(4.0f, 5.0f);
841     PointI pointi3 = pointi1 + pointi2;
842     EXPECT_EQ(6.0f, pointi3.GetX());
843     EXPECT_EQ(8.0f, pointi3.GetY());
844 }
845 
846 /**
847  * @tc.name: PointPointIMinus001
848  * @tc.desc:
849  * @tc.type: FUNC
850  * @tc.require:AR000GGNV3
851  * @tc.author:
852  */
853 HWTEST_F(PointTest, PointPointIMinus001, TestSize.Level1)
854 {
855     PointI pointi1(1.0f, 2.0f);
856     PointI pointi2(2.0f, 1.0f);
857     PointI pointi3 = pointi1 - pointi2;
858     EXPECT_EQ(-1.0f, pointi3.GetX());
859     EXPECT_EQ(1.0f, pointi3.GetY());
860 }
861 
862 /**
863  * @tc.name: PointPointIMinus002
864  * @tc.desc:
865  * @tc.type: FUNC
866  * @tc.require:AR000GGNV3
867  * @tc.author:
868  */
869 HWTEST_F(PointTest, PointPointIMinus002, TestSize.Level1)
870 {
871     PointI pointi1(1.0f, 2.0f);
872     PointI pointi2(3.0f, 4.0f);
873     PointI pointi3 = pointi1 - pointi2;
874     EXPECT_EQ(-2.0f, pointi3.GetX());
875     EXPECT_EQ(-2.0f, pointi3.GetY());
876 }
877 
878 /**
879  * @tc.name: PointPointIMultiply001
880  * @tc.desc:
881  * @tc.type: FUNC
882  * @tc.require:AR000GGNV3
883  * @tc.author:
884  */
885 HWTEST_F(PointTest, PointPointIMultiply001, TestSize.Level1)
886 {
887     PointI pointi1(1.0f, 2.0f);
888     PointI pointi2 = 3.0f * pointi1;
889     EXPECT_EQ(3.0f, pointi2.GetX());
890     EXPECT_EQ(6.0f, pointi2.GetY());
891 }
892 
893 /**
894  * @tc.name: PointPointIMultiply002
895  * @tc.desc:
896  * @tc.type: FUNC
897  * @tc.require:AR000GGNV3
898  * @tc.author:
899  */
900 HWTEST_F(PointTest, PointPointIMultiply002, TestSize.Level1)
901 {
902     PointI pointi1(1.0f, 2.0f);
903     PointI pointi2 = 4.0f * pointi1;
904     EXPECT_EQ(4.0f, pointi2.GetX());
905     EXPECT_EQ(8.0f, pointi2.GetY());
906 }
907 
908 /**
909  * @tc.name: PointPointIMultiply003
910  * @tc.desc:
911  * @tc.type: FUNC
912  * @tc.require:AR000GGNV3
913  * @tc.author:
914  */
915 HWTEST_F(PointTest, PointPointIMultiply003, TestSize.Level1)
916 {
917     PointI pointi1(1.0f, 2.0f);
918     PointI pointi2 = pointi1 * 3.0f;
919     EXPECT_EQ(3.0f, pointi2.GetX());
920     EXPECT_EQ(6.0f, pointi2.GetY());
921 }
922 
923 /**
924  * @tc.name: PointPointIMultiply004
925  * @tc.desc:
926  * @tc.type: FUNC
927  * @tc.require:AR000GGNV3
928  * @tc.author:
929  */
930 HWTEST_F(PointTest, PointPointIMultiply004, TestSize.Level1)
931 {
932     PointI pointi1(1.0f, 2.0f);
933     PointI pointi2 = pointi1 * 4.0f;
934     EXPECT_EQ(4.0f, pointi2.GetX());
935     EXPECT_EQ(8.0f, pointi2.GetY());
936 }
937 
938 /**
939  * @tc.name: PointPointIDevide001
940  * @tc.desc:
941  * @tc.type: FUNC
942  * @tc.require:AR000GGNV3
943  * @tc.author:
944  */
945 HWTEST_F(PointTest, PointPointIDevide001, TestSize.Level1)
946 {
947     PointI pointi1(1.0f, 2.0f);
948     PointI pointi2 = pointi1 / 1.0f;
949     EXPECT_EQ(1.0f, pointi2.GetX());
950     EXPECT_EQ(2.0f, pointi2.GetY());
951 }
952 
953 /**
954  * @tc.name: PointPointIDevide002
955  * @tc.desc:
956  * @tc.type: FUNC
957  * @tc.require:AR000GGNV3
958  * @tc.author:
959  */
960 HWTEST_F(PointTest, PointPointIDevide002, TestSize.Level1)
961 {
962     PointI pointi1(4.0f, 8.0f);
963     PointI pointi2 = pointi1 / 2.0f;
964     EXPECT_EQ(2.0f, pointi2.GetX());
965     EXPECT_EQ(4.0f, pointi2.GetY());
966 }
967 
968 /**
969  * @tc.name: PointPointIPositive001
970  * @tc.desc:
971  * @tc.type: FUNC
972  * @tc.require:AR000GGNV3
973  * @tc.author:
974  */
975 HWTEST_F(PointTest, PointPointIPositive001, TestSize.Level1)
976 {
977     PointI pointi1(1.0f, 2.0f);
978     PointI pointi2 = +pointi1;
979     EXPECT_EQ(1.0f, pointi2.GetX());
980     EXPECT_EQ(2.0f, pointi2.GetY());
981 }
982 
983 /**
984  * @tc.name: PointPointIPositive002
985  * @tc.desc:
986  * @tc.type: FUNC
987  * @tc.require:AR000GGNV3
988  * @tc.author:
989  */
990 HWTEST_F(PointTest, PointPointIPositive002, TestSize.Level1)
991 {
992     PointI pointi1(3.0f, 4.0f);
993     PointI pointi2 = +pointi1;
994     EXPECT_EQ(3.0f, pointi2.GetX());
995     EXPECT_EQ(4.0f, pointi2.GetY());
996 }
997 
998 /**
999  * @tc.name: PointPointINegative001
1000  * @tc.desc:
1001  * @tc.type: FUNC
1002  * @tc.require:AR000GGNV3
1003  * @tc.author:
1004  */
1005 HWTEST_F(PointTest, PointPointINegative001, TestSize.Level1)
1006 {
1007     PointI pointi1(1.0f, 2.0f);
1008     PointI pointi2 = -pointi1;
1009     EXPECT_EQ(-1.0f, pointi2.GetX());
1010     EXPECT_EQ(-2.0f, pointi2.GetY());
1011 }
1012 
1013 /**
1014  * @tc.name: PointPointINegative002
1015  * @tc.desc:
1016  * @tc.type: FUNC
1017  * @tc.require:AR000GGNV3
1018  * @tc.author:
1019  */
1020 HWTEST_F(PointTest, PointPointINegative002, TestSize.Level1)
1021 {
1022     PointI pointi1(2.0f, 3.0f);
1023     PointI pointi2 = -pointi1;
1024     EXPECT_EQ(-2.0f, pointi2.GetX());
1025     EXPECT_EQ(-3.0f, pointi2.GetY());
1026 }
1027 
1028 /**
1029  * @tc.name: PointPointIEqual001
1030  * @tc.desc:
1031  * @tc.type: FUNC
1032  * @tc.require:AR000GGNV3
1033  * @tc.author:
1034  */
1035 HWTEST_F(PointTest, PointPointIEqual001, TestSize.Level1)
1036 {
1037     PointI pointi1(1.0f, 2.0f);
1038     PointI pointi2(1.0f, 2.0f);
1039     EXPECT_TRUE(pointi1 == pointi2);
1040 }
1041 
1042 /**
1043  * @tc.name: PointPointIEqual002
1044  * @tc.desc:
1045  * @tc.type: FUNC
1046  * @tc.require:AR000GGNV3
1047  * @tc.author:
1048  */
1049 HWTEST_F(PointTest, PointPointIEqual002, TestSize.Level1)
1050 {
1051     PointI pointi1(1.0f, 2.0f);
1052     PointI pointi2(2.0f, 3.0f);
1053     EXPECT_FALSE(pointi1 == pointi2);
1054 }
1055 
1056 /**
1057  * @tc.name: PointPointINotEqual001
1058  * @tc.desc:
1059  * @tc.type: FUNC
1060  * @tc.require:AR000GGNV3
1061  * @tc.author:
1062  */
1063 HWTEST_F(PointTest, PointPointINotEqual001, TestSize.Level1)
1064 {
1065     PointI pointi1(1.0f, 2.0f);
1066     PointI pointi2(2.0f, 3.0f);
1067     EXPECT_TRUE(pointi1 != pointi2);
1068 }
1069 
1070 /**
1071  * @tc.name: PointPointINotEqual002
1072  * @tc.desc:
1073  * @tc.type: FUNC
1074  * @tc.require:AR000GGNV3
1075  * @tc.author:
1076  */
1077 HWTEST_F(PointTest, PointPointINotEqual002, TestSize.Level1)
1078 {
1079     PointI pointi1(1.0f, 2.0f);
1080     PointI pointi2(1.0f, 2.0f);
1081     EXPECT_FALSE(pointi1 != pointi2);
1082 }
1083 } // namespace Drawing
1084 } // namespace Rosen
1085 } // namespace OHOS
1086