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