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 #include "image_source_processor_test.h"
17
18 using namespace testing::ext;
19
20 namespace OHOS {
21 namespace DistributedHardware {
SetUpTestCase(void)22 void ImageSourceProcessorTest::SetUpTestCase(void) {}
23
TearDownTestCase(void)24 void ImageSourceProcessorTest::TearDownTestCase(void) {}
25
SetUp(void)26 void ImageSourceProcessorTest::SetUp(void) {}
27
TearDown(void)28 void ImageSourceProcessorTest::TearDown(void) {}
29
30 /**
31 * @tc.name: ConfigureImageProcessor_001
32 * @tc.desc: Verify the ConfigureImageProcessor function.
33 * @tc.type: FUNC
34 * @tc.require: Issue Number
35 */
36 HWTEST_F(ImageSourceProcessorTest, ConfigureImageProcessor_001, TestSize.Level1)
37 {
38 VideoParam localParam;
39 VideoParam remoteParam;
40 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
41
42 int32_t actual = processor.ConfigureImageProcessor(localParam, remoteParam, listener);
43
44 EXPECT_EQ(ERR_DH_SCREEN_CODEC_SURFACE_ERROR, actual);
45 }
46
47 /**
48 * @tc.name: ConfigureImageProcessor_002
49 * @tc.desc: Verify the ConfigureImageProcessor function.
50 * @tc.type: FUNC
51 * @tc.require: Issue Number
52 */
53 HWTEST_F(ImageSourceProcessorTest, ConfigureImageProcessor_002, TestSize.Level1)
54 {
55 VideoParam localParam;
56 localParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264;
57 VideoParam remoteParam;
58 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
59
60 int32_t actual = processor.ConfigureImageProcessor(localParam, remoteParam, listener);
61
62 EXPECT_EQ(ERR_DH_SCREEN_CODEC_SURFACE_ERROR, actual);
63 }
64
65 /**
66 * @tc.name: ReleaseImageProcessor_001
67 * @tc.desc: Verify the ReleaseImageProcessor function.
68 * @tc.type: FUNC
69 * @tc.require: Issue Number
70 */
71 HWTEST_F(ImageSourceProcessorTest, ReleaseImageProcessor_001, TestSize.Level1)
72 {
73 int32_t actual = processor.ReleaseImageProcessor();
74
75 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
76 }
77
78 /**
79 * @tc.name: ReleaseImageProcessor_002
80 * @tc.desc: Verify the ReleaseImageProcessor function.
81 * @tc.type: FUNC
82 * @tc.require: Issue Number
83 */
84 HWTEST_F(ImageSourceProcessorTest, ReleaseImageProcessor_002, TestSize.Level1)
85 {
86 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
87 processor.imageEncoder_ = std::make_shared<ImageSourceEncoder>(listener);
88 int32_t actual = processor.ReleaseImageProcessor();
89
90 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
91 }
92
93 /**
94 * @tc.name: StartImageProcessor_001
95 * @tc.desc: Verify the StartImageProcessor function.
96 * @tc.type: FUNC
97 * @tc.require: Issue Number
98 */
99 HWTEST_F(ImageSourceProcessorTest, StartImageProcessor_001, TestSize.Level1)
100 {
101 int32_t actual = processor.StartImageProcessor();
102
103 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
104 }
105
106 /**
107 * @tc.name: StartImageProcessor_002
108 * @tc.desc: Verify the StartImageProcessor function.
109 * @tc.type: FUNC
110 * @tc.require: Issue Number
111 */
112 HWTEST_F(ImageSourceProcessorTest, StartImageProcessor_002, TestSize.Level1)
113 {
114 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
115 processor.imageEncoder_ = std::make_shared<ImageSourceEncoder>(listener);
116 int32_t actual = processor.StartImageProcessor();
117
118 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
119 }
120
121 /**
122 * @tc.name: StopImageProcessor_001
123 * @tc.desc: Verify the StopImageProcessor function.
124 * @tc.type: FUNC
125 * @tc.require: Issue Number
126 */
127 HWTEST_F(ImageSourceProcessorTest, StopImageProcessor_001, TestSize.Level1)
128 {
129 int32_t actual = processor.StopImageProcessor();
130
131 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
132 }
133
134 /**
135 * @tc.name: StopImageProcessor_002
136 * @tc.desc: Verify the StopImageProcessor function.
137 * @tc.type: FUNC
138 * @tc.require: Issue Number
139 */
140 HWTEST_F(ImageSourceProcessorTest, StopImageProcessor_002, TestSize.Level1)
141 {
142 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
143 processor.imageEncoder_ = std::make_shared<ImageSourceEncoder>(listener);
144 int32_t actual = processor.StopImageProcessor();
145
146 EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, actual);
147 }
148
149 /**
150 * @tc.name: GetImageSurface_001
151 * @tc.desc: Verify the GetImageSurface function.
152 * @tc.type: FUNC
153 * @tc.require: Issue Number
154 */
155 HWTEST_F(ImageSourceProcessorTest, GetImageSurface_001, TestSize.Level1)
156 {
157 std::shared_ptr<IImageSourceProcessorListener> listener = nullptr;
158 processor.imageEncoder_ = std::make_shared<ImageSourceEncoder>(listener);
159 sptr<Surface> actual = processor.GetImageSurface();
160
161 EXPECT_EQ(nullptr, actual);
162 }
163 } // DistributedHardware
164 } // OHOS