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_controller.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22
23 namespace OHOS::Rosen {
24 class BootAnimationControllerTest : 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 BootAnimationControllerTest::SetUpTestCase() {}
TearDownTestCase()33 void BootAnimationControllerTest::TearDownTestCase() {}
SetUp()34 void BootAnimationControllerTest::SetUp() {}
TearDown()35 void BootAnimationControllerTest::TearDown() {}
36
37 /**
38 * @tc.name: BootAnimationControllerTest_001
39 * @tc.desc: Verify the CreateDefaultBootConfig
40 * @tc.type:FUNC
41 */
42 HWTEST_F(BootAnimationControllerTest, BootAnimationControllerTest_001, TestSize.Level1)
43 {
44 BootAnimationController controller;
45 controller.CreateDefaultBootConfig();
46 EXPECT_EQ(1, controller.animationConfigs_.size());
47 }
48
49 /**
50 * @tc.name: BootAnimationControllerTest_002
51 * @tc.desc: Verify the GetBootType
52 * @tc.type:FUNC
53 */
54 HWTEST_F(BootAnimationControllerTest, BootAnimationControllerTest_002, TestSize.Level1)
55 {
56 BootAnimationController controller;
57 controller.isCompatible_ = true;
58 BootStrategyType type = controller.GetBootType();
59 EXPECT_EQ(type, BootStrategyType::COMPATIBLE);
60 }
61
62 /**
63 * @tc.name: BootAnimationControllerTest_003
64 * @tc.desc: Verify the GetBootType
65 * @tc.type:FUNC
66 */
67 HWTEST_F(BootAnimationControllerTest, BootAnimationControllerTest_003, TestSize.Level1)
68 {
69 BootAnimationController controller;
70 controller.isMultiDisplay_ = true;
71 BootStrategyType type = controller.GetBootType();
72 EXPECT_EQ(type, BootStrategyType::INDEPENDENT);
73 }
74
75 /**
76 * @tc.name: BootAnimationControllerTest_004
77 * @tc.desc: Verify the GetBootType
78 * @tc.type:FUNC
79 */
80 HWTEST_F(BootAnimationControllerTest, BootAnimationControllerTest_004, TestSize.Level1)
81 {
82 BootAnimationController controller;
83 BootAnimationConfig config;
84 controller.animationConfigs_.emplace_back(config);
85 BootStrategyType type = controller.GetBootType();
86 EXPECT_EQ(type, BootStrategyType::INDEPENDENT);
87 }
88
89 /**
90 * @tc.name: BootAnimationControllerTest_005
91 * @tc.desc: Verify the GetBootType
92 * @tc.type:FUNC
93 */
94 HWTEST_F(BootAnimationControllerTest, BootAnimationControllerTest_005, TestSize.Level1)
95 {
96 BootAnimationController controller;
97 BootAnimationConfig first_config;
98 controller.animationConfigs_.emplace_back(first_config);
99 BootAnimationConfig second_config;
100 controller.animationConfigs_.emplace_back(second_config);
101 BootStrategyType type = controller.GetBootType();
102 EXPECT_EQ(type, BootStrategyType::ASSOCIATIVE);
103 }
104 }
105