From 9e49ef5c68cfa9df39af3c7a291777412492995f Mon Sep 17 00:00:00 2001 From: fandongyu Date: Mon, 16 Jun 2025 19:24:04 +0800 Subject: [PATCH 1/2] Signed-off-by:fandongyu Signed-off-by: fandongyu --- .../image_source_ai_sr_hdr_test.cpp | 158 --------------- .../image_source_test/image_source_test.cpp | 190 ------------------ .../pixel_map_test/pixelmap_native_test.cpp | 102 ---------- .../unittest/plugin_test/ext_decoder_test.cpp | 38 ---- 4 files changed, 488 deletions(-) diff --git a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_ai_sr_hdr_test.cpp b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_ai_sr_hdr_test.cpp index 0f3f0cf8f..cdbb03843 100644 --- a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_ai_sr_hdr_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_ai_sr_hdr_test.cpp @@ -209,44 +209,6 @@ HWTEST_F(ImageSourceAiTest, AisrTestLargerLow, TestSize.Level3) ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); } -/** - * @tc.name: AisrTestSmallerHigh - * @tc.desc: test jpg, set want smaller size + HIGH. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceAiTest, AisrTestSmallerHigh, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_HDR_PIC1_PATH, opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - - int32_t jpegWidth = 0; - int32_t jpegHeight = 0; - - DecodeOptions decodeOpts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - - jpegWidth = pixelMap->GetWidth(); - jpegHeight = pixelMap->GetHeight(); - int32_t desiredWidth = 400; // enable AISR by desired size - int32_t desiredHeight = 400; - - decodeOpts.desiredSize.width = desiredWidth; - decodeOpts.desiredSize.height = desiredHeight; - decodeOpts.resolutionQuality = ResolutionQuality::HIGH; // decode zoom to want size - - pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); // aisr process change solution quality - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - ASSERT_EQ(desiredWidth, pixelMap->GetWidth()); - ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); -} - /** * @tc.name: AisrTestEqual * @tc.desc: test jpg, set want equal size, so NOT run AISR. @@ -283,125 +245,5 @@ HWTEST_F(ImageSourceAiTest, AisrTestEqual, TestSize.Level3) ASSERT_EQ(desiredWidth, pixelMap->GetWidth()); ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); } - -/** - * @tc.name: SrHdrTestSmallerHigh - * @tc.desc: Set smaller want size + HIGH to run aisr;set HDR to run AIHDR. (AiSr/AiHdr both) - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceAiTest, SrHdrTestSmallerHigh, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_HDR_PIC1_PATH, opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - - int32_t jpegWidth = 0; - int32_t jpegHeight = 0; - - DecodeOptions decodeOpts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - - jpegWidth = pixelMap->GetWidth(); - jpegHeight = pixelMap->GetHeight(); - - int32_t desiredWidth = jpegWidth - 400; - int32_t desiredHeight = jpegHeight - 400; - - decodeOpts.desiredSize.width = desiredWidth; - decodeOpts.desiredSize.height = desiredHeight; - decodeOpts.desiredDynamicRange = DecodeDynamicRange::HDR; - decodeOpts.resolutionQuality = ResolutionQuality::HIGH; - - pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - ASSERT_EQ(desiredWidth, pixelMap->GetWidth()); - ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); -} - -/** - * @tc.name: SrHdrTestSmallerMiddle - * @tc.desc: Set smaller want size + MEDIUM to run aisr;set HDR to run AIHDR. (AiSr/AiHdr both) - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceAiTest, SrHdrTestSmallerMiddle, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_HDR_PIC1_PATH, opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - - int32_t jpegWidth = 0; - int32_t jpegHeight = 0; - - DecodeOptions decodeOpts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - - jpegWidth = pixelMap->GetWidth(); - jpegHeight = pixelMap->GetHeight(); - - int32_t desiredWidth = jpegWidth - 400; - int32_t desiredHeight = jpegHeight - 400; - - decodeOpts.desiredSize.width = desiredWidth; - decodeOpts.desiredSize.height = desiredHeight; - decodeOpts.desiredDynamicRange = DecodeDynamicRange::HDR; - decodeOpts.resolutionQuality = ResolutionQuality::MEDIUM; - - pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - ASSERT_EQ(desiredWidth, pixelMap->GetWidth()); - ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); -} - -/** - * @tc.name: SrHdrTestSmallerLow - * @tc.desc: Set smaller want size + LOW to run aisr;set HDR to run AIHDR. (AiSr/AiHdr both) - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceAiTest, SrHdrTestSmallerLow, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_HDR_PIC1_PATH, opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - - int32_t jpegWidth = 0; - int32_t jpegHeight = 0; - - DecodeOptions decodeOpts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - - jpegWidth = pixelMap->GetWidth(); - jpegHeight = pixelMap->GetHeight(); - - int32_t desiredWidth = jpegWidth - 400; - int32_t desiredHeight = jpegHeight - 400; - - decodeOpts.desiredSize.width = desiredWidth; - decodeOpts.desiredSize.height = desiredHeight; - decodeOpts.desiredDynamicRange = DecodeDynamicRange::HDR; - decodeOpts.resolutionQuality = ResolutionQuality::LOW; - - pixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); - ASSERT_EQ(desiredWidth, pixelMap->GetWidth()); - ASSERT_EQ(desiredHeight, pixelMap->GetHeight()); -} } // namespace Multimedia } // namespace OHOS \ No newline at end of file diff --git a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_test.cpp b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_test.cpp index 4528127cd..7b5194fa2 100644 --- a/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_test.cpp @@ -2159,140 +2159,6 @@ HWTEST_F(ImageSourceTest, ApplyGainMap001, TestSize.Level3) ASSERT_EQ(ret, false); } -/** - * @tc.name: ReusePixelmap001 - * @tc.desc: test ReusePixelmap Heif SDR RGBA - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, ReusePixelmap001, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - opts.formatHint = "image/heif"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(IMAGE_INPUT_HEIF_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - uint32_t index = 0; - DecodeOptions optsPixel; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, optsPixel, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - - std::unique_ptr reuseImageSource = ImageSource::CreateImageSource(IMAGE_INPUT_HEIF_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(reuseImageSource.get(), nullptr); - DecodeOptions reusePixelmapOpts; - std::shared_ptr rPixelmap = std::move(pixelMap); - reusePixelmapOpts.reusePixelmap = rPixelmap; - std::unique_ptr newPixelMap = reuseImageSource->CreatePixelMap(index, reusePixelmapOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); -} - -/** - * @tc.name: ReusePixelmap002 - * @tc.desc: test ReusePixelmap Jpeg HDR - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, ReusePixelmap002, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - opts.formatHint = "image/jpeg"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_HDR_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - uint32_t index = 0; - DecodeOptions optsPixel; - optsPixel.desiredDynamicRange = Media::DecodeDynamicRange::HDR; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, optsPixel, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - - std::unique_ptr reuseImageSource = ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_HDR_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(reuseImageSource.get(), nullptr); - DecodeOptions reusePixelmapOpts; - std::shared_ptr rPixelmap = std::move(pixelMap); - reusePixelmapOpts.reusePixelmap = rPixelmap; - reusePixelmapOpts.desiredDynamicRange = Media::DecodeDynamicRange::HDR; - std::unique_ptr newPixelMap = reuseImageSource->CreatePixelMap(index, reusePixelmapOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); -} - -/** - * @tc.name: ReusePixelmap003 - * @tc.desc: test ReusePixelmap Heif SDR YUV - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, ReusePixelmap003, TestSize.Level3) -{ - uint32_t errorCode = 0; - SourceOptions opts; - opts.formatHint = "image/heif"; - std::unique_ptr imageSource = ImageSource::CreateImageSource(IMAGE_INPUT_HEIF_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - uint32_t index = 0; - DecodeOptions optsPixel; - optsPixel.desiredPixelFormat = PixelFormat::NV12; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, optsPixel, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - - std::unique_ptr reuseImageSource = ImageSource::CreateImageSource(IMAGE_INPUT_HEIF_PATH, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(reuseImageSource.get(), nullptr); - DecodeOptions reusePixelmapOpts; - std::shared_ptr rPixelmap = std::move(pixelMap); - reusePixelmapOpts.desiredPixelFormat = PixelFormat::NV12; - reusePixelmapOpts.reusePixelmap = rPixelmap; - std::unique_ptr newPixelMap = reuseImageSource->CreatePixelMap(index, reusePixelmapOpts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); -} - -/** - * @tc.name: CreatePixelMapUsingBrokenImage001 - * @tc.desc: test CreatePixelMap use broken jpeg image. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, CreatePixelMapUsingBrokenImage001, TestSize.Level1) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_BROKEN_ONE, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - uint32_t index = 0; - DecodeOptions dopts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, dopts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); -} - -/** - * @tc.name: CreatePixelMapUsingBrokenImage002 - * @tc.desc: test CreatePixelMap use broken jpeg image. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, CreatePixelMapUsingBrokenImage002, TestSize.Level1) -{ - uint32_t errorCode = 0; - SourceOptions opts; - std::unique_ptr imageSource = ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_BROKEN_TWO, - opts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(imageSource.get(), nullptr); - uint32_t index = 0; - DecodeOptions dopts; - std::unique_ptr pixelMap = imageSource->CreatePixelMap(index, dopts, errorCode); - ASSERT_EQ(errorCode, SUCCESS); - ASSERT_NE(pixelMap.get(), nullptr); -} - /** * @tc.name: ImageSourceTest_CreateImageSourceTest003 * @tc.desc: Verify that create image source when use larger than MAX_SOURCE_SIZE size. @@ -2478,38 +2344,6 @@ HWTEST_F(ImageSourceTest, IsSupportAllocatorTypeTest001, TestSize.Level1) GTEST_LOG_(INFO) << "ImageSourceTest: IsSupportAllocatorTypeTest001 end"; } -/** - * @tc.name: ImageSourceTest_IsSupportAllocatorTypeTest002 - * @tc.desc: Verify that IsSupportAllocatorType when decode sdr image and pixel format is ARGB_8888 - * and allocatype is DMA_ALLOC. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, IsSupportAllocatorTypeTest002, TestSize.Level1) -{ - GTEST_LOG_(INFO) << "ImageSourceTest: IsSupportAllocatorTypeTest002 start"; - uint32_t errorCode = 0; - SourceOptions opts; - opts.formatHint = "image/jpeg"; - std::unique_ptr imageSource = - ImageSource::CreateImageSource(IMAGE_INPUT_JPEG_PATH, opts, errorCode); - ASSERT_NE(imageSource, nullptr); - ASSERT_EQ(errorCode, SUCCESS); - - imageSource->sourceHdrType_ = ImageHdrType::SDR; - DecodeOptions decodeOpts; - decodeOpts.desiredDynamicRange = DecodeDynamicRange::SDR; - decodeOpts.desiredPixelFormat = PixelFormat::ARGB_8888; - - auto iter = imageSource->GetValidImageStatus(0, errorCode); - ASSERT_NE(iter, imageSource->imageStatusMap_.end()); - ImageInfo& firstImageInfo = (iter->second).imageInfo; - firstImageInfo.encodedFormat = "image/jpeg"; - - auto ret = imageSource->IsSupportAllocatorType(decodeOpts, NUM_1); - ASSERT_EQ(ret, false); - GTEST_LOG_(INFO) << "ImageSourceTest: IsSupportAllocatorTypeTest002 end"; -} - /** * @tc.name: ImageSourceTest_InitDecodeContextTest001 * @tc.desc: Verify that InitDecodeContext when desiredPixelFormat is ARGB_8888. @@ -2574,18 +2408,6 @@ HWTEST_F(ImageSourceTest, CreatePixelMapExtendedTest001, TestSize.Level1) GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest001 end"; } -/** - * @tc.name: ImageSourceTest_CreatePixelMapExtendedTest002 - * @tc.desc: Verify that CreatePixelMapExtended when decode options is invalid data. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, CreatePixelMapExtendedTest002, TestSize.Level1) -{ - GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest002 start"; - CreatePixelMapExtendedUseInvalidOptsTest(2, 0); - GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest002 end"; -} - /** * @tc.name: ImageSourceTest_CreatePixelMapExtendedTest003 * @tc.desc: Verify that CreatePixelMapExtended when decode options is invalid data. @@ -2610,18 +2432,6 @@ HWTEST_F(ImageSourceTest, CreatePixelMapExtendedTest004, TestSize.Level1) GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest004 end"; } -/** - * @tc.name: ImageSourceTest_CreatePixelMapExtendedTest005 - * @tc.desc: Verify that CreatePixelMapExtended when decode options is invalid data. - * @tc.type: FUNC - */ -HWTEST_F(ImageSourceTest, CreatePixelMapExtendedTest005, TestSize.Level1) -{ - GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest005 start"; - CreatePixelMapExtendedUseInvalidOptsTest(0, 3, ERR_IMAGE_DATA_ABNORMAL); - GTEST_LOG_(INFO) << "ImageSourceTest: CreatePixelMapExtendedTest005 end"; -} - /** * @tc.name: ImageSourceTest_ModifyImagePropertyExTest001 * @tc.desc: Verify that ModifyImagePropertyEx when srcFd_ is -1 and srcFilePath_ is empty and diff --git a/frameworks/innerkitsimpl/test/unittest/pixel_map_test/pixelmap_native_test.cpp b/frameworks/innerkitsimpl/test/unittest/pixel_map_test/pixelmap_native_test.cpp index 6eb94af8f..8f9bed609 100644 --- a/frameworks/innerkitsimpl/test/unittest/pixel_map_test/pixelmap_native_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/pixel_map_test/pixelmap_native_test.cpp @@ -638,108 +638,6 @@ HWTEST_F(PixelMapNdk2Test, OH_PixelmapNative_Release, TestSize.Level3) GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapNative_Release end"; } -/** - * @tc.name: OH_PixelmapImageInfo_GetMimeType001 - * @tc.desc: test OH_PixelmapImageInfo_GetMimeType - * @tc.type: FUNC - */ -HWTEST_F(PixelMapNdk2Test, OH_PixelmapImageInfo_GetMimeType001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType001 start"; - OH_Pixelmap_ImageInfo *info1 = nullptr; - Image_ErrorCode ret = OH_PixelmapImageInfo_Create(&info1); - ASSERT_EQ(ret, IMAGE_SUCCESS); - ASSERT_NE(info1, nullptr); - OH_Pixelmap_ImageInfo *info2 = nullptr; - - Image_MimeType mimeType1; - Image_MimeType *mimeType2 = nullptr; - ret = OH_PixelmapImageInfo_GetMimeType(info1, &mimeType1); - EXPECT_EQ(ret, IMAGE_UNKNOWN_MIME_TYPE); - ret = OH_PixelmapImageInfo_GetMimeType(info2, &mimeType1); - EXPECT_EQ(ret, IMAGE_BAD_PARAMETER); - ret = OH_PixelmapImageInfo_GetMimeType(info1, mimeType2); - EXPECT_EQ(ret, IMAGE_BAD_PARAMETER); - ret = OH_PixelmapImageInfo_GetMimeType(info2, mimeType2); - EXPECT_EQ(ret, IMAGE_BAD_PARAMETER); - - ret = OH_PixelmapImageInfo_Release(info1); - EXPECT_EQ(ret, IMAGE_SUCCESS); - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType001 end"; -} - -/** - * @tc.name: OH_PixelmapImageInfo_GetMimeType002 - * @tc.desc: test OH_PixelmapImageInfo_GetMimeType - * @tc.type: FUNC - */ -HWTEST_F(PixelMapNdk2Test, OH_PixelmapImageInfo_GetMimeType002, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType002 start"; - OH_Pixelmap_ImageInfo *info = nullptr; - Image_ErrorCode ret = OH_PixelmapImageInfo_Create(&info); - ASSERT_EQ(ret, IMAGE_SUCCESS); - - Image_MimeType mimeType; - ret = OH_PixelmapImageInfo_GetMimeType(info, &mimeType); - EXPECT_EQ(ret, IMAGE_UNKNOWN_MIME_TYPE); - - info->mimeType.size = TWO; - ret = OH_PixelmapImageInfo_GetMimeType(info, &mimeType); - EXPECT_EQ(ret, IMAGE_UNKNOWN_MIME_TYPE); - - ret = OH_PixelmapImageInfo_Release(info); - EXPECT_EQ(ret, IMAGE_SUCCESS); - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType002 end"; -} - -/** - * @tc.name: OH_PixelmapImageInfo_GetMimeType003 - * @tc.desc: test OH_PixelmapImageInfo_GetMimeType - * @tc.type: FUNC - */ -HWTEST_F(PixelMapNdk2Test, OH_PixelmapImageInfo_GetMimeType003, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType003 start"; - size_t length = IMAGE_JPEG_PATH_TEST.size(); - char filePath[length + 1]; - strcpy_s(filePath, sizeof(filePath), IMAGE_JPEG_PATH_TEST.c_str()); - - OH_ImageSourceNative *source = nullptr; - Image_ErrorCode ret = OH_ImageSourceNative_CreateFromUri(filePath, length, &source); - EXPECT_EQ(ret, IMAGE_SUCCESS); - ASSERT_NE(source, nullptr); - - OH_DecodingOptions *opts = nullptr; - OH_DecodingOptions_Create(&opts); - OH_PixelmapNative *pixelmap = nullptr; - ret = OH_ImageSourceNative_CreatePixelmap(source, opts, &pixelmap); - EXPECT_EQ(ret, IMAGE_SUCCESS); - ASSERT_NE(pixelmap, nullptr); - - OH_Pixelmap_ImageInfo *imageInfo = nullptr; - OH_PixelmapImageInfo_Create(&imageInfo); - ret = OH_PixelmapNative_GetImageInfo(pixelmap, imageInfo); - EXPECT_EQ(ret, IMAGE_SUCCESS); - ASSERT_NE(imageInfo, nullptr); - - Image_MimeType mimeType; - ret = OH_PixelmapImageInfo_GetMimeType(imageInfo, &mimeType); - EXPECT_EQ(ret, IMAGE_SUCCESS); - ASSERT_NE(mimeType.data, nullptr); - EXPECT_EQ(strcmp(mimeType.data, IMAGE_JPEG_FORMAT.c_str()), 0); - - imageInfo->mimeType.size = 0; - ret = OH_PixelmapImageInfo_GetMimeType(imageInfo, &mimeType); - EXPECT_EQ(ret, IMAGE_UNKNOWN_MIME_TYPE); - - OH_ImageSourceNative_Release(source); - OH_DecodingOptions_Release(opts); - OH_PixelmapNative_Release(pixelmap); - OH_PixelmapImageInfo_Release(imageInfo); - GTEST_LOG_(INFO) << "PixelMapNdk2Test: OH_PixelmapImageInfo_GetMimeType003 end"; -} - /** * @tc.name: OH_PixelmapInitializationOptions_SetGetSrcPixelFormat * @tc.desc: OH_PixelmapInitializationOptions_SetGetSrcPixelFormat 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 4bcb51d0e..e8718886c 100644 --- a/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/plugin_test/ext_decoder_test.cpp @@ -135,25 +135,6 @@ HWTEST_F(ExtDecoderTest, GetScaledSizeTest001, TestSize.Level3) GTEST_LOG_(INFO) << "ExtDecoderTest: GetScaledSizeTest001 end"; } -/** - * @tc.name: GetHardwareScaledSizeTest001 - * @tc.desc: Test of GetHardwareScaledSize - * @tc.type: FUNC - */ -HWTEST_F(ExtDecoderTest, GetHardwareScaledSizeTest001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ExtDecoderTest: GetHardwareScaledSizeTest001 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->GetHardwareScaledSize(dWidth, dHeight, scale); - ASSERT_EQ(ret, false); - GTEST_LOG_(INFO) << "ExtDecoderTest: GetHardwareScaledSizeTest001 end"; -} - /** * @tc.name: IsSupportScaleOnDecodeTest001 * @tc.desc: Test of IsSupportScaleOnDecode @@ -170,25 +151,6 @@ HWTEST_F(ExtDecoderTest, IsSupportScaleOnDecodeTest001, TestSize.Level3) GTEST_LOG_(INFO) << "ExtDecoderTest: IsSupportScaleOnDecodeTest001 end"; } -/** - * @tc.name: IsSupportCropOnDecodeTest001 - * @tc.desc: Test of IsSupportCropOnDecode - * @tc.type: FUNC - */ -HWTEST_F(ExtDecoderTest, IsSupportCropOnDecodeTest001, TestSize.Level3) -{ - GTEST_LOG_(INFO) << "ExtDecoderTest: IsSupportCropOnDecodeTest001 start"; - std::shared_ptr extDecoder = std::make_shared(); - EXIFInfo exifInfo_; - extDecoder->codec_ = nullptr; - bool ret = extDecoder->IsSupportCropOnDecode(); - ASSERT_EQ(ret, false); - SkIRect target; - ret = extDecoder->IsSupportCropOnDecode(target); - ASSERT_EQ(ret, false); - GTEST_LOG_(INFO) << "ExtDecoderTest: IsSupportCropOnDecodeTest001 end"; -} - /** * @tc.name: HasPropertyTest001 * @tc.desc: Test of HasProperty -- Gitee From 57b518fabfcd69cbb7dd482cff5c80d49d31c2dc Mon Sep 17 00:00:00 2001 From: fandongyu Date: Tue, 17 Jun 2025 10:49:49 +0800 Subject: [PATCH 2/2] Signed-off-by:fandongyu Signed-off-by: fandongyu --- frameworks/innerkitsimpl/test/BUILD.gn | 180 ------------------------- 1 file changed, 180 deletions(-) diff --git a/frameworks/innerkitsimpl/test/BUILD.gn b/frameworks/innerkitsimpl/test/BUILD.gn index c2ddc8625..8b469a52b 100644 --- a/frameworks/innerkitsimpl/test/BUILD.gn +++ b/frameworks/innerkitsimpl/test/BUILD.gn @@ -253,103 +253,6 @@ ohos_unittest("imagepixelmapparceltest") { ] } -ohos_unittest("imagesourcetest") { - DUAL_ADAPTER = true - module_out_path = module_output_path - - include_dirs = [ - "$image_subsystem/frameworks/innerkitsimpl/accessor/include", - "$image_subsystem/frameworks/innerkitsimpl/converter/include", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/mock", - "$image_subsystem/frameworks/innerkitsimpl/utils/include", - "$image_subsystem/interfaces/innerkits/include", - "$image_subsystem/plugins/common/libs/image/libextplugin/include", - "$image_subsystem/plugins/common/libs/image/libextplugin/include/hdr", - "$image_subsystem/plugins/manager/include", - ] - sources = [ - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/abstract_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/buffer_metadata_stream.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/data_buf.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/dng_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/exif_metadata.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/exif_metadata_formatter.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/file_metadata_stream.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/heif_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/jpeg_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/metadata_accessor_factory.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/png_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/png_image_chunk_utils.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/tiff_parser.cpp", - "$image_subsystem/frameworks/innerkitsimpl/accessor/src/webp_exif_metadata_accessor.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_packer_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_ai_sr_hdr_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_exif_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_gif_ex_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_gif_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_hdr_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_jpeg_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_png_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_svg_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_util.cpp", - - # "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_webp_test.cpp", - "$image_subsystem/plugins/common/libs/image/libextplugin/src/ext_stream.cpp", - "$image_subsystem/plugins/common/libs/image/libextplugin/src/hdr/hdr_helper.cpp", - "$image_subsystem/plugins/common/libs/image/libextplugin/src/hdr/jpeg_mpf_parser.cpp", - ] - - if (enable_heif_hw_decode) { - sources += [ "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_heif_test.cpp" ] - } - - if (DUAL_ADAPTER) { - sources += [ - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_bmp_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_raw_test.cpp", - "$image_subsystem/frameworks/innerkitsimpl/test/unittest/image_source_test/image_source_wbmp_test.cpp", - ] - } - - deps = [ - "$image_subsystem/plugins/common/libs/image/libextplugin:heifparser", - "//foundation/multimedia/image_framework/frameworks/innerkitsimpl/utils:image_utils", - "//foundation/multimedia/image_framework/interfaces/innerkits:image_native", - ] - - external_deps = [ - "c_utils:utils", - "drivers_interface_display:display_commontype_idl_headers", - "googletest:gmock_main", - "googletest:gtest_main", - "graphic_surface:surface", - "hilog:libhilog", - "skia:libjpeg", - "zlib:libz", - ] - if (enable_libexif) { - external_deps += [ "libexif:libexif" ] - } - - if (memory_utils_purgeable_ashmem_enable && defined(global_parts_info) && - defined(global_parts_info.resourceschedule_memmgr_override)) { - defines = [ "IMAGE_PURGEABLE_PIXELMAP" ] - external_deps += [ "memmgr_override:libpurgeablemem_plugin" ] - } - - if (defined(global_parts_info) && - defined(global_parts_info.multimedia_video_processing_engine)) { - if (defined(defines)) { - defines += [ "IMAGE_VPE_FLAG" ] - } else { - defines = [ "IMAGE_VPE_FLAG" ] - } - } - resource_config_file = "$image_subsystem/test/resource/image/ohos_test.xml" -} - ohos_unittest("jpegdecoderextest") { module_out_path = module_output_path @@ -1233,84 +1136,6 @@ ohos_unittest("napitest") { ] } -ohos_unittest("jpeg_hw_decoder_test") { - module_out_path = module_output_path - - if (is_ohos) { - 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", - "${image_subsystem}/plugins/common/libs/image/libextplugin/src/hardware/jpeg_hw_decoder.cpp", - "unittest/jpeg_hw_decode/common/mock_jpeg_hw_decode_flow.cpp", - "unittest/jpeg_hw_decode/unittest/jpeg_hw_decoder_test.cpp", - ] - - include_dirs = [ - "${image_subsystem}/frameworks/innerkitsimpl/test/unittest/jpeg_hw_decode/common/", - "${image_subsystem}/frameworks/innerkitsimpl/test/unittest/mock/", - "${image_subsystem}/frameworks/innerkitsimpl/utils/include/", - "${image_subsystem}/plugins/common/libs/image/libextplugin/include/", - "${image_subsystem}/plugins/common/libs/image/libextplugin/include/jpeg_yuv_decoder/", - "${image_subsystem}/plugins/manager/include/", - "${image_subsystem}/plugins/manager/include/pluginbase/", - "${image_subsystem}/interfaces/innerkits/include/", - "${image_subsystem}/plugins/common/libs/image/libextplugin/include/heif_impl/", - ] - - deps = [ - "${image_subsystem}/frameworks/innerkitsimpl/utils:image_utils", - "${image_subsystem}/interfaces/innerkits:image_native", - "${image_subsystem}/plugins/common/libs/image/libextplugin:extplugin", - "${image_subsystem}/plugins/common/libs/image/libextplugin:textureEncoderCL", - ] - - external_deps = [ - "c_utils:utils", - "drivers_interface_codec:libimage_proxy_2.0", - "drivers_interface_display:libdisplay_buffer_hdi_impl", - "drivers_interface_display:libdisplay_buffer_proxy_1.0", - "drivers_interface_display:libdisplay_composer_hdi_impl_1.2", - "drivers_interface_display:libdisplay_composer_proxy_1.0", - "googletest:gtest_main", - "graphic_surface:surface", - "hdf_core:libhdf_utils", - "hdf_core:libhdi", - "hilog:libhilog", - "ipc:ipc_single", - "libexif:libexif", - "libjpeg-turbo:turbojpeg", - "skia:libjpeg", - "skia:skia_canvaskit", - ] - if (enable_heif_hw_decode) { - defines += [ "HEIF_HW_DECODE_ENABLE" ] - deps += - [ "${image_subsystem}/plugins/common/libs/image/libextplugin:heifimpl" ] - external_deps += [ - "drivers_interface_codec:libcodec_proxy_3.0", - "ffmpeg:libohosffmpeg", - "ffrt:libffrt", - "graphic_2d:color_manager", - "hitrace:hitrace_meter", - "init:libbegetutil", - "ipc:ipc_core", - "openmax:libopenmax_static", - "qos_manager:qos", - ] - } - resource_config_file = "$image_subsystem/test/resource/image/ohos_test.xml" - cflags = [ - "-Dprivate=public", - "-Dprotected=public", - ] - - if (enable_picture) { - defines += [ "EXIF_INFO_ENABLE" ] - } -} - ohos_unittest("heif_hw_decoder_test") { module_out_path = module_output_path @@ -2043,7 +1868,6 @@ group("unittest") { ":imageformatconverttest", ":imagepixelmapparceltest", ":imagepixelmaptest", - ":imagesourcetest", ":imagestreamtest", ":imagetiffparsertest", ":imageutilstest", @@ -2072,10 +1896,6 @@ group("unittest") { #":webpplugintest", ] - if (enable_jpeg_hw_decode) { - deps += [ ":jpeg_hw_decoder_test" ] - } - if (enable_heif_hw_decode) { deps += [ ":heif_hw_decoder_test", -- Gitee