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#include "device_manager_test.h"
16
17void UtestDeviceManagerTest::SetUpTestCase(void) {}
18void UtestDeviceManagerTest::TearDownTestCase(void) {}
19void UtestDeviceManagerTest::SetUp(void)
20{
21    if (cameraBase == nullptr)
22    cameraBase = std::make_shared<TestCameraBase>();
23    cameraBase->FBInit();
24    cameraBase->Init();
25}
26void UtestDeviceManagerTest::TearDown(void)
27{
28    cameraBase->Close();
29}
30
31/**
32  * @tc.name: Check device manager.
33  * @tc.desc: The GBM/ION buffer command is requested, the parameters are normal,
34  * and the buffer application through the Display module is successful.
35  * @tc.level: Level2
36  * @tc.size: MediumTest
37  * @tc.type: Function
38  */
39TEST_F(UtestDeviceManagerTest, camera_devMan_0001)
40{
41    std::cout << "==========[test log] Preview stream, expected success." << std::endl;
42    // Get the stream manager
43    cameraBase->AchieveStreamOperator();
44    // start stream
45    cameraBase->intents = {PREVIEW};
46    cameraBase->StartStream(cameraBase->intents);
47    // Get preview
48    cameraBase->StartCapture(cameraBase->STREAM_ID_PREVIEW, cameraBase->CAPTURE_ID_PREVIEW, false, true);
49    // release stream
50    cameraBase->captureIds = {cameraBase->CAPTURE_ID_PREVIEW};
51    cameraBase->streamIds = {cameraBase->STREAM_ID_PREVIEW};
52    cameraBase->StopStream(cameraBase->captureIds, cameraBase->streamIds);
53}