1 /*
2 * Copyright (c) 2022-2024 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 #include "include/command/rs_surface_node_command.h"
18 #include "include/pipeline/rs_surface_render_node.h"
19 #include "pipeline/rs_display_render_node.h"
20
21 using namespace testing;
22 using namespace testing::ext;
23
24 namespace OHOS::Rosen {
25 class RSSurfaceNodeCommandTest : public testing::Test {
26 public:
27 static void SetUpTestCase();
28 static void TearDownTestCase();
29 void SetUp() override;
30 void TearDown() override;
31 };
32
SetUpTestCase()33 void RSSurfaceNodeCommandTest::SetUpTestCase() {}
TearDownTestCase()34 void RSSurfaceNodeCommandTest::TearDownTestCase() {}
SetUp()35 void RSSurfaceNodeCommandTest::SetUp() {}
TearDown()36 void RSSurfaceNodeCommandTest::TearDown() {}
37
38 /**
39 * @tc.name: TestRSSurfaceNodeCommand002
40 * @tc.desc: ConnectToNodeInRenderService test.
41 * @tc.type: FUNC
42 */
43 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand002, TestSize.Level1)
44 {
45 RSContext context;
46 NodeId id = static_cast<NodeId>(-1);
47 SurfaceNodeCommandHelper::ConnectToNodeInRenderService(context, id);
48 NodeId id2 = 10;
49 auto context2 = std::make_shared<RSContext>();
50 SurfaceNodeCommandHelper::Create(*context2, id2);
51 SurfaceNodeCommandHelper::ConnectToNodeInRenderService(*context2, id2);
52 }
53
54 /**
55 * @tc.name: TestRSSurfaceNodeCommand003
56 * @tc.desc: SetContextClipRegion test.
57 * @tc.type: FUNC
58 */
59 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand003, TestSize.Level1)
60 {
61 RSContext context;
62 NodeId id = static_cast<NodeId>(-1);
63 Drawing::Rect clipRect;
64 SurfaceNodeCommandHelper::SetContextClipRegion(context, id, clipRect);
65 NodeId id2 = 10;
66 auto context2 = std::make_shared<RSContext>();
67 SurfaceNodeCommandHelper::Create(*context2, id2);
68 SurfaceNodeCommandHelper::SetContextClipRegion(*context2, id2, clipRect);
69 }
70
71 /**
72 * @tc.name: TestRSSurfaceNodeCommand004
73 * @tc.desc: SetSecurityLayer test.
74 * @tc.type: FUNC
75 */
76 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand004, TestSize.Level1)
77 {
78 RSContext context;
79 NodeId id = static_cast<NodeId>(-1);
80 bool isSecurityLayer = false;
81 SurfaceNodeCommandHelper::SetSecurityLayer(context, id, isSecurityLayer);
82 NodeId id2 = 10;
83 auto context2 = std::make_shared<RSContext>();
84 SurfaceNodeCommandHelper::Create(*context2, id2);
85 SurfaceNodeCommandHelper::SetSecurityLayer(*context2, id2, isSecurityLayer);
86 }
87
88 /**
89 * @tc.name: TestRSSurfaceNodeCommand005
90 * @tc.desc: SetColorSpace test.
91 * @tc.type: FUNC
92 */
93 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand005, TestSize.Level1)
94 {
95 RSContext context;
96 NodeId id = static_cast<NodeId>(-1);
97 GraphicColorGamut colorSpace = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_INVALID;
98 SurfaceNodeCommandHelper::SetColorSpace(context, id, colorSpace);
99 NodeId id2 = 10;
100 auto context2 = std::make_shared<RSContext>();
101 SurfaceNodeCommandHelper::Create(*context2, id2);
102 SurfaceNodeCommandHelper::SetColorSpace(*context2, id2, colorSpace);
103 }
104
105 /**
106 * @tc.name: TestRSSurfaceNodeCommand006
107 * @tc.desc: UpdateSurfaceDefaultSize test.
108 * @tc.type: FUNC
109 */
110 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand006, TestSize.Level1)
111 {
112 RSContext context;
113 NodeId id = static_cast<NodeId>(-1);
114 float width = 0;
115 float height = 0;
116 SurfaceNodeCommandHelper::UpdateSurfaceDefaultSize(context, id, width, height);
117 NodeId id2 = 10;
118 auto context2 = std::make_shared<RSContext>();
119 SurfaceNodeCommandHelper::Create(*context2, id2);
120 SurfaceNodeCommandHelper::UpdateSurfaceDefaultSize(*context2, id2, width, height);
121 }
122
123 /**
124 * @tc.name: TestRSSurfaceNodeCommand007
125 * @tc.desc: ConnectToNodeInRenderService test.
126 * @tc.type: FUNC
127 */
128 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand007, TestSize.Level1)
129 {
130 RSContext context;
131 NodeId id = static_cast<NodeId>(-1);
132 SurfaceNodeCommandHelper::ConnectToNodeInRenderService(context, id);
133 NodeId id2 = 10;
134 auto context2 = std::make_shared<RSContext>();
135 SurfaceNodeCommandHelper::Create(*context2, id2);
136 SurfaceNodeCommandHelper::ConnectToNodeInRenderService(*context2, id2);
137 }
138
139 /**
140 * @tc.name: TestRSSurfaceNodeCommand008
141 * @tc.desc: SetCallbackForRenderThreadRefresh test.
142 * @tc.type: FUNC
143 */
144 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand008, TestSize.Level1)
145 {
146 RSContext context;
147 NodeId id = static_cast<NodeId>(-1);
148 SurfaceNodeCommandHelper::SetCallbackForRenderThreadRefresh(context, id, true);
149 NodeId id2 = 10;
150 auto context2 = std::make_shared<RSContext>();
151 SurfaceNodeCommandHelper::Create(*context2, id2);
152 SurfaceNodeCommandHelper::SetCallbackForRenderThreadRefresh(*context2, id2, false);
153 }
154
155 /**
156 * @tc.name: TestRSSurfaceNodeCommand009
157 * @tc.desc: SetContextBounds test.
158 * @tc.type: FUNC
159 */
160 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand009, TestSize.Level1)
161 {
162 RSContext context;
163 NodeId id = static_cast<NodeId>(-1);
164 Vector4f bounds;
165 SurfaceNodeCommandHelper::SetContextBounds(context, id, bounds);
166 NodeId id2 = 10;
167 auto context2 = std::make_shared<RSContext>();
168 SurfaceNodeCommandHelper::Create(*context2, id2);
169 SurfaceNodeCommandHelper::SetContextBounds(*context2, id2, bounds);
170 }
171
172 /**
173 * @tc.name: TestRSSurfaceNodeCommand010
174 * @tc.desc: SetAbilityBGAlpha test.
175 * @tc.type: FUNC
176 */
177 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand010, TestSize.Level1)
178 {
179 RSContext context;
180 NodeId id = static_cast<NodeId>(-1);
181 uint8_t alpha = static_cast<uint8_t>(0);
182 SurfaceNodeCommandHelper::SetAbilityBGAlpha(context, id, alpha);
183 NodeId id2 = 10;
184 auto context2 = std::make_shared<RSContext>();
185 SurfaceNodeCommandHelper::Create(*context2, id2);
186 SurfaceNodeCommandHelper::SetAbilityBGAlpha(*context2, id2, alpha);
187 }
188
189 /**
190 * @tc.name: TestRSSurfaceNodeCommand012
191 * @tc.desc: SetIsNotifyUIBufferAvailable test.
192 * @tc.type: FUNC
193 */
194 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand012, TestSize.Level1)
195 {
196 RSContext context;
197 NodeId id = -10;
198 bool available = false;
199 SurfaceNodeCommandHelper::SetIsNotifyUIBufferAvailable(context, id, available);
200 NodeId id2 = 10;
201 auto context2 = std::make_shared<RSContext>();
202 SurfaceNodeCommandHelper::Create(*context2, id2);
203 SurfaceNodeCommandHelper::SetIsNotifyUIBufferAvailable(*context2, id2, available);
204 }
205
206 /**
207 * @tc.name: TestRSSurfaceNodeCommand013
208 * @tc.desc: SetSurfaceNodeType test.
209 * @tc.type: FUNC
210 */
211 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand013, TestSize.Level1)
212 {
213 RSContext context;
214 NodeId id = -10;
215 RSSurfaceNodeType type = RSSurfaceNodeType::DEFAULT;
216 SurfaceNodeCommandHelper::SetSurfaceNodeType(context, id, static_cast<uint8_t>(type));
217 NodeId id2 = 10;
218 auto context2 = std::make_shared<RSContext>();
219 SurfaceNodeCommandHelper::Create(*context2, id2);
220 SurfaceNodeCommandHelper::SetSurfaceNodeType(*context2, id2, static_cast<uint8_t>(type));
221 type = RSSurfaceNodeType::ABILITY_COMPONENT_NODE;
222 SurfaceNodeCommandHelper::SetSurfaceNodeType(*context2, id2, static_cast<uint8_t>(type));
223 }
224
225 /**
226 * @tc.name: TestRSSurfaceNodeCommand015
227 * @tc.desc: SetContextAlpha test.
228 * @tc.type: FUNC
229 */
230 HWTEST_F(RSSurfaceNodeCommandTest, TestRSSurfaceNodeCommand015, TestSize.Level1)
231 {
232 RSContext context;
233 NodeId id = -10;
234 float alpha = 0;
235 SurfaceNodeCommandHelper::SetContextAlpha(context, id, alpha);
236 NodeId id2 = 10;
237 auto context2 = std::make_shared<RSContext>();
238 SurfaceNodeCommandHelper::Create(*context2, id2);
239 SurfaceNodeCommandHelper::SetContextAlpha(*context2, id2, alpha);
240 }
241
242 /**
243 * @tc.name: SetContextMatrix001
244 * @tc.desc: test.
245 * @tc.type: FUNC
246 */
247 HWTEST_F(RSSurfaceNodeCommandTest, SetContextMatrix001, TestSize.Level1)
248 {
249 RSContext context;
250 NodeId id = -10;
251 Drawing::Matrix matrix;
252 SurfaceNodeCommandHelper::SetContextMatrix(context, id, matrix);
253 NodeId id2 = 10;
254 auto context2 = std::make_shared<RSContext>();
255 SurfaceNodeCommandHelper::Create(*context2, id2);
256 SurfaceNodeCommandHelper::SetContextMatrix(*context2, id2, matrix);
257 SurfaceNodeCommandHelper::Create(*context2, id2);
258 }
259
260 /**
261 * @tc.name: SetContainerWindow001
262 * @tc.desc: test.
263 * @tc.type: FUNC
264 */
265 HWTEST_F(RSSurfaceNodeCommandTest, SetContainerWindow001, TestSize.Level1)
266 {
267 RSContext context;
268 NodeId id = -10;
269 bool hasContainerWindow = false;
270 float density = 0.1;
271 SurfaceNodeCommandHelper::SetContainerWindow(context, id, hasContainerWindow, density);
272 NodeId id2 = 10;
273 auto context2 = std::make_shared<RSContext>();
274 SurfaceNodeCommandHelper::Create(*context2, id2);
275 SurfaceNodeCommandHelper::SetContainerWindow(*context2, id2, hasContainerWindow, density);
276 }
277
278 /**
279 * @tc.name: Fingerprint Test
280 * @tc.desc: SetFingerprint and GetFingerprint
281 * @tc.type: FUNC
282 * @tc.require: issueI6Z3YK
283 */
284 HWTEST_F(RSSurfaceNodeCommandTest, FingerprintTest001, TestSize.Level1)
285 {
286 RSContext context;
287 NodeId id = static_cast<NodeId>(-1);
288 SurfaceNodeCommandHelper::SetFingerprint(context, id, true);
289 SurfaceNodeCommandHelper::SetFingerprint(context, id, false);
290
291 NodeId id2 = static_cast<NodeId>(1);
292 SurfaceNodeCommandHelper::Create(context, id2);
293 SurfaceNodeCommandHelper::SetFingerprint(context, id2, true);
294 }
295
296 /**
297 * @tc.name: SetSkipLayerTest001
298 * @tc.desc: SetSkipLayer test.
299 * @tc.type: FUNC
300 */
301 HWTEST_F(RSSurfaceNodeCommandTest, SetSkipLayerTest001, TestSize.Level1)
302 {
303 RSContext context;
304 NodeId id = static_cast<NodeId>(-1);
305 bool isSkipLayer = false;
306 SurfaceNodeCommandHelper::SetSkipLayer(context, id, isSkipLayer);
307 NodeId id2 = 10;
308 SurfaceNodeCommandHelper::Create(context, id2);
309 SurfaceNodeCommandHelper::SetSkipLayer(context, id2, isSkipLayer);
310 }
311
312 /**
313 * @tc.name: SetBootAnimation001
314 * @tc.desc: SetBootAnimation test.
315 * @tc.type: FUNC
316 * @tc.require:SR000HSUII
317 */
318 HWTEST_F(RSSurfaceNodeCommandTest, SetBootAnimation001, TestSize.Level1)
319 {
320 RSContext context;
321 NodeId id = static_cast<NodeId>(-1);
322 SurfaceNodeCommandHelper::SetBootAnimation(context, id, false);
323 NodeId id2 = 10;
324 SurfaceNodeCommandHelper::Create(context, id2);
325 SurfaceNodeCommandHelper::SetBootAnimation(context, id2, true);
326 }
327
328 /**
329 * @tc.name: AttachToDisplay001
330 * @tc.desc: AttachToDisplay test.
331 * @tc.type: FUNC
332 * @tc.require: issueIA61E9
333 */
334 HWTEST_F(RSSurfaceNodeCommandTest, AttachToDisplay001, TestSize.Level1)
335 {
336 RSContext context;
337 SurfaceNodeCommandHelper::AttachToDisplay(context, -1, 0);
338
339 std::shared_ptr<RSSurfaceRenderNode> renderNode = std::make_shared<RSSurfaceRenderNode>(0);
340 EXPECT_NE(renderNode, nullptr);
341 context.nodeMap.renderNodeMap_[0][0] = renderNode;
342 std::shared_ptr<RSDisplayRenderNode> displayNodeTest1 = nullptr;
343 context.nodeMap.displayNodeMap_.emplace(0, displayNodeTest1);
344 SurfaceNodeCommandHelper::AttachToDisplay(context, 0, 1);
345
346 RSDisplayNodeConfig config;
347 std::shared_ptr<RSDisplayRenderNode> displayNodeTest2 = std::make_shared<RSDisplayRenderNode>(0, config);
348 displayNodeTest2->screenId_ = 0;
349 context.nodeMap.displayNodeMap_.at(0) = displayNodeTest2;
350 EXPECT_NE(displayNodeTest2, nullptr);
351 SurfaceNodeCommandHelper::AttachToDisplay(context, 0, 1);
352 SurfaceNodeCommandHelper::AttachToDisplay(context, 0, 0);
353 }
354
355 /**
356 * @tc.name: DetachToDisplay001
357 * @tc.desc: DetachToDisplay test.
358 * @tc.type: FUNC
359 * @tc.require: issueIA61E9
360 */
361 HWTEST_F(RSSurfaceNodeCommandTest, DetachToDisplay001, TestSize.Level1)
362 {
363 RSContext context;
364 SurfaceNodeCommandHelper::DetachToDisplay(context, -1, 0);
365 std::shared_ptr<RSSurfaceRenderNode> renderNode = std::make_shared<RSSurfaceRenderNode>(0);
366 EXPECT_NE(renderNode, nullptr);
367 context.nodeMap.renderNodeMap_[0][0] = renderNode;
368 std::shared_ptr<RSDisplayRenderNode> displayNodeTest1 = nullptr;
369 context.nodeMap.displayNodeMap_.emplace(0, displayNodeTest1);
370 SurfaceNodeCommandHelper::DetachToDisplay(context, 0, 1);
371
372 RSDisplayNodeConfig config;
373 std::shared_ptr<RSDisplayRenderNode> displayNodeTest2 = std::make_shared<RSDisplayRenderNode>(0, config);
374 displayNodeTest2->screenId_ = 0;
375 context.nodeMap.displayNodeMap_.at(0) = displayNodeTest2;
376 EXPECT_NE(displayNodeTest2, nullptr);
377 SurfaceNodeCommandHelper::DetachToDisplay(context, 0, 1);
378 SurfaceNodeCommandHelper::DetachToDisplay(context, 0, 0);
379 }
380
381 /**
382 * @tc.name: SetIsTextureExportNode001
383 * @tc.desc: DetachToDisplay test.
384 * @tc.type: FUNC
385 * @tc.require:SR000HSUII
386 */
387 HWTEST_F(RSSurfaceNodeCommandTest, SetIsTextureExportNode001, TestSize.Level1)
388 {
389 NodeId id = 10;
390 RSContext context;
391 SurfaceNodeCommandHelper::Create(context, id);
392 SurfaceNodeCommandHelper::SetIsTextureExportNode(context, id, true);
393 SurfaceNodeCommandHelper::SetIsTextureExportNode(context, 0, true);
394 }
395
396 /**
397 * @tc.name: MarkUIHidden001
398 * @tc.desc: SetIsNotifyUIBufferAvailable test.
399 * @tc.type: FUNC
400 */
401 HWTEST_F(RSSurfaceNodeCommandTest, MarkUIHidden001, TestSize.Level1)
402 {
403 RSContext context;
404 NodeId id = -10;
405 bool available = false;
406 SurfaceNodeCommandHelper::MarkUIHidden(context, id, available);
407 NodeId id2 = 10;
408 SurfaceNodeCommandHelper::Create(context, id2);
409 SurfaceNodeCommandHelper::MarkUIHidden(context, id2, available);
410 }
411
412 /**
413 * @tc.name: SetAnimationFinished001
414 * @tc.desc: SetIsNotifyUIBufferAvailable test.
415 * @tc.type: FUNC
416 */
417 HWTEST_F(RSSurfaceNodeCommandTest, SetAnimationFinished001, TestSize.Level1)
418 {
419 RSContext context;
420 NodeId id = -10;
421 SurfaceNodeCommandHelper::SetAnimationFinished(context, id);
422 NodeId id2 = 10;
423 SurfaceNodeCommandHelper::Create(context, id2);
424 SurfaceNodeCommandHelper::SetAnimationFinished(context, id2);
425 }
426
427 /**
428 * @tc.name: SetForeground001
429 * @tc.desc: SetIsNotifyUIBufferAvailable test.
430 * @tc.type: FUNC
431 */
432 HWTEST_F(RSSurfaceNodeCommandTest, SetForeground001, TestSize.Level1)
433 {
434 RSContext context;
435 NodeId id = -2;
436 bool available = false;
437 SurfaceNodeCommandHelper::SetForeground(context, id, available);
438 NodeId id2 = 2;
439 SurfaceNodeCommandHelper::Create(context, id2);
440 SurfaceNodeCommandHelper::SetForeground(context, id2, available);
441 }
442
443 /**
444 * @tc.name: SetSurfaceId001
445 * @tc.desc: SetIsNotifyUIBufferAvailable test.
446 * @tc.type: FUNC
447 */
448 HWTEST_F(RSSurfaceNodeCommandTest, SetSurfaceId001, TestSize.Level1)
449 {
450 RSContext context;
451 NodeId id = -2;
452 bool available = false;
453 SurfaceNodeCommandHelper::SetSurfaceId(context, id, available);
454 NodeId id2 = 2;
455 SurfaceNodeCommandHelper::Create(context, id2);
456 SurfaceNodeCommandHelper::SetSurfaceId(context, id2, available);
457 }
458
459 /**
460 * @tc.name: CreateWithConfigTest
461 * @tc.desc: Verify function CreateWithConfig
462 * @tc.type:FUNC
463 * @tc.require: issueI9P2KH
464 */
465 HWTEST_F(RSSurfaceNodeCommandTest, CreateWithConfigTest, TestSize.Level1)
466 {
467 RSContext context;
468 std::string name = "name"; // for test
469 std::string bundleName = "bundleName"; // for test
470 enum SurfaceWindowType windowType = SurfaceWindowType::DEFAULT_WINDOW;
471 SurfaceNodeCommandHelper::CreateWithConfig(context, 1, name, 1, bundleName, windowType);
__anonda9d6d990102() 472 EXPECT_TRUE([&context]() -> bool {
473 auto& renderNodeMap = context.GetMutableNodeMap().renderNodeMap_;
474 auto iter = renderNodeMap.find(ExtractPid(1));
475 if (iter != renderNodeMap.end()) {
476 auto& submap = iter->second;
477 if (submap.find(1) != submap.end()) {
478 return true;
479 }
480 }
481 return false;
482 }());
483 }
484
485 /**
486 * @tc.name: SetForceHardwareAndFixRotationTest
487 * @tc.desc: Verify function SetForceHardwareAndFixRotation
488 * @tc.type:FUNC
489 * @tc.require: issueI9P2KH
490 */
491 HWTEST_F(RSSurfaceNodeCommandTest, SetForceHardwareAndFixRotationTest, TestSize.Level1)
492 {
493 RSContext context;
494
495 SurfaceNodeCommandHelper::SetForceHardwareAndFixRotation(context, 0, false);
496 SurfaceNodeCommandHelper::Create(context, 1);
497 SurfaceNodeCommandHelper::SetForceHardwareAndFixRotation(context, 1, false);
498 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
499 }
500
501 /**
502 * @tc.name: SetForceUIFirstTest
503 * @tc.desc: Verify function SetForceUIFirst
504 * @tc.type:FUNC
505 * @tc.require: issueI9P2KH
506 */
507 HWTEST_F(RSSurfaceNodeCommandTest, SetForceUIFirstTest, TestSize.Level1)
508 {
509 RSContext context;
510 SurfaceNodeCommandHelper::SetForceUIFirst(context, 0, false);
511 SurfaceNodeCommandHelper::Create(context, 1);
512 SurfaceNodeCommandHelper::SetForceUIFirst(context, 1, false);
513 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
514 }
515
516 /**
517 * @tc.name: SetAncoFlagsTest
518 * @tc.desc: Verify function SetAncoFlags
519 * @tc.type:FUNC
520 * @tc.require: issueIAIIEP
521 */
522 HWTEST_F(RSSurfaceNodeCommandTest, SetAncoFlagsTest, TestSize.Level1)
523 {
524 RSContext context;
525 SurfaceNodeCommandHelper::SetAncoFlags(context, 0, 0);
526 SurfaceNodeCommandHelper::Create(context, 1);
527 SurfaceNodeCommandHelper::SetAncoFlags(context, 1, 1);
528 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
529 }
530
531 /**
532 * @tc.name: SetHDRPresentTest
533 * @tc.desc: Verify function SetHDRPresent
534 * @tc.type:FUNC
535 * @tc.require: issueI9SBEZ
536 */
537 HWTEST_F(RSSurfaceNodeCommandTest, SetHDRPresentTest, TestSize.Level1)
538 {
539 RSContext context;
540 SurfaceNodeCommandHelper::SetHDRPresent(context, 0, false);
541 SurfaceNodeCommandHelper::Create(context, 1);
542 SurfaceNodeCommandHelper::SetHDRPresent(context, 1, false);
543 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
544 }
545
546 /**
547 * @tc.name: SetSkipDraw
548 * @tc.desc: Verify function SetSkipDraw
549 * @tc.type: FUNC
550 * @tc.require: issueI9U6LX
551 */
552 HWTEST_F(RSSurfaceNodeCommandTest, SetSkipDrawTest, TestSize.Level1)
553 {
554 RSContext context;
555 SurfaceNodeCommandHelper::SetSkipDraw(context, 0, true);
556 SurfaceNodeCommandHelper::Create(context, 1);
557 SurfaceNodeCommandHelper::SetSkipDraw(context, 1, true);
558 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
559 }
560
561 /**
562 * @tc.name: SetAbilityState
563 * @tc.desc: Verify function SetAbilityState
564 * @tc.type: FUNC
565 * @tc.require: issueIAQL48
566 */
567 HWTEST_F(RSSurfaceNodeCommandTest, SetAbilityState, TestSize.Level1)
568 {
569 RSContext context;
570 SurfaceNodeCommandHelper::SetAbilityState(context, 0, RSSurfaceNodeAbilityState::FOREGROUND);
571 SurfaceNodeCommandHelper::Create(context, 1);
572 SurfaceNodeCommandHelper::SetAbilityState(context, 1, RSSurfaceNodeAbilityState::FOREGROUND);
573 EXPECT_TRUE(context.GetNodeMap().GetRenderNode<RSSurfaceRenderNode>(1) != nullptr);
574 }
575 } // namespace OHOS::Rosen
576