• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "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 (display_ == nullptr)
24     display_ = std::make_shared<TestDisplay>();
25     display_->FBInit();
26     display_->Init();
27 }
TearDown(void)28 void UtestAdapterTest::TearDown(void)
29 {
30     display_->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     // 获取流管理器
44     display_->AchieveStreamOperator();
45     // 启流
46     display_->intents = {Camera::PREVIEW};
47     display_->StartStream(display_->intents);
48     // 获取预览图
49     display_->StartCapture(display_->streamId_preview, display_->captureId_preview, false, true);
50     // 释放流
51     display_->captureIds = {display_->captureId_preview};
52     display_->streamIds = {display_->streamId_preview};
53     display_->StopStream(display_->captureIds, display_->streamIds);
54 }