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 #include "adapter_test.h"
16 
SetUpTestCase(void)17 void UtestAdapterTest::SetUpTestCase(void)
18 {}
TearDownTestCase(void)19 void UtestAdapterTest::TearDownTestCase(void)
20 {}
SetUp(void)21 void UtestAdapterTest::SetUp(void)
22 {
23     if (cameraBase == nullptr)
24     cameraBase = std::make_shared<TestCameraBase>();
25     cameraBase->FBInit();
26     cameraBase->Init();
27 }
TearDown(void)28 void UtestAdapterTest::TearDown(void)
29 {
30     cameraBase->Close();
31 }
32 
33 /**
34   * @tc.name: OpenCamera cameraID input error
35   * @tc.desc: OpenCamera, cameraID is not found.
36   * @tc.level: level2
37   * @tc.size: MediumTest
38   * @tc.type: Function
39   */
TEST_F(UtestAdapterTest,camera_adapter_0001)40 TEST_F(UtestAdapterTest, camera_adapter_0001)
41 {
42     std::cout << "==========[test log] Preview stream, expected success." << std::endl;
43     // Get the stream manager
44     cameraBase->AchieveStreamOperator();
45     // start stream
46     cameraBase->intents = {PREVIEW};
47     cameraBase->StartStream(cameraBase->intents);
48     // Get preview
49     cameraBase->StartCapture(cameraBase->STREAM_ID_PREVIEW, cameraBase->CAPTURE_ID_PREVIEW, false, true);
50     // release stream
51     cameraBase->captureIds = {cameraBase->CAPTURE_ID_PREVIEW};
52     cameraBase->streamIds = {cameraBase->STREAM_ID_PREVIEW};
53     cameraBase->StopStream(cameraBase->captureIds, cameraBase->streamIds);
54 }