1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file expected in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci#include "capture_test.h" 16094332d3Sopenharmony_ci 17094332d3Sopenharmony_ciusing namespace OHOS; 18094332d3Sopenharmony_ciusing namespace std; 19094332d3Sopenharmony_ciusing namespace testing::ext; 20094332d3Sopenharmony_ciusing namespace OHOS::Camera; 21094332d3Sopenharmony_ci 22094332d3Sopenharmony_civoid CaptureTest::SetUpTestCase(void) {} 23094332d3Sopenharmony_civoid CaptureTest::TearDownTestCase(void) {} 24094332d3Sopenharmony_civoid CaptureTest::SetUp(void) 25094332d3Sopenharmony_ci{ 26094332d3Sopenharmony_ci Test_ = std::make_shared<OHOS::Camera::Test>(); 27094332d3Sopenharmony_ci Test_->Init(); 28094332d3Sopenharmony_ci Test_->Open(); 29094332d3Sopenharmony_ci} 30094332d3Sopenharmony_civoid CaptureTest::TearDown(void) 31094332d3Sopenharmony_ci{ 32094332d3Sopenharmony_ci Test_->Close(); 33094332d3Sopenharmony_ci} 34094332d3Sopenharmony_ci 35094332d3Sopenharmony_ci/** 36094332d3Sopenharmony_ci * @tc.name: preview and capture 37094332d3Sopenharmony_ci * @tc.desc: Preview and still_capture streams, Commit 2 streams together, capture in order, isStreaming is true. 38094332d3Sopenharmony_ci * @tc.size: MediumTest 39094332d3Sopenharmony_ci * @tc.type: Function 40094332d3Sopenharmony_ci */ 41094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0001, TestSize.Level0) 42094332d3Sopenharmony_ci{ 43094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview and still_capture streams."; 44094332d3Sopenharmony_ci std::cout << " Commit 2 streams together, capture in order, isStreaming is true." << std::endl; 45094332d3Sopenharmony_ci // Configure two streams of information 46094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 47094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 48094332d3Sopenharmony_ci // Capture preview stream 49094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 50094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 51094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 52094332d3Sopenharmony_ci // post-processing 53094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 54094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 55094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 56094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 57094332d3Sopenharmony_ci} 58094332d3Sopenharmony_ci 59094332d3Sopenharmony_ci/** 60094332d3Sopenharmony_ci * @tc.name: preview and capture 61094332d3Sopenharmony_ci * @tc.desc: Preview + capture, then cloase camera, and preview + capture again. 62094332d3Sopenharmony_ci * @tc.size: MediumTest 63094332d3Sopenharmony_ci * @tc.type: Function 64094332d3Sopenharmony_ci */ 65094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0002, TestSize.Level2) 66094332d3Sopenharmony_ci{ 67094332d3Sopenharmony_ci std::cout << "==========[test log]Preview + capture, cloase camera, and preview + capture." << std::endl; 68094332d3Sopenharmony_ci // Configure two streams of information 69094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 70094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 71094332d3Sopenharmony_ci // Capture preview stream 72094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 73094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 74094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 75094332d3Sopenharmony_ci // post-processing 76094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 77094332d3Sopenharmony_ci Test_->streamIds = {Test_->streamId_preview, Test_->streamId_capture}; 78094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 79094332d3Sopenharmony_ci Test_->consumerMap_.clear(); 80094332d3Sopenharmony_ci // the 2nd time configures two streams of information 81094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 82094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 83094332d3Sopenharmony_ci // Capture preview stream 84094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 85094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 86094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 87094332d3Sopenharmony_ci // post-processing 88094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 89094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 90094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 91094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 92094332d3Sopenharmony_ci} 93094332d3Sopenharmony_ci 94094332d3Sopenharmony_ci/** 95094332d3Sopenharmony_ci * @tc.name: preview and capture 96094332d3Sopenharmony_ci * @tc.desc: Preview and still_capture streams + 3A, Commit 2 streams together, capture in order, isStreaming is true. 97094332d3Sopenharmony_ci * @tc.size: MediumTest 98094332d3Sopenharmony_ci * @tc.type: Function 99094332d3Sopenharmony_ci */ 100094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0003, TestSize.Level1) 101094332d3Sopenharmony_ci{ 102094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview and still_capture streams + 3A,"; 103094332d3Sopenharmony_ci std::cout << "Commit 2 streams together, capture in order, isStreaming is true." << std::endl; 104094332d3Sopenharmony_ci // Configure two streams of information 105094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 106094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 107094332d3Sopenharmony_ci // Capture preview stream 108094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 109094332d3Sopenharmony_ci // Issue 3A parameters to increase exposure 110094332d3Sopenharmony_ci int32_t expo = 0xa0; 111094332d3Sopenharmony_ci std::shared_ptr<Camera::CameraSetting> meta = std::make_shared<Camera::CameraSetting>(100, 2000); 112094332d3Sopenharmony_ci meta->addEntry(OHOS_CONTROL_AE_EXPOSURE_COMPENSATION, &expo, 1); 113094332d3Sopenharmony_ci Test_->rc = Test_->cameraDevice->UpdateSettings(meta); 114094332d3Sopenharmony_ci if (Test_->rc == Camera::NO_ERROR) { 115094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: UpdateSettings success, for 10s." << std::endl; 116094332d3Sopenharmony_ci } else { 117094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: UpdateSettings fail, rc = " << Test_->rc << std::endl; 118094332d3Sopenharmony_ci } 119094332d3Sopenharmony_ci sleep(3); // sleep for 3 seconds 120094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 121094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 122094332d3Sopenharmony_ci // post-processing 123094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 124094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 125094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 126094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 127094332d3Sopenharmony_ci} 128094332d3Sopenharmony_ci 129094332d3Sopenharmony_ci/** 130094332d3Sopenharmony_ci * @tc.name: preview and capture 131094332d3Sopenharmony_ci * @tc.desc: Preview + capture, then switch to preview + video. 132094332d3Sopenharmony_ci * @tc.size: MediumTest 133094332d3Sopenharmony_ci * @tc.type: Function 134094332d3Sopenharmony_ci */ 135094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0004, TestSize.Level1) 136094332d3Sopenharmony_ci{ 137094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview + capture, then switch to preview + video." << std::endl; 138094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: First, create preview + capture." << std::endl; 139094332d3Sopenharmony_ci // Configure two streams of information 140094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 141094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 142094332d3Sopenharmony_ci // Capture preview stream 143094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 144094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 145094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 146094332d3Sopenharmony_ci // post-processing 147094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 148094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 149094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 150094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 151094332d3Sopenharmony_ci Test_->consumerMap_.clear(); 152094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Next, switch to preview + video." << Test_->rc << std::endl; 153094332d3Sopenharmony_ci // Configure two streams of information 154094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::VIDEO}; 155094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 156094332d3Sopenharmony_ci // Capture preview stream 157094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 158094332d3Sopenharmony_ci // Capture video stream 159094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_video, Test_->captureId_video, false, true); 160094332d3Sopenharmony_ci // post-processing 161094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_video}; 162094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 163094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_video); 164094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 165094332d3Sopenharmony_ci} 166094332d3Sopenharmony_ci 167094332d3Sopenharmony_ci/** 168094332d3Sopenharmony_ci * @tc.name: video cannot capture 169094332d3Sopenharmony_ci * @tc.desc: Preview + video, then capture a photo, expected not support. 170094332d3Sopenharmony_ci * @tc.size: MediumTest 171094332d3Sopenharmony_ci * @tc.type: Function 172094332d3Sopenharmony_ci */ 173094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0005, TestSize.Level2) 174094332d3Sopenharmony_ci{ 175094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview + video, then capture a photo." << std::endl; 176094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: First, create Preview + video." << std::endl; 177094332d3Sopenharmony_ci // Configure two streams of information 178094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::VIDEO}; 179094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 180094332d3Sopenharmony_ci // Capture preview stream 181094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 182094332d3Sopenharmony_ci // Capture video stream 183094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_video, Test_->captureId_video, false, true); 184094332d3Sopenharmony_ci 185094332d3Sopenharmony_ci // Start the capture stream 186094332d3Sopenharmony_ci std::shared_ptr<Camera::StreamInfo> streamInfo_capture = std::make_shared<Camera::StreamInfo>(); 187094332d3Sopenharmony_ci streamInfo_capture->streamId_ = Test_->streamId_capture; 188094332d3Sopenharmony_ci streamInfo_capture->width_ = 640; 189094332d3Sopenharmony_ci streamInfo_capture->height_ = 480; 190094332d3Sopenharmony_ci#ifdef CAMERA_BUILT_ON_OHOS_LITE 191094332d3Sopenharmony_ci streamInfo_capture->format_ = IMAGE_PIXEL_FORMAT_NV21; 192094332d3Sopenharmony_ci#else 193094332d3Sopenharmony_ci streamInfo_capture->format_ = PIXEL_FMT_YCRCB_420_SP; 194094332d3Sopenharmony_ci#endif 195094332d3Sopenharmony_ci streamInfo_capture->dataspace_ = 8; 196094332d3Sopenharmony_ci streamInfo_capture->intent_ = Camera::STILL_CAPTURE; 197094332d3Sopenharmony_ci streamInfo_capture->tunneledMode_ = 5; 198094332d3Sopenharmony_ci std::shared_ptr<OHOS::Camera::Test::StreamConsumer> capture_consumer = 199094332d3Sopenharmony_ci std::make_shared<OHOS::Camera::Test::StreamConsumer>(); 200094332d3Sopenharmony_ci#ifdef CAMERA_BUILT_ON_OHOS_LITE 201094332d3Sopenharmony_ci streamInfo_capture->bufferQueue_ = capture_consumer->CreateProducer([this](OHOS::SurfaceBuffer* buffer) { 202094332d3Sopenharmony_ci Test_->SaveYUV("capture", buffer->GetVirAddr(), buffer->GetSize()); 203094332d3Sopenharmony_ci }); 204094332d3Sopenharmony_ci#else 205094332d3Sopenharmony_ci streamInfo_capture->bufferQueue_ = capture_consumer->CreateProducer([this](void* addr, uint32_t size) { 206094332d3Sopenharmony_ci Test_->SaveYUV("capture", addr, size); 207094332d3Sopenharmony_ci }); 208094332d3Sopenharmony_ci#endif 209094332d3Sopenharmony_ci streamInfo_capture->bufferQueue_->SetQueueSize(8); 210094332d3Sopenharmony_ci Test_->consumerMap_[Camera::STILL_CAPTURE] = capture_consumer; 211094332d3Sopenharmony_ci // Query whether the IsStreamsSupported interface supports 212094332d3Sopenharmony_ci Camera::StreamSupportType pType; 213094332d3Sopenharmony_ci std::shared_ptr<CameraMetadata> modeSetting = 214094332d3Sopenharmony_ci std::make_shared<CameraMetadata>(2, 128); 215094332d3Sopenharmony_ci int64_t expoTime = 0; 216094332d3Sopenharmony_ci modeSetting->addEntry(OHOS_SENSOR_EXPOSURE_TIME, &expoTime, 1); 217094332d3Sopenharmony_ci int64_t colorGains[4] = {0}; 218094332d3Sopenharmony_ci modeSetting->addEntry(OHOS_SENSOR_COLOR_CORRECTION_GAINS, &colorGains, 4); 219094332d3Sopenharmony_ci std::vector<std::shared_ptr<Camera::StreamInfo>> stre; 220094332d3Sopenharmony_ci stre.push_back(streamInfo_capture); 221094332d3Sopenharmony_ci Test_->rc = Test_->streamOperator->IsStreamsSupported(Camera::NORMAL, modeSetting, stre, pType); 222094332d3Sopenharmony_ci EXPECT_EQ(Test_->rc, Camera::NO_ERROR); 223094332d3Sopenharmony_ci std::cout << "ptype = " << pType << std::endl; 224094332d3Sopenharmony_ci EXPECT_EQ(true, pType == Camera::RE_CONFIGURED_REQUIRED); 225094332d3Sopenharmony_ci // post-processing 226094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_video}; 227094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 228094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_video); 229094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 230094332d3Sopenharmony_ci} 231094332d3Sopenharmony_ci 232094332d3Sopenharmony_ci/** 233094332d3Sopenharmony_ci * @tc.name: preview and capture 234094332d3Sopenharmony_ci * @tc.desc: Commit 2 streams together, Preview and still_capture streams, isStreaming is false. 235094332d3Sopenharmony_ci * @tc.size: MediumTest 236094332d3Sopenharmony_ci * @tc.type: Function 237094332d3Sopenharmony_ci */ 238094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0006, TestSize.Level0) 239094332d3Sopenharmony_ci{ 240094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Commit 2 streams together,"; 241094332d3Sopenharmony_ci std::cout << "Preview and still_capture streams, isStreaming is false." << std::endl; 242094332d3Sopenharmony_ci // Configure two streams of information 243094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 244094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 245094332d3Sopenharmony_ci // Capture preview stream 246094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 247094332d3Sopenharmony_ci // Capture the photo stream, single capture 248094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, false); 249094332d3Sopenharmony_ci // post-processing 250094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview}; 251094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 252094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 253094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 254094332d3Sopenharmony_ci} 255094332d3Sopenharmony_ci 256094332d3Sopenharmony_ci/** 257094332d3Sopenharmony_ci * @tc.name: preview and capture 258094332d3Sopenharmony_ci * @tc.desc: Commit 2 streams together, Preview and still_capture streams, isStreaming is false, 259094332d3Sopenharmony_ci * Do not stop the stream, multiple single capture 260094332d3Sopenharmony_ci * @tc.size: MediumTest 261094332d3Sopenharmony_ci * @tc.type: Function 262094332d3Sopenharmony_ci */ 263094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0007, TestSize.Level0) 264094332d3Sopenharmony_ci{ 265094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Commit 2 streams together,"; 266094332d3Sopenharmony_ci std::cout << "Preview and still_capture streams, isStreaming is false, multiple single capture" << std::endl; 267094332d3Sopenharmony_ci // Configure two streams of information 268094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 269094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 270094332d3Sopenharmony_ci // Capture preview stream 271094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 272094332d3Sopenharmony_ci // Capture the photo stream, multiple single capture 273094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, false); 274094332d3Sopenharmony_ci sleep(1); 275094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, (Test_->captureId_capture) + 1, false, false); 276094332d3Sopenharmony_ci sleep(1); 277094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, (Test_->captureId_capture) + 2, false, false); 278094332d3Sopenharmony_ci // post-processing 279094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview}; 280094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 281094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 282094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 283094332d3Sopenharmony_ci} 284094332d3Sopenharmony_ci 285094332d3Sopenharmony_ci/** 286094332d3Sopenharmony_ci * @tc.name: preview and capture 287094332d3Sopenharmony_ci * @tc.desc: Commit 2 streams in order, Preview and still_capture streams. 288094332d3Sopenharmony_ci * @tc.size: MediumTest 289094332d3Sopenharmony_ci * @tc.type: Function 290094332d3Sopenharmony_ci */ 291094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0010, TestSize.Level1) 292094332d3Sopenharmony_ci{ 293094332d3Sopenharmony_ci std::cout << "==========[test log]Commit 2 streams in order, Preview and still_capture." << std::endl; 294094332d3Sopenharmony_ci // start preview stream 295094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW}; 296094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 297094332d3Sopenharmony_ci // Get preview 298094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 299094332d3Sopenharmony_ci // start stream 300094332d3Sopenharmony_ci Test_->intents = {Camera::STILL_CAPTURE}; 301094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 302094332d3Sopenharmony_ci // Start capture 303094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 304094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 305094332d3Sopenharmony_ci // release stream 306094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 307094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 308094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 309094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 310094332d3Sopenharmony_ci} 311094332d3Sopenharmony_ci 312094332d3Sopenharmony_ci/** 313094332d3Sopenharmony_ci * @tc.name: preview and capture 314094332d3Sopenharmony_ci * @tc.desc: Preview and still_capture streams, Commit 2 streams together, capture together, isStreaming is true. 315094332d3Sopenharmony_ci * @tc.size: MediumTest 316094332d3Sopenharmony_ci * @tc.type: Function 317094332d3Sopenharmony_ci */ 318094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0030, TestSize.Level2) 319094332d3Sopenharmony_ci{ 320094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview and still_capture streams,"; 321094332d3Sopenharmony_ci std::cout << " Commit 2 streams together, capture together, isStreaming is true." << std::endl; 322094332d3Sopenharmony_ci // Configure two streams of information 323094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 324094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 325094332d3Sopenharmony_ci // Capture preview stream 326094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 327094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 328094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 329094332d3Sopenharmony_ci // post-processing 330094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 331094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 332094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 333094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 334094332d3Sopenharmony_ci} 335094332d3Sopenharmony_ci 336094332d3Sopenharmony_ci/** 337094332d3Sopenharmony_ci * @tc.name: preview and capture 338094332d3Sopenharmony_ci * @tc.desc: Preview and still_capture streams + 3A, Commit 2 streams together, capture together, isStreaming is true. 339094332d3Sopenharmony_ci * @tc.size: MediumTest 340094332d3Sopenharmony_ci * @tc.type: Function 341094332d3Sopenharmony_ci */ 342094332d3Sopenharmony_ciHWTEST_F(CaptureTest, Camera_Capture_0040, TestSize.Level2) 343094332d3Sopenharmony_ci{ 344094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: Preview and still_capture streams + 3A,"; 345094332d3Sopenharmony_ci std::cout << " Commit 2 streams together, capture together, isStreaming is true." << std::endl; 346094332d3Sopenharmony_ci // Configure two streams of information 347094332d3Sopenharmony_ci Test_->intents = {Camera::PREVIEW, Camera::STILL_CAPTURE}; 348094332d3Sopenharmony_ci Test_->StartStream(Test_->intents); 349094332d3Sopenharmony_ci // Capture preview stream 350094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_preview, Test_->captureId_preview, false, true); 351094332d3Sopenharmony_ci // Issue 3A parameters to increase exposure 352094332d3Sopenharmony_ci std::shared_ptr<Camera::CameraSetting> meta = std::make_shared<Camera::CameraSetting>(100, 2000); 353094332d3Sopenharmony_ci int32_t expo = 0xa0; 354094332d3Sopenharmony_ci meta->addEntry(OHOS_CONTROL_AE_EXPOSURE_COMPENSATION, &expo, 1); 355094332d3Sopenharmony_ci Test_->rc = Test_->cameraDevice->UpdateSettings(meta); 356094332d3Sopenharmony_ci if (Test_->rc == Camera::NO_ERROR) { 357094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: UpdateSettings success, for 10s." << std::endl; 358094332d3Sopenharmony_ci } else { 359094332d3Sopenharmony_ci std::cout << "==========[test log]check Capture: UpdateSettings fail, rc = " << Test_->rc << std::endl; 360094332d3Sopenharmony_ci } 361094332d3Sopenharmony_ci sleep(3); // sleep for 3 seconds 362094332d3Sopenharmony_ci // Capture the photo stream, continuous capture 363094332d3Sopenharmony_ci Test_->StartCapture(Test_->streamId_capture, Test_->captureId_capture, false, true); 364094332d3Sopenharmony_ci // post-processing 365094332d3Sopenharmony_ci Test_->captureIds = {Test_->captureId_preview, Test_->captureId_capture}; 366094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_preview); 367094332d3Sopenharmony_ci Test_->streamIds.push_back(Test_->streamId_capture); 368094332d3Sopenharmony_ci Test_->StopStream(Test_->captureIds, Test_->streamIds); 369094332d3Sopenharmony_ci}