diff --git a/frameworks/innerkitsimpl/test/BUILD.gn b/frameworks/innerkitsimpl/test/BUILD.gn index 5325d271b457a65bf0df7982aa84a91bf164bf1c..8f71115f7fb95138d7ce7cd8943e67f5baf3d704 100644 --- a/frameworks/innerkitsimpl/test/BUILD.gn +++ b/frameworks/innerkitsimpl/test/BUILD.gn @@ -1259,7 +1259,6 @@ ohos_unittest("jpeg_hw_decoder_test") { defines = [ "SK_ENABLE_OHOS_CODEC" ] } sources = [ - "${image_subsystem}/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp", "${image_subsystem}/plugins/common/libs/image/libextplugin/src/ext_stream.cpp", "unittest/jpeg_hw_decode/common/mock_jpeg_hw_decode_flow.cpp", "unittest/jpeg_hw_decode/unittest/jpeg_hw_decoder_test.cpp", diff --git a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_packer_test.cpp b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_packer_test.cpp index b55ed5d2f0b884992670b5a708cbb97969b1b418..84e27469e86162ef53bd7a3cd801a634c49223e0 100644 --- a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_packer_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_packer_test.cpp @@ -658,154 +658,6 @@ HWTEST_F(ImagePackerTest, StartPacking020, TestSize.Level3) GTEST_LOG_(INFO) << "ImagePackerTest: StartPacking020 end"; } -/** - * @tc.name: PackYuv2Jpeg001 - * @tc.desc: test PackYuv2Jpeg - * @tc.type: FUNC - */ -HWTEST_F(ImagePackerTest, PackYuv2Jpeg001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg001 start"; - - uint32_t errorCode = 0; - SourceOptions opts; - std::string srcJpeg = "/data/local/tmp/image/test.jpg"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(srcJpeg.c_str(), opts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(imageSource, nullptr); - DecodeOptions dstOpts; - dstOpts.desiredPixelFormat = PixelFormat::NV12; - std::unique_ptr pixelMap = imageSource->CreatePixelMapEx(0, dstOpts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(pixelMap, nullptr); - - std::string outJpeg = "/data/local/tmp/image/pack1.jpg"; - ImagePacker pack; - const int fd = open(outJpeg.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - ASSERT_NE(fd, -1); - PackOption option; - option.format = "image/jpeg"; - errorCode = pack.StartPacking(fd, option); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - errorCode = pack.AddImage(*(imageSource.get())); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - pack.FinalizePacking(); - - close(fd); - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg001 end"; -} - -/** - * @tc.name: PackYuv2Jpeg002 - * @tc.desc: test PackYuv2Jpeg - * @tc.type: FUNC - */ -HWTEST_F(ImagePackerTest, PackYuv2Jpeg002, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg002 start"; - - uint32_t errorCode = 0; - SourceOptions opts; - std::string srcJpeg = "/data/local/tmp/image/test_hw.jpg"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(srcJpeg.c_str(), opts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(imageSource, nullptr); - DecodeOptions dstOpts; - dstOpts.desiredPixelFormat = PixelFormat::NV21; - std::unique_ptr pixelMap = imageSource->CreatePixelMapEx(0, dstOpts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(pixelMap, nullptr); - - std::string outJpeg = "/data/local/tmp/image/pack2.jpg"; - ImagePacker pack; - const int fd = open(outJpeg.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - ASSERT_NE(fd, -1); - PackOption option; - option.format = "image/jpeg"; - errorCode = pack.StartPacking(fd, option); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - errorCode = pack.AddImage(*(imageSource.get())); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - pack.FinalizePacking(); - - close(fd); - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg002 end"; -} - -/** - * @tc.name: PackYuv2Jpeg003 - * @tc.desc: test PackYuv2Jpeg - * @tc.type: FUNC - */ -HWTEST_F(ImagePackerTest, PackYuv2Jpeg003, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg003 start"; - - uint32_t errorCode = 0; - SourceOptions opts; - std::string srcJpeg = "/data/local/tmp/image/test_exif.jpg"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(srcJpeg.c_str(), opts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(imageSource, nullptr); - DecodeOptions dstOpts; - dstOpts.desiredPixelFormat = PixelFormat::NV12; - std::unique_ptr pixelMap = imageSource->CreatePixelMapEx(0, dstOpts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(pixelMap, nullptr); - - std::string outJpeg = "/data/local/tmp/image/pack3.jpg"; - ImagePacker pack; - const int fd = open(outJpeg.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - ASSERT_NE(fd, -1); - PackOption option; - option.format = "image/jpeg"; - errorCode = pack.StartPacking(fd, option); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - errorCode = pack.AddImage(*(imageSource.get())); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - pack.FinalizePacking(); - - close(fd); - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg003 end"; -} - -/** - * @tc.name: PackYuv2Jpeg004 - * @tc.desc: test PackYuv2Jpeg - * @tc.type: FUNC - */ -HWTEST_F(ImagePackerTest, PackYuv2Jpeg004, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg004 start"; - - uint32_t errorCode = 0; - SourceOptions opts; - std::string srcJpeg = "/data/local/tmp/image/test_packing_exif.jpg"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(srcJpeg.c_str(), opts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(imageSource, nullptr); - DecodeOptions dstOpts; - dstOpts.desiredPixelFormat = PixelFormat::NV21; - std::unique_ptr pixelMap = imageSource->CreatePixelMapEx(0, dstOpts, errorCode); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - ASSERT_NE(pixelMap, nullptr); - - std::string outJpeg = "/data/local/tmp/image/pack4.jpg"; - ImagePacker pack; - const int fd = open(outJpeg.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - ASSERT_NE(fd, -1); - PackOption option; - option.format = "image/jpeg"; - errorCode = pack.StartPacking(fd, option); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - errorCode = pack.AddImage(*(imageSource.get())); - ASSERT_EQ(errorCode, OHOS::Media::SUCCESS); - pack.FinalizePacking(); - - close(fd); - GTEST_LOG_(INFO) << "ImagePackerTest: PackYuv2Jpeg004 end"; -} - /** * @tc.name: GetSupportedFormatsTest001 * @tc.desc: test GetSupportedFormats diff --git a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_hdr_test.cpp b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_hdr_test.cpp index 50c51bb20c47937a8e6bc7951454c318f59424aa..01d173b96046a264304a89cc7e3e9319386b1ce3 100644 --- a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_hdr_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_hdr_test.cpp @@ -565,37 +565,6 @@ HWTEST_F(ImageSourceHdrTest, PackHdrMediaTypeMarkerTest001, TestSize.Level3) ASSERT_EQ(bytes, HDR_METADATA_TYPE_BYTES); } -/** - * @tc.name: CheckPhotoDesiredPixelForamt001 - * @tc.desc: Test PhotoDesiredPixelForamt - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceHdrTest, CheckPhotoDesiredPixelForamt001, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_HDR_VIVID_PATH, opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); -#ifdef IMAGE_VPE_FLAG - uint32_t index = 0; - DecodeOptions optsPixel; - optsPixel.desiredDynamicRange = Media::DecodeDynamicRange::AUTO; - optsPixel.photoDesiredPixelFormat = PixelFormat::YCBCR_P010; - errorCode = 0; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, optsPixel, errorCode); - Media::PixelFormat outputPixelFormat = pixelMap->GetPixelFormat(); - bool isYcbcrP010 = outputPixelFormat == PixelFormat::YCBCR_P010; - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - bool isHdr = pixelMap->IsHdr(); - ASSERT_EQ(isHdr, true); - ASSERT_EQ(isYcbcrP010, true); -#endif -} - - /** * @tc.name: CheckPhotoDesiredPixelForamt002 * @tc.desc: Test PhotoDesiredPixelForamt diff --git a/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp b/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp index 38802e28448fdaa5b67b2edfadb5e83e62453286..bc9d63413f21b121490c03ac1527d71440cdf3ef 100644 --- a/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp @@ -44,7 +44,6 @@ constexpr int32_t PIXEL_MAP_MAX_RAM_SIZE = 600 * 1024 * 1024; constexpr static int32_t ZERO = 0; constexpr static size_t SIZE_ZERO = 0; constexpr static uint32_t NO_EXIF_TAG = 1; -constexpr static uint32_t OFFSET_2 = 2; constexpr static uint32_t INVALID_ENCODE_DYNAMIC_RANGE_VALUE = 20; #ifdef EXIF_INFO_ENABLE constexpr static uint32_t INVALID_COLOR_TYPE = 100; @@ -55,6 +54,9 @@ constexpr static int SUBSET_SIZE_SMALL = 5; constexpr static int SUBSET_SIZE_LARGE = 9; constexpr static int DEFAULT_SAMPLE_SIZE = 10; #endif +#ifdef SK_ENABLE_OHOS_CODEC +constexpr static uint32_t OFFSET_2 = 2; +#endif const static string CODEC_INITED_KEY = "CodecInited"; const static string ENCODED_FORMAT_KEY = "EncodedFormat"; const static string SUPPORT_SCALE_KEY = "SupportScale"; @@ -138,25 +140,6 @@ HWTEST_F(ExtDecoderTest, CheckCodecTest001, TestSize.Level3) GTEST_LOG_(INFO) << "ExtDecoderTest: CheckCodecTest001 end"; } -/** - * @tc.name: GetScaledSizeTest001 - * @tc.desc: Test of GetScaledSize - * @tc.type: FUNC - */ -HWTEST_F(ExtDecoderTest, GetScaledSizeTest001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ExtDecoderTest: GetScaledSizeTest001 start"; - std::shared_ptr extDecoder = std::make_shared(); - EXIFInfo exifInfo_; - int dWidth = 0; - int dHeight = 0; - float scale = ZERO; - extDecoder->codec_ = nullptr; - bool ret = extDecoder->GetScaledSize(dWidth, dHeight, scale); - ASSERT_EQ(ret, false); - GTEST_LOG_(INFO) << "ExtDecoderTest: GetScaledSizeTest001 end"; -} - /** * @tc.name: GetHardwareScaledSizeTest001 * @tc.desc: Test of GetHardwareScaledSize @@ -294,29 +277,6 @@ HWTEST_F(ExtDecoderTest, CheckDecodeOptionsTest001, TestSize.Level3) GTEST_LOG_(INFO) << "ExtDecoderTest: CheckDecodeOptionsTest001 end"; } -/** - * @tc.name: SetDecodeOptionsTest001 - * @tc.desc: Test of SetDecodeOptions - * @tc.type: FUNC - */ -HWTEST_F(ExtDecoderTest, SetDecodeOptionsTest001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ExtDecoderTest: SetDecodeOptionsTest001 start"; - std::shared_ptr extDecoder = std::make_shared(); - EXIFInfo exifInfo_; - uint32_t index = ZERO; - PixelDecodeOptions opts; - PlImageInfo info; - extDecoder->codec_ = nullptr; - uint32_t ret = extDecoder->SetDecodeOptions(index, opts, info); - ASSERT_EQ(ret, ERR_IMAGE_INVALID_PARAMETER); - extDecoder->frameCount_ = 1; - opts.sampleSize = OFFSET_2; - ret = extDecoder->SetDecodeOptions(index, opts, info); - ASSERT_EQ(ret, ERR_IMAGE_INVALID_PARAMETER); - GTEST_LOG_(INFO) << "ExtDecoderTest: SetDecodeOptionsTest001 end"; -} - /** * @tc.name: SetContextPixelsBufferTest001 * @tc.desc: Test of SetContextPixelsBuffer ShareMemAlloc DmaMemAlloc diff --git a/frameworks/innerkitsimpl/test/unittest/plugin_test/plugin_libjpeg_test.cpp b/frameworks/innerkitsimpl/test/unittest/plugin_test/plugin_libjpeg_test.cpp index d5dd3c372a6666ac32504e331fea1905500d952b..d883fa45932af507ffc317059c925dd680796bb1 100644 --- a/frameworks/innerkitsimpl/test/unittest/plugin_test/plugin_libjpeg_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/plugin_test/plugin_libjpeg_test.cpp @@ -690,26 +690,6 @@ HWTEST_F(PluginLibJpegTest, GetDataRangeFromIFD002, TestSize.Level3) GTEST_LOG_(INFO) << "PluginLibJpegTest: GetDataRangeFromIFD002 end"; } -/** - * @tc.name: ParseIFDPointerTag001 - * @tc.desc: ParseIFDPointerTag - * @tc.type: FUNC - */ -HWTEST_F(PluginLibJpegTest, ParseIFDPointerTag001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "PluginLibJpegTest: ParseIFDPointerTag001 start"; - const uint8_t *buf = new uint8_t; - ByteOrderedBuffer byteorder(buf, 10); - uint16_t tagNumber = byteorder.ReadUnsignedShort(); - const ExifIfd ifd = byteorder.GetIFDOfIFDPointerTag(tagNumber);; - const uint16_t dataFormat = byteorder.ReadUnsignedShort(); - ASSERT_EQ(dataFormat, 0); - byteorder.ParseIFDPointerTag(ifd, dataFormat); - delete buf; - buf = nullptr; - GTEST_LOG_(INFO) << "PluginLibJpegTest: ParseIFDPointerTag001 end"; -} - /** * @tc.name: IsIFDhandled001 * @tc.desc: IsIFDhandled