• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, 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/rect.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 RectTest : 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 RectTest::SetUpTestCase() {}
TearDownTestCase()36 void RectTest::TearDownTestCase() {}
SetUp()37 void RectTest::SetUp() {}
TearDown()38 void RectTest::TearDown() {}
39 
40 /**
41  * @tc.name: RectFCreateAndDestroy001
42  * @tc.desc:
43  * @tc.type: FUNC
44  * @tc.require:AR000GGNV3
45  * @tc.author:
46  */
47 HWTEST_F(RectTest, RectFCreateAndDestroy001, TestSize.Level1)
48 {
49     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
50     EXPECT_EQ(0.0f, rectF->GetLeft());
51     EXPECT_EQ(0.0f, rectF->GetTop());
52     EXPECT_EQ(0.0f, rectF->GetRight());
53     EXPECT_EQ(0.0f, rectF->GetBottom());
54 }
55 
56 /**
57  * @tc.name: RectFCreateAndDestroy002
58  * @tc.desc:
59  * @tc.type: FUNC
60  * @tc.require:AR000GGNV3
61  * @tc.author:
62  */
63 HWTEST_F(RectTest, RectFCreateAndDestroy002, TestSize.Level1)
64 {
65     RectF rectf1;
66     rectf1.SetLeft(1.0f);
67     RectF rectf2(rectf1);
68     EXPECT_EQ(rectf1.GetLeft(), rectf2.GetLeft());
69 }
70 
71 /**
72  * @tc.name: RectFCreateAndDestroy003
73  * @tc.desc:
74  * @tc.type: FUNC
75  * @tc.require:AR000GGNV3
76  * @tc.author:
77  */
78 HWTEST_F(RectTest, RectFCreateAndDestroy003, TestSize.Level1)
79 {
80     RectF rectf1;
81     rectf1.SetLeft(2.0f);
82     RectF rectf2(rectf1);
83     EXPECT_EQ(rectf1.GetLeft(), rectf2.GetLeft());
84 }
85 
86 /**
87  * @tc.name: RectFCreateAndDestroy004
88  * @tc.desc:
89  * @tc.type: FUNC
90  * @tc.require:AR000GGNV3
91  * @tc.author:
92  */
93 HWTEST_F(RectTest, RectFCreateAndDestroy004, TestSize.Level1)
94 {
95     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(1.0f, 2.0f, 3.0f, 4.0f);
96     EXPECT_EQ(1.0f, rectF->GetLeft());
97     EXPECT_EQ(2.0f, rectF->GetTop());
98     EXPECT_EQ(3.0f, rectF->GetRight());
99     EXPECT_EQ(4.0f, rectF->GetBottom());
100 }
101 
102 /**
103  * @tc.name: RectFCreateAndDestroy005
104  * @tc.desc:
105  * @tc.type: FUNC
106  * @tc.require:AR000GGNV3
107  * @tc.author:
108  */
109 HWTEST_F(RectTest, RectFCreateAndDestroy005, TestSize.Level1)
110 {
111     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(4.0f, 3.0f, 2.0f, 1.0f);
112     EXPECT_EQ(4.0f, rectF->GetLeft());
113     EXPECT_EQ(3.0f, rectF->GetTop());
114     EXPECT_EQ(2.0f, rectF->GetRight());
115     EXPECT_EQ(1.0f, rectF->GetBottom());
116 }
117 
118 /**
119  * @tc.name: RectFIsValid001
120  * @tc.desc:
121  * @tc.type: FUNC
122  * @tc.require:AR000GGNV3
123  * @tc.author:
124  */
125 HWTEST_F(RectTest, RectFIsValid001, TestSize.Level1)
126 {
127     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(4.0f, 3.0f, 2.0f, 1.0f);
128     EXPECT_FALSE(rectF->IsValid());
129 }
130 
131 /**
132  * @tc.name: RectFIsValid002
133  * @tc.desc:
134  * @tc.type: FUNC
135  * @tc.require:AR000GGNV3
136  * @tc.author:
137  */
138 HWTEST_F(RectTest, RectFIsValid002, TestSize.Level1)
139 {
140     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(1.0f, 2.0f, 3.0f, 4.0f);
141     EXPECT_TRUE(rectF->IsValid());
142 }
143 
144 /**
145  * @tc.name: RectFSetAndGetLeft001
146  * @tc.desc:
147  * @tc.type: FUNC
148  * @tc.require:AR000GGNV3
149  * @tc.author:
150  */
151 HWTEST_F(RectTest, RectFSetAndGetLeft001, TestSize.Level1)
152 {
153     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
154     rectF->SetLeft(1.0f);
155     EXPECT_EQ(1.0f, rectF->GetLeft());
156 }
157 
158 /**
159  * @tc.name: RectFSetAndGetLeft002
160  * @tc.desc:
161  * @tc.type: FUNC
162  * @tc.require:AR000GGNV3
163  * @tc.author:
164  */
165 HWTEST_F(RectTest, RectFSetAndGetLeft002, TestSize.Level1)
166 {
167     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
168     rectF->SetLeft(2.0f);
169     EXPECT_EQ(2.0f, rectF->GetLeft());
170 }
171 
172 /**
173  * @tc.name: RectFSetAndGetRight001
174  * @tc.desc:
175  * @tc.type: FUNC
176  * @tc.require:AR000GGNV3
177  * @tc.author:
178  */
179 HWTEST_F(RectTest, RectFSetAndGetRight001, TestSize.Level1)
180 {
181     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
182     rectF->SetRight(1.0f);
183     EXPECT_EQ(1.0f, rectF->GetRight());
184 }
185 
186 /**
187  * @tc.name: RectFSetAndGetRight002
188  * @tc.desc:
189  * @tc.type: FUNC
190  * @tc.require:AR000GGNV3
191  * @tc.author:
192  */
193 HWTEST_F(RectTest, RectFSetAndGetRight002, TestSize.Level1)
194 {
195     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
196     rectF->SetRight(2.0f);
197     EXPECT_EQ(2.0f, rectF->GetRight());
198 }
199 
200 /**
201  * @tc.name: RectFSetAndGetTop001
202  * @tc.desc:
203  * @tc.type: FUNC
204  * @tc.require:AR000GGNV3
205  * @tc.author:
206  */
207 HWTEST_F(RectTest, RectFSetAndGetTop001, TestSize.Level1)
208 {
209     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
210     rectF->SetTop(1.0f);
211     EXPECT_EQ(1.0f, rectF->GetTop());
212 }
213 
214 /**
215  * @tc.name: RectFSetAndGetTop002
216  * @tc.desc:
217  * @tc.type: FUNC
218  * @tc.require:AR000GGNV3
219  * @tc.author:
220  */
221 HWTEST_F(RectTest, RectFSetAndGetTop002, TestSize.Level1)
222 {
223     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
224     rectF->SetTop(2.0f);
225     EXPECT_EQ(2.0f, rectF->GetTop());
226 }
227 
228 /**
229  * @tc.name: RectFSetAndGetBottom001
230  * @tc.desc:
231  * @tc.type: FUNC
232  * @tc.require:AR000GGNV3
233  * @tc.author:
234  */
235 HWTEST_F(RectTest, RectFSetAndGetBottom001, TestSize.Level1)
236 {
237     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
238     rectF->SetBottom(1.0f);
239     EXPECT_EQ(1.0f, rectF->GetBottom());
240 }
241 
242 /**
243  * @tc.name: RectFSetAndGetBottom002
244  * @tc.desc:
245  * @tc.type: FUNC
246  * @tc.require:AR000GGNV3
247  * @tc.author:
248  */
249 HWTEST_F(RectTest, RectFSetAndGetBottom002, TestSize.Level1)
250 {
251     std::unique_ptr<RectF> rectF = std::make_unique<RectF>();
252     rectF->SetBottom(2.0f);
253     EXPECT_EQ(2.0f, rectF->GetBottom());
254 }
255 
256 /**
257  * @tc.name: RectFOffset001
258  * @tc.desc:
259  * @tc.type: FUNC
260  * @tc.require:AR000GGNV3
261  * @tc.author:
262  */
263 HWTEST_F(RectTest, RectFOffset001, TestSize.Level1)
264 {
265     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(1.0f, 2.0f, 3.0f, 4.0f);
266     rectF->Offset(1.0f, 2.0f);
267     EXPECT_EQ(2.0f, rectF->GetLeft());
268     EXPECT_EQ(4.0f, rectF->GetRight());
269     EXPECT_EQ(4.0f, rectF->GetTop());
270     EXPECT_EQ(6.0f, rectF->GetBottom());
271 }
272 
273 /**
274  * @tc.name: RectFOffset002
275  * @tc.desc:
276  * @tc.type: FUNC
277  * @tc.require:AR000GGNV3
278  * @tc.author:
279  */
280 HWTEST_F(RectTest, RectFOffset002, TestSize.Level1)
281 {
282     std::unique_ptr<RectF> rectF = std::make_unique<RectF>(1.0f, 2.0f, 3.0f, 4.0f);
283     rectF->Offset(2.0f, 1.0f);
284     EXPECT_EQ(3.0f, rectF->GetLeft());
285     EXPECT_EQ(5.0f, rectF->GetRight());
286     EXPECT_EQ(3.0f, rectF->GetTop());
287     EXPECT_EQ(5.0f, rectF->GetBottom());
288 }
289 
290 /**
291  * @tc.name: RectFEqual001
292  * @tc.desc:
293  * @tc.type: FUNC
294  * @tc.require:AR000GGNV3
295  * @tc.author:
296  */
297 HWTEST_F(RectTest, RectFEqual001, TestSize.Level1)
298 {
299     RectF rectf1;
300     RectF rectf2;
301     rectf1.SetLeft(1.0f);
302     EXPECT_FALSE(rectf1 == rectf2);
303 }
304 
305 /**
306  * @tc.name: RectFEqual002
307  * @tc.desc:
308  * @tc.type: FUNC
309  * @tc.require:AR000GGNV3
310  * @tc.author:
311  */
312 HWTEST_F(RectTest, RectFEqual002, TestSize.Level1)
313 {
314     RectF rectf1;
315     RectF rectf2;
316     EXPECT_TRUE(rectf1 == rectf2);
317 }
318 
319 /**
320  * @tc.name: RectFNotEqual001
321  * @tc.desc:
322  * @tc.type: FUNC
323  * @tc.require:AR000GGNV3
324  * @tc.author:
325  */
326 HWTEST_F(RectTest, RectFNotEqual001, TestSize.Level1)
327 {
328     RectF rectf1;
329     RectF rectf2;
330     EXPECT_FALSE(rectf1 != rectf2);
331 }
332 
333 /**
334  * @tc.name: RectFNotEqual002
335  * @tc.desc:
336  * @tc.type: FUNC
337  * @tc.require:AR000GGNV3
338  * @tc.author:
339  */
340 HWTEST_F(RectTest, RectFNotEqual002, TestSize.Level1)
341 {
342     RectF rectf1;
343     RectF rectf2;
344     rectf2.SetLeft(2.0f);
345     EXPECT_TRUE(rectf1 != rectf2);
346 }
347 
348 /**
349  * @tc.name: RectIntersect001
350  * @tc.desc: test for seting RectF to intersection.
351  * @tc.type: FUNC
352  * @tc.require: I6ZMMK
353  */
354 HWTEST_F(RectTest, RectIntersect001, TestSize.Level1)
355 {
356     RectF rectf1(1.0f, 2.0f, 3.0f, 4.0f);
357     RectF rectf2;
358     EXPECT_FALSE(rectf2.Intersect(rectf1));
359 }
360 
361 /**
362  * @tc.name: RectIntersect002
363  * @tc.desc: test for seting RectF to intersection.
364  * @tc.type: FUNC
365  * @tc.require: I6ZMMK
366  */
367 HWTEST_F(RectTest, RectIntersect002, TestSize.Level1)
368 {
369     RectF rectf1;
370     RectF rectf2;
371     EXPECT_FALSE(rectf2.Intersect(rectf1));
372 }
373 
374 /**
375  * @tc.name: RectIntersect003
376  * @tc.desc: test for seting RectF to intersection.
377  * @tc.type: FUNC
378  * @tc.require: I6ZMMK
379  */
380 HWTEST_F(RectTest, RectIntersect003, TestSize.Level1)
381 {
382     RectF rectf1(1.0f, 2.0f, 3.0f, 4.0f);
383     RectF rectf2(1.0f, 2.0f, 3.0f, 5.0f);
384     EXPECT_TRUE(rectf2.Intersect(rectf1));
385 }
386 
387 /**
388  * @tc.name: RectJoin001
389  * @tc.desc: test for seting RectF to the union of itself and other.
390  * @tc.type: FUNC
391  * @tc.require: I6ZMMK
392  */
393 HWTEST_F(RectTest, RectJoin001, TestSize.Level1)
394 {
395     RectF rectf1(1.0f, 2.0f, 3.0f, 4.0f);
396     RectF rectf2;
397     EXPECT_TRUE(rectf2.Join(rectf1));
398 }
399 
400 /**
401  * @tc.name: RectJoin002
402  * @tc.desc: test for seting RectF to the union of itself and other.
403  * @tc.type: FUNC
404  * @tc.require: I6ZMMK
405  */
406 HWTEST_F(RectTest, RectJoin002, TestSize.Level1)
407 {
408     RectF rectf1;
409     RectF rectf2;
410     EXPECT_FALSE(rectf2.Join(rectf1));
411 }
412 
413 /**
414  * @tc.name: RectJoin003
415  * @tc.desc: test for seting RectF to the union of itself and other.
416  * @tc.type: FUNC
417  * @tc.require: I6ZMMK
418  */
419 HWTEST_F(RectTest, RectJoin003, TestSize.Level1)
420 {
421     RectF rectf1(2.0f, 4.0f, 6.0f, 8.0f);
422     RectF rectf2(1.0f, 2.0f, 3.0f, 5.0f);
423     EXPECT_TRUE(rectf2.Join(rectf1));
424 }
425 
426 /**
427  * @tc.name: RectICreateAndDestroy001
428  * @tc.desc:
429  * @tc.type: FUNC
430  * @tc.require:AR000GGNV3
431  * @tc.author:
432  */
433 HWTEST_F(RectTest, RectICreateAndDestroy001, TestSize.Level1)
434 {
435     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
436     EXPECT_EQ(0.0f, rectI->GetLeft());
437     EXPECT_EQ(0.0f, rectI->GetTop());
438     EXPECT_EQ(0.0f, rectI->GetRight());
439     EXPECT_EQ(0.0f, rectI->GetBottom());
440 }
441 
442 /**
443  * @tc.name: RectICreateAndDestroy002
444  * @tc.desc:
445  * @tc.type: FUNC
446  * @tc.require:AR000GGNV3
447  * @tc.author:
448  */
449 HWTEST_F(RectTest, RectICreateAndDestroy002, TestSize.Level1)
450 {
451     RectI recti1;
452     recti1.SetLeft(1.0f);
453     RectI recti2(recti1);
454     EXPECT_EQ(recti1.GetLeft(), recti2.GetLeft());
455 }
456 
457 /**
458  * @tc.name: RectICreateAndDestroy003
459  * @tc.desc:
460  * @tc.type: FUNC
461  * @tc.require:AR000GGNV3
462  * @tc.author:
463  */
464 HWTEST_F(RectTest, RectICreateAndDestroy003, TestSize.Level1)
465 {
466     RectI recti1;
467     recti1.SetLeft(2.0f);
468     RectI recti2(recti1);
469     EXPECT_EQ(recti1.GetLeft(), recti2.GetLeft());
470 }
471 
472 /**
473  * @tc.name: RectICreateAndDestroy004
474  * @tc.desc:
475  * @tc.type: FUNC
476  * @tc.require:AR000GGNV3
477  * @tc.author:
478  */
479 HWTEST_F(RectTest, RectICreateAndDestroy004, TestSize.Level1)
480 {
481     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(1.0f, 2.0f, 3.0f, 4.0f);
482     EXPECT_EQ(1.0f, rectI->GetLeft());
483     EXPECT_EQ(2.0f, rectI->GetTop());
484     EXPECT_EQ(3.0f, rectI->GetRight());
485     EXPECT_EQ(4.0f, rectI->GetBottom());
486 }
487 
488 /**
489  * @tc.name: RectICreateAndDestroy005
490  * @tc.desc:
491  * @tc.type: FUNC
492  * @tc.require:AR000GGNV3
493  * @tc.author:
494  */
495 HWTEST_F(RectTest, RectICreateAndDestroy005, TestSize.Level1)
496 {
497     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(4.0f, 3.0f, 2.0f, 1.0f);
498     EXPECT_EQ(4.0f, rectI->GetLeft());
499     EXPECT_EQ(3.0f, rectI->GetTop());
500     EXPECT_EQ(2.0f, rectI->GetRight());
501     EXPECT_EQ(1.0f, rectI->GetBottom());
502 }
503 
504 /**
505  * @tc.name: RectIIsValid001
506  * @tc.desc:
507  * @tc.type: FUNC
508  * @tc.require:AR000GGNV3
509  * @tc.author:
510  */
511 HWTEST_F(RectTest, RectIIsValid001, TestSize.Level1)
512 {
513     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(4.0f, 3.0f, 2.0f, 1.0f);
514     EXPECT_FALSE(rectI->IsValid());
515 }
516 
517 /**
518  * @tc.name: RectIIsValid002
519  * @tc.desc:
520  * @tc.type: FUNC
521  * @tc.require:AR000GGNV3
522  * @tc.author:
523  */
524 HWTEST_F(RectTest, RectIIsValid002, TestSize.Level1)
525 {
526     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(1.0f, 2.0f, 3.0f, 4.0f);
527     EXPECT_TRUE(rectI->IsValid());
528 }
529 
530 /**
531  * @tc.name: RectISetAndGetLeft001
532  * @tc.desc:
533  * @tc.type: FUNC
534  * @tc.require:AR000GGNV3
535  * @tc.author:
536  */
537 HWTEST_F(RectTest, RectISetAndGetLeft001, TestSize.Level1)
538 {
539     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
540     rectI->SetLeft(1.0f);
541     EXPECT_EQ(1.0f, rectI->GetLeft());
542 }
543 
544 /**
545  * @tc.name: RectISetAndGetLeft002
546  * @tc.desc:
547  * @tc.type: FUNC
548  * @tc.require:AR000GGNV3
549  * @tc.author:
550  */
551 HWTEST_F(RectTest, RectISetAndGetLeft002, TestSize.Level1)
552 {
553     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
554     rectI->SetLeft(2.0f);
555     EXPECT_EQ(2.0f, rectI->GetLeft());
556 }
557 
558 /**
559  * @tc.name: RectISetAndGetRight001
560  * @tc.desc:
561  * @tc.type: FUNC
562  * @tc.require:AR000GGNV3
563  * @tc.author:
564  */
565 HWTEST_F(RectTest, RectISetAndGetRight001, TestSize.Level1)
566 {
567     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
568     rectI->SetRight(1.0f);
569     EXPECT_EQ(1.0f, rectI->GetRight());
570 }
571 
572 /**
573  * @tc.name: RectISetAndGetRight002
574  * @tc.desc:
575  * @tc.type: FUNC
576  * @tc.require:AR000GGNV3
577  * @tc.author:
578  */
579 HWTEST_F(RectTest, RectISetAndGetRight002, TestSize.Level1)
580 {
581     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
582     rectI->SetRight(2.0f);
583     EXPECT_EQ(2.0f, rectI->GetRight());
584 }
585 
586 /**
587  * @tc.name: RectISetAndGetTop001
588  * @tc.desc:
589  * @tc.type: FUNC
590  * @tc.require:AR000GGNV3
591  * @tc.author:
592  */
593 HWTEST_F(RectTest, RectISetAndGetTop001, TestSize.Level1)
594 {
595     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
596     rectI->SetTop(1.0f);
597     EXPECT_EQ(1.0f, rectI->GetTop());
598 }
599 
600 /**
601  * @tc.name: RectISetAndGetTop002
602  * @tc.desc:
603  * @tc.type: FUNC
604  * @tc.require:AR000GGNV3
605  * @tc.author:
606  */
607 HWTEST_F(RectTest, RectISetAndGetTop002, TestSize.Level1)
608 {
609     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
610     rectI->SetTop(2.0f);
611     EXPECT_EQ(2.0f, rectI->GetTop());
612 }
613 
614 /**
615  * @tc.name: RectISetAndGetBottom001
616  * @tc.desc:
617  * @tc.type: FUNC
618  * @tc.require:AR000GGNV3
619  * @tc.author:
620  */
621 HWTEST_F(RectTest, RectISetAndGetBottom001, TestSize.Level1)
622 {
623     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
624     rectI->SetBottom(1.0f);
625     EXPECT_EQ(1.0f, rectI->GetBottom());
626 }
627 
628 /**
629  * @tc.name: RectISetAndGetBottom002
630  * @tc.desc:
631  * @tc.type: FUNC
632  * @tc.require:AR000GGNV3
633  * @tc.author:
634  */
635 HWTEST_F(RectTest, RectISetAndGetBottom002, TestSize.Level1)
636 {
637     std::unique_ptr<RectI> rectI = std::make_unique<RectI>();
638     rectI->SetBottom(2.0f);
639     EXPECT_EQ(2.0f, rectI->GetBottom());
640 }
641 
642 /**
643  * @tc.name: RectIOffset001
644  * @tc.desc:
645  * @tc.type: FUNC
646  * @tc.require:AR000GGNV3
647  * @tc.author:
648  */
649 HWTEST_F(RectTest, RectIOffset001, TestSize.Level1)
650 {
651     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(1.0f, 2.0f, 3.0f, 4.0f);
652     rectI->Offset(1.0f, 2.0f);
653     EXPECT_EQ(2.0f, rectI->GetLeft());
654     EXPECT_EQ(4.0f, rectI->GetRight());
655     EXPECT_EQ(4.0f, rectI->GetTop());
656     EXPECT_EQ(6.0f, rectI->GetBottom());
657 }
658 
659 /**
660  * @tc.name: RectIOffset002
661  * @tc.desc:
662  * @tc.type: FUNC
663  * @tc.require:AR000GGNV3
664  * @tc.author:
665  */
666 HWTEST_F(RectTest, RectIOffset002, TestSize.Level1)
667 {
668     std::unique_ptr<RectI> rectI = std::make_unique<RectI>(1.0f, 2.0f, 3.0f, 4.0f);
669     rectI->Offset(2.0f, 1.0f);
670     EXPECT_EQ(3.0f, rectI->GetLeft());
671     EXPECT_EQ(5.0f, rectI->GetRight());
672     EXPECT_EQ(3.0f, rectI->GetTop());
673     EXPECT_EQ(5.0f, rectI->GetBottom());
674 }
675 
676 /**
677  * @tc.name: RectIEqual001
678  * @tc.desc:
679  * @tc.type: FUNC
680  * @tc.require:AR000GGNV3
681  * @tc.author:
682  */
683 HWTEST_F(RectTest, RectIEqual001, TestSize.Level1)
684 {
685     RectI recti1;
686     RectI recti2;
687     recti1.SetLeft(1.0f);
688     EXPECT_FALSE(recti1 == recti2);
689 }
690 
691 /**
692  * @tc.name: RectIEqual002
693  * @tc.desc:
694  * @tc.type: FUNC
695  * @tc.require:AR000GGNV3
696  * @tc.author:
697  */
698 HWTEST_F(RectTest, RectIEqual002, TestSize.Level1)
699 {
700     RectI recti1;
701     RectI recti2;
702     EXPECT_TRUE(recti1 == recti2);
703 }
704 
705 /**
706  * @tc.name: RectINotEqual001
707  * @tc.desc:
708  * @tc.type: FUNC
709  * @tc.require:AR000GGNV3
710  * @tc.author:
711  */
712 HWTEST_F(RectTest, RectINotEqual001, TestSize.Level1)
713 {
714     RectI recti1;
715     RectI recti2;
716     EXPECT_FALSE(recti1 != recti2);
717 }
718 
719 /**
720  * @tc.name: RectINotEqual002
721  * @tc.desc:
722  * @tc.type: FUNC
723  * @tc.require:AR000GGNV3
724  * @tc.author:
725  */
726 HWTEST_F(RectTest, RectINotEqual002, TestSize.Level1)
727 {
728     RectI recti1;
729     RectI recti2;
730     recti2.SetLeft(2.0f);
731     EXPECT_TRUE(recti1 != recti2);
732 }
733 
734 /**
735  * @tc.name: RectIIntersect001
736  * @tc.desc: test for seting RectI to intersection.
737  * @tc.type: FUNC
738  * @tc.require: I6ZMMK
739  */
740 HWTEST_F(RectTest, RectIIntersect001, TestSize.Level1)
741 {
742     RectI rectI1(1, 2, 3, 4);
743     RectI rectI2;
744     EXPECT_FALSE(rectI2.Intersect(rectI1));
745 }
746 
747 /**
748  * @tc.name: RectIIntersect002
749  * @tc.desc: test for seting RectI to intersection.
750  * @tc.type: FUNC
751  * @tc.require: I6ZMMK
752  */
753 HWTEST_F(RectTest, RectIIntersect002, TestSize.Level1)
754 {
755     RectI rectI1;
756     RectI rectI2;
757     EXPECT_TRUE(rectI2.Intersect(rectI1));
758 }
759 
760 /**
761  * @tc.name: RectIIntersect003
762  * @tc.desc: test for seting RectI to intersection.
763  * @tc.type: FUNC
764  * @tc.require: I6ZMMK
765  */
766 HWTEST_F(RectTest, RectIIntersect003, TestSize.Level1)
767 {
768     RectI rectI1(1, 2, 3, 4);
769     RectI rectI2(1, 2, 3, 5);
770     EXPECT_TRUE(rectI2.Intersect(rectI1));
771 }
772 
773 /**
774  * @tc.name: RectIJoin001
775  * @tc.desc: test for seting RectI to the union of itself and other.
776  * @tc.type: FUNC
777  * @tc.require: I6ZMMK
778  */
779 HWTEST_F(RectTest, RectIJoin001, TestSize.Level1)
780 {
781     RectI rectI1(1, 2, 3, 4);
782     RectI rectI2;
783     EXPECT_TRUE(rectI2.Join(rectI1));
784 }
785 
786 /**
787  * @tc.name: RectIJoin002
788  * @tc.desc: test for seting RectI to the union of itself and other.
789  * @tc.type: FUNC
790  * @tc.require: I6ZMMK
791  */
792 HWTEST_F(RectTest, RectIJoin002, TestSize.Level1)
793 {
794     RectI rectI1;
795     RectI rectI2;
796     EXPECT_TRUE(rectI2.Join(rectI1));
797 }
798 
799 /**
800  * @tc.name: RectIJoin003
801  * @tc.desc: test for seting RectI to the union of itself and other.
802  * @tc.type: FUNC
803  * @tc.require: I6ZMMK
804  */
805 HWTEST_F(RectTest, RectIJoin003, TestSize.Level1)
806 {
807     RectI rectI1(2, 4, 6, 8);
808     RectI rectI2(1, 2, 3, 5);
809     EXPECT_TRUE(rectI2.Join(rectI1));
810     EXPECT_EQ(rectI2.GetLeft(), 1);
811     EXPECT_EQ(rectI2.GetBottom(), 8);
812 }
813 } // namespace Drawing
814 } // namespace Rosen
815 } // namespace OHOS