1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file expected 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 "buffer_manager_test.h"
17
SetUpTestCase(void)18 void UtestBufferManagerTest::SetUpTestCase(void)
19 {}
TearDownTestCase(void)20 void UtestBufferManagerTest::TearDownTestCase(void)
21 {}
SetUp(void)22 void UtestBufferManagerTest::SetUp(void)
23 {
24 if (display_ == nullptr)
25 display_ = std::make_shared<TestDisplay>();
26 display_->FBInit();
27 display_->Init();
28 }
TearDown(void)29 void UtestBufferManagerTest::TearDown(void)
30 {
31 display_->Close();
32 }
33
34 /**
35 * @tc.name: OpenCamera cameraID input error
36 * @tc.desc: 请求GBM/ION buffer命令,参数正常,通过Display模块申请buffer申请buffer成功。
37 * @tc.level: level0
38 * @tc.size: MediumTest
39 * @tc.type: Function
40 */
TEST_F(UtestBufferManagerTest,camera_buffer_0001)41 TEST_F(UtestBufferManagerTest, camera_buffer_0001)
42 {
43 std::cout << "==========[test log] Preview stream, expected success." << std::endl;
44 // 获取流管理器
45 display_->AchieveStreamOperator();
46 // 启流
47 display_->intents = {Camera::PREVIEW};
48 display_->StartStream(display_->intents);
49 // 获取预览图
50 display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true);
51 // 释放流
52 display_->captureIds = {display_->captureId_preview};
53 display_->streamIds = {display_->streamId_preview};
54 display_->StopStream(display_->captureIds, display_->streamIds);
55 }