1/*
2 * Copyright (c) 2024 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
18void UtestBufferManagerTest::SetUpTestCase(void)
19{}
20void UtestBufferManagerTest::TearDownTestCase(void)
21{}
22void UtestBufferManagerTest::SetUp(void)
23{
24    if (cameraBase == nullptr)
25    cameraBase = std::make_shared<TestCameraBase>();
26    cameraBase->FBInit();
27    cameraBase->Init();
28}
29void UtestBufferManagerTest::TearDown(void)
30{
31    cameraBase->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  */
42TEST_F(UtestBufferManagerTest, camera_buffer_0001)
43{
44    std::cout << "==========[test log] Preview stream, expected success." << std::endl;
45    // Get the stream manager
46    cameraBase->AchieveStreamOperator();
47    // start stream
48    cameraBase->intents = {PREVIEW};
49    cameraBase->StartStream(cameraBase->intents);
50    // Get preview
51    cameraBase->StartCapture(cameraBase->STREAM_ID_PREVIEW, cameraBase->CAPTURE_ID_PREVIEW, false, true);
52    // release stream
53    cameraBase->captureIds = {cameraBase->CAPTURE_ID_PREVIEW};
54    cameraBase->streamIds = {cameraBase->STREAM_ID_PREVIEW};
55    cameraBase->StopStream(cameraBase->captureIds, cameraBase->streamIds);
56}