From c40d82cdd8617118aaf7aaee15fbe19552956322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E5=87=AF?= Date: Sun, 25 May 2025 18:56:58 +0800 Subject: [PATCH] addImageDecoderPixelmapCacheTDD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘永凯 --- .../core/pattern/image/image_test_ng.cpp | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/test/unittest/core/pattern/image/image_test_ng.cpp b/test/unittest/core/pattern/image/image_test_ng.cpp index 51164914751..a610a5f646c 100755 --- a/test/unittest/core/pattern/image/image_test_ng.cpp +++ b/test/unittest/core/pattern/image/image_test_ng.cpp @@ -36,6 +36,10 @@ public: { return ViewStackProcessor::GetInstance()->GetMainFrameNode(); } + + static void setSrcType(ImageSourceInfo& info, SrcType value) { + info.srcType_ = value; + }; }; /** @@ -2194,4 +2198,66 @@ HWTEST_F(ImageTestNg, TestSetBorderRadius004, TestSize.Level1) EXPECT_EQ(imageRenderProperty->GetBorderRadiusValue().radiusBottomLeft.value(), bottomLeft); EXPECT_EQ(imageRenderProperty->GetBorderRadiusValue().radiusBottomRight.value(), bottomRight); } +/** + * @tc.name: TestIsSurportCachePixelmap001 + * @tc.desc: Test IsSurportCachePixelmap + * @tc.type: FUNC + */ +HWTEST_F(ImageTestNg, TestIsSurportCachePixelmap001, TestSize.Level1) +{ + /** + * @tc.steps: step1. create Image Info. + */ + ImageSourceInfo sourceInfo; + ImageTestNg::setSrcType(sourceInfo, SrcType::ASSET); + EXPECT_EQ(sourceInfo.srcType_, SrcType::ASSET); + + /** + * @tc.steps: step2. Test IsSurportCachePixelmap + */ + bool result = sourceInfo.IsSurportCachePixelmap(); + EXPECT_EQ(result, false); +} + +/** + * @tc.name: TestIsSurportCachePixelmap002 + * @tc.desc: Test IsSurportCachePixelmap + * @tc.type: FUNC + */ +HWTEST_F(ImageTestNg, TestIsSurportCachePixelmap002, TestSize.Level1) +{ + /** + * @tc.steps: step1. create Image Info. + */ + ImageSourceInfo sourceInfo; + ImageTestNg::setSrcType(sourceInfo, SrcType::NETWORK); + EXPECT_EQ(sourceInfo.srcType_, SrcType::NETWORK); + + /** + * @tc.steps: step2. Test IsSurportCachePixelmap + */ + bool result = sourceInfo.IsSurportCachePixelmap(); + EXPECT_EQ(result, true); +} + +/** + * @tc.name: TestIsSurportCachePixelmap003 + * @tc.desc: Test IsSurportCachePixelmap + * @tc.type: FUNC + */ +HWTEST_F(ImageTestNg, TestIsSurportCachePixelmap003, TestSize.Level1) +{ + /** + * @tc.steps: step1. create Image Info. + */ + ImageSourceInfo sourceInfo; + ImageTestNg::setSrcType(sourceInfo, SrcType::RESOURCE); + EXPECT_EQ(sourceInfo.srcType_, SrcType::RESOURCE); + + /** + * @tc.steps: step2. Test IsSurportCachePixelmap + */ + bool result = sourceInfo.IsSurportCachePixelmap(); + EXPECT_EQ(result, true); +} } // namespace OHOS::Ace::NG \ No newline at end of file -- Gitee