<分布式相机修改>

Signed-off-by: majiangfeng <majiangfeng7@h-partners.com>
This commit is contained in:
majiangfeng 2022-09-03 13:05:09 +08:00
parent 648a85082e
commit ed5acf6bc9
4 changed files with 30 additions and 34 deletions

View File

@ -21,10 +21,8 @@ using namespace testing::ext;
using namespace OHOS::DistributedHardware;
auto mainDemo = std::make_shared<DcameraHdfDemo>();
int32_t g_dCamera_Ok = 0;
int32_t g_dCamera_Error = -1;
int32_t g_dSleepOk = 2;
int32_t g_dSleep = 5;
int32_t CameraOk = 0;
int32_t SleepOk = 2;
class DCameraAutomatTest : public testing::Test {
public:
@ -49,69 +47,68 @@ DCameraAutomatTest::DCameraAutomatTest(void) {}
HWTEST_F(DCameraAutomatTest, DCameraTest_0100, TestSize.Level1)
{
int32_t ret = mainDemo->InitSensors();
EXPECT_EQ(g_dCamera_Ok, ret) << "InitSensors fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "InitSensors fail";
sleep(SleepOk);
ret = mainDemo->InitCameraDevice();
EXPECT_EQ(g_dCamera_Ok, ret) << "InitCameraDevice fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "InitCameraDevice fail";
sleep(SleepOk);
ret = PreviewOn(0, mainDemo);
EXPECT_EQ(g_dCamera_Ok, ret) << "PreviewOn fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "PreviewOn fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0200, TestSize.Level1)
{
int32_t ret = mainDemo->SetAwbMode(g_dSleepOk);
EXPECT_EQ(g_dCamera_Ok, ret) << "SetAwbMode incandescent fail";
sleep(g_dSleepOk);
int32_t ret = mainDemo->SetAwbMode(SleepOk);
EXPECT_EQ(CameraOk, ret) << "SetAwbMode incandescent fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0300, TestSize.Level1)
{
int32_t ret = mainDemo->SetAwbMode(g_dCamera_Ok);
EXPECT_EQ(g_dCamera_Ok, ret) << "SetAwbMode fail";
sleep(g_dSleepOk);
int32_t ret = mainDemo->SetAwbMode(SleepOk);
EXPECT_EQ(CameraOk, ret) << "SetAwbMode fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0400, TestSize.Level1)
{
int32_t ret = mainDemo->SetAeExpo();
EXPECT_EQ(g_dCamera_Ok, ret) << "SetAeExpo fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "SetAeExpo fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0500, TestSize.Level1)
{
int32_t ret = mainDemo->SetMetadata();
EXPECT_EQ(g_dCamera_Ok, ret) << "SetMetadata fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "SetMetadata fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0600, TestSize.Level1)
{
int32_t ret = CaptureTest(mainDemo);
EXPECT_EQ(g_dCamera_Ok, ret) << "CaptureTest fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "CaptureTest fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0700, TestSize.Level1)
{
int32_t ret = VideoTest(mainDemo);
EXPECT_EQ(g_dCamera_Ok, ret) << "VideoTest fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "VideoTest fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0800, TestSize.Level1)
{
int32_t ret = FlashLightTest(mainDemo);
EXPECT_EQ(g_dCamera_Ok, ret) << "FlashLightTest fail";
sleep(g_dSleepOk);
EXPECT_EQ(CameraOk, ret) << "FlashLightTest fail";
sleep(SleepOk);
}
HWTEST_F(DCameraAutomatTest, DCameraTest_0900, TestSize.Level1)
{
int32_t ret = OfflineTest(mainDemo);
EXPECT_EQ(g_dCamera_Ok, ret) << "OfflineTest fail";
sleep(g_dSleep);
EXPECT_EQ(CameraOk, ret) << "OfflineTest fail";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -87,8 +87,7 @@ void DcameraHdfDemo::GetStreamOpt()
}
}
RetCode DcameraHdfDemo::CaptureON(const int streamId,
const int captureId, CaptureMode mode)
RetCode DcameraHdfDemo::CaptureON(const int streamId, const int captureId, CaptureMode mode)
{
DHLOGI("demo test: CaptureON enter streamId == %d and captureId == %d and mode == %d",
streamId, captureId, mode);
@ -114,7 +113,7 @@ RetCode DcameraHdfDemo::CaptureON(const int streamId,
sizeof(mirrorSwitch_));
captureSetting_->addEntry(OHOS_JPEG_GPS_COORDINATES, gps_.data(), gps_.size());
}
std::vector<uint8_t> setting;
bool iscapture = true;
OHOS::Camera::MetadataUtils::ConvertMetadataToVec(captureSetting_, setting);

View File

@ -78,7 +78,7 @@ typedef enum {
OHOS_CAMERA_AWB_MODE_CLOUDY_DAYLIGHT,
OHOS_CAMERA_AWB_MODE_TWILIGHT,
OHOS_CAMERA_AWB_MODE_SHADE,
} camera_awb_mode_t;
} CameraAwbMode;
class DemoCameraHostCallback;
class DcameraHdfDemo {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at