From 79741cc0d55056263fda19f95fdff5e88e0e2f33 Mon Sep 17 00:00:00 2001 From: zhoutianer Date: Mon, 3 Apr 2023 09:59:21 +0800 Subject: [PATCH] implement copyOption Signed-off-by: zhoutianer Change-Id: I6605777f5a04d5ace432c3f73a22e4e28c2de77b --- .../pattern/image/image_layout_property.h | 14 +- .../pattern/image/image_model_ng.cpp | 10 +- .../pattern/image/image_pattern.cpp | 122 +++++++++++++++++- .../pattern/image/image_pattern.h | 33 ++++- .../mock_select_overlay_manager.cpp | 2 +- .../mock_select_overlay_proxy.cpp | 2 +- .../mock_select_overlay_property.cpp | 22 ++++ .../test/pattern/container_modal/BUILD.gn | 2 +- .../test/pattern/custom_dialog/BUILD.gn | 2 +- .../components_ng/test/pattern/image/BUILD.gn | 4 + .../test/pattern/image/image_test_ng.cpp | 37 +++++- .../pattern/image/mock/mock_image_pattern.cpp | 52 ++++++++ .../test/pattern/image_animator/BUILD.gn | 2 +- .../test/pattern/indexer/BUILD.gn | 2 +- .../components_ng/test/pattern/menu/BUILD.gn | 2 +- .../test/pattern/navigation/BUILD.gn | 2 +- .../test/pattern/picker/BUILD.gn | 2 +- .../test/pattern/search/BUILD.gn | 2 +- .../test/pattern/select/BUILD.gn | 2 +- .../test/pattern/side_bar/BUILD.gn | 2 +- .../test/pattern/slider/BUILD.gn | 2 +- .../test/pattern/stepper/BUILD.gn | 2 +- .../components_ng/test/pattern/tabs/BUILD.gn | 2 +- .../test/pattern/textfield/BUILD.gn | 2 +- .../components_ng/test/pattern/video/BUILD.gn | 2 +- test/unittest/core/pipeline/BUILD.gn | 2 +- 26 files changed, 287 insertions(+), 43 deletions(-) create mode 100644 frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_property.cpp create mode 100644 frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp diff --git a/frameworks/core/components_ng/pattern/image/image_layout_property.h b/frameworks/core/components_ng/pattern/image/image_layout_property.h index 46a59d3d1d1..28cdfb79ea6 100644 --- a/frameworks/core/components_ng/pattern/image/image_layout_property.h +++ b/frameworks/core/components_ng/pattern/image/image_layout_property.h @@ -49,8 +49,6 @@ public: value->propImageSourceInfo_ = CloneImageSourceInfo(); value->propAlt_ = CloneAlt(); value->propImageFit_ = CloneImageFit(); - value->propSyncMode_ = CloneSyncMode(); - value->propCopyOptions_ = CloneCopyOptions(); value->propImageSizeStyle_ = CloneImageSizeStyle(); value->propVerticalAlign_ = CloneVerticalAlign(); return value; @@ -62,8 +60,6 @@ public: ResetImageSourceInfo(); ResetAlt(); ResetImageFit(); - ResetSyncMode(); - ResetCopyOptions(); ResetImageSizeStyle(); ResetVerticalAlign(); } @@ -73,14 +69,10 @@ public: LayoutProperty::ToJsonValue(json); static const char* OBJECTFITVALUE[] = { "ImageFit.Fill", "ImageFit.Contain", "ImageFit.Cover", "ImageFit.Auto", "ImageFit.FitHeight", "ImageFit.None", "ImageFit.ScaleDown" }; - static const char* COPYOPTIONSVALUE[] = { "CopyOptions.None", "CopyOptions.InApp", "CopyOptions.Local", - "CopyOptions.Distributed" }; static const char* VERTICALALIGNVALUE[] = { "VerticalAlign.NONE", "VerticalAlign.TOP", "VerticalAlign.CENTER", "VerticalAlign.BOTTOM", "CopyOptions.BASELINE", "VerticalAlign.NONE" }; json->Put("alt", propAlt_.value_or(ImageSourceInfo("")).GetSrc().c_str()); json->Put("objectFit", OBJECTFITVALUE[static_cast(propImageFit_.value_or(ImageFit::COVER))]); - json->Put("syncLoad", propSyncMode_.value_or(false) ? "true" : "false"); - json->Put("copyOption", COPYOPTIONSVALUE[static_cast(propCopyOptions_.value_or(CopyOptions::None))]); json->Put("verticalAlign", VERTICALALIGNVALUE[static_cast(propVerticalAlign_.value_or(VerticalAlign::BOTTOM))]); std::string src; @@ -99,10 +91,8 @@ public: } ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(ImageFit, ImageFit, PROPERTY_UPDATE_LAYOUT); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(ImageSourceInfo, ImageSourceInfo, PROPERTY_UPDATE_MEASURE); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Alt, ImageSourceInfo, PROPERTY_UPDATE_LAYOUT); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(SyncMode, bool, PROPERTY_UPDATE_LAYOUT); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(CopyOptions, CopyOptions, PROPERTY_UPDATE_LAYOUT); + ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(ImageSourceInfo, ImageSourceInfo, PROPERTY_UPDATE_NORMAL); + ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Alt, ImageSourceInfo, PROPERTY_UPDATE_NORMAL); ACE_DEFINE_PROPERTY_GROUP(ImageSizeStyle, ImageSizeStyle); ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(ImageSizeStyle, AutoResize, bool, PROPERTY_UPDATE_LAYOUT); ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(ImageSizeStyle, SourceSize, SizeF, PROPERTY_UPDATE_LAYOUT); diff --git a/frameworks/core/components_ng/pattern/image/image_model_ng.cpp b/frameworks/core/components_ng/pattern/image/image_model_ng.cpp index fd40e1f3500..d5b46975418 100644 --- a/frameworks/core/components_ng/pattern/image/image_model_ng.cpp +++ b/frameworks/core/components_ng/pattern/image/image_model_ng.cpp @@ -40,7 +40,7 @@ void ImageModelNG::Create(const std::string& src, bool noPixMap, RefPtrGetMainFrameNodePattern(); + CHECK_NULL_VOID(pattern); + pattern->SetSyncLoad(syncMode); } void ImageModelNG::SetColorFilterMatrix(const std::vector& matrix) @@ -197,7 +199,9 @@ void ImageModelNG::SetOnDrop(OnDragDropFunc&& onDrop) {} void ImageModelNG::SetCopyOption(const CopyOptions& copyOption) { - ACE_UPDATE_LAYOUT_PROPERTY(ImageLayoutProperty, CopyOptions, copyOption); + auto pattern = ViewStackProcessor::GetInstance()->GetMainFrameNodePattern(); + CHECK_NULL_VOID(pattern); + pattern->SetCopyOption(copyOption); } bool ImageModelNG::UpdateDragItemInfo(DragItemInfo& itemInfo) diff --git a/frameworks/core/components_ng/pattern/image/image_pattern.cpp b/frameworks/core/components_ng/pattern/image/image_pattern.cpp index 4479c224e19..265d402d4f4 100644 --- a/frameworks/core/components_ng/pattern/image/image_pattern.cpp +++ b/frameworks/core/components_ng/pattern/image/image_pattern.cpp @@ -24,6 +24,7 @@ #endif #include "core/components/theme/icon_theme.h" #include "core/components_ng/base/view_abstract.h" +#include "core/components_ng/pattern/image/image_layout_property.h" #include "core/components_ng/pattern/image/image_paint_method.h" #include "core/components_v2/inspector/inspector_constants.h" #include "core/pipeline/base/element_register.h" @@ -250,8 +251,7 @@ void ImagePattern::LoadImageDataIfNeed() (src.IsSvg() && loadingCtx_->GetSvgFillColor() != svgFillColorOpt)) { LoadNotifier loadNotifier(CreateDataReadyCallback(), CreateLoadSuccessCallback(), CreateLoadFailCallback()); - bool syncLoad = imageLayoutProperty->GetSyncModeValue(false); - loadingCtx_ = AceType::MakeRefPtr(src, std::move(loadNotifier), syncLoad); + loadingCtx_ = AceType::MakeRefPtr(src, std::move(loadNotifier), syncLoad_); LOGD("start loading image %{public}s", src.ToString().c_str()); loadingCtx_->LoadImageData(); } @@ -276,6 +276,25 @@ void ImagePattern::OnModifyDone() { Pattern::OnModifyDone(); LoadImageDataIfNeed(); + + if (copyOption_ != CopyOptions::None) { + InitCopy(); + } else { + // remove long press and mouse events + auto host = GetHost(); + CHECK_NULL_VOID(host); + + auto gestureHub = host->GetOrCreateGestureEventHub(); + gestureHub->SetLongPressEvent(nullptr); + longPressEvent_ = nullptr; + + gestureHub->RemoveClickEvent(clickEvent_); + clickEvent_ = nullptr; + + auto inputHub = host->GetOrCreateInputEventHub(); + inputHub->RemoveOnMouseEvent(mouseEvent_); + mouseEvent_ = nullptr; + } } DataReadyNotifyTask ImagePattern::CreateDataReadyCallbackForAlt() @@ -497,9 +516,106 @@ void ImagePattern::BeforeCreatePaintWrapper() host->GetRenderContext()->MarkContentChanged(true); } +void ImagePattern::InitCopy() +{ + if (longPressEvent_ && mouseEvent_ && clickEvent_) { + return; + } + auto longPressTask = [weak = WeakClaim(this)](GestureEvent& info) { + auto pattern = weak.Upgrade(); + CHECK_NULL_VOID(pattern); + pattern->OpenSelectOverlay(); + }; + longPressEvent_ = MakeRefPtr(std::move(longPressTask)); + + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto gestureHub = host->GetOrCreateGestureEventHub(); + gestureHub->SetLongPressEvent(longPressEvent_); + + auto mouseTask = [weak = WeakClaim(this)](MouseInfo& info) { + if (info.GetButton() == MouseButton::RIGHT_BUTTON && info.GetAction() == MouseAction::PRESS) { + auto pattern = weak.Upgrade(); + CHECK_NULL_VOID_NOLOG(pattern); + pattern->OpenSelectOverlay(); + } + }; + mouseEvent_ = MakeRefPtr(std::move(mouseTask)); + auto inputHub = host->GetOrCreateInputEventHub(); + CHECK_NULL_VOID(inputHub); + inputHub->AddOnMouseEvent(mouseEvent_); + + // close overlay on click + clickEvent_ = MakeRefPtr([weak = WeakClaim(this)](GestureEvent& callback) { + auto pattern = weak.Upgrade(); + CHECK_NULL_VOID(pattern); + pattern->CloseSelectOverlay(); + }); + gestureHub->AddClickEvent(clickEvent_); +} + +void ImagePattern::OpenSelectOverlay() +{ + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto rect = host->GetTransformRectRelativeToWindow(); + SelectOverlayInfo info; + SizeF handleSize = { SelectHandleInfo::GetDefaultLineWidth().ConvertToPx(), info.singleLineHeight }; + info.firstHandle.paintRect = RectF(rect.GetOffset(), handleSize); + OffsetF offset(rect.Width() - handleSize.Width(), rect.Height() - handleSize.Height()); + info.secondHandle.paintRect = RectF(rect.GetOffset() + offset, handleSize); + info.menuInfo.menuIsShow = true; + info.menuInfo.showCut = false; + info.menuInfo.showPaste = false; + info.menuCallback.onCopy = [weak = WeakClaim(this)]() { + auto pattern = weak.Upgrade(); + CHECK_NULL_VOID(pattern); + pattern->HandleCopy(); + }; + + CloseSelectOverlay(); + auto pipeline = PipelineContext::GetCurrentContext(); + CHECK_NULL_VOID(pipeline); + LOGI("Opening select overlay"); + selectOverlay_ = pipeline->GetSelectOverlayManager()->CreateAndShowSelectOverlay(info); +} + +void ImagePattern::CloseSelectOverlay() +{ + LOGI("closing select overlay"); + if (selectOverlay_ && !selectOverlay_->IsClosed()) { + selectOverlay_->Close(); + selectOverlay_ = nullptr; + } +} + +void ImagePattern::HandleCopy() +{ + CHECK_NULL_VOID(image_); + if (!clipboard_) { + auto pipeline = PipelineContext::GetCurrentContext(); + CHECK_NULL_VOID(pipeline); + clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(pipeline->GetTaskExecutor()); + } + auto pixmap = image_->GetPixelMap(); + if (pixmap) { + clipboard_->SetPixelMapData(pixmap, copyOption_); + } else { + auto host = GetHost(); + CHECK_NULL_VOID(host); + clipboard_->SetData(loadingCtx_->GetSourceInfo().GetSrc()); + } +} + void ImagePattern::ToJsonValue(std::unique_ptr& json) const { json->Put("draggable", draggable_ ? "true" : "false"); + + static const char* COPY_OPTIONS[] = { "CopyOptions.None", "CopyOptions.InApp", "CopyOptions.Local", + "CopyOptions.Distributed" }; + json->Put("copyOption", COPY_OPTIONS[static_cast(copyOption_)]); + + json->Put("syncLoad", syncLoad_ ? "true" : "false"); } void ImagePattern::UpdateFillColorIfForegroundColor() @@ -526,7 +642,7 @@ void ImagePattern::DumpInfo() auto layoutProp = GetLayoutProperty(); CHECK_NULL_VOID(layoutProp); if (layoutProp->GetImageSourceInfo().has_value()) { - DumpLog::GetInstance().AddDesc(std::string("src: ").append(layoutProp->GetImageSourceInfo()->ToString())); + DumpLog::GetInstance().AddDesc(std::string("url: ").append(layoutProp->GetImageSourceInfo()->ToString())); } } } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/image/image_pattern.h b/frameworks/core/components_ng/pattern/image/image_pattern.h index 3e2b0f35e01..37f925718ea 100644 --- a/frameworks/core/components_ng/pattern/image/image_pattern.h +++ b/frameworks/core/components_ng/pattern/image/image_pattern.h @@ -20,6 +20,8 @@ #include "base/memory/referenced.h" #include "base/utils/utils.h" +#include "core/components/common/layout/constants.h" +#include "core/components_ng/event/click_event.h" #include "core/components_ng/pattern/image/image_event_hub.h" #include "core/components_ng/pattern/image/image_layout_algorithm.h" #include "core/components_ng/pattern/image/image_layout_property.h" @@ -27,6 +29,7 @@ #include "core/components_ng/pattern/pattern.h" #include "core/components_ng/property/property.h" #include "core/components_ng/render/canvas_image.h" +#include "core/image/image_source_info.h" #include "core/pipeline_ng/pipeline_context.h" namespace OHOS::Ace::NG { @@ -84,6 +87,16 @@ public: return draggable_; } + void SetCopyOption(CopyOptions value) + { + copyOption_ = value; + } + + void SetSyncLoad(bool value) + { + syncLoad_ = value; + } + void BeforeCreatePaintWrapper() override; void DumpInfo() override; @@ -106,6 +119,11 @@ private: void SetRedrawCallback(); void RegisterVisibleAreaChange(); + void InitCopy(); + void HandleCopy(); + void OpenSelectOverlay(); + void CloseSelectOverlay(); + void UpdateFillColorIfForegroundColor(); void ToJsonValue(std::unique_ptr& json) const override; @@ -118,20 +136,29 @@ private: LoadSuccessNotifyTask CreateLoadSuccessCallbackForAlt(); LoadFailNotifyTask CreateLoadFailCallbackForAlt(); + + CopyOptions copyOption_ = CopyOptions::None; + bool syncLoad_ = false; + bool draggable_ = false; + bool isShow_ = true; // TODO: remove it later when use [isActive_] to determine image data management + RefPtr loadingCtx_; RefPtr image_; RectF dstRect_; RectF srcRect_; - bool draggable_ = false; - bool isShow_ = true; // TODO: remove it later when use [isActive_] to determine image data management - // clear alt data after [OnImageLoadSuccess] being called RefPtr altLoadingCtx_; RefPtr altImage_; std::unique_ptr altDstRect_; std::unique_ptr altSrcRect_; + RefPtr longPressEvent_; + RefPtr clickEvent_; + RefPtr mouseEvent_; + RefPtr clipboard_; + RefPtr selectOverlay_; + ACE_DISALLOW_COPY_AND_MOVE(ImagePattern); }; diff --git a/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_manager.cpp b/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_manager.cpp index efe23ae9107..9908e7477a7 100644 --- a/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_manager.cpp +++ b/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_manager.cpp @@ -23,7 +23,7 @@ constexpr int32_t SELECT_OVERLAY_ID = 143; RefPtr SelectOverlayManager::CreateAndShowSelectOverlay(const SelectOverlayInfo& info) { - return nullptr; + return MakeRefPtr(0); } void SelectOverlayManager::DestroySelectOverlay(const RefPtr& proxy) {} diff --git a/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_proxy.cpp b/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_proxy.cpp index de205126a1e..51a90e95139 100644 --- a/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_proxy.cpp +++ b/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_proxy.cpp @@ -18,7 +18,7 @@ namespace OHOS::Ace::NG { bool SelectOverlayProxy::IsClosed() const { - return true; + return false; } void SelectOverlayProxy::Close() const {} diff --git a/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_property.cpp b/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_property.cpp new file mode 100644 index 00000000000..07d7b997a62 --- /dev/null +++ b/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_property.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "core/components_ng/pattern/select_overlay/select_overlay_property.h" + +namespace OHOS::Ace::NG { +Dimension SelectHandleInfo::GetDefaultLineWidth() +{ + return {}; +} +} // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/test/pattern/container_modal/BUILD.gn b/frameworks/core/components_ng/test/pattern/container_modal/BUILD.gn index 35dd6cbc632..8f09c1daef1 100644 --- a/frameworks/core/components_ng/test/pattern/container_modal/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/container_modal/BUILD.gn @@ -81,7 +81,6 @@ ohos_unittest("container_modal_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_model_ng.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/navigation/bar_item_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/navigation/bar_item_node.cpp", "$ace_root/frameworks/core/components_ng/pattern/navigation/bar_item_pattern.cpp", @@ -116,6 +115,7 @@ ohos_unittest("container_modal_test_ng") { "$ace_root/frameworks/core/components_ng/property/property.cpp", "$ace_root/frameworks/core/components_ng/render/divider_painter.cpp", "$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", diff --git a/frameworks/core/components_ng/test/pattern/custom_dialog/BUILD.gn b/frameworks/core/components_ng/test/pattern/custom_dialog/BUILD.gn index a687fc23ab5..2313d3187b1 100644 --- a/frameworks/core/components_ng/test/pattern/custom_dialog/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/custom_dialog/BUILD.gn @@ -59,7 +59,6 @@ ohos_unittest("custom_dialog_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_view.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_event_hub.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_layout_algorithm.cpp", @@ -77,6 +76,7 @@ ohos_unittest("custom_dialog_test_ng") { "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", "$ace_root/frameworks/core/components_ng/property/measure_utils.cpp", "$ace_root/frameworks/core/components_ng/property/property.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", # components_ng_base diff --git a/frameworks/core/components_ng/test/pattern/image/BUILD.gn b/frameworks/core/components_ng/test/pattern/image/BUILD.gn index 383a4fd2581..523d2230dc9 100644 --- a/frameworks/core/components_ng/test/pattern/image/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/image/BUILD.gn @@ -27,8 +27,12 @@ ohos_unittest("image_test_ng") { "$ace_root/frameworks/base/geometry/matrix4.cpp", "$ace_root/frameworks/base/test/mock/mock_drag_window.cpp", "$ace_root/frameworks/core/common/test/mock/mock_clipboard.cpp", + "$ace_root/frameworks/core/components_ng/test/event/mock/mock_long_press_event.cpp", "$ace_root/frameworks/core/components_ng/test/mock/manager/drag_drop/mock_drag_drop_manager.cpp", "$ace_root/frameworks/core/components_ng/test/mock/manager/drag_drop/mock_drag_drop_proxy.cpp", + "$ace_root/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_manager.cpp", + "$ace_root/frameworks/core/components_ng/test/mock/manager/select_overlay/mock_select_overlay_proxy.cpp", + "$ace_root/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_property.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", # self diff --git a/frameworks/core/components_ng/test/pattern/image/image_test_ng.cpp b/frameworks/core/components_ng/test/pattern/image/image_test_ng.cpp index 59075d03d73..2d6dc5d0614 100644 --- a/frameworks/core/components_ng/test/pattern/image/image_test_ng.cpp +++ b/frameworks/core/components_ng/test/pattern/image/image_test_ng.cpp @@ -611,8 +611,6 @@ HWTEST_F(ImageTestNg, ImageCreator002, TestSize.Level1) EXPECT_EQ(imageLayoutProperty->GetImageSourceInfo().value(), ImageSourceInfo("")); EXPECT_EQ(imageLayoutProperty->GetImageFit(), std::nullopt); EXPECT_EQ(imageLayoutProperty->GetAlt(), std::nullopt); - EXPECT_EQ(imageLayoutProperty->GetSyncMode(), std::nullopt); - EXPECT_EQ(imageLayoutProperty->GetCopyOptions(), std::nullopt); EXPECT_EQ(imageLayoutProperty->GetImageSizeStyle(), nullptr); auto imageRenderProperty = frameNode->GetPaintProperty(); ASSERT_NE(imageRenderProperty, nullptr); @@ -651,8 +649,8 @@ HWTEST_F(ImageTestNg, ImageCreator003, TestSize.Level1) EXPECT_EQ(imageLayoutProperty->GetImageSourceInfoValue(), ImageSourceInfo(IMAGE_SRC_URL)); EXPECT_EQ(imageLayoutProperty->GetImageFitValue(), IMAGE_FIT_DEFAULT); EXPECT_EQ(imageLayoutProperty->GetAltValue(), ImageSourceInfo(ALT_SRC_URL)); - EXPECT_EQ(imageLayoutProperty->GetSyncModeValue(), false); - EXPECT_EQ(imageLayoutProperty->GetCopyOptionsValue(), COPYOPTIONS_DEFAULT); + EXPECT_EQ(frameNode->GetPattern()->syncLoad_, false); + EXPECT_EQ(frameNode->GetPattern()->copyOption_, COPYOPTIONS_DEFAULT); EXPECT_TRUE(imageLayoutProperty->GetImageSizeStyle() != nullptr); EXPECT_EQ(imageLayoutProperty->GetAutoResize().value(), AUTORESIZE_DEFAULT); EXPECT_EQ(imageLayoutProperty->GetFitOriginalSize().value(), FIT_ORIGINAL_SIZE_DEFAULT); @@ -1345,4 +1343,35 @@ HWTEST_F(ImageTestNg, Drag001, TestSize.Level1) ASSERT_NE(dragPattern->image_, nullptr); EXPECT_EQ(dragPattern->loadingCtx_->src_.GetSrc(), ALT_SRC_URL); } + +/** + * @tc.name: CopyOption001 + * @tc.desc: Test image copyOption. + * @tc.type: FUNC + */ +HWTEST_F(ImageTestNg, CopyOption001, TestSize.Level1) +{ + auto frameNode = ImageTestNg::CreateImageNode(IMAGE_SRC_URL, ALT_SRC_URL); + auto pattern = frameNode->GetPattern(); + pattern->SetCopyOption(CopyOptions::InApp); + frameNode->MarkModifyDone(); + EXPECT_EQ(pattern->copyOption_, CopyOptions::InApp); + EXPECT_TRUE(pattern->clickEvent_ && pattern->longPressEvent_ && pattern->mouseEvent_); + + // emulate long press to open select overlay and click to close it + EXPECT_FALSE(pattern->selectOverlay_); + auto gestureHub = frameNode->GetOrCreateGestureEventHub(); + gestureHub->ActLongClick(); + EXPECT_TRUE(pattern->selectOverlay_); + gestureHub->ActClick(); + EXPECT_FALSE(pattern->selectOverlay_); + + pattern->SetCopyOption(CopyOptions::None); + frameNode->MarkModifyDone(); + EXPECT_FALSE(gestureHub->longPressEventActuator_->longPressEvent_); + + pattern->SetCopyOption(CopyOptions::Distributed); + frameNode->MarkModifyDone(); + EXPECT_TRUE(gestureHub->longPressEventActuator_->longPressEvent_); +} } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp b/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp new file mode 100644 index 00000000000..856e4bce2aa --- /dev/null +++ b/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "core/components_ng/pattern/image/image_layout_property.h" +#include "core/components_ng/pattern/image/image_paint_method.h" +#include "core/components_ng/pattern/image/image_pattern.h" + +namespace OHOS::Ace::NG { +RefPtr ImagePattern::CreateNodePaintMethod() +{ + if (image_) { + return MakeRefPtr(image_); + } + if (altImage_ && altDstRect_ && altSrcRect_) { + return MakeRefPtr(altImage_); + } + return nullptr; +} + +bool ImagePattern::OnDirtyLayoutWrapperSwap(const RefPtr& dirty, const DirtySwapConfig& config) +{ + if (config.skipMeasure || dirty->SkipMeasureContent()) { + return false; + } + return image_; +} +void ImagePattern::OnModifyDone() {} +void ImagePattern::OnAttachToFrameNode() {} + +void ImagePattern::OnDetachFromFrameNode(FrameNode* frameNode) {} +void ImagePattern::BeforeCreatePaintWrapper() {} + +void ImagePattern::OnNotifyMemoryLevel(int32_t level) {} +void ImagePattern::OnWindowHide() {} +void ImagePattern::OnWindowShow() {} +void ImagePattern::OnVisibleChange(bool isVisible) {} + +void ImagePattern::ToJsonValue(std::unique_ptr& json) const {} +void ImagePattern::DumpInfo() {} +} // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/test/pattern/image_animator/BUILD.gn b/frameworks/core/components_ng/test/pattern/image_animator/BUILD.gn index c942952be95..5f372143c0f 100644 --- a/frameworks/core/components_ng/test/pattern/image_animator/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/image_animator/BUILD.gn @@ -45,11 +45,11 @@ ohos_unittest("image_animator_pattern_test") { "$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/image_animator/image_animator_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/image_animator/image_animator_view.cpp", "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", "$ace_root/frameworks/core/components_ng/render/adapter/svg_canvas_image.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", "$ace_root/frameworks/core/image/image_source_info.cpp", diff --git a/frameworks/core/components_ng/test/pattern/indexer/BUILD.gn b/frameworks/core/components_ng/test/pattern/indexer/BUILD.gn index 1ad4c4745cc..92124fb5697 100644 --- a/frameworks/core/components_ng/test/pattern/indexer/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/indexer/BUILD.gn @@ -36,7 +36,6 @@ ohos_unittest("indexer_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_event_hub.cpp", "$ace_root/frameworks/core/components_ng/pattern/list/list_item_group_accessibility_property.cpp", @@ -61,6 +60,7 @@ ohos_unittest("indexer_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp", "$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp", "$ace_root/frameworks/core/components_ng/syntax/lazy_layout_wrapper_builder.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", "$ace_root/frameworks/core/image/image_source_info.cpp", diff --git a/frameworks/core/components_ng/test/pattern/menu/BUILD.gn b/frameworks/core/components_ng/test/pattern/menu/BUILD.gn index d286ed2108d..bf3d3abb958 100644 --- a/frameworks/core/components_ng/test/pattern/menu/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/menu/BUILD.gn @@ -54,7 +54,6 @@ ohos_unittest("menu_layout_algorithm_test_ng") { # components_ng_pattern "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/option/option_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/option/option_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/option/option_paint_method.cpp", @@ -66,6 +65,7 @@ ohos_unittest("menu_layout_algorithm_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_model_ng.cpp", "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_paint_method.cpp", "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_pattern.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", # mock "$ace_root/frameworks/base/test/mock/mock_animatable_dimension.cpp", diff --git a/frameworks/core/components_ng/test/pattern/navigation/BUILD.gn b/frameworks/core/components_ng/test/pattern/navigation/BUILD.gn index 3f32d291dfe..16dc0e7712e 100755 --- a/frameworks/core/components_ng/test/pattern/navigation/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/navigation/BUILD.gn @@ -88,7 +88,6 @@ ohos_unittest("navigation_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_layout_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/linear_layout/linear_layout_utils.cpp", "$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_event_hub.cpp", "$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_pattern.cpp", @@ -115,6 +114,7 @@ ohos_unittest("navigation_test_ng") { "$ace_root/frameworks/core/components_ng/render/image_painter.cpp", "$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp", "$ace_root/frameworks/core/components_ng/syntax/for_each_node.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", "$ace_root/frameworks/core/event/back_end_event_manager.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", diff --git a/frameworks/core/components_ng/test/pattern/picker/BUILD.gn b/frameworks/core/components_ng/test/pattern/picker/BUILD.gn index 1cd4c70edcf..8ba1823252d 100644 --- a/frameworks/core/components_ng/test/pattern/picker/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/picker/BUILD.gn @@ -86,7 +86,6 @@ ohos_unittest("picker_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_layout_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/picker/date_time_animation_controller.cpp", "$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_column_accessibility_property.cpp", @@ -137,6 +136,7 @@ ohos_unittest("picker_test_ng") { "$ace_root/frameworks/core/components_ng/property/property.cpp", "$ace_root/frameworks/core/components_ng/render/divider_painter.cpp", "$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", "$ace_root/frameworks/core/event/back_end_event_manager.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", diff --git a/frameworks/core/components_ng/test/pattern/search/BUILD.gn b/frameworks/core/components_ng/test/pattern/search/BUILD.gn index 9c52298a845..28de672de71 100644 --- a/frameworks/core/components_ng/test/pattern/search/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/search/BUILD.gn @@ -20,7 +20,6 @@ ohos_unittest("search_test_ng") { sources = [ "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_content_modifier.cpp", @@ -43,6 +42,7 @@ ohos_unittest("search_test_ng") { "$ace_root/frameworks/core/components_ng/test/mock/pattern/text_field/mock_text_field_overlay_modifier.cpp", "$ace_root/frameworks/core/components_ng/test/mock/pattern/text_field/mock_text_field_paint_method.cpp", "$ace_root/frameworks/core/components_ng/test/mock/pattern/text_field/mock_text_field_pattern.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_ng/test/pattern/image/mock_icon_theme.cpp", # other diff --git a/frameworks/core/components_ng/test/pattern/select/BUILD.gn b/frameworks/core/components_ng/test/pattern/select/BUILD.gn index b927ffed901..ee79dccf6a3 100644 --- a/frameworks/core/components_ng/test/pattern/select/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/select/BUILD.gn @@ -76,7 +76,6 @@ ohos_unittest("select_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_layout_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_pattern.cpp", @@ -99,6 +98,7 @@ ohos_unittest("select_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_model_ng.cpp", "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_paint_method.cpp", "$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_pattern.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", # components_ng_event "$ace_root/frameworks/core/components_ng/event/click_event.cpp", diff --git a/frameworks/core/components_ng/test/pattern/side_bar/BUILD.gn b/frameworks/core/components_ng/test/pattern/side_bar/BUILD.gn index 95c13b38c07..c009273cce3 100644 --- a/frameworks/core/components_ng/test/pattern/side_bar/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/side_bar/BUILD.gn @@ -45,9 +45,9 @@ ohos_unittest("side_bar_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_pattern.cpp", "$ace_root/frameworks/core/components_ng/render/divider_painter.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", # mock "$ace_root/frameworks/base/test/mock/mock_mouse_style.cpp", diff --git a/frameworks/core/components_ng/test/pattern/slider/BUILD.gn b/frameworks/core/components_ng/test/pattern/slider/BUILD.gn index be589e5a0a4..4fc0e1dee00 100644 --- a/frameworks/core/components_ng/test/pattern/slider/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/slider/BUILD.gn @@ -86,7 +86,6 @@ ohos_unittest("slider_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_layout_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_paint_method.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_pattern.cpp", @@ -100,6 +99,7 @@ ohos_unittest("slider_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/text/text_paint_method.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", # components_ng_syntax "$ace_root/frameworks/core/components_ng/syntax/for_each_node.cpp", diff --git a/frameworks/core/components_ng/test/pattern/stepper/BUILD.gn b/frameworks/core/components_ng/test/pattern/stepper/BUILD.gn index bc82c229b07..22390f95f1b 100644 --- a/frameworks/core/components_ng/test/pattern/stepper/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/stepper/BUILD.gn @@ -75,9 +75,9 @@ ohos_unittest("stepper_pattern_test_ng") { "$ace_root/frameworks/core/components/theme/theme_utils.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_loading_context.cpp", "$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_painter.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/image/image_source_info.cpp", # loadingProgress diff --git a/frameworks/core/components_ng/test/pattern/tabs/BUILD.gn b/frameworks/core/components_ng/test/pattern/tabs/BUILD.gn index 468d1af82d3..81dfebf6003 100644 --- a/frameworks/core/components_ng/test/pattern/tabs/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/tabs/BUILD.gn @@ -40,7 +40,6 @@ ohos_unittest("tabs_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.cpp", "$ace_root/frameworks/core/components_ng/pattern/linear_layout/linear_layout_utils.cpp", "$ace_root/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.cpp", @@ -68,6 +67,7 @@ ohos_unittest("tabs_test_ng") { "$ace_root/frameworks/core/components_ng/test/mock/pattern/text/mock_text_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/test/mock/pattern/text/mock_text_paint_method.cpp", "$ace_root/frameworks/core/components_ng/test/mock/pattern/text/mock_text_pattern.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_layout_adapter.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", "$ace_root/frameworks/core/image/image_source_info.cpp", diff --git a/frameworks/core/components_ng/test/pattern/textfield/BUILD.gn b/frameworks/core/components_ng/test/pattern/textfield/BUILD.gn index 9af995897c1..da4d3f32b58 100644 --- a/frameworks/core/components_ng/test/pattern/textfield/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/textfield/BUILD.gn @@ -38,7 +38,6 @@ ohos_unittest("textfield_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp", @@ -79,6 +78,7 @@ ohos_unittest("textfield_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/text/text_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp", "$ace_root/frameworks/core/components_ng/render/image_painter.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", # mock diff --git a/frameworks/core/components_ng/test/pattern/video/BUILD.gn b/frameworks/core/components_ng/test/pattern/video/BUILD.gn index 90688a4c7a9..c969ce74060 100644 --- a/frameworks/core/components_ng/test/pattern/video/BUILD.gn +++ b/frameworks/core/components_ng/test/pattern/video/BUILD.gn @@ -122,7 +122,6 @@ ohos_unittest("video_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_layout_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/linear_layout/linear_layout_utils.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_paint_method.cpp", @@ -145,6 +144,7 @@ ohos_unittest("video_pattern_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/text/text_paint_method.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", "$ace_root/frameworks/core/components_ng/test/pattern/image/mock_icon_theme.cpp", # components_ng_property diff --git a/test/unittest/core/pipeline/BUILD.gn b/test/unittest/core/pipeline/BUILD.gn index 47cac20a4e9..5a0d03cd245 100644 --- a/test/unittest/core/pipeline/BUILD.gn +++ b/test/unittest/core/pipeline/BUILD.gn @@ -135,7 +135,6 @@ ohos_unittest("pipeline_context_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/grid_container/grid_container_model_ng.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp", "$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp", - "$ace_root/frameworks/core/components_ng/pattern/image/image_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_accessibility_property.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_pattern.cpp", "$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp", @@ -178,6 +177,7 @@ ohos_unittest("pipeline_context_test_ng") { "$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp", "$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_manager.cpp", "$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp", + "$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp", # property "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", -- Gitee