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, 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 "window_property.h"
19 #include "wm_common_inner.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace Rosen {
26 class WindowPropertyTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     virtual void SetUp() override;
31     virtual void TearDown() override;
32 };
33 
SetUpTestCase()34 void WindowPropertyTest::SetUpTestCase()
35 {
36 }
37 
TearDownTestCase()38 void WindowPropertyTest::TearDownTestCase()
39 {
40 }
41 
SetUp()42 void WindowPropertyTest::SetUp()
43 {
44 }
45 
TearDown()46 void WindowPropertyTest::TearDown()
47 {
48 }
49 
50 namespace {
51 /**
52  * @tc.name: MarshallingUnmarshalling
53  * @tc.desc: Marshalling Unmarshalling test
54  * @tc.type: FUNC
55  */
56 HWTEST_F(WindowPropertyTest, MarshallingUnmarshalling, Function | SmallTest | Level2)
57 {
58     WindowProperty winPropSrc;
59     winPropSrc.SetPrivacyMode(true);
60     winPropSrc.SetTransparent(true);
61     winPropSrc.SetTransform(Transform::Identity());
62 
63     Parcel parcel;
64     winPropSrc.Marshalling(parcel);
65     WindowProperty* winPropDst = winPropSrc.Unmarshalling(parcel);
66 
67     ASSERT_EQ(winPropDst->GetPrivacyMode(), true);
68     ASSERT_EQ(winPropDst->GetTransparent(), true);
69     ASSERT_EQ(winPropDst->GetTransform(), Transform::Identity());
70     delete winPropDst;
71 }
72 
73 /**
74  * @tc.name: CopyFrom
75  * @tc.desc: CopyFrom test
76  * @tc.type: FUNC
77  */
78 HWTEST_F(WindowPropertyTest, CopyFrom, Function | SmallTest | Level2)
79 {
80     const sptr<WindowProperty> winPropSrc = new(std::nothrow) WindowProperty();
81     winPropSrc->SetPrivacyMode(true);
82     winPropSrc->SetTransparent(true);
83     winPropSrc->SetTransform(Transform::Identity());
84 
85     WindowProperty winPropDst(winPropSrc); // winPropDst.CopyFrom(winPropSrc);
86 
87     ASSERT_EQ(winPropSrc->GetPrivacyMode(), winPropDst.GetPrivacyMode());
88     ASSERT_EQ(winPropSrc->GetTransparent(), winPropDst.GetTransparent());
89     ASSERT_EQ(winPropSrc->GetTransform(), winPropDst.GetTransform());
90 }
91 
92 /**
93  * @tc.name: Read
94  * @tc.desc: Read test
95  * @tc.type: FUNC
96  */
97 HWTEST_F(WindowPropertyTest, Read, Function | SmallTest | Level2)
98 {
99     WindowProperty winPropSrc;
100     winPropSrc.SetPrivacyMode(true);
101     winPropSrc.SetTransparent(true);
102 
103     Parcel parcel;
104     winPropSrc.Marshalling(parcel);
105 
106     WindowProperty winPropDst;
107     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_RECT);
108     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_MODE);
109     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_FLAGS);
110     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_OTHER_PROPS);
111     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_FOCUSABLE);
112     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_TOUCHABLE);
113     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_CALLING_WINDOW);
114     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_ORIENTATION);
115     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON);
116     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON);
117     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS);
118     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO);
119     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA);
120     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_TRANSFORM_PROPERTY);
121     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG);
122     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE);
123     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE);
124 
125     ASSERT_EQ(false, winPropDst.GetPrivacyMode());
126     ASSERT_EQ(false, winPropDst.GetTransparent());
127 }
128 
129 /**
130  * @tc.name: Write
131  * @tc.desc: Write test
132  * @tc.type: FUNC
133  */
134 HWTEST_F(WindowPropertyTest, Write, Function | SmallTest | Level2)
135 {
136     Parcel parcel;
137     WindowProperty winPropDst;
138     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_RECT));
139     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_MODE));
140     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_FLAGS));
141     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_OTHER_PROPS));
142     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_FOCUSABLE));
143     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_TOUCHABLE));
144     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_CALLING_WINDOW));
145     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_ORIENTATION));
146     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON));
147     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON));
148     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS));
149     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO));
150     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA));
151     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_TRANSFORM_PROPERTY));
152     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG));
153 }
154 
155 /**
156  * @tc.name: SetAbilityInfo
157  * @tc.desc: Test SetAbilityInfo and GetAbilityInfo
158  * @tc.type: FUNC
159  */
160 HWTEST_F(WindowPropertyTest, SetAbilityInfo, Function | SmallTest | Level2)
161 {
162     WindowProperty winPropDst;
163     AbilityInfo info;
164     info.bundleName_ = "testBundleName";
165     info.abilityName_ = "testAbilityName";
166     winPropDst.SetAbilityInfo(info);
167     ASSERT_EQ("testBundleName", winPropDst.GetAbilityInfo().bundleName_);
168     ASSERT_EQ("testAbilityName", winPropDst.GetAbilityInfo().abilityName_);
169 }
170 
171 /**
172  * @tc.name: ResumeLastWindowMode
173  * @tc.desc: Test ResumeLastWindowMode
174  * @tc.type: FUNC
175  */
176 HWTEST_F(WindowPropertyTest, ResumeLastWindowMode, Function | SmallTest | Level2)
177 {
178     WindowProperty winPropDst;
179     winPropDst.windowModeSupportType_ = WindowModeSupport::WINDOW_MODE_SUPPORT_PIP;
180     winPropDst.lastMode_ = WindowMode::WINDOW_MODE_PIP;
181     winPropDst.mode_ = WindowMode::WINDOW_MODE_UNDEFINED;
182     winPropDst.ResumeLastWindowMode();
183     ASSERT_EQ(WindowMode::WINDOW_MODE_PIP, winPropDst.mode_);
184 
185     winPropDst.windowModeSupportType_ = WindowModeSupport::WINDOW_MODE_SUPPORT_SPLIT_SECONDARY;
186     winPropDst.lastMode_ = WindowMode::WINDOW_MODE_PIP;
187     winPropDst.mode_ = WindowMode::WINDOW_MODE_UNDEFINED;
188     winPropDst.ResumeLastWindowMode();
189     ASSERT_EQ(WindowMode::WINDOW_MODE_UNDEFINED, winPropDst.mode_);
190 
191     winPropDst.windowModeSupportType_ = WindowModeSupport::WINDOW_MODE_SUPPORT_FLOATING;
192     winPropDst.lastMode_ = WindowMode::WINDOW_MODE_PIP;
193     winPropDst.mode_ = WindowMode::WINDOW_MODE_UNDEFINED;
194     winPropDst.ResumeLastWindowMode();
195     ASSERT_EQ(WindowMode::WINDOW_MODE_FLOATING, winPropDst.mode_);
196 }
197 
198 /**
199  * @tc.name: AddWindowFlag001
200  * @tc.desc: AddWindowFlag test
201  * @tc.type: FUNC
202  */
203 HWTEST_F(WindowPropertyTest, AddWindowFlag001, Function | SmallTest | Level2)
204 {
205     WindowProperty winPropSrc;
206     int resultValue = 0;
207     WindowFlag flag = WindowFlag::WINDOW_FLAG_NEED_AVOID;
__anon70fc50590202() 208     std::function<void()> func = [&]() {
209         winPropSrc.AddWindowFlag(flag);
210         resultValue = 1;
211     };
212     func();
213     ASSERT_EQ(resultValue, 1);
214 }
215 
216 /**
217  * @tc.name: GetRequestRect002
218  * @tc.desc: GetRequestRect test
219  * @tc.type: FUNC
220  */
221 HWTEST_F(WindowPropertyTest, GetRequestRect001, Function | SmallTest | Level2)
222 {
223     WindowProperty winPropSrc;
224     Rect requestRect { 0, 0, 0, 0 };
225     winPropSrc.SetRequestRect(requestRect);
226     Rect res = winPropSrc.GetRequestRect();
227     ASSERT_EQ(res, requestRect);
228 }
229 
230 /**
231  * @tc.name: GetWindowSizeChangeReason003
232  * @tc.desc: GetWindowSizeChangeReason test
233  * @tc.type: FUNC
234  */
235 HWTEST_F(WindowPropertyTest, GetWindowSizeChangeReason003, Function | SmallTest | Level2)
236 {
237     WindowProperty winPropSrc;
238     WindowSizeChangeReason reason = WindowSizeChangeReason::UNDEFINED;
239     winPropSrc.SetWindowSizeChangeReason(reason);
240     WindowSizeChangeReason res = winPropSrc.GetWindowSizeChangeReason();
241     ASSERT_EQ(res, reason);
242 }
243 
244 /**
245  * @tc.name: GetFullScreen004
246  * @tc.desc: GetFullScreen test
247  * @tc.type: FUNC
248  */
249 HWTEST_F(WindowPropertyTest, GetFullScreen004, Function | SmallTest | Level2)
250 {
251     WindowProperty winPropSrc;
252     bool isFullScreen = true;
253     winPropSrc.SetFullScreen(isFullScreen);
254     bool res = winPropSrc.GetFullScreen();
255     ASSERT_EQ(res, isFullScreen);
256 }
257 
258 /**
259  * @tc.name: GetFocusable005
260  * @tc.desc: GetFocusable test
261  * @tc.type: FUNC
262  */
263 HWTEST_F(WindowPropertyTest, GetFocusable005, Function | SmallTest | Level2)
264 {
265     WindowProperty winPropSrc;
266     bool isFocusable = true;
267     winPropSrc.SetFocusable(isFocusable);
268     bool res = winPropSrc.GetFocusable();
269     ASSERT_EQ(res, isFocusable);
270 }
271 
272 /**
273  * @tc.name: GetTouchable006
274  * @tc.desc: GetTouchable test
275  * @tc.type: FUNC
276  */
277 HWTEST_F(WindowPropertyTest, GetTouchable006, Function | SmallTest | Level2)
278 {
279     WindowProperty winPropSrc;
280     bool isTouchable = true;
281     winPropSrc.SetTouchable(isTouchable);
282     bool res = winPropSrc.GetFocusable();
283     ASSERT_EQ(res, isTouchable);
284 }
285 
286 /**
287  * @tc.name: GetCallingWindow007
288  * @tc.desc: GetCallingWindow test
289  * @tc.type: FUNC
290  */
291 HWTEST_F(WindowPropertyTest, GetCallingWindow007, Function | SmallTest | Level2)
292 {
293     WindowProperty winPropSrc;
294     uint32_t windowId = 1;
295     winPropSrc.SetCallingWindow(windowId);
296     uint32_t res = winPropSrc.GetCallingWindow();
297     ASSERT_EQ(res, windowId);
298 }
299 
300 /**
301  * @tc.name: GetPrivacyMode008
302  * @tc.desc: GetPrivacyMode test
303  * @tc.type: FUNC
304  */
305 HWTEST_F(WindowPropertyTest, GetPrivacyMode008, Function | SmallTest | Level2)
306 {
307     WindowProperty winPropSrc;
308     bool isPrivate = true;
309     winPropSrc.SetPrivacyMode(isPrivate);
310     bool res = winPropSrc.GetPrivacyMode();
311     ASSERT_EQ(res, isPrivate);
312 }
313 
314 /**
315  * @tc.name: GetSystemPrivacyMode009
316  * @tc.desc: GetSystemPrivacyMode test
317  * @tc.type: FUNC
318  */
319 HWTEST_F(WindowPropertyTest, GetSystemPrivacyMode009, Function | SmallTest | Level2)
320 {
321     WindowProperty winPropSrc;
322     bool isSystemPrivate = true;
323     winPropSrc.SetSystemPrivacyMode(isSystemPrivate);
324     bool res = winPropSrc.GetSystemPrivacyMode();
325     ASSERT_EQ(res, isSystemPrivate);
326 }
327 
328 /**
329  * @tc.name: GetSnapshotSkip010
330  * @tc.desc: GetSnapshotSkip test
331  * @tc.type: FUNC
332  */
333 HWTEST_F(WindowPropertyTest, GetSnapshotSkip010, Function | SmallTest | Level2)
334 {
335     WindowProperty winPropSrc;
336     bool isSkip = true;
337     winPropSrc.SetSnapshotSkip(isSkip);
338     bool res = winPropSrc.GetSnapshotSkip();
339     ASSERT_EQ(res, isSkip);
340 }
341 
342 /**
343  * @tc.name: GetAlpha011
344  * @tc.desc: GetAlpha test
345  * @tc.type: FUNC
346  */
347 HWTEST_F(WindowPropertyTest, GetAlpha011, Function | SmallTest | Level2)
348 {
349     WindowProperty winPropSrc;
350     float alpha = 1;
351     winPropSrc.SetAlpha(alpha);
352     float res = winPropSrc.GetAlpha();
353     ASSERT_EQ(res, alpha);
354 }
355 
356 /**
357  * @tc.name: GetBrightness012
358  * @tc.desc: GetBrightness test
359  * @tc.type: FUNC
360  */
361 HWTEST_F(WindowPropertyTest, GetBrightness012, Function | SmallTest | Level2)
362 {
363     WindowProperty winPropSrc;
364     float brightness = 1;
365     winPropSrc.SetBrightness(brightness);
366     float res = winPropSrc.GetBrightness();
367     ASSERT_EQ(res, brightness);
368 }
369 
370 /**
371  * @tc.name: IsTurnScreenOn013
372  * @tc.desc: IsTurnScreenOn test
373  * @tc.type: FUNC
374  */
375 HWTEST_F(WindowPropertyTest, IsTurnScreenOn013, Function | SmallTest | Level2)
376 {
377     WindowProperty winPropSrc;
378     bool turnScreenOn = true;
379     winPropSrc.SetTurnScreenOn(turnScreenOn);
380     bool res = winPropSrc.IsTurnScreenOn();
381     ASSERT_EQ(res, turnScreenOn);
382 }
383 
384 /**
385  * @tc.name: IsKeepScreenOn014
386  * @tc.desc: IsKeepScreenOn test
387  * @tc.type: FUNC
388  */
389 HWTEST_F(WindowPropertyTest, IsKeepScreenOn014, Function | SmallTest | Level2)
390 {
391     WindowProperty winPropSrc;
392     bool keepScreenOn = true;
393     winPropSrc.SetKeepScreenOn(keepScreenOn);
394     bool res = winPropSrc.IsKeepScreenOn();
395     ASSERT_EQ(res, keepScreenOn);
396 }
397 
398 /**
399  * @tc.name: GetWindowFlags015
400  * @tc.desc: GetWindowFlags test
401  * @tc.type: FUNC
402  */
403 HWTEST_F(WindowPropertyTest, GetWindowFlags015, Function | SmallTest | Level2)
404 {
405     WindowProperty winPropSrc;
406     uint32_t flags = 1;
407     winPropSrc.SetWindowFlags(flags);
408     uint32_t res = winPropSrc.GetWindowFlags();
409     ASSERT_EQ(res, flags);
410 }
411 
412 /**
413  * @tc.name: GetSystemBarProperty016
414  * @tc.desc: GetSystemBarProperty test
415  * @tc.type: FUNC
416  */
417 HWTEST_F(WindowPropertyTest, GetSystemBarProperty016, Function | SmallTest | Level2)
418 {
419     WindowProperty winPropSrc;
420     SystemBarProperty property;
421     WindowType type = WindowType::WINDOW_TYPE_STATUS_BAR;
422     winPropSrc.SetSystemBarProperty(type, property);
423     std::unordered_map<WindowType, SystemBarProperty> res = winPropSrc.GetSystemBarProperty();
424     ASSERT_EQ(res[type], property);
425 }
426 
427 /**
428  * @tc.name: GetStretchable017
429  * @tc.desc: GetHitOffset test
430  * @tc.type: FUNC
431  */
432 HWTEST_F(WindowPropertyTest, GetStretchable017, Function | SmallTest | Level2)
433 {
434     WindowProperty winPropSrc;
435     bool stretchable = true;
436     winPropSrc.SetStretchable(stretchable);
437     bool res = winPropSrc.GetStretchable();
438     ASSERT_EQ(res, stretchable);
439 }
440 
441 /**
442  * @tc.name: GetAnimationFlag018
443  * @tc.desc: GetAnimationFlag test
444  * @tc.type: FUNC
445  */
446 HWTEST_F(WindowPropertyTest, GetAnimationFlag018, Function | SmallTest | Level2)
447 {
448     WindowProperty winPropSrc;
449     uint32_t animationFlag = 1;
450     winPropSrc.SetAnimationFlag(animationFlag);
451     uint32_t res = winPropSrc.GetAnimationFlag();
452     ASSERT_EQ(res, animationFlag);
453 }
454 
455 /**
456  * @tc.name: GetWindowModeSupportType019
457  * @tc.desc: GetWindowModeSupportType test
458  * @tc.type: FUNC
459  */
460 HWTEST_F(WindowPropertyTest, GetWindowModeSupportType019, Function | SmallTest | Level2)
461 {
462     WindowProperty winPropSrc;
463     uint32_t windowModeSupportType = 1;
464     winPropSrc.SetWindowModeSupportType(windowModeSupportType);
465     uint32_t res = winPropSrc.GetWindowModeSupportType();
466     ASSERT_EQ(res, windowModeSupportType);
467 }
468 
469 /**
470  * @tc.name: GetRequestWindowModeSupportType020
471  * @tc.desc: GetRequestWindowModeSupportType test
472  * @tc.type: FUNC
473  */
474 HWTEST_F(WindowPropertyTest, GetRequestWindowModeSupportType020, Function | SmallTest | Level2)
475 {
476     WindowProperty winPropSrc;
477     uint32_t requestWindowModeSupportType = 1;
478     winPropSrc.SetRequestWindowModeSupportType(requestWindowModeSupportType);
479     uint32_t res = winPropSrc.GetRequestWindowModeSupportType();
480     ASSERT_EQ(res, requestWindowModeSupportType);
481 }
482 
483 /**
484  * @tc.name: GetTokenState021
485  * @tc.desc: GetTokenState test
486  * @tc.type: FUNC
487  */
488 HWTEST_F(WindowPropertyTest, GetTokenState021, Function | SmallTest | Level2)
489 {
490     WindowProperty winPropSrc;
491     bool hasToken = true;
492     winPropSrc.SetTokenState(hasToken);
493     bool res = winPropSrc.GetTokenState();
494     ASSERT_EQ(res, hasToken);
495 }
496 
497 /**
498  * @tc.name: GetDragType022
499  * @tc.desc: GetDragType test
500  * @tc.type: FUNC
501  */
502 HWTEST_F(WindowPropertyTest, GetDragType022, Function | SmallTest | Level2)
503 {
504     WindowProperty winPropSrc;
505     DragType dragType = DragType::DRAG_UNDEFINED;
506     winPropSrc.SetDragType(dragType);
507     DragType res = winPropSrc.GetDragType();
508     ASSERT_EQ(res, dragType);
509 }
510 
511 /**
512  * @tc.name: GetOriginRect023
513  * @tc.desc: GetOriginRect test
514  * @tc.type: FUNC
515  */
516 HWTEST_F(WindowPropertyTest, GetOriginRect023, Function | SmallTest | Level2)
517 {
518     WindowProperty winPropSrc;
519     Rect rect = { 0, 0, 0, 0 };
520     winPropSrc.SetOriginRect(rect);
521     Rect res = winPropSrc.GetOriginRect();
522     ASSERT_EQ(res, rect);
523 }
524 
525 /**
526  * @tc.name: SetTouchHotAreas028
527  * @tc.desc: SetTouchHotAreas test
528  * @tc.type: FUNC
529  */
530 HWTEST_F(WindowPropertyTest, SetTouchHotAreas028, Function | SmallTest | Level2)
531 {
532     WindowProperty winPropSrc;
533     std::vector<Rect> rects;
534     winPropSrc.SetTouchHotAreas(rects);
535     winPropSrc.GetTouchHotAreas(rects);
536     ASSERT_EQ(rects, winPropSrc.touchHotAreas_);
537 }
538 
539 /**
540  * @tc.name: SetAspectRatio029
541  * @tc.desc: SetAspectRatio test
542  * @tc.type: FUNC
543  */
544 HWTEST_F(WindowPropertyTest, SetAspectRatio029, Function | SmallTest | Level2)
545 {
546     WindowProperty winPropSrc;
547     float ratio = 1;
548     winPropSrc.SetAspectRatio(ratio);
549     float res = winPropSrc.GetAspectRatio();
550     ASSERT_EQ(res, ratio);
551 }
552 
553 /**
554  * @tc.name: SetMaximizeMode030
555  * @tc.desc: SetMaximizeMode test
556  * @tc.type: FUNC
557  */
558 HWTEST_F(WindowPropertyTest, SetMaximizeMode030, Function | SmallTest | Level2)
559 {
560     WindowProperty winPropSrc;
561     MaximizeMode maximizeMode = { MaximizeMode::MODE_RECOVER };
562     winPropSrc.SetMaximizeMode(maximizeMode);
563     MaximizeMode res = winPropSrc.GetMaximizeMode();
564     ASSERT_EQ(res, maximizeMode);
565 }
566 
567 /**
568  * @tc.name: GetAccessTokenId031
569  * @tc.desc: GetAccessTokenId test
570  * @tc.type: FUNC
571  */
572 HWTEST_F(WindowPropertyTest, GetAccessTokenId031, Function | SmallTest | Level2)
573 {
574     WindowProperty winPropSrc;
575     uint32_t accessTokenId = 1;
576     winPropSrc.SetAccessTokenId(accessTokenId);
577     uint32_t res = winPropSrc.GetAccessTokenId();
578     ASSERT_EQ(res, accessTokenId);
579 }
580 
581 /**
582  * @tc.name: SetWindowGravity032
583  * @tc.desc: SetWindowGravity test
584  * @tc.type: FUNC
585  */
586 HWTEST_F(WindowPropertyTest, GetAccessTokenId032, Function | SmallTest | Level2)
587 {
588     WindowProperty winPropSrc;
589     WindowGravity gravity = WindowGravity::WINDOW_GRAVITY_FLOAT;
590     uint32_t percent = 1;
591     winPropSrc.SetWindowGravity(gravity, percent);
592     winPropSrc.GetWindowGravity(gravity, percent);
593     ASSERT_EQ(gravity, winPropSrc.windowGravity_);
594     ASSERT_EQ(percent, winPropSrc.windowGravitySizePercent_);
595 }
596 
597 /**
598  * @tc.name: Write033
599  * @tc.desc: Write test
600  * @tc.type: FUNC
601  */
602 HWTEST_F(WindowPropertyTest, Write033, Function | SmallTest | Level2)
603 {
604     WindowProperty winPropDst;
605     Parcel parcel;
606     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE));
607     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE));
608     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP));
609     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO));
610     ASSERT_EQ(true, winPropDst.Write(parcel, PropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE));
611 }
612 
613 /**
614  * @tc.name: Read034
615  * @tc.desc: Read test
616  * @tc.type: FUNC
617  */
618 HWTEST_F(WindowPropertyTest, Read034, Function | SmallTest | Level2)
619 {
620     WindowProperty winPropSrc;
621     winPropSrc.SetPrivacyMode(true);
622     winPropSrc.SetTransparent(true);
623 
624     Parcel parcel;
625     winPropSrc.Marshalling(parcel);
626 
627     WindowProperty winPropDst;
628     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP);
629     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO);
630     winPropDst.Read(parcel, PropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE);
631 
632     ASSERT_EQ(false, winPropDst.GetPrivacyMode());
633     ASSERT_EQ(false, winPropDst.GetTransparent());
634 }
635 
636 /**
637  * @tc.name: GetTextFieldPositionY035
638  * @tc.desc: GetTextFieldPositionY test
639  * @tc.type: FUNC
640  */
641 HWTEST_F(WindowPropertyTest, GetTextFieldPositionY035, Function | SmallTest | Level2)
642 {
643     WindowProperty winPropSrc;
644     double textFieldPositionY = 1;
645     winPropSrc.SetTextFieldPositionY(textFieldPositionY);
646     double res = winPropSrc.GetTextFieldPositionY();
647     ASSERT_EQ(res, textFieldPositionY);
648 }
649 
650 /**
651  * @tc.name: GetTextFieldHeight036
652  * @tc.desc: GetTextFieldHeight test
653  * @tc.type: FUNC
654  */
655 HWTEST_F(WindowPropertyTest, GetTextFieldHeight36, Function | SmallTest | Level2)
656 {
657     WindowProperty winPropSrc;
658     double textFieldHeight = 1;
659     winPropSrc.SetTextFieldHeight(textFieldHeight);
660     double res = winPropSrc.GetTextFieldHeight();
661     ASSERT_EQ(res, textFieldHeight);
662 }
663 }
664 } // namespace Rosen
665 } // namespace OHOS