1 /*
2 * Copyright (c) 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
18 #include "boot_animation_operation.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22
23 namespace OHOS::Rosen {
24 class BootAnimationOperationTest : public testing::Test {
25 public:
26 static void SetUpTestCase();
27 static void TearDownTestCase();
28 void SetUp() override;
29 void TearDown() override;
30 };
31
SetUpTestCase()32 void BootAnimationOperationTest::SetUpTestCase() {}
TearDownTestCase()33 void BootAnimationOperationTest::TearDownTestCase() {}
SetUp()34 void BootAnimationOperationTest::SetUp() {}
TearDown()35 void BootAnimationOperationTest::TearDown() {}
36
37 /**
38 * @tc.name: BootAnimationOperationTest_001
39 * @tc.desc: Verify the SetSoundEnable
40 * @tc.type:FUNC
41 */
42 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_001, TestSize.Level1)
43 {
44 BootAnimationOperation operation;
45 operation.SetSoundEnable(true);
46 EXPECT_EQ(operation.isSoundEnabled_, true);
47 }
48
49 /**
50 * @tc.name: BootAnimationOperationTest_002
51 * @tc.desc: Verify the SetSoundEnable
52 * @tc.type:FUNC
53 */
54 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_002, TestSize.Level1)
55 {
56 BootAnimationOperation operation;
57 operation.SetSoundEnable(false);
58 EXPECT_EQ(operation.isSoundEnabled_, false);
59 }
60
61 /**
62 * @tc.name: BootAnimationOperationTest_003
63 * @tc.desc: Verify the InitRsDisplayNode
64 * @tc.type:FUNC
65 */
66 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_003, TestSize.Level1)
67 {
68 BootAnimationOperation operation;
69 operation.InitRsDisplayNode();
70 ASSERT_NE(nullptr, operation.rsDisplayNode_);
71 }
72
73 /**
74 * @tc.name: BootAnimationOperationTest_004
75 * @tc.desc: Verify the InitRsSurfaceNode
76 * @tc.type:FUNC
77 */
78 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_004, TestSize.Level1)
79 {
80 BootAnimationOperation operation;
81 int32_t degree = 0;
82 operation.InitRsSurfaceNode(degree);
83 ASSERT_NE(nullptr, operation.rsSurfaceNode_);
84 }
85
86 /**
87 * @tc.name: BootAnimationOperationTest_005
88 * @tc.desc: Verify the InitRsSurface
89 * @tc.type:FUNC
90 */
91 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_005, TestSize.Level1)
92 {
93 BootAnimationOperation operation;
94 int32_t degree = 0;
95 operation.InitRsSurfaceNode(degree);
96 operation.InitRsSurface();
97 ASSERT_NE(nullptr, operation.rsSurface_);
98 }
99
100 /**
101 * @tc.name: BootAnimationOperationTest_006
102 * @tc.desc: Verify the IsBootVideoEnabled
103 * @tc.type:FUNC
104 */
105 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_006, TestSize.Level1)
106 {
107 BootAnimationOperation operation;
108 BootAnimationConfig config;
109 config.picZipPath = "abc";
110 EXPECT_EQ(false, operation.IsBootVideoEnabled(config));
111 }
112
113 /**
114 * @tc.name: BootAnimationOperationTest_007
115 * @tc.desc: Verify the IsBootVideoEnabled
116 * @tc.type:FUNC
117 */
118 HWTEST_F(BootAnimationOperationTest, BootAnimationOperationTest_007, TestSize.Level1)
119 {
120 BootAnimationOperation operation;
121 BootAnimationConfig config;
122 config.videoDefaultPath = "abc";
123 EXPECT_EQ(true, operation.IsBootVideoEnabled(config));
124 }
125 }
126