• 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 "capability_data_adapter_impl.h"
19 #undef private
20 
21 using namespace testing;
22 using namespace testing::ext;
23 using namespace OHOS::NWeb;
24 
25 class CapabilityDataAdapterImplTest : public ::testing::Test {
26     protected:
SetUp()27         void SetUp() override {}
TearDown()28         void TearDown() override {}
29 };
30 
31 /**
32  * @tc.name: GetMaxWidth_ShouldReturnMaxWidth_WhenCalled
33  * @tc.number: CapabilityDataAdapterImplTest_001
34  * @tc.desc: Test GetMaxWidth method of CapabilityDataAdapterImpl class
35  */
36 HWTEST_F(CapabilityDataAdapterImplTest,
37          GetMaxWidth_ShouldReturnMaxWidth_WhenCalled, TestSize.Level0)
38 {
39     CapabilityDataAdapterImpl capabilityDataAdapterImpl;
40     int64_t maxWidth = 1920;
41     capabilityDataAdapterImpl.SetMaxWidth(maxWidth);
42     EXPECT_EQ(capabilityDataAdapterImpl.GetMaxWidth(), maxWidth);
43 }
44 
45 /**
46  * @tc.name: GetMaxHeight_ShouldReturnMaxHeight_WhenCalled
47  * @tc.number: CapabilityDataAdapterImplTest_002
48  * @tc.desc: Test GetMaxHeight method of CapabilityDataAdapterImpl class
49  */
50 HWTEST_F(CapabilityDataAdapterImplTest,
51          GetMaxHeight_ShouldReturnMaxHeight_WhenCalled, TestSize.Level0)
52 {
53     CapabilityDataAdapterImpl capabilityDataAdapterImpl;
54     int64_t maxHeight = 1080;
55     capabilityDataAdapterImpl.SetMaxHeight(maxHeight);
56     EXPECT_EQ(capabilityDataAdapterImpl.GetMaxHeight(), maxHeight);
57 }
58 
59 /**
60  * @tc.name: GetMaxframeRate_ShouldReturnMaxframeRate_WhenCalled
61  * @tc.number: CapabilityDataAdapterImplTest_003
62  * @tc.desc: Test GetMaxframeRate method of CapabilityDataAdapterImpl class
63  */
64 HWTEST_F(CapabilityDataAdapterImplTest,
65          GetMaxframeRate_ShouldReturnMaxframeRate_WhenCalled, TestSize.Level0)
66 {
67     CapabilityDataAdapterImpl capabilityDataAdapterImpl;
68     int32_t maxFrameRate = 60;
69     capabilityDataAdapterImpl.SetMaxframeRate(maxFrameRate);
70     EXPECT_EQ(capabilityDataAdapterImpl.GetMaxframeRate(), maxFrameRate);
71 }