• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 "screen_property.h"
17 #include <gtest/gtest.h>
18 
19 // using namespace FRAME_TRACE;
20 using namespace testing;
21 using namespace testing::ext;
22 namespace OHOS {
23 namespace Rosen {
24 class ScreenPropertyTest : public testing::Test {
25   public:
ScreenPropertyTest()26     ScreenPropertyTest() {}
~ScreenPropertyTest()27     ~ScreenPropertyTest() {}
28 };
29 
30 namespace {
31 /**
32  * @tc.name: SetScreenRotation
33  * @tc.desc: normal function
34  * @tc.type: FUNC
35  */
36 HWTEST_F(ScreenPropertyTest, SetScreenRotation, Function | SmallTest | Level2)
37 {
38     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenRotation start";
39     ScreenProperty* property = new(std::nothrow) ScreenProperty();
40     int64_t ret = 0;
41     Rotation rotation = Rotation::ROTATION_0;
42     property->SetScreenRotation(rotation);
43 
44     rotation = Rotation::ROTATION_90;
45     property->SetScreenRotation(rotation);
46 
47     rotation = Rotation::ROTATION_180;
48     property->SetScreenRotation(rotation);
49 
50     rotation = Rotation::ROTATION_270;
51     property->SetScreenRotation(rotation);
52     ASSERT_EQ(ret, 0);
53     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenRotation end";
54 }
55 
56 /**
57  * @tc.name: UpdateDeviceRotation
58  * @tc.desc: normal function
59  * @tc.type: FUNC
60  */
61 HWTEST_F(ScreenPropertyTest, UpdateDeviceRotation, Function | SmallTest | Level2)
62 {
63     GTEST_LOG_(INFO) << "ScreenPropertyTest: UpdateDeviceRotation start";
64     ScreenProperty* property = new(std::nothrow) ScreenProperty();
65     Rotation ret = Rotation::ROTATION_0;
66     Rotation rotation = Rotation::ROTATION_0;
67     property->UpdateDeviceRotation(rotation);
68     ret = property->GetDeviceRotation();
69     ASSERT_EQ(ret, rotation);
70 
71     rotation = Rotation::ROTATION_90;
72     property->UpdateDeviceRotation(rotation);
73     ret = property->GetDeviceRotation();
74     ASSERT_EQ(ret, rotation);
75 
76     rotation = Rotation::ROTATION_180;
77     property->UpdateDeviceRotation(rotation);
78     ret = property->GetDeviceRotation();
79     ASSERT_EQ(ret, rotation);
80 
81     rotation = Rotation::ROTATION_270;
82     property->UpdateDeviceRotation(rotation);
83     ret = property->GetDeviceRotation();
84     ASSERT_EQ(ret, rotation);
85     GTEST_LOG_(INFO) << "ScreenPropertyTest: UpdateDeviceRotation end";
86 }
87 
88 /**
89  * @tc.name: SetDeviceOrientation
90  * @tc.desc: normal function
91  * @tc.type: FUNC
92  */
93 HWTEST_F(ScreenPropertyTest, SetDeviceOrientation, Function | SmallTest | Level2)
94 {
95     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDeviceOrientation start";
96     ScreenProperty* property = new(std::nothrow) ScreenProperty();
97     DisplayOrientation ret = DisplayOrientation::PORTRAIT;
98     DisplayOrientation displayOrientation = DisplayOrientation::PORTRAIT;
99     property->SetDeviceOrientation(displayOrientation);
100     ret = property->GetDeviceOrientation();
101     ASSERT_EQ(ret, displayOrientation);
102 
103     displayOrientation = DisplayOrientation::LANDSCAPE;
104     property->SetDeviceOrientation(displayOrientation);
105     ret = property->GetDeviceOrientation();
106     ASSERT_EQ(ret, displayOrientation);
107 
108     displayOrientation = DisplayOrientation::PORTRAIT_INVERTED;
109     property->SetDeviceOrientation(displayOrientation);
110     ret = property->GetDeviceOrientation();
111     ASSERT_EQ(ret, displayOrientation);
112 
113     displayOrientation = DisplayOrientation::LANDSCAPE_INVERTED;
114     property->SetDeviceOrientation(displayOrientation);
115     ret = property->GetDeviceOrientation();
116     ASSERT_EQ(ret, displayOrientation);
117     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDeviceOrientation end";
118 }
119 
120 /**
121  * @tc.name: UpdateVirtualPixelRatio
122  * @tc.desc: normal function
123  * @tc.type: FUNC
124  */
125 HWTEST_F(ScreenPropertyTest, UpdateVirtualPixelRatio, Function | SmallTest | Level2)
126 {
127     GTEST_LOG_(INFO) << "ScreenPropertyTest: UpdateVirtualPixelRatio start";
128     ScreenProperty* property = new(std::nothrow) ScreenProperty();
129     int64_t ret = 0;
130     RRect bounds;
131     bounds.rect_.width_ = 1344;
132     bounds.rect_.height_ = 2772;
133 
134     property->UpdateVirtualPixelRatio(bounds);
135 
136     bounds.rect_.height_ = 1111;
137     property->UpdateVirtualPixelRatio(bounds);
138 
139     bounds.rect_.width_ = 1111;
140     bounds.rect_.height_ = 2772;
141     property->UpdateVirtualPixelRatio(bounds);
142 
143     bounds.rect_.width_ = 1111;
144     bounds.rect_.height_ = 1111;
145     property->UpdateVirtualPixelRatio(bounds);
146     ASSERT_EQ(ret, 0);
147     GTEST_LOG_(INFO) << "ScreenPropertyTest: UpdateVirtualPixelRatio end";
148 }
149 
150 /**
151  * @tc.name: SetBounds
152  * @tc.desc: normal function
153  * @tc.type: FUNC
154  */
155 HWTEST_F(ScreenPropertyTest, SetBounds, Function | SmallTest | Level2)
156 {
157     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetBounds start";
158     ScreenProperty* property = new(std::nothrow) ScreenProperty();
159     int64_t ret = 0;
160     RRect bounds;
161     bounds.rect_.width_ = 1344;
162     bounds.rect_.height_ = 2772;
163 
164     uint32_t phyWidth = UINT32_MAX;
165     property->SetPhyWidth(phyWidth);
166     uint32_t phyHeigth = UINT32_MAX;
167     property->SetPhyHeight(phyHeigth);
168     property->SetBounds(bounds);
169 
170     bounds.rect_.width_ = 2772;
171     bounds.rect_.height_ = 1344;
172 
173     uint32_t phyWidth1 = 2772;
174     property->SetPhyWidth(phyWidth1);
175     uint32_t phyHeigth1 = 1344;
176     property->SetPhyHeight(phyHeigth1);
177     property->SetBounds(bounds);
178     ASSERT_EQ(ret, 0);
179     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetBounds end";
180 }
181 
182 /**
183  * @tc.name: CalculateXYDpi
184  * @tc.desc: normal function
185  * @tc.type: FUNC
186  */
187 HWTEST_F(ScreenPropertyTest, CalculateXYDpi, Function | SmallTest | Level2)
188 {
189     GTEST_LOG_(INFO) << "ScreenPropertyTest: CalculateXYDpi start";
190     ScreenProperty* property = new(std::nothrow) ScreenProperty();
191     uint32_t phyWidth = 0;
192     uint32_t phyHeight = 0;
193     int ret = 0;
194     property->CalculateXYDpi(phyWidth, phyHeight);
195     phyWidth = 1;
196     phyHeight = 1;
197     property->CalculateXYDpi(phyWidth, phyHeight);
198     ASSERT_EQ(ret, 0);
199     delete property;
200     GTEST_LOG_(INFO) << "ScreenPropertyTest: CalculateXYDpi end";
201 }
202 
203 /**
204  * @tc.name: SetOffsetX
205  * @tc.desc: normal function
206  * @tc.type: FUNC
207  */
208 HWTEST_F(ScreenPropertyTest, SetOffsetX, Function | SmallTest | Level2)
209 {
210     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffsetX start";
211     ScreenProperty* property = new(std::nothrow) ScreenProperty();
212     int32_t offsetX = 0;
213     property->SetOffsetX(offsetX);
214     int32_t ret = property->GetOffsetX();
215     ASSERT_EQ(ret, offsetX);
216     delete property;
217     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffsetX end";
218 }
219 
220 /**
221  * @tc.name: SetOffsetY
222  * @tc.desc: normal function
223  * @tc.type: FUNC
224  */
225 HWTEST_F(ScreenPropertyTest, SetOffsetY, Function | SmallTest | Level2)
226 {
227     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffsetY start";
228     ScreenProperty* property = new(std::nothrow) ScreenProperty();
229     int32_t offsetY = 0;
230     property->SetOffsetY(offsetY);
231     int32_t ret = property->GetOffsetY();
232     ASSERT_EQ(ret, offsetY);
233     delete property;
234     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffsetY end";
235 }
236 
237 /**
238  * @tc.name: SetOffset
239  * @tc.desc: normal function
240  * @tc.type: FUNC
241  */
242 HWTEST_F(ScreenPropertyTest, SetOffset, Function | SmallTest | Level2)
243 {
244     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffset start";
245     ScreenProperty* property = new(std::nothrow) ScreenProperty();
246     int32_t offsetX = 0;
247     int32_t offsetY = 0;
248     property->SetOffset(offsetX, offsetY);
249     int32_t ret_x = property->GetOffsetX();
250     int32_t ret_y = property->GetOffsetY();
251     ASSERT_EQ(ret_x, offsetX);
252     ASSERT_EQ(ret_y, offsetY);
253     delete property;
254     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetOffset end";
255 }
256 
257 /**
258  * @tc.name: SetScreenRequestedOrientation
259  * @tc.desc: normal function
260  * @tc.type: FUNC
261  */
262 HWTEST_F(ScreenPropertyTest, SetScreenRequestedOrientation, Function | SmallTest | Level2)
263 {
264     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenRequestedOrientation start";
265     ScreenProperty* property = new(std::nothrow) ScreenProperty();
266     Orientation orientation = Orientation::UNSPECIFIED;
267     property->SetScreenRequestedOrientation(orientation);
268     Orientation ret = property->GetScreenRequestedOrientation();
269     ASSERT_EQ(ret, orientation);
270     delete property;
271     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenRequestedOrientation end";
272 }
273 
274 /**
275  * @tc.name: GetPhyHeight
276  * @tc.desc: normal function
277  * @tc.type: FUNC
278  */
279 HWTEST_F(ScreenPropertyTest, GetPhyHeight, Function | SmallTest | Level2)
280 {
281     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhyHeight start";
282     ScreenProperty* property = new(std::nothrow) ScreenProperty();
283     uint32_t phyHeight = 1;
284     property->SetPhyHeight(phyHeight);
285     int32_t ret = property->GetPhyHeight();
286     ASSERT_EQ(ret, phyHeight);
287     delete property;
288     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhyHeight end";
289 }
290 
291 /**
292  * @tc.name: SetRotation
293  * @tc.desc: normal function
294  * @tc.type: FUNC
295  */
296 HWTEST_F(ScreenPropertyTest, SetRotation, Function | SmallTest | Level2)
297 {
298     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetRotation start";
299     ScreenProperty* property = new(std::nothrow) ScreenProperty();
300     ASSERT_NE(property, nullptr);
301     float rotation = 2.0f;
302     property->SetRotation(rotation);
303     ASSERT_EQ(property->rotation_, rotation);
304     delete property;
305     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetRotation end";
306 }
307 
308 /**
309  * @tc.name: GetRotation
310  * @tc.desc: normal function
311  * @tc.type: FUNC
312  */
313 HWTEST_F(ScreenPropertyTest, GetRotation, Function | SmallTest | Level2)
314 {
315     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetRotation start";
316     ScreenProperty* property = new(std::nothrow) ScreenProperty();
317     ASSERT_NE(property, nullptr);
318     float rotation = property->GetRotation();
319     ASSERT_EQ(property->rotation_, rotation);
320     delete property;
321     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetRotation end";
322 }
323 
324 /**
325  * @tc.name: SetPhysicalRotation
326  * @tc.desc: normal function
327  * @tc.type: FUNC
328  */
329 HWTEST_F(ScreenPropertyTest, SetPhysicalRotation, Function | SmallTest | Level2)
330 {
331     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhysicalRotation start";
332     ScreenProperty* property = new(std::nothrow) ScreenProperty();
333     ASSERT_NE(property, nullptr);
334     float rotation = 2.0f;
335     property->SetPhysicalRotation(rotation);
336     ASSERT_EQ(property->physicalRotation_, rotation);
337     delete property;
338     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhysicalRotation end";
339 }
340 
341 /**
342  * @tc.name: GetPhysicalRotation
343  * @tc.desc: normal function
344  * @tc.type: FUNC
345  */
346 HWTEST_F(ScreenPropertyTest, GetPhysicalRotation, Function | SmallTest | Level2)
347 {
348     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhysicalRotation start";
349     ScreenProperty* property = new(std::nothrow) ScreenProperty();
350     ASSERT_NE(property, nullptr);
351     float rotation = property->GetPhysicalRotation();
352     ASSERT_EQ(property->physicalRotation_, rotation);
353     delete property;
354     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhysicalRotation end";
355 }
356 
357 /**
358  * @tc.name: SetScreenComponentRotation
359  * @tc.desc: normal function
360  * @tc.type: FUNC
361  */
362 HWTEST_F(ScreenPropertyTest, SetScreenComponentRotation, Function | SmallTest | Level2)
363 {
364     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenComponentRotation start";
365     ScreenProperty* property = new(std::nothrow) ScreenProperty();
366     ASSERT_NE(property, nullptr);
367     float rotation = 2.0f;
368     property->SetScreenComponentRotation(rotation);
369     ASSERT_EQ(property->screenComponentRotation_, rotation);
370     delete property;
371     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenComponentRotation end";
372 }
373 
374 /**
375  * @tc.name: GetScreenComponentRotation
376  * @tc.desc: normal function
377  * @tc.type: FUNC
378  */
379 HWTEST_F(ScreenPropertyTest, GetScreenComponentRotation, Function | SmallTest | Level2)
380 {
381     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenComponentRotation start";
382     ScreenProperty* property = new(std::nothrow) ScreenProperty();
383     ASSERT_NE(property, nullptr);
384     float rotation = property->GetScreenComponentRotation();
385     ASSERT_EQ(property->screenComponentRotation_, rotation);
386     delete property;
387     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenComponentRotation end";
388 }
389 
390 /**
391  * @tc.name: GetBounds
392  * @tc.desc: normal function
393  * @tc.type: FUNC
394  */
395 HWTEST_F(ScreenPropertyTest, GetBounds, Function | SmallTest | Level2)
396 {
397     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetBounds start";
398     ScreenProperty* property = new(std::nothrow) ScreenProperty();
399     ASSERT_NE(property, nullptr);
400     RRect bounds = property->GetBounds();
401     ASSERT_EQ(property->bounds_, bounds);
402     delete property;
403     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetBounds end";
404 }
405 
406 /**
407  * @tc.name: SetPhyBounds
408  * @tc.desc: normal function
409  * @tc.type: FUNC
410  */
411 HWTEST_F(ScreenPropertyTest, SetPhyBounds, Function | SmallTest | Level2)
412 {
413     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhyBounds start";
414     ScreenProperty* property = new(std::nothrow) ScreenProperty();
415     ASSERT_NE(property, nullptr);
416     RRect phyBounds;
417     phyBounds.rect_.width_ = 1344;
418     phyBounds.rect_.height_ = 2772;
419     property->SetPhyBounds(phyBounds);
420     ASSERT_EQ(property->phyBounds_, phyBounds);
421     delete property;
422     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhyBounds end";
423 }
424 
425 /**
426  * @tc.name: GetPhyBounds
427  * @tc.desc: normal function
428  * @tc.type: FUNC
429  */
430 HWTEST_F(ScreenPropertyTest, GetPhyBounds, Function | SmallTest | Level2)
431 {
432     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhyBounds start";
433     ScreenProperty* property = new(std::nothrow) ScreenProperty();
434     ASSERT_NE(property, nullptr);
435     RRect phyBounds = property->GetPhyBounds();
436     ASSERT_EQ(property->phyBounds_, phyBounds);
437     delete property;
438     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhyBounds end";
439 }
440 
441 /**
442  * @tc.name: GetDensity
443  * @tc.desc: normal function
444  * @tc.type: FUNC
445  */
446 HWTEST_F(ScreenPropertyTest, GetDensity, Function | SmallTest | Level2)
447 {
448     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDensity start";
449     ScreenProperty* property = new(std::nothrow) ScreenProperty();
450     ASSERT_NE(property, nullptr);
451     float virtualPixelRatio = 1.0f;
452     ASSERT_EQ(property->virtualPixelRatio_, virtualPixelRatio);
453     delete property;
454     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDensity end";
455 }
456 
457 /**
458  * @tc.name: GetDefaultDensity
459  * @tc.desc: normal function
460  * @tc.type: FUNC
461  */
462 HWTEST_F(ScreenPropertyTest, GetDefaultDensity, Function | SmallTest | Level2)
463 {
464     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDefaultDensity start";
465     ScreenProperty* property = new(std::nothrow) ScreenProperty();
466     ASSERT_NE(property, nullptr);
467     float defaultDensity = 1.0f;
468     ASSERT_EQ(property->GetDefaultDensity(), defaultDensity);
469     delete property;
470     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDefaultDensity end";
471 }
472 
473 /**
474  * @tc.name: SetDefaultDensity
475  * @tc.desc: normal function
476  * @tc.type: FUNC
477  */
478 HWTEST_F(ScreenPropertyTest, SetDefaultDensity, Function | SmallTest | Level2)
479 {
480     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDefaultDensity start";
481     ScreenProperty* property = new(std::nothrow) ScreenProperty();
482     ASSERT_NE(property, nullptr);
483     float defaultDensity = 1.0f;
484     property->SetDefaultDensity(defaultDensity);
485     ASSERT_EQ(property->defaultDensity_, defaultDensity);
486     delete property;
487     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDefaultDensity end";
488 }
489 
490 /**
491  * @tc.name: GetDensityInCurResolution
492  * @tc.desc: normal function
493  * @tc.type: FUNC
494  */
495 HWTEST_F(ScreenPropertyTest, GetDensityInCurResolution, Function | SmallTest | Level2)
496 {
497     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDensityInCurResolution start";
498     ScreenProperty* property = new(std::nothrow) ScreenProperty();
499     ASSERT_NE(property, nullptr);
500     float densityInCurResolution = 1.0f;
501     ASSERT_EQ(property->GetDensityInCurResolution(), densityInCurResolution);
502     delete property;
503     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetDensityInCurResolution end";
504 }
505 
506 /**
507  * @tc.name: SetDensityInCurResolution
508  * @tc.desc: normal function
509  * @tc.type: FUNC
510  */
511 HWTEST_F(ScreenPropertyTest, SetDensityInCurResolution, Function | SmallTest | Level2)
512 {
513     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDensityInCurResolution start";
514     ScreenProperty* property = new(std::nothrow) ScreenProperty();
515     ASSERT_NE(property, nullptr);
516     float densityInCurResolution = 1.0f;
517     property->SetDensityInCurResolution(densityInCurResolution);
518     ASSERT_EQ(property->densityInCurResolution_, densityInCurResolution);
519     delete property;
520     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetDensityInCurResolution end";
521 }
522 
523 /**
524  * @tc.name: GetPropertyChangeReason
525  * @tc.desc: normal function
526  * @tc.type: FUNC
527  */
528 HWTEST_F(ScreenPropertyTest, GetPropertyChangeReason, Function | SmallTest | Level2)
529 {
530     ScreenProperty* property = new(std::nothrow) ScreenProperty();
531     ASSERT_NE(property, nullptr);
532     std::string propertyChangeReason = "a";
533     std::string propertyChangeReason_copy = property->GetPropertyChangeReason();
534     property->SetPropertyChangeReason(propertyChangeReason);
535     ASSERT_EQ(propertyChangeReason, property->GetPropertyChangeReason());
536     property->SetPropertyChangeReason(propertyChangeReason_copy);
537 }
538 
539 /**
540  * @tc.name: CalcDefaultDisplayOrientation
541  * @tc.desc: bounds_.rect_.width_ > bounds_.rect_.height_
542  * @tc.type: FUNC
543  */
544 HWTEST_F(ScreenPropertyTest, CalcDefaultDisplayOrientation, Function | SmallTest | Level2)
545 {
546     ScreenProperty* property = new(std::nothrow) ScreenProperty();
547     ASSERT_NE(property, nullptr);
548     RRect bounds_temp = property->GetBounds();
549     RRect bounds;
550     bounds.rect_.width_ = 2772;
551     bounds.rect_.height_ = 1344;
552     property->SetBounds(bounds);
553     property->CalcDefaultDisplayOrientation();
554     ASSERT_EQ(DisplayOrientation::LANDSCAPE, property->GetDisplayOrientation());
555     property->SetBounds(bounds_temp);
556 }
557 
558 /**
559  * @tc.name: SetStartX
560  * @tc.desc: normal function
561  * @tc.type: FUNC
562  */
563 HWTEST_F(ScreenPropertyTest, SetStartX, Function | SmallTest | Level2)
564 {
565     ScreenProperty* property = new(std::nothrow) ScreenProperty();
566     ASSERT_NE(property, nullptr);
567     uint32_t ret = 100;
568     uint32_t ret_copy = property->GetStartX();
569     property->SetStartX(ret);
570     ASSERT_EQ(ret, property->GetStartX());
571     property->SetStartX(ret_copy);
572 }
573 
574 /**
575  * @tc.name: SetStartY
576  * @tc.desc: normal function
577  * @tc.type: FUNC
578  */
579 HWTEST_F(ScreenPropertyTest, SetStartY, Function | SmallTest | Level2)
580 {
581     ScreenProperty* property = new(std::nothrow) ScreenProperty();
582     ASSERT_NE(property, nullptr);
583     uint32_t ret = 100;
584     uint32_t ret_copy = property->GetStartY();
585     property->SetStartY(ret);
586     ASSERT_EQ(ret, property->GetStartY());
587     property->SetStartY(ret_copy);
588 }
589 
590 /**
591  * @tc.name: SetStartPosition
592  * @tc.desc: normal function
593  * @tc.type: FUNC
594  */
595 HWTEST_F(ScreenPropertyTest, SetStartPosition, Function | SmallTest | Level2)
596 {
597     ScreenProperty* property = new(std::nothrow) ScreenProperty();
598     ASSERT_NE(property, nullptr);
599     uint32_t ret_x = 100;
600     uint32_t ret_y = 200;
601     uint32_t retx_copy = property->GetStartX();
602     uint32_t rety_copy = property->GetStartY();
603     property->SetStartPosition(ret_x, ret_y);
604     ASSERT_EQ(100, property->GetStartX());
605     ASSERT_EQ(200, property->GetStartY());
606     property->SetStartPosition(retx_copy, rety_copy);
607 }
608 
609 /**
610  * @tc.name: SetScreenShape
611  * @tc.desc: normal function
612  * @tc.type: FUNC
613  */
614 HWTEST_F(ScreenPropertyTest, SetScreenShape, Function | SmallTest | Level2)
615 {
616     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenShape start";
617     ScreenProperty* property = new(std::nothrow) ScreenProperty();
618     ASSERT_NE(property, nullptr);
619     ScreenShape screenshape = ScreenShape::ROUND;
620     property->SetScreenShape(screenshape);
621     ASSERT_EQ(property->screenShape_, screenshape);
622     delete property;
623     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenShape end";
624 }
625 
626 /**
627  * @tc.name: GetScreenShape
628  * @tc.desc: normal function
629  * @tc.type: FUNC
630  */
631 HWTEST_F(ScreenPropertyTest, GetScreenShape, Function | SmallTest | Level2)
632 {
633     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenShape start";
634     ScreenProperty* property = new(std::nothrow) ScreenProperty();
635     ASSERT_NE(property, nullptr);
636     ScreenShape screenshape = ScreenShape::ROUND;
637     property->SetScreenShape(screenshape);
638     ASSERT_EQ(property->GetScreenShape(), screenshape);
639     delete property;
640     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenShape end";
641 }
642 
643 /**
644  * @tc.name: SetPointerActiveWidth
645  * @tc.desc: normal function
646  * @tc.type: FUNC
647  */
648 HWTEST_F(ScreenPropertyTest, SetPointerActiveWidth, Function | SmallTest | Level2)
649 {
650     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPointerActiveWidth start";
651     ScreenProperty* property = new(std::nothrow) ScreenProperty();
652     ASSERT_NE(property, nullptr);
653     uint32_t pointerActiveWidth = 123;
654     property->SetPointerActiveWidth(pointerActiveWidth);
655     ASSERT_EQ(property->pointerActiveWidth_, pointerActiveWidth);
656     delete property;
657     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPointerActiveWidth end";
658 }
659 
660 /**
661  * @tc.name: GetPointerActiveWidth
662  * @tc.desc: normal function
663  * @tc.type: FUNC
664  */
665 HWTEST_F(ScreenPropertyTest, GetPointerActiveWidth, Function | SmallTest | Level2)
666 {
667     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPointerActiveWidth start";
668     ScreenProperty* property = new(std::nothrow) ScreenProperty();
669     ASSERT_NE(property, nullptr);
670     uint32_t pointerActiveWidth = 123;
671     property->SetPointerActiveWidth(pointerActiveWidth);
672     ASSERT_EQ(property->GetPointerActiveWidth(), pointerActiveWidth);
673     delete property;
674     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPointerActiveWidth end";
675 }
676 
677 /**
678  * @tc.name: SetPointerActiveHeight
679  * @tc.desc: normal function
680  * @tc.type: FUNC
681  */
682 HWTEST_F(ScreenPropertyTest, SetPointerActiveHeight, Function | SmallTest | Level2)
683 {
684     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPointerActiveHeight start";
685     ScreenProperty* property = new(std::nothrow) ScreenProperty();
686     ASSERT_NE(property, nullptr);
687     uint32_t pointerActiveHeight = 321;
688     property->SetPointerActiveHeight(pointerActiveHeight);
689     ASSERT_EQ(property->pointerActiveHeight_, pointerActiveHeight);
690     delete property;
691     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPointerActiveHeight end";
692 }
693 
694 /**
695  * @tc.name: GetPointerActiveHeight
696  * @tc.desc: normal function
697  * @tc.type: FUNC
698  */
699 HWTEST_F(ScreenPropertyTest, GetPointerActiveHeight, Function | SmallTest | Level2)
700 {
701     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPointerActiveHeight start";
702     ScreenProperty* property = new(std::nothrow) ScreenProperty();
703     ASSERT_NE(property, nullptr);
704     uint32_t pointerActiveHeight = 321;
705     property->SetPointerActiveHeight(pointerActiveHeight);
706     ASSERT_EQ(property->GetPointerActiveHeight(), pointerActiveHeight);
707     delete property;
708     GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPointerActiveHeight end";
709 }
710 
711 /**
712 * @tc.name: SetX
713 * @tc.desc: normal function
714 * @tc.type: FUNC
715 */
716 HWTEST_F(ScreenPropertyTest, SetX, Function | SmallTest | Level2)
717 {
718     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetX start";
719     ScreenProperty* property = new(std::nothrow) ScreenProperty();
720     ASSERT_NE(property, nullptr);
721     int32_t ret = -1000;
722     int32_t ret_copy = property->GetX();
723     property->SetX(ret);
724     ASSERT_EQ(ret, property->GetX());
725     property->SetX(ret_copy);
726     delete property;
727     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetX end";
728 }
729 
730 /**
731 * @tc.name: SetY
732 * @tc.desc: normal function
733 * @tc.type: FUNC
734 */
735 HWTEST_F(ScreenPropertyTest, SetY, Function | SmallTest | Level2)
736 {
737     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetY start";
738     ScreenProperty* property = new(std::nothrow) ScreenProperty();
739     ASSERT_NE(property, nullptr);
740     int32_t ret = -1000;
741     int32_t ret_copy = property->GetY();
742     property->SetY(ret);
743     ASSERT_EQ(ret, property->GetY());
744     property->SetY(ret_copy);
745     delete property;
746     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetY end";
747 }
748 
749 /**
750 * @tc.name: SetXYPosition
751 * @tc.desc: normal function
752 * @tc.type: FUNC
753 */
754 HWTEST_F(ScreenPropertyTest, SetXYPosition, Function | SmallTest | Level2)
755 {
756     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetXYPosition start";
757     ScreenProperty* property = new(std::nothrow) ScreenProperty();
758     ASSERT_NE(property, nullptr);
759     int32_t ret_x = 1000;
760     int32_t ret_y = 2000;
761     int32_t retx_copy = property->GetX();
762     int32_t rety_copy = property->GetY();
763     property->SetXYPosition(ret_x, ret_y);
764     ASSERT_EQ(1000, property->GetX());
765     ASSERT_EQ(2000, property->GetY());
766     property->SetXYPosition(retx_copy, rety_copy);
767     delete property;
768     GTEST_LOG_(INFO) << "ScreenPropertyTest: SetXYPosition end";
769 }
770 } // namespace
771 } // namespace Rosen
772 } // namespace OHOS
773