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: The GBM/ION buffer command is requested, the parameters are normal,
37 * and the buffer application through the Display module is successful.
38 * @tc.level: level0
39 * @tc.size: MediumTest
40 * @tc.type: Function
41 */
42 HWTEST_F(UtestBufferManagerTest, camera_buffer_0001,, TestSize.Level1)
43 {
44 std::cout << "==========[test log] Preview stream, expected success." << std::endl;
45 // Get the stream manager
46 display_->AchieveStreamOperator();
47 // start stream
48 display_->intents = {PREVIEW};
49 display_->StartStream(display_->intents);
50 // Get preview
51 display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true);
52 // release stream
53 display_->captureIds = {display_->captureId_preview};
54 display_->streamIds = {display_->streamId_preview};
55 display_->StopStream(display_->captureIds, display_->streamIds);
56 }