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