• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define private public
17 #include "video_param_test.h"
18 #undef private
19 
20 using json = nlohmann::json;
21 
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace DistributedHardware {
SetUpTestCase(void)26 void VideoParamTest::SetUpTestCase(void) {}
27 
TearDownTestCase(void)28 void VideoParamTest::TearDownTestCase(void) {}
29 
SetUp()30 void VideoParamTest::SetUp()
31 {
32     videoParam_ = std::make_shared<VideoParam>();
33 }
34 
TearDown()35 void VideoParamTest::TearDown() {}
36 
37 /**
38  * @tc.name: GetScreenWidth_001
39  * @tc.desc: Verify the GetScreenWidth function.
40  * @tc.type: FUNC
41  * @tc.require: Issue Number
42  */
43 HWTEST_F(VideoParamTest, GetScreenWidth_001, TestSize.Level1)
44 {
45     uint32_t screenWidth = 1;
46     videoParam_->SetScreenWidth(screenWidth);
47     uint32_t actual = videoParam_->GetScreenWidth();
48     EXPECT_EQ(screenWidth, actual);
49 }
50 
51 /**
52  * @tc.name: GetScreenHeight_001
53  * @tc.desc: Verify the GetScreenHeight function.
54  * @tc.type: FUNC
55  * @tc.require: Issue Number
56  */
57 HWTEST_F(VideoParamTest, GetScreenHeight_001, TestSize.Level1)
58 {
59     uint32_t screenHeight = 1;
60     videoParam_->SetScreenHeight(screenHeight);
61     uint32_t actual = videoParam_->GetScreenHeight();
62     EXPECT_EQ(screenHeight, actual);
63 }
64 
65 /**
66  * @tc.name: GetVideoWidth_001
67  * @tc.desc: Verify the GetVideoWidth function.
68  * @tc.type: FUNC
69  * @tc.require: Issue Number
70  */
71 HWTEST_F(VideoParamTest, GetVideoWidth_001, TestSize.Level1)
72 {
73     uint32_t videoWidth = 1;
74     videoParam_->SetVideoWidth(videoWidth);
75     uint32_t actual = videoParam_->GetVideoWidth();
76     EXPECT_EQ(videoWidth, actual);
77 }
78 
79 /**
80  * @tc.name: GetVideoHeight_001
81  * @tc.desc: Verify the GetVideoHeight function.
82  * @tc.type: FUNC
83  * @tc.require: Issue Number
84  */
85 HWTEST_F(VideoParamTest, GetVideoHeight_001, TestSize.Level1)
86 {
87     uint32_t videoHeight = 1;
88     videoParam_->SetVideoHeight(videoHeight);
89     uint32_t actual = videoParam_->GetVideoHeight();
90     EXPECT_EQ(videoHeight, actual);
91 }
92 
93 /**
94  * @tc.name: GetFps_001
95  * @tc.desc: Verify the GetFps function.
96  * @tc.type: FUNC
97  * @tc.require: Issue Number
98  */
99 HWTEST_F(VideoParamTest, GetFps_001, TestSize.Level1)
100 {
101     uint32_t fps = 1;
102     videoParam_->SetFps(fps);
103     uint32_t actual = videoParam_->GetFps();
104     EXPECT_EQ(fps, actual);
105 }
106 
107 /**
108  * @tc.name: GetCodecType_001
109  * @tc.desc: Verify the GetCodecType function.
110  * @tc.type: FUNC
111  * @tc.require: Issue Number
112  */
113 HWTEST_F(VideoParamTest, GetCodecType_001, TestSize.Level1)
114 {
115     uint8_t codecType = 1;
116     videoParam_->SetCodecType(codecType);
117     uint8_t actual = videoParam_->GetCodecType();
118     EXPECT_EQ(codecType, actual);
119 }
120 
121 /**
122  * @tc.name: GetVideoFormat_001
123  * @tc.desc: Verify the GetVideoFormat function.
124  * @tc.type: FUNC
125  * @tc.require: Issue Number
126  */
127 HWTEST_F(VideoParamTest, GetVideoFormat_001, TestSize.Level1)
128 {
129     uint8_t videoFormat = 1;
130     videoParam_->SetVideoFormat(videoFormat);
131     uint8_t actual = videoParam_->GetVideoFormat();
132     EXPECT_EQ(videoFormat, actual);
133 }
134 } // namespace DistributedHardware
135 } // namespace OHOS