!33947 【bug】修复image的base64图片的内存系统中存在多份问题

Merge pull request !33947 from 吴寅潇/fixMemImageBase64New
This commit is contained in:
openharmony_ci 2024-05-27 04:47:20 +00:00 committed by Gitee
commit f97b1e5d3b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 167 additions and 80 deletions

View File

@ -15,6 +15,7 @@
#include "frameworks/bridge/declarative_frontend/jsview/js_image.h"
#include <cstdint>
#include <memory>
#include <vector>
#include "base/utils/utils.h"
@ -54,15 +55,15 @@ namespace {
namespace OHOS::Ace {
namespace {
ImageSourceInfo CreateSourceInfo(const std::string &src, RefPtr<PixelMap> &pixmap, const std::string &bundleName,
const std::string &moduleName)
ImageSourceInfo CreateSourceInfo(const std::shared_ptr<std::string>& srcRef, RefPtr<PixelMap>& pixmap,
const std::string& bundleName, const std::string& moduleName)
{
#if defined(PIXEL_MAP_SUPPORTED)
if (pixmap) {
return ImageSourceInfo(pixmap);
}
#endif
return { src, bundleName, moduleName };
return { srcRef, bundleName, moduleName };
}
} // namespace
@ -158,7 +159,8 @@ void JSImage::SetAlt(const JSCallbackInfo& args)
pixmap = CreatePixelMapFromNapiValue(args[0]);
#endif
}
auto srcInfo = CreateSourceInfo(src, pixmap, bundleName, moduleName);
auto srcRef = std::make_shared<std::string>(src);
auto srcInfo = CreateSourceInfo(srcRef, pixmap, bundleName, moduleName);
srcInfo.SetIsUriPureNumber((resId == -1));
ImageModel::GetInstance()->SetAlt(srcInfo);
}
@ -305,12 +307,9 @@ void JSImage::CreateImage(const JSCallbackInfo& info, bool isImageSpan)
}
#endif
}
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = src;
imageInfoConfig.bundleName = bundleName;
imageInfoConfig.moduleName = moduleName;
imageInfoConfig.isUriPureNumber = (resId == -1);
imageInfoConfig.isImageSpan = isImageSpan;
ImageInfoConfig imageInfoConfig(
std::make_shared<std::string>(src), bundleName, moduleName, (resId == -1), isImageSpan
);
ImageModel::GetInstance()->Create(imageInfoConfig, pixmap);
}

View File

@ -120,7 +120,8 @@ void ImageModelImpl::SetSvgAnimatorFinishEvent(std::function<void()>&& callback)
void ImageModelImpl::Create(const ImageInfoConfig& imageInfoConfig, RefPtr<PixelMap>& pixmap)
{
RefPtr<ImageComponent> image = AceType::MakeRefPtr<OHOS::Ace::ImageComponent>(imageInfoConfig.src);
RefPtr<ImageComponent> image =
AceType::MakeRefPtr<OHOS::Ace::ImageComponent>(imageInfoConfig.src ? *imageInfoConfig.src : "");
image->SetBundleInfo(imageInfoConfig.bundleName, imageInfoConfig.moduleName);
ViewStackProcessor::GetInstance()->ClaimElementId(image);
image->SetUseSkiaSvg(false);

View File

@ -114,10 +114,10 @@ RefPtr<CanvasImage> ImageDecoder::MakePixmapImage(AIImageQuality imageQuality)
auto width = std::lround(desiredSize_.Width());
auto height = std::lround(desiredSize_.Height());
std::pair<int32_t, int32_t> sourceSize = source->GetImageSize();
ACE_SCOPED_TRACE("CreateImagePixelMap %s, sourceSize: [ %d, %d ], targetSize: [ %d, %d ]",
obj_->GetSourceInfo().ToString().c_str(), sourceSize.first, sourceSize.second,
static_cast<int32_t>(width),
static_cast<int32_t>(height));
auto src = obj_->GetSourceInfo();
auto srcStr = src.GetSrcType() == SrcType::BASE64 ? src.GetKey() : src.ToString();
ACE_SCOPED_TRACE("CreateImagePixelMap %s, sourceSize: [ %d, %d ], targetSize: [ %d, %d ]", srcStr.c_str(),
sourceSize.first, sourceSize.second, static_cast<int32_t>(width), static_cast<int32_t>(height));
auto pixmap = source->CreatePixelMap({ width, height }, imageQuality);
CHECK_NULL_RETURN(pixmap, nullptr);

View File

@ -281,6 +281,7 @@ void ImageLoadingContext::DownloadImageSuccess(const std::string& imageData)
{
TAG_LOGI(AceLogTag::ACE_IMAGE, "Download image successfully, srcInfo = %{public}s, ImageData length=%{public}zu",
GetSrc().ToString().c_str(), imageData.size());
ACE_LAYOUT_SCOPED_TRACE("DownloadImageSuccess[src:%s]", GetSrc().ToString().c_str());
auto data = ImageData::MakeFromDataWithCopy(imageData.data(), imageData.size());
if (!Positive(imageData.size())) {
FailCallback("The length of imageData from netStack is not positive");

View File

@ -33,11 +33,24 @@
namespace OHOS::Ace {
struct ImageInfoConfig {
std::string src;
std::shared_ptr<std::string> src;
std::string bundleName;
std::string moduleName;
bool isUriPureNumber = false;
bool isImageSpan = false;
ImageInfoConfig() {}
ImageInfoConfig(
const std::shared_ptr<std::string>& src_, const std::string& bundleName_, const std::string& moduleName_)
: src(src_), bundleName(bundleName_), moduleName(moduleName_)
{}
ImageInfoConfig(const std::shared_ptr<std::string>& src_, const std::string& bundleName_,
const std::string& moduleName_, bool isUriPureNumber_, bool isImageSpan_)
: src(src_), bundleName(bundleName_), moduleName(moduleName_), isUriPureNumber(isUriPureNumber_),
isImageSpan(isImageSpan_)
{}
};
class ImageModel {
public:

View File

@ -21,6 +21,7 @@
#include "core/components/common/layout/constants.h"
#include "core/components/image/image_theme.h"
#include "core/components_ng/base/frame_node.h"
#include "core/image/image_source_info.h"
#ifndef ACE_UNITTEST
#include "core/components_ng/base/view_abstract.h"
#endif
@ -35,8 +36,19 @@
namespace OHOS::Ace::NG {
namespace {
const std::vector<float> DEFAULT_COLOR_FILTER = { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 };
ImageSourceInfo CreateSourceInfo(const std::string &src, RefPtr<PixelMap> &pixmap, const std::string &bundleName,
const std::string &moduleName)
ImageSourceInfo CreateSourceInfo(const std::shared_ptr<std::string>& src, RefPtr<PixelMap>& pixmap,
const std::string& bundleName, const std::string& moduleName)
{
#if defined(PIXEL_MAP_SUPPORTED)
if (pixmap) {
return ImageSourceInfo(pixmap);
}
#endif
return { src, bundleName, moduleName };
}
ImageSourceInfo CreateSourceInfo(
const std::string& src, RefPtr<PixelMap>& pixmap, const std::string& bundleName, const std::string& moduleName)
{
#if defined(PIXEL_MAP_SUPPORTED)
if (pixmap) {
@ -51,7 +63,8 @@ void ImageModelNG::Create(const ImageInfoConfig& imageInfoConfig, RefPtr<PixelMa
{
auto* stack = ViewStackProcessor::GetInstance();
auto nodeId = stack->ClaimNodeId();
ACE_LAYOUT_SCOPED_TRACE("Create[%s][self:%d] [src:%s]", V2::IMAGE_ETS_TAG, nodeId, imageInfoConfig.src.c_str());
const std::string& src = imageInfoConfig.src ? *imageInfoConfig.src : "";
ACE_LAYOUT_SCOPED_TRACE("Create[%s][self:%d] [src:%s]", V2::IMAGE_ETS_TAG, nodeId, src.c_str());
RefPtr<FrameNode> frameNode;
if (imageInfoConfig.isImageSpan) {
frameNode = ImageSpanNode::GetOrCreateSpanNode(V2::IMAGE_ETS_TAG,
@ -63,7 +76,7 @@ void ImageModelNG::Create(const ImageInfoConfig& imageInfoConfig, RefPtr<PixelMa
stack->Push(frameNode);
auto pattern = GetImagePattern();
CHECK_NULL_VOID(pattern);
if (imageInfoConfig.src.empty() && !pixMap && pattern->GetIsAnimation()) {
if (src.empty() && !pixMap && pattern->GetIsAnimation()) {
pattern->SetSrcUndefined(true);
return;
}
@ -112,7 +125,7 @@ void ImageModelNG::SetInitialSrc(FrameNode *frameNode, const std::string &src, c
void ImageModelNG::SetInitialPixelMap(FrameNode* frameNode, RefPtr<PixelMap>& pixMap)
{
auto srcInfo = CreateSourceInfo("", pixMap, "", "");
auto srcInfo = ImageSourceInfo(pixMap);
ACE_UPDATE_NODE_LAYOUT_PROPERTY(ImageLayoutProperty, ImageSourceInfo, srcInfo, frameNode);
}

View File

@ -579,6 +579,10 @@ std::shared_ptr<RSData> Base64ImageLoader::LoadImageData(
TAG_LOGW(AceLogTag::ACE_IMAGE, "error base64 image code!");
return nullptr;
}
if (SystemProperties::GetDebugEnabled()) {
TAG_LOGI(AceLogTag::ACE_IMAGE, "base64 size=%{public}d, src=%{public}s", (int)base64Code.size(),
imageSourceInfo.ToString().c_str());
}
return resData;
}

View File

@ -154,13 +154,43 @@ ImageSourceInfo::ImageSourceInfo(std::string imageSrc, std::string bundleName, s
}
}
ImageSourceInfo::ImageSourceInfo(const std::shared_ptr<std::string>& imageSrc, std::string bundleName,
std::string moduleName, Dimension width, Dimension height, InternalResource::ResourceId resourceId,
const RefPtr<PixelMap>& pixmap)
: srcRef_(imageSrc), bundleName_(std::move(bundleName)), moduleName_(std::move(moduleName)), sourceWidth_(width),
sourceHeight_(height), resourceId_(resourceId), pixmap_(pixmap), isSvg_(IsSVGSource(*srcRef_, resourceId_)),
isPng_(IsPngSource(*srcRef_, resourceId_)), srcType_(ResolveSrcType())
{
// count how many source set.
int32_t count = 0;
if (srcRef_ && !(*srcRef_).empty()) {
++count;
}
if (resourceId_ != InternalResource::ResourceId::NO_ID) {
++count;
}
if (pixmap != nullptr) {
++count;
}
if (count > 1) {
TAG_LOGW(AceLogTag::ACE_IMAGE, "ImageSourceInfo: multi image source set, only one will be load.");
}
GenerateCacheKey();
auto pipelineContext = NG::PipelineContext::GetCurrentContext();
if (pipelineContext) {
localColorMode_ = pipelineContext->GetLocalColorMode();
}
}
SrcType ImageSourceInfo::ResolveSrcType() const
{
if (pixmap_) {
return SrcType::PIXMAP;
}
if (!src_.empty()) {
return ResolveURIType(src_);
auto& src = GetSrc();
if (!src.empty()) {
return ResolveURIType(src);
}
if (resourceId_ != InternalResource::ResourceId::NO_ID) {
return SrcType::RESOURCE_ID;
@ -174,6 +204,9 @@ void ImageSourceInfo::GenerateCacheKey()
auto name = ToString() + AceApplicationInfo::GetInstance().GetAbilityName() + bundleName_ + moduleName_;
cacheKey_ =
std::to_string(std::hash<std::string> {}(name)) + std::to_string(static_cast<int32_t>(resourceId_)) + colorMode;
if (srcType_ == SrcType::BASE64) {
cacheKey_ += "SrcType:BASE64";
}
}
const std::string ImageSourceInfo::GetColorModeToString()
@ -203,7 +236,7 @@ bool ImageSourceInfo::operator==(const ImageSourceInfo& info) const
return false;
}
return ((!pixmap_ && !info.pixmap_) || (pixmap_ && info.pixmap_ && pixmap_ == info.pixmap_)) &&
src_ == info.src_ && resourceId_ == info.resourceId_;
GetSrc() == info.GetSrc() && resourceId_ == info.resourceId_;
}
bool ImageSourceInfo::operator!=(const ImageSourceInfo& info) const
@ -213,10 +246,10 @@ bool ImageSourceInfo::operator!=(const ImageSourceInfo& info) const
void ImageSourceInfo::SetSrc(const std::string& src, std::optional<Color> fillColor)
{
src_ = src;
srcType_ = ResolveURIType(src_);
srcRef_.reset(new std::string(src));
srcType_ = ResolveURIType(src);
resourceId_ = InternalResource::ResourceId::NO_ID;
isSvg_ = IsSVGSource(src_, resourceId_);
isSvg_ = IsSVGSource(src, resourceId_);
fillColor_ = fillColor;
pixmap_ = nullptr;
GenerateCacheKey();
@ -224,6 +257,9 @@ void ImageSourceInfo::SetSrc(const std::string& src, std::optional<Color> fillCo
const std::string& ImageSourceInfo::GetSrc() const
{
if (srcRef_) {
return *srcRef_;
}
return src_;
}
@ -248,6 +284,7 @@ void ImageSourceInfo::SetPixMap(const RefPtr<PixelMap>& pixmap, std::optional<Co
resourceId_ = InternalResource::ResourceId::NO_ID;
srcType_ = SrcType::PIXMAP;
src_.clear();
srcRef_.reset();
isSvg_ = IsSVGSource(src_, resourceId_);
fillColor_ = fillColor;
pixmap_ = pixmap;
@ -265,13 +302,14 @@ void ImageSourceInfo::SetModuleName(const std::string& moduleName)
bool ImageSourceInfo::IsInternalResource() const
{
return src_.empty() && resourceId_ != InternalResource::ResourceId::NO_ID && !pixmap_;
return GetSrc().empty() && resourceId_ != InternalResource::ResourceId::NO_ID && !pixmap_;
}
bool ImageSourceInfo::IsValid() const
{
return (src_.empty() && resourceId_ != InternalResource::ResourceId::NO_ID) ||
(!src_.empty() && resourceId_ == InternalResource::ResourceId::NO_ID) || pixmap_;
auto& src = GetSrc();
return (src.empty() && resourceId_ != InternalResource::ResourceId::NO_ID) ||
(!src.empty() && resourceId_ == InternalResource::ResourceId::NO_ID) || pixmap_;
}
bool ImageSourceInfo::IsPng() const
@ -306,8 +344,9 @@ SrcType ImageSourceInfo::GetSrcType() const
std::string ImageSourceInfo::ToString() const
{
if (!src_.empty()) {
return src_;
auto& src = GetSrc();
if (!src.empty()) {
return src;
}
if (resourceId_ != InternalResource::ResourceId::NO_ID) {
return std::string("internal resource id: ") + std::to_string(static_cast<int32_t>(resourceId_));
@ -342,6 +381,7 @@ Size ImageSourceInfo::GetSourceSize() const
void ImageSourceInfo::Reset()
{
srcRef_.reset();
src_.clear();
sourceWidth_ = Dimension(-1);
sourceHeight_ = Dimension(-1);
@ -370,7 +410,7 @@ bool ImageSourceInfo::SupportObjCache() const
if (!needCache_) {
return false;
}
return !src_.empty() || resourceId_ != InternalResource::ResourceId::NO_ID;
return !GetSrc().empty() || resourceId_ != InternalResource::ResourceId::NO_ID;
}
std::string ImageSourceInfo::GetKey() const

View File

@ -36,6 +36,11 @@ public:
InternalResource::ResourceId resourceId = InternalResource::ResourceId::NO_ID,
const RefPtr<PixelMap>& pixmap = nullptr);
ImageSourceInfo(const std::shared_ptr<std::string> &imageSrc, std::string bundleName, std::string moduleName,
Dimension width = Dimension(-1), Dimension height = Dimension(-1),
InternalResource::ResourceId resourceId = InternalResource::ResourceId::NO_ID,
const RefPtr<PixelMap>& pixmap = nullptr);
explicit ImageSourceInfo(std::string imageSrc, Dimension width = Dimension(-1), Dimension height = Dimension(-1),
InternalResource::ResourceId resourceId = InternalResource::ResourceId::NO_ID,
const RefPtr<PixelMap>& pixmap = nullptr)
@ -130,6 +135,7 @@ private:
void GenerateCacheKey();
std::string src_;
std::shared_ptr<std::string> srcRef_ = nullptr;
std::string cacheKey_;
// Interim programme
std::string bundleName_;

View File

@ -101,6 +101,7 @@ void* createImageSpanNode(ArkUI_Int32 nodeId)
imageSpanNode->IncRefCount();
return AceType::RawPtr(imageSpanNode);
}
void* createImageNode(ArkUI_Int32 nodeId)
{
RefPtr<PixelMap> pixmap = nullptr;

View File

@ -13,6 +13,7 @@
* limitations under the License.
*/
#include <memory>
#include <regex>
#include <utility>
@ -100,6 +101,14 @@ ImageSourceInfo::ImageSourceInfo(std::string imageSrc, std::string bundleName, s
isSvg_(IsSVGSource(src_, resourceId_)), isPng_(IsPngSource(src_, resourceId_)), srcType_(ResolveSrcType())
{}
ImageSourceInfo::ImageSourceInfo(const std::shared_ptr<std::string>& imageSrc, std::string bundleName,
std::string moduleName, Dimension width, Dimension height, InternalResource::ResourceId resourceId,
const RefPtr<PixelMap>& pixmap)
: bundleName_(std::move(bundleName)), moduleName_(std::move(moduleName)), sourceWidth_(width),
sourceHeight_(height), resourceId_(resourceId), pixmap_(pixmap), isSvg_(IsSVGSource(src_, resourceId_)),
isPng_(IsPngSource(src_, resourceId_)), srcType_(ResolveSrcType())
{}
SrcType ImageSourceInfo::ResolveSrcType() const
{
if (pixmap_) {

View File

@ -57,7 +57,7 @@ RefPtr<FrameNode> ImageBases::CreateImageNode(const std::string& src, const std:
{
ImageModelNG image;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = src;
imageInfoConfig.src = std::make_shared<std::string>(src);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -75,7 +75,7 @@ RefPtr<FrameNode> ImageBases::CreateImageNodeWithDefaultProp(
{
ImageModelNG image;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = src;
imageInfoConfig.src = std::make_shared<std::string>(src);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -100,7 +100,7 @@ RefPtr<FrameNode> ImageBases::CreateSyncImageNode()
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -115,7 +115,7 @@ RefPtr<FrameNode> ImageBases::CreateSyncWebImageNode()
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = WEB_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(WEB_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);

View File

@ -692,7 +692,7 @@ HWTEST_F(ImageTestNg, ImageCreator001, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -711,7 +711,7 @@ HWTEST_F(ImageTestNg, ImageCreator002, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -740,7 +740,7 @@ HWTEST_F(ImageTestNg, ImageCreator003, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -794,7 +794,7 @@ HWTEST_F(ImageTestNg, ImageEventTest001, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -826,7 +826,7 @@ HWTEST_F(ImageTestNg, ImageEventTest002, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -855,7 +855,7 @@ HWTEST_F(ImageTestNg, ImageSvgTest001, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -890,7 +890,7 @@ HWTEST_F(ImageTestNg, ImageColorFilterTest001, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);

View File

@ -33,7 +33,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0024, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -85,7 +85,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0025, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -137,7 +137,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0026, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -189,7 +189,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0027, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -241,7 +241,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0028, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -293,7 +293,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0029, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -345,7 +345,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0030, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -421,7 +421,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0031, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -473,7 +473,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0032, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -525,7 +525,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0033, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -577,7 +577,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0034, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -605,7 +605,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0035, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -659,7 +659,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0036, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -711,7 +711,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0037, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -763,7 +763,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0038, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -815,7 +815,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0039, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -867,7 +867,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0040, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -919,7 +919,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0041, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -971,7 +971,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0042, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1023,7 +1023,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0043, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1075,7 +1075,7 @@ HWTEST_F(ImageTestThreeNg, ImagePixelMapListTest0044, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = "";
imageInfoConfig.src = std::make_shared<std::string>("");
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);

View File

@ -426,7 +426,7 @@ HWTEST_F(ImageTestTwoNg, ImageSetDraggable0001, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -440,7 +440,7 @@ HWTEST_F(ImageTestTwoNg, ImageSetDraggable0002, TestSize.Level1)
ImageModelNG image;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = IMAGE_SRC_URL;
imageInfoConfig.src = std::make_shared<std::string>(IMAGE_SRC_URL);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
image.Create(imageInfoConfig, pixMap);
@ -1110,7 +1110,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0011, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1162,7 +1162,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0012, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1214,7 +1214,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0013, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1266,7 +1266,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0014, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1318,7 +1318,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0015, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1370,7 +1370,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0016, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1422,7 +1422,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0017, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1474,7 +1474,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0018, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1526,7 +1526,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0019, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1578,7 +1578,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0020, TestSize.Level1)
//切换Image数据源
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1606,7 +1606,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0021, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1660,7 +1660,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0022, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);
@ -1712,7 +1712,7 @@ HWTEST_F(ImageTestTwoNg, ImagePixelMapListTest0023, TestSize.Level1)
ImageModelNG imageModelNG;
RefPtr<PixelMap> pixMap = nullptr;
ImageInfoConfig imageInfoConfig;
imageInfoConfig.src = PNG_IMAGE;
imageInfoConfig.src = std::make_shared<std::string>(PNG_IMAGE);
imageInfoConfig.bundleName = BUNDLE_NAME;
imageInfoConfig.moduleName = MODULE_NAME;
imageModelNG.Create(imageInfoConfig, pixMap);