mirror of
https://gitee.com/openharmony/multimedia_image_framework
synced 2024-12-04 05:16:21 +00:00
commit
5645b38e61
@ -213,6 +213,36 @@ HWTEST_F(ImageCreatorTest, OnBufferRelease001, TestSize.Level3)
|
||||
GTEST_LOG_(INFO) << "ImageCreatorTest: OnBufferRelease001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnBufferRelease002
|
||||
* @tc.desc: test OnBufferRelease
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageCreatorTest, OnBufferRelease002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageCreatorTest: OnBufferRelease002 start";
|
||||
std::shared_ptr<ImageCreator> creator = ImageCreator::CreateImageCreator(1, 1, 1, 1);
|
||||
OHOS::sptr<OHOS::SurfaceBuffer> buffer = nullptr;
|
||||
GSError ret = ImageCreator::OnBufferRelease(buffer);
|
||||
ASSERT_EQ(ret, GSERROR_NO_ENTRY);
|
||||
GTEST_LOG_(INFO) << "ImageCreatorTest: OnBufferRelease002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnBufferRelease003
|
||||
* @tc.desc: test OnBufferRelease
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageCreatorTest, OnBufferRelease003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageCreatorTest: OnBufferRelease003 start";
|
||||
std::shared_ptr<ImageCreator> creator = ImageCreator::CreateImageCreator(1, 1, 1, 1);
|
||||
sptr<SurfaceBuffer> buffer = SurfaceBuffer::Create();
|
||||
GSError ret = ImageCreator::OnBufferRelease(buffer);
|
||||
ASSERT_EQ(ret, GSERROR_NO_ENTRY);
|
||||
GTEST_LOG_(INFO) << "ImageCreatorTest: OnBufferRelease003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: QueueImage001
|
||||
* @tc.desc: test QueueImage
|
||||
|
@ -106,6 +106,27 @@ HWTEST_F(ImageNativeTest, OH_ImageNative_GetRowStrideTest, TestSize.Level3)
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetRowStrideTest end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_ImageNative_GetRowStrideTest002
|
||||
* @tc.desc: OH_ImageNative_GetRowStride
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageNativeTest, OH_ImageNative_GetRowStrideTest002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetRowStrideTest002 start";
|
||||
struct OH_ImageNative imageNative;
|
||||
OH_ImageNative* pImg = &imageNative;
|
||||
sptr<SurfaceBuffer> buffer = SurfaceBuffer::Create();
|
||||
std::shared_ptr<IBufferProcessor> releaser;
|
||||
NativeImage imgNative(buffer, releaser);
|
||||
pImg->imgNative = &imgNative;
|
||||
uint32_t componentType = 0;
|
||||
int32_t nRowStride = 0;
|
||||
Image_ErrorCode nRst = OH_ImageNative_GetRowStride(pImg, componentType, &nRowStride);
|
||||
ASSERT_EQ(nRst, IMAGE_BAD_PARAMETER);
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetRowStrideTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_ImageNative_GetPixelStrideTest
|
||||
* @tc.desc: OH_ImageNative_GetPixelStride
|
||||
@ -168,6 +189,27 @@ HWTEST_F(ImageNativeTest, OH_ImageNative_GetComponentTypesTest002, TestSize.Leve
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetComponentTypesTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_ImageNative_GetComponentTypesTest003
|
||||
* @tc.desc: OH_ImageNative_GetComponentTypes
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageNativeTest, OH_ImageNative_GetComponentTypesTest003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetComponentTypesTest003 start";
|
||||
struct OH_ImageNative imageNative;
|
||||
OH_ImageNative* pImg = &imageNative;
|
||||
sptr<SurfaceBuffer> buffer = SurfaceBuffer::Create();
|
||||
std::shared_ptr<IBufferProcessor> releaser;
|
||||
NativeImage imgNative(buffer, releaser);
|
||||
pImg->imgNative = &imgNative;
|
||||
uint32_t* pTypes = nullptr;
|
||||
size_t nTypeSize = 0;
|
||||
Image_ErrorCode nRst = OH_ImageNative_GetComponentTypes(pImg, &pTypes, &nTypeSize);
|
||||
ASSERT_EQ(nRst, IMAGE_SUCCESS);
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetComponentTypesTest003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_ImageNative_GetByteBufferTest002
|
||||
* @tc.desc: OH_ImageNative_GetByteBuffer
|
||||
@ -287,5 +329,25 @@ HWTEST_F(ImageNativeTest, OH_ImageNative_GetTimestampTest002, TestSize.Level3)
|
||||
ASSERT_EQ(nRst, IMAGE_SUCCESS);
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetTimestampTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_ImageNative_GetTimestampTest003
|
||||
* @tc.desc: OH_ImageNative_GetTimestamp
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageNativeTest, OH_ImageNative_GetTimestampTest003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetTimestampTest003 start";
|
||||
struct OH_ImageNative imageNative;
|
||||
OH_ImageNative* pImg = &imageNative;
|
||||
sptr<SurfaceBuffer> buffer = nullptr;
|
||||
std::shared_ptr<IBufferProcessor> releaser;
|
||||
NativeImage imgNative(buffer, releaser);
|
||||
pImg->imgNative = &imgNative;
|
||||
int64_t timestamp = 0;
|
||||
Image_ErrorCode nRst = OH_ImageNative_GetTimestamp(pImg, ×tamp);
|
||||
ASSERT_EQ(nRst, IMAGE_BAD_PARAMETER);
|
||||
GTEST_LOG_(INFO) << "ImageNativeTest: OH_ImageNative_GetTimestampTest003 end";
|
||||
}
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
|
@ -401,6 +401,23 @@ HWTEST_F(ImageReceiverTest, NextNativeImageTest001, TestSize.Level3)
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: NextNativeImageTest001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NextNativeImageTest002
|
||||
* @tc.desc: test NextNativeImage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageReceiverTest, NextNativeImageTest002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: NextNativeImageTest002 start";
|
||||
std::shared_ptr<ImageReceiver> imageReceiver;
|
||||
imageReceiver = ImageReceiver::CreateImageReceiver(RECEIVER_TEST_WIDTH,
|
||||
RECEIVER_TEST_HEIGHT, RECEIVER_TEST_FORMAT, RECEIVER_TEST_CAPACITY);
|
||||
imageReceiver->bufferProcessor_ = nullptr;
|
||||
std::shared_ptr<NativeImage> surfacebuffer = imageReceiver->NextNativeImage();
|
||||
ASSERT_EQ(surfacebuffer, nullptr);
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: NextNativeImageTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: LastNativeImageTest001
|
||||
* @tc.desc: test LastNativeImage
|
||||
@ -417,6 +434,23 @@ HWTEST_F(ImageReceiverTest, LastNativeImageTest001, TestSize.Level3)
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: LastNativeImageTest001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: LastNativeImageTest002
|
||||
* @tc.desc: test LastNativeImage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageReceiverTest, LastNativeImageTest002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: LastNativeImageTest002 start";
|
||||
std::shared_ptr<ImageReceiver> imageReceiver;
|
||||
imageReceiver = ImageReceiver::CreateImageReceiver(RECEIVER_TEST_WIDTH,
|
||||
RECEIVER_TEST_HEIGHT, RECEIVER_TEST_FORMAT, RECEIVER_TEST_CAPACITY);
|
||||
imageReceiver->bufferProcessor_ = nullptr;
|
||||
std::shared_ptr<NativeImage> surfacebuffer = imageReceiver->LastNativeImage();
|
||||
ASSERT_EQ(surfacebuffer, nullptr);
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: LastNativeImageTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SaveSTPTest001
|
||||
* @tc.desc: test SaveSTP
|
||||
@ -522,6 +556,28 @@ HWTEST_F(ImageReceiverTest, SaveBufferAsImageTest002, TestSize.Level3)
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: SaveBufferAsImageTest002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SaveBufferAsImageTest003
|
||||
* @tc.desc: test SaveBufferAsImage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ImageReceiverTest, SaveBufferAsImageTest003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: SaveBufferAsImageTest003 start";
|
||||
InitializationOptions opts;
|
||||
opts.size.width = 0;
|
||||
opts.size.height = 0;
|
||||
opts.editable = true;
|
||||
std::shared_ptr<ImageReceiver> imageReceiver;
|
||||
imageReceiver = ImageReceiver::CreateImageReceiver(0,
|
||||
0, RECEIVER_TEST_FORMAT, RECEIVER_TEST_CAPACITY);
|
||||
int fd = open("/data/receiver/Receiver_buffer7.jpg", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
ASSERT_NE(fd, 0);
|
||||
int32_t res = imageReceiver->SaveBufferAsImage(fd, opts);
|
||||
ASSERT_EQ(res, SUCCESS);
|
||||
GTEST_LOG_(INFO) << "ImageReceiverTest: SaveBufferAsImageTest003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetReceiverSurfaceTest001
|
||||
* @tc.desc: test GetReceiverSurface
|
||||
|
Loading…
Reference in New Issue
Block a user