• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #define private public
18 #include "codec_format_adapter_impl.h"
19 #undef private
20 
21 using namespace testing;
22 using namespace testing::ext;
23 using namespace OHOS::NWeb;
24 
25 class CodecFormatAdapterImplTest : public ::testing::Test {
26     protected:
SetUp()27         void SetUp() override {}
TearDown()28         void TearDown() override {}
29 };
30 
31 /**
32  * @tc.name: GetWidth_ShouldReturnWidth_WhenCalled
33  * @tc.number: CodecFormatAdapterImplTest_001
34  * @tc.desc: Test GetWidth method of  CodecFormatAdapterImpl class
35  */
36 HWTEST_F(CodecFormatAdapterImplTest,
37          GetWidth_ShouldReturnWidth_WhenCalled, TestSize.Level0)
38 {
39     CodecFormatAdapterImpl codecFormatAdapterImpl;
40     int32_t width = 1280;
41     codecFormatAdapterImpl.SetWidth(width);
42     EXPECT_EQ(codecFormatAdapterImpl.GetWidth(), width);
43 }
44 
45 /**
46  * @tc.name: GetHeight_ShouldReturnHeight_WhenCalled
47  * @tc.number: CodecFormatAdapterImplTest_002
48  * @tc.desc: Test GetHeight method of  CodecFormatAdapterImpl class
49  */
50 HWTEST_F(CodecFormatAdapterImplTest,
51          GetHeight_ShouldReturnHeight_WhenCalled, TestSize.Level0)
52 {
53     CodecFormatAdapterImpl codecFormatAdapterImpl;
54     int32_t height = 720;
55     codecFormatAdapterImpl.SetHeight(height);
56     EXPECT_EQ(codecFormatAdapterImpl.GetHeight(), height);
57 }