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_picture_player.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22
23 namespace OHOS::Rosen {
24 class BootPicturePlayerTest : 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 BootPicturePlayerTest::SetUpTestCase() {}
TearDownTestCase()33 void BootPicturePlayerTest::TearDownTestCase() {}
SetUp()34 void BootPicturePlayerTest::SetUp() {}
TearDown()35 void BootPicturePlayerTest::TearDown() {}
36
37 /**
38 * @tc.name: BootPicturePlayerTest_001
39 * @tc.desc: Verify the ReadPicZipFile
40 * @tc.type:FUNC
41 */
42 HWTEST_F(BootPicturePlayerTest, BootPicturePlayerTest_001, TestSize.Level1)
43 {
44 PlayerParams params;
45 std::shared_ptr<BootPicturePlayer> player = std::make_shared<BootPicturePlayer>(params);
46 ImageStructVec imgVec;
47 int32_t freq = 30;
48 EXPECT_EQ(player->ReadPicZipFile(imgVec, freq), true);
49 }
50
51 /**
52 * @tc.name: BootPicturePlayerTest_002
53 * @tc.desc: Verify the CheckFrameRateValid
54 * @tc.type:FUNC
55 */
56 HWTEST_F(BootPicturePlayerTest, BootPicturePlayerTest_002, TestSize.Level1)
57 {
58 PlayerParams params;
59 std::shared_ptr<BootPicturePlayer> player = std::make_shared<BootPicturePlayer>(params);
60 int32_t frameRate = 0;
61 EXPECT_EQ(player->CheckFrameRateValid(frameRate), false);
62 }
63
64 /**
65 * @tc.name: BootPicturePlayerTest_003
66 * @tc.desc: Verify the CheckFrameRateValid
67 * @tc.type:FUNC
68 */
69 HWTEST_F(BootPicturePlayerTest, BootPicturePlayerTest_003, TestSize.Level1)
70 {
71 PlayerParams params;
72 std::shared_ptr<BootPicturePlayer> player = std::make_shared<BootPicturePlayer>(params);
73 int32_t frameRate = 30;
74 EXPECT_EQ(player->CheckFrameRateValid(frameRate), true);
75 }
76 }
77