1 /*
2 * Copyright (c) 2023-2023 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 #include "picture_in_picture_option.h"
18
19 using namespace testing;
20 using namespace testing::ext;
21
22 namespace OHOS {
23 namespace Rosen {
24 class PictureInPictureOptionTest : public testing::Test {
25 public:
26 static void SetUpTestCase();
27
28 static void TearDownTestCase();
29
30 void SetUp() override;
31
32 void TearDown() override;
33 };
34
SetUpTestCase()35 void PictureInPictureOptionTest::SetUpTestCase() {
36 }
37
TearDownTestCase()38 void PictureInPictureOptionTest::TearDownTestCase() {
39 }
40
SetUp()41 void PictureInPictureOptionTest::SetUp() {
42 }
43
TearDown()44 void PictureInPictureOptionTest::TearDown() {
45 }
46
47 namespace {
48
49 /**
50 * @tc.name: Context
51 * @tc.desc: SetContext/GetContext
52 * @tc.type: FUNC
53 */
54 HWTEST_F(PictureInPictureOptionTest, Context, Function | SmallTest | Level2)
55 {
56 void* contextPtr = nullptr;
57 sptr<PipOption> option = new PipOption();
58 option->SetContext(contextPtr);
59 ASSERT_EQ(contextPtr, option->GetContext());
60 }
61
62 /**
63 * @tc.name: PipTemplate
64 * @tc.desc: SetPipTemplate/GetPipTemplate
65 * @tc.type: FUNC
66 */
67 HWTEST_F(PictureInPictureOptionTest, PipTemplate, Function | SmallTest | Level2)
68 {
69 sptr<PipOption> option = new PipOption();
70 option->SetPipTemplate(100);
71 ASSERT_EQ(100, option->GetPipTemplate());
72 }
73
74 /**
75 * @tc.name: NavigationId
76 * @tc.desc: SetNavigationId/GetNavigationId
77 * @tc.type: FUNC
78 */
79 HWTEST_F(PictureInPictureOptionTest, NavigationId, Function | SmallTest | Level2)
80 {
81 sptr<PipOption> option = new PipOption();
82 std::string navigationId = "abc";
83 option->SetNavigationId(navigationId);
84 ASSERT_EQ(navigationId, option->GetNavigationId());
85 }
86
87 /**
88 * @tc.name: ContentSize
89 * @tc.desc: SetContentSize/GetContentSize
90 * @tc.type: FUNC
91 */
92 HWTEST_F(PictureInPictureOptionTest, ContentSize, Function | SmallTest | Level2)
93 {
94 sptr<PipOption> option = new PipOption();
95 uint32_t width = 800;
96 uint32_t height = 600;
97 option->SetContentSize(width, height);
98 uint32_t w = 0;
99 uint32_t h = 0;
100 option->GetContentSize(w, h);
101 ASSERT_EQ(width, w);
102 ASSERT_EQ(height, h);
103 }
104 }
105 }
106 }