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
18using namespace OHOS;
19using namespace std;
20using namespace testing::ext;
21using namespace OHOS::Camera;
22
23void BufferManagerTest::SetUpTestCase(void) {}
24void BufferManagerTest::TearDownTestCase(void) {}
25void BufferManagerTest::SetUp(void)
26{
27    Test_ = std::make_shared<OHOS::Camera::Test>();
28    Test_->Init();
29    Test_->Open();
30}
31void BufferManagerTest::TearDown(void)
32{
33    Test_->Close();
34}
35
36/**
37  * @tc.name: OpenCamera cameraID input error
38  * @tc.desc: The GBM/ION buffer command is requested, the parameters are normal,
39  * and the buffer application through the Display module is successful.
40  * @tc.size: MediumTest
41  * @tc.type: Function
42  */
43HWTEST_F(BufferManagerTest, Camera_Buffer_0001, TestSize.Level0)
44{
45    std::cout << "==========[test log]Preview stream, 640*480, expected success." << std::endl;
46    // Start stream
47    Test_->intents = {Camera::PREVIEW};
48    Test_->StartStream(Test_->intents);
49    // Get preview
50    Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true);
51    // release stream
52    Test_->captureIds = {Test_->captureId_preview};
53    Test_->streamIds = {Test_->streamId_preview};
54    Test_->StopStream(Test_->captureIds, Test_->streamIds);
55    Test_->StopConsumer(Test_->intents);
56}
57