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 "common/rs_vector4.h"
19 #include "rs_window_animation_stub.h"
20 #include "rs_window_animation_finished_callback.h"
21 #include "rs_window_animation_target.h"
22 #include "ui/rs_surface_node.h"
23
24 using namespace testing;
25 using namespace testing::ext;
26
27 namespace OHOS {
28 namespace Rosen {
29 class RSWindowAnimationStubMock : public RSWindowAnimationStub {
30 public:
31 RSWindowAnimationStubMock() = default;
32 virtual ~RSWindowAnimationStubMock() = default;
33
OnStartApp(StartingAppType type,const sptr<RSWindowAnimationTarget> & startingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)34 void OnStartApp(StartingAppType type, const sptr<RSWindowAnimationTarget>& startingWindowTarget,
35 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
36
OnAppTransition(const sptr<RSWindowAnimationTarget> & fromWindowTarget,const sptr<RSWindowAnimationTarget> & toWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)37 void OnAppTransition(const sptr<RSWindowAnimationTarget>& fromWindowTarget,
38 const sptr<RSWindowAnimationTarget>& toWindowTarget,
39 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
40
OnAppBackTransition(const sptr<RSWindowAnimationTarget> & fromWindowTarget,const sptr<RSWindowAnimationTarget> & toWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)41 void OnAppBackTransition(const sptr<RSWindowAnimationTarget>& fromWindowTarget,
42 const sptr<RSWindowAnimationTarget>& toWindowTarget,
43 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
44
OnMinimizeWindow(const sptr<RSWindowAnimationTarget> & minimizingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)45 void OnMinimizeWindow(const sptr<RSWindowAnimationTarget>& minimizingWindowTarget,
46 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
47
OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindowsTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)48 void OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindowsTarget,
49 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
50
OnCloseWindow(const sptr<RSWindowAnimationTarget> & closingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)51 void OnCloseWindow(const sptr<RSWindowAnimationTarget>& closingWindowTarget,
52 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
53
OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)54 void OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
55
OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget> & fullScreenWindowTarget,const std::vector<sptr<RSWindowAnimationTarget>> & floatingWindowTargets)56 void OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget>& fullScreenWindowTarget,
57 const std::vector<sptr<RSWindowAnimationTarget>>& floatingWindowTargets) override {};
58
OnWallpaperUpdate(const sptr<RSWindowAnimationTarget> & wallpaperTarget)59 void OnWallpaperUpdate(const sptr<RSWindowAnimationTarget>& wallpaperTarget) override {};
60 };
61
62 class RSWindowAnimationStubTest : public testing::Test {
63 public:
64 static void SetUpTestCase();
65 static void TearDownTestCase();
66 void SetUp() override;
67 void TearDown() override;
68
69 static sptr<RSWindowAnimationFinishedCallback> finishCallBack_;
70 static std::shared_ptr<RSSurfaceNode> animationSurfaceNode;
71 static sptr<RSWindowAnimationStubMock> windowAnimationStub_;
72 static std::shared_ptr<RSWindowAnimationTarget> windowAnimationTarget_;
73 };
74 sptr<RSWindowAnimationFinishedCallback> RSWindowAnimationStubTest::finishCallBack_ = nullptr;
75 std::shared_ptr<RSSurfaceNode> RSWindowAnimationStubTest::animationSurfaceNode = nullptr;
76 sptr<RSWindowAnimationStubMock> RSWindowAnimationStubTest::windowAnimationStub_ = nullptr;
77 std::shared_ptr<RSWindowAnimationTarget> RSWindowAnimationStubTest::windowAnimationTarget_ =
78 nullptr;
79
SetUpTestCase()80 void RSWindowAnimationStubTest::SetUpTestCase()
81 {
82 finishCallBack_ = new RSWindowAnimationFinishedCallback(nullptr);
83 RSSurfaceNodeConfig config;
84 animationSurfaceNode = RSSurfaceNode::Create(config, true);
85 windowAnimationStub_ = new RSWindowAnimationStubMock();
86 windowAnimationTarget_ = std::make_shared<RSWindowAnimationTarget>();
87 windowAnimationTarget_->bundleName_ = "";
88 windowAnimationTarget_->abilityName_ = "";
89 windowAnimationTarget_->windowBounds_ = RRect();
90 windowAnimationTarget_->surfaceNode_ = animationSurfaceNode;
91 windowAnimationTarget_->windowId_ = 0;
92 windowAnimationTarget_->displayId_ = 0;
93 windowAnimationTarget_->missionId_ = 0;
94 }
TearDownTestCase()95 void RSWindowAnimationStubTest::TearDownTestCase()
96 {
97 windowAnimationStub_ = nullptr;
98 finishCallBack_ = nullptr;
99 }
SetUp()100 void RSWindowAnimationStubTest::SetUp() {}
TearDown()101 void RSWindowAnimationStubTest::TearDown() {}
102
103 /**
104 * @tc.name: OnRemoteRequest001
105 * @tc.desc: Verify the OnRemoteRequest
106 * @tc.type:FUNC
107 */
108 HWTEST_F(RSWindowAnimationStubTest, OnRemoteRequest001, TestSize.Level1)
109 {
110 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest001 start";
111 MessageParcel data;
112 MessageParcel reply;
113 MessageOption option;
114
115 int res = windowAnimationStub_->OnRemoteRequest(
116 RSIWindowAnimationController::ON_START_APP, data, reply, option);
117 ASSERT_EQ(res, ERR_INVALID_STATE);
118 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest001 end";
119 }
120
121 /**
122 * @tc.name: OnRemoteRequest002
123 * @tc.desc: Verify the OnRemoteRequest
124 * @tc.type:FUNC
125 */
126 HWTEST_F(RSWindowAnimationStubTest, OnRemoteRequest002, TestSize.Level1)
127 {
128 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest002 start";
129 MessageParcel data;
130 MessageParcel reply;
131 MessageOption option;
132 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
133 int res = windowAnimationStub_->OnRemoteRequest(-1, data, reply, option);
134 ASSERT_EQ(res, ERR_UNKNOWN_TRANSACTION);
135 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest002 end";
136 }
137
138 /**
139 * @tc.name: StartApp001
140 * @tc.desc: Verify the StartApp
141 * @tc.type:FUNC
142 */
143 HWTEST_F(RSWindowAnimationStubTest, StartApp001, TestSize.Level1)
144 {
145 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp001 start";
146 MessageParcel data;
147 MessageParcel reply;
148 MessageOption option;
149 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
150 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
151 int res = windowAnimationStub_->OnRemoteRequest(
152 RSIWindowAnimationController::ON_START_APP, data, reply, option);
153 ASSERT_EQ(res, ERR_INVALID_DATA);
154 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp001 end";
155 }
156
157 /**
158 * @tc.name: StartApp002
159 * @tc.desc: Verify the StartApp
160 * @tc.type:FUNC
161 */
162 HWTEST_F(RSWindowAnimationStubTest, StartApp002, TestSize.Level1)
163 {
164 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp002 start";
165 MessageParcel data1;
166 MessageParcel reply;
167 MessageOption option;
168 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
169 data1.WriteInt32(StartingAppType::FROM_LAUNCHER);
170 data1.WriteParcelable(windowAnimationTarget_.get());
171 int res = windowAnimationStub_->OnRemoteRequest(
172 RSIWindowAnimationController::ON_START_APP, data1, reply, option);
173 ASSERT_EQ(res, ERR_INVALID_DATA);
174 MessageParcel data2;
175 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
176 data2.WriteInt32(StartingAppType::FROM_LAUNCHER);
177 data2.WriteParcelable(windowAnimationTarget_.get());
178 data2.WriteRemoteObject(finishCallBack_->AsObject());
179 res = windowAnimationStub_->OnRemoteRequest(
180 RSIWindowAnimationController::ON_START_APP, data2, reply, option);
181 ASSERT_EQ(res, ERR_NONE);
182 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp002 end";
183 }
184
185 /**
186 * @tc.name: StartApp003
187 * @tc.desc: Verify the StartApp
188 * @tc.type:FUNC
189 */
190 HWTEST_F(RSWindowAnimationStubTest, StartApp003, TestSize.Level1)
191 {
192 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp003 start";
193 MessageParcel data1;
194 MessageParcel reply;
195 MessageOption option;
196 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
197 int res = windowAnimationStub_->OnRemoteRequest(
198 RSIWindowAnimationController::ON_START_APP, data1, reply, option);
199 ASSERT_EQ(res, ERR_INVALID_DATA);
200 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp003 end";
201 }
202
203 /**
204 * @tc.name: AppTransition001
205 * @tc.desc: Verify the AppTransition
206 * @tc.type:FUNC
207 */
208 HWTEST_F(RSWindowAnimationStubTest, AppTransition001, TestSize.Level1)
209 {
210 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 start";
211 MessageParcel data;
212 MessageParcel reply;
213 MessageOption option;
214 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
215 int res = windowAnimationStub_->OnRemoteRequest(
216 RSIWindowAnimationController::ON_APP_TRANSITION, data, reply, option);
217 ASSERT_EQ(res, ERR_INVALID_DATA);
218 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 end";
219 }
220
221 /**
222 * @tc.name: AppTransition002
223 * @tc.desc: Verify the AppTransition
224 * @tc.type:FUNC
225 */
226 HWTEST_F(RSWindowAnimationStubTest, AppTransition002, TestSize.Level1)
227 {
228 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 start";
229 MessageParcel data1;
230 MessageParcel reply;
231 MessageOption option;
232 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
233 data1.WriteParcelable(windowAnimationTarget_.get());
234 int res = windowAnimationStub_->OnRemoteRequest(
235 RSIWindowAnimationController::ON_APP_TRANSITION, data1, reply, option);
236 ASSERT_EQ(res, ERR_INVALID_DATA);
237 MessageParcel data2;
238 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
239 data2.WriteParcelable(windowAnimationTarget_.get());
240 data2.WriteParcelable(windowAnimationTarget_.get());
241 res = windowAnimationStub_->OnRemoteRequest(
242 RSIWindowAnimationController::ON_APP_TRANSITION, data2, reply, option);
243 ASSERT_EQ(res, ERR_INVALID_DATA);
244 MessageParcel data3;
245 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
246 data3.WriteParcelable(windowAnimationTarget_.get());
247 data3.WriteParcelable(windowAnimationTarget_.get());
248 data3.WriteRemoteObject(finishCallBack_->AsObject());
249 res = windowAnimationStub_->OnRemoteRequest(
250 RSIWindowAnimationController::ON_APP_TRANSITION, data3, reply, option);
251 ASSERT_EQ(res, ERR_NONE);
252 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition002 end";
253 }
254
255 /**
256 * @tc.name: AppBackTransition001
257 * @tc.desc: Verify the AppBackTransition
258 * @tc.type:FUNC
259 */
260 HWTEST_F(RSWindowAnimationStubTest, AppBackTransition001, TestSize.Level1)
261 {
262 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition001 start";
263 MessageParcel data;
264 MessageParcel reply;
265 MessageOption option;
266 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
267 int res = windowAnimationStub_->OnRemoteRequest(
268 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data, reply, option);
269 ASSERT_EQ(res, ERR_INVALID_DATA);
270 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition001 end";
271 }
272
273 /**
274 * @tc.name: AppBackTransition002
275 * @tc.desc: Verify the AppBackTransition
276 * @tc.type:FUNC
277 */
278 HWTEST_F(RSWindowAnimationStubTest, AppBackTransition002, TestSize.Level1)
279 {
280 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition002 start";
281 MessageParcel data1;
282 MessageParcel reply;
283 MessageOption option;
284 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
285 data1.WriteParcelable(windowAnimationTarget_.get());
286 int res = windowAnimationStub_->OnRemoteRequest(
287 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data1, reply, option);
288 ASSERT_EQ(res, ERR_INVALID_DATA);
289 MessageParcel data2;
290 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
291 data2.WriteParcelable(windowAnimationTarget_.get());
292 data2.WriteParcelable(windowAnimationTarget_.get());
293 res = windowAnimationStub_->OnRemoteRequest(
294 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data2, reply, option);
295 ASSERT_EQ(res, ERR_INVALID_DATA);
296 MessageParcel data3;
297 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
298 data3.WriteParcelable(windowAnimationTarget_.get());
299 data3.WriteParcelable(windowAnimationTarget_.get());
300 data3.WriteRemoteObject(finishCallBack_->AsObject());
301 res = windowAnimationStub_->OnRemoteRequest(
302 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data3, reply, option);
303 ASSERT_EQ(res, ERR_NONE);
304 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition002 end";
305 }
306
307 /**
308 * @tc.name: MinimizeWindow001
309 * @tc.desc: Verify the MinimizeWindow
310 * @tc.type:FUNC
311 */
312 HWTEST_F(RSWindowAnimationStubTest, MinimizeWindow001, TestSize.Level1)
313 {
314 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow001 start";
315 MessageParcel data;
316 MessageParcel reply;
317 MessageOption option;
318 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
319 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
320 int res = windowAnimationStub_->OnRemoteRequest(
321 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data, reply, option);
322 ASSERT_EQ(res, ERR_INVALID_DATA);
323 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow001 end";
324 }
325
326 /**
327 * @tc.name: MinimizeWindow002
328 * @tc.desc: Verify the MinimizeWindow
329 * @tc.type:FUNC
330 */
331 HWTEST_F(RSWindowAnimationStubTest, MinimizeWindow002, TestSize.Level1)
332 {
333 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow002 start";
334 MessageParcel data1;
335 MessageParcel reply;
336 MessageOption option;
337 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
338 data1.WriteParcelable(windowAnimationTarget_.get());
339 int res = windowAnimationStub_->OnRemoteRequest(
340 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data1, reply, option);
341 ASSERT_EQ(res, ERR_INVALID_DATA);
342 MessageParcel data2;
343 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
344 data2.WriteParcelable(windowAnimationTarget_.get());
345 data2.WriteRemoteObject(finishCallBack_->AsObject());
346 res = windowAnimationStub_->OnRemoteRequest(
347 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data2, reply, option);
348 ASSERT_EQ(res, ERR_NONE);
349 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow002 end";
350 }
351
352 /**
353 * @tc.name: MinimizeAllWindow001
354 * @tc.desc: Verify the MinimizeAllWindow
355 * @tc.type:FUNC
356 */
357 HWTEST_F(RSWindowAnimationStubTest, MinimizeAllWindow001, TestSize.Level1)
358 {
359 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow001 start";
360 MessageParcel data;
361 MessageParcel reply;
362 MessageOption option;
363 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
364 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
365 data.WriteUint32(1);
366 int res = windowAnimationStub_->OnRemoteRequest(
367 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data, reply, option);
368 ASSERT_EQ(res, ERR_INVALID_DATA);
369 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow001 end";
370 }
371
372 /**
373 * @tc.name: MinimizeAllWindow002
374 * @tc.desc: Verify the MinimizeAllWindow
375 * @tc.type:FUNC
376 */
377 HWTEST_F(RSWindowAnimationStubTest, MinimizeAllWindow002, TestSize.Level1)
378 {
379 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow002 start";
380 MessageParcel data1;
381 MessageParcel reply;
382 MessageOption option;
383 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
384 data1.WriteUint32(1);
385 data1.WriteParcelable(windowAnimationTarget_.get());
386 int res = windowAnimationStub_->OnRemoteRequest(
387 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data1, reply, option);
388 ASSERT_EQ(res, ERR_INVALID_DATA);
389 MessageParcel data2;
390 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
391 data2.WriteUint32(1);
392 data2.WriteParcelable(windowAnimationTarget_.get());
393 data2.WriteRemoteObject(finishCallBack_->AsObject());
394 res = windowAnimationStub_->OnRemoteRequest(
395 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data2, reply, option);
396 ASSERT_EQ(res, ERR_NONE);
397 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow002 end";
398 }
399
400 /**
401 * @tc.name: CloseWindow001
402 * @tc.desc: Verify the CloseWindow
403 * @tc.type:FUNC
404 */
405 HWTEST_F(RSWindowAnimationStubTest, CloseWindow001, TestSize.Level1)
406 {
407 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow001 start";
408 MessageParcel data;
409 MessageParcel reply;
410 MessageOption option;
411 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
412 int res = windowAnimationStub_->OnRemoteRequest(
413 RSIWindowAnimationController::ON_CLOSE_WINDOW, data, reply, option);
414 ASSERT_EQ(res, ERR_INVALID_DATA);
415 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow001 end";
416 }
417
418 /**
419 * @tc.name: CloseWindow002
420 * @tc.desc: Verify the CloseWindow
421 * @tc.type:FUNC
422 */
423 HWTEST_F(RSWindowAnimationStubTest, CloseWindow002, TestSize.Level1)
424 {
425 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow002 start";
426 MessageParcel data1;
427 MessageParcel reply;
428 MessageOption option;
429 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
430 data1.WriteParcelable(windowAnimationTarget_.get());
431 int res = windowAnimationStub_->OnRemoteRequest(
432 RSIWindowAnimationController::ON_CLOSE_WINDOW, data1, reply, option);
433 ASSERT_EQ(res, ERR_INVALID_DATA);
434 MessageParcel data2;
435 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
436 data2.WriteParcelable(windowAnimationTarget_.get());
437 data2.WriteRemoteObject(finishCallBack_->AsObject());
438 res = windowAnimationStub_->OnRemoteRequest(
439 RSIWindowAnimationController::ON_CLOSE_WINDOW, data2, reply, option);
440 ASSERT_EQ(res, ERR_NONE);
441 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow002 end";
442 }
443
444 /**
445 * @tc.name: ScreenUnlock001
446 * @tc.desc: Verify the ScreenUnlock
447 * @tc.type:FUNC
448 */
449 HWTEST_F(RSWindowAnimationStubTest, ScreenUnlock001, TestSize.Level1)
450 {
451 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest ScreenUnlock001 start";
452 MessageParcel data1;
453 MessageParcel reply;
454 MessageOption option;
455 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
456 int res = windowAnimationStub_->OnRemoteRequest(
457 RSIWindowAnimationController::ON_SCREEN_UNLOCK, data1, reply, option);
458 ASSERT_EQ(res, ERR_INVALID_DATA);
459 MessageParcel data2;
460 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
461 data2.WriteRemoteObject(finishCallBack_->AsObject());
462 res = windowAnimationStub_->OnRemoteRequest(
463 RSIWindowAnimationController::ON_SCREEN_UNLOCK, data2, reply, option);
464 ASSERT_EQ(res, ERR_NONE);
465 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest ScreenUnlock001 end";
466 }
467
468 /**
469 * @tc.name: WindowAnimationTargetsUpdate001
470 * @tc.desc: Verify the WindowAnimationTargetsUpdate
471 * @tc.type:FUNC
472 */
473 HWTEST_F(RSWindowAnimationStubTest, WindowAnimationTargetsUpdate001, TestSize.Level1)
474 {
475 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WindowAnimationTargetsUpdate001 start";
476 MessageParcel reply;
477 MessageOption option;
478 MessageParcel data1;
479 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
480 data1.WriteBool(false);
481 data1.WriteUint32(1000);
482 int res = windowAnimationStub_->OnRemoteRequest(
483 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data1, reply, option);
484 ASSERT_EQ(res, ERR_INVALID_DATA);
485 MessageParcel data2;
486 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
487 data2.WriteBool(false);
488 data2.WriteUint32(1);
489 res = windowAnimationStub_->OnRemoteRequest(
490 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data2, reply, option);
491 ASSERT_EQ(res, ERR_INVALID_DATA);
492 MessageParcel data3;
493 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
494 data3.WriteBool(false);
495 data3.WriteUint32(1);
496 data3.WriteParcelable(windowAnimationTarget_.get());
497 res = windowAnimationStub_->OnRemoteRequest(
498 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data3, reply, option);
499 ASSERT_EQ(res, ERR_NONE);
500 MessageParcel data4;
501 data4.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
502 res = windowAnimationStub_->OnRemoteRequest(
503 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data4, reply, option);
504 ASSERT_EQ(res, ERR_INVALID_DATA);
505 MessageParcel data5;
506 data5.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
507 data5.WriteBool(true);
508 res = windowAnimationStub_->OnRemoteRequest(
509 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data5, reply, option);
510 ASSERT_EQ(res, ERR_INVALID_DATA);
511 MessageParcel data6;
512 data6.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
513 data6.WriteBool(true);
514 data6.WriteParcelable(windowAnimationTarget_.get());
515 data6.WriteUint32(1);
516 data6.WriteParcelable(windowAnimationTarget_.get());
517 res = windowAnimationStub_->OnRemoteRequest(
518 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data6, reply, option);
519 ASSERT_EQ(res, ERR_NONE);
520 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWinWindowAnimationTargetsUpdate001 end";
521 }
522
523 /**
524 * @tc.name: WallpaperUpdate001
525 * @tc.desc: Verify the WallpaperUpdate
526 * @tc.type:FUNC
527 */
528 HWTEST_F(RSWindowAnimationStubTest, WallpaperUpdate001, TestSize.Level1)
529 {
530 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WallpaperUpdate001 start";
531 MessageParcel data;
532 MessageParcel reply;
533 MessageOption option;
534 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
535 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
536 int res = windowAnimationStub_->OnRemoteRequest(
537 RSIWindowAnimationController::ON_WALLPAPER_UPDATE, data, reply, option);
538 ASSERT_EQ(res, ERR_NONE);
539 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WallpaperUpdate001 end";
540 }
541 } // namespace Rosen
542 } // namespace OHOS