fix unittest compile and add text field unittest cases

Signed-off-by: liyujie <liyujie43@huawei.com>
Change-Id: I336aea05181befb54ce6433f1ad13831b5413374
This commit is contained in:
liyujie 2023-10-18 15:05:32 +08:00 committed by jyj-0306
parent 0df406926c
commit c4e09b2aa3
87 changed files with 471 additions and 2928 deletions

View File

@ -312,7 +312,7 @@ public:
return false;
}
virtual void NotifyConfigurationChange(bool, const OnConfigurationChange& configurationChange = {false, false}) {}
virtual void NotifyConfigurationChange(bool, const OnConfigurationChange& configurationChange = { false, false }) {}
virtual void HotReload() {}
void SetIsModule(bool isModule)
@ -358,20 +358,14 @@ public:
static bool LessThanAPIVersion(PlatformVersion version)
{
if (PipelineBase::GetCurrentContext() &&
PipelineBase::GetCurrentContext()->GetMinPlatformVersion() < static_cast<int32_t>(version)) {
return true;
}
return false;
return PipelineBase::GetCurrentContext() &&
PipelineBase::GetCurrentContext()->GetMinPlatformVersion() < static_cast<int32_t>(version);
}
static bool GreatOrEqualAPIVersion(PlatformVersion version)
{
if (PipelineBase::GetCurrentContext() &&
PipelineBase::GetCurrentContext()->GetMinPlatformVersion() >= static_cast<int32_t>(version)) {
return true;
}
return false;
return PipelineBase::GetCurrentContext() &&
PipelineBase::GetCurrentContext()->GetMinPlatformVersion() >= static_cast<int32_t>(version);
}
protected:

View File

@ -975,7 +975,6 @@ void FrameNode::CreateLayoutTask(bool forceUseMainThread)
Layout();
}
SetRootMeasureNode(false);
return;
}
std::optional<UITask> FrameNode::CreateRenderTask(bool forceUseMainThread)

View File

@ -90,10 +90,7 @@ public:
bool HasPopupInfo(int32_t targetId) const
{
if (popupMap_.find(targetId) != popupMap_.end()) {
return true;
}
return false;
return popupMap_.find(targetId) != popupMap_.end();
}
void ShowMenu(int32_t targetId, const NG::OffsetF& offset, RefPtr<FrameNode> menu = nullptr);
@ -256,12 +253,12 @@ public:
void RemoveEventColumn();
#endif // ENABLE_DRAG_FRAMEWORK
void BindContentCover(bool isShow, std::function<void(const std::string&)>&& callback,
std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::ModalStyle& modalStyle,
std::function<void()>&& onAppear, std::function<void()>&& onDisappear, int32_t targetId);
std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::ModalStyle& modalStyle, std::function<void()>&& onAppear,
std::function<void()>&& onDisappear, int32_t targetId);
void BindSheet(bool isShow, std::function<void(const std::string&)>&& callback,
std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::SheetStyle& sheetStyle,
std::function<void()>&& onAppear, std::function<void()>&& onDisappear, int32_t targetId);
std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear,
std::function<void()>&& onDisappear, int32_t targetId);
void DestroySheet(const RefPtr<FrameNode>& sheetNode, int32_t targetId);
@ -349,14 +346,14 @@ private:
std::stack<WeakPtr<FrameNode>> modalStack_;
std::list<WeakPtr<FrameNode>> modalList_;
WeakPtr<FrameNode> lastModalNode_;
float sheetHeight_ {0.0};
float sheetHeight_ { 0.0 };
WeakPtr<UINode> rootNodeWeak_;
int32_t dialogCount_ = 0;
#ifdef ENABLE_DRAG_FRAMEWORK
bool hasPixelMap_ {false};
bool hasFilter_ {false};
bool hasEvent_ {false};
bool isOnAnimation_ {false};
bool hasPixelMap_ { false };
bool hasFilter_ { false };
bool hasEvent_ { false };
bool isOnAnimation_ { false };
WeakPtr<FrameNode> pixmapColumnNodeWeak_;
WeakPtr<FrameNode> filterColumnNodeWeak_;
WeakPtr<FrameNode> eventColumnNodeWeak_;

View File

@ -62,7 +62,6 @@ public:
void SetOnDrop(NG::OnDragDropFunc&& onDrop) override;
void SetDraggable(bool draggable) override;
void SetMenuOptionItems(std::vector<MenuOptionsParam>&& menuOptionsItems) override;
};
} // namespace OHOS::Ace::NG

View File

@ -60,14 +60,14 @@ Rect TextFieldController::GetTextContentRect()
rect.SetTop(y);
textFieldPattern->UpdateRectByAlignment(rect);
if (textFieldPattern->IsOperation()) {
return Rect(rect.GetX(), rect.GetY(), rect.Width(), rect.Height());
return { rect.GetX(), rect.GetY(), rect.Width(), rect.Height() };
}
if (NearEqual(rect.GetX(), -Infinity<float>())) {
return Rect(textFieldPattern->GetPaddingLeft(), rect.GetY(), 0, 0);
return { textFieldPattern->GetPaddingLeft(), rect.GetY(), 0, 0 };
}
return Rect(rect.GetX(), rect.GetY(), 0, 0);
return { rect.GetX(), rect.GetY(), 0, 0 };
}
return Rect(0, 0, 0, 0);
return { 0, 0, 0, 0 };
}
int32_t TextFieldController::GetTextContentLinesNum()
@ -79,15 +79,14 @@ int32_t TextFieldController::GetTextContentLinesNum()
return lines;
}
RectF textRect = textFieldPattern->GetTextRect();
if ((int32_t)textFieldPattern->GetLineHeight() == 0) {
if (static_cast<int32_t>(textFieldPattern->GetLineHeight()) == 0) {
return lines;
}
lines = (int32_t)textRect.Height() / (int32_t)textFieldPattern->GetLineHeight();
lines = static_cast<int32_t>(textRect.Height()) / static_cast<int32_t>(textFieldPattern->GetLineHeight());
return lines;
} else {
lines = getTextContentLinesNum_();
}
lines = getTextContentLinesNum_();
return lines;
}

View File

@ -1162,9 +1162,9 @@ void TextFieldPattern::HandleTouchUp()
}
}
#ifdef ENABLE_DRAG_FRAMEWORK
void TextFieldPattern::InitDragEvent()
{
#ifdef ENABLE_DRAG_FRAMEWORK
auto host = GetHost();
CHECK_NULL_VOID(host);
auto layoutProperty = host->GetLayoutProperty<TextFieldLayoutProperty>();
@ -1177,10 +1177,8 @@ void TextFieldPattern::InitDragEvent()
ClearDragDropEvent();
RemoveDragFrameNodeFromManager(host);
}
#endif // ENABLE_DRAG_FRAMEWORK
}
#ifdef ENABLE_DRAG_FRAMEWORK
std::function<void(Offset)> TextFieldPattern::GetThumbnailCallback()
{
auto callback = [weak = WeakClaim(this)](const Offset& point) {

View File

@ -221,9 +221,6 @@ public:
}
void OnModifyDone() override;
void UpdateCaretPositionByTextEdit();
void UpdateCaretPositionByPressOffset();
void UpdateSelectionOffset();
void CalcCaretMetricsByPosition(
int32_t extent, CaretMetricsF& caretCaretMetric, TextAffinity textAffinity = TextAffinity::DOWNSTREAM);
@ -277,10 +274,7 @@ public:
selectController_->UpdateCaretIndex(caretPosition);
}
void SetEditingValueToProperty(const std::string& newValueText);
// void UpdatePositionOfParagraph(int32_t pos);
void UpdateCaretPositionByTouch(const Offset& offset);
void UpdateCaretOffsetByEvent();
bool IsReachedBoundary(float offset);
virtual TextInputAction GetDefaultTextInputAction();
@ -495,7 +489,6 @@ public:
bool CursorMoveUp() override;
bool CursorMoveDown() override;
void SetCaretPosition(int32_t position);
void SetTextSelection(int32_t selectionStart, int32_t selectionEnd);
void HandleSetSelection(int32_t start, int32_t end, bool showHandle = true) override;
void HandleExtendAction(int32_t action) override;
void HandleSelect(int32_t keyCode, int32_t cursorMoveSkip) override;
@ -915,7 +908,7 @@ public:
isCustomFont_ = isCustomFont;
}
bool GetIsCustomFont()
bool GetIsCustomFont() const
{
return isCustomFont_;
}
@ -1002,8 +995,6 @@ private:
void ClearDragDropEvent();
std::function<void(Offset)> GetThumbnailCallback();
#endif
bool CaretPositionCloseToTouchPosition();
void CreateSingleHandle(bool animation = false, bool isMenuShow = true);
int32_t UpdateCaretPositionOnHandleMove(const OffsetF& localOffset);
bool HasStateStyle(UIState state) const;
@ -1022,9 +1013,6 @@ private:
void HandleLeftMouseReleaseEvent(MouseInfo& info);
void HandleLongPress(GestureEvent& info);
void UpdateCaretPositionWithClamp(const int32_t& pos);
// assert handles are inside the contentRect, reset them if not
void CheckHandles(std::optional<RectF>& firstHandle, std::optional<RectF>& secondHandle,
float firstHandleSize = 0.0f, float secondHandleSize = 0.0f);
void ShowSelectOverlay(const std::optional<RectF>& firstHandle, const std::optional<RectF>& secondHandle,
bool animation = false, bool isMenuShow = true);
@ -1053,9 +1041,7 @@ private:
void UpdateSelection(int32_t both);
void UpdateSelection(int32_t start, int32_t end);
void FireOnSelectionChange(int32_t start, int32_t end);
void UpdateDestinationToCaretByEvent();
void UpdateCaretPositionByLastTouchOffset();
bool UpdateCaretPositionByMouseMovement();
bool UpdateCaretPosition();
void UpdateCaretRect();
void AdjustTextInReasonableArea();
@ -1075,14 +1061,6 @@ private:
void Delete(int32_t start, int32_t end);
bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
// void BeforeCreateLayoutWrapper() override;
bool FilterWithRegex(
const std::string& filter, const std::string& valueToUpdate, std::string& result, bool needToEscape = false);
bool FilterWithAscii(const std::string& valueToUpdate, std::string& result);
bool FilterWithEmail(std::string& result);
void EditingValueFilter(std::string& valueToUpdate, std::string& result, bool isInsertValue = false);
bool LastTouchIsInSelectRegion(const std::vector<RectF>& boxes);
bool CursorInContentRegion();
float FitCursorInSafeArea();
bool OffsetInContentRegion(const Offset& offset);

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("drag_drop_proxy_test_ng") {
type = "new"
module_output = "manager"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"drag_drop_proxy_test_ng.cpp",
]
sources = [ "drag_drop_proxy_test_ng.cpp" ]
}

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("select_overlay_manager_test_ng") {
type = "new"
module_output = "manager"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"select_overlay_manager_test_ng.cpp",
]
sources = [ "select_overlay_manager_test_ng.cpp" ]
}

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("select_overlay_proxy_test_ng") {
type = "new"
module_output = "manager"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"select_overlay_proxy_test_ng.cpp",
]
sources = [ "select_overlay_proxy_test_ng.cpp" ]
}

View File

@ -18,6 +18,8 @@
#include "gmock/gmock.h"
#include "base/geometry/ng/point_t.h"
#include "base/geometry/ng/rect_t.h"
#include "core/components_ng/render/render_context.h"
namespace OHOS::Ace::NG {
@ -27,7 +29,6 @@ public:
~MockRenderContext() override = default;
MOCK_METHOD4(SetBounds, void(float, float, float, float));
MOCK_METHOD0(GetPaintRectWithTransform, RectF());
MOCK_METHOD1(GetPointWithTransform, void(PointF&));
MOCK_METHOD2(AddChild, void(const RefPtr<RenderContext>& renderContext, int index));
MOCK_METHOD1(AnimateHoverEffectScale, void(bool));
@ -48,6 +49,12 @@ public:
return transInfo_;
}
RectF GetPaintRectWithTransform() override
{
return rect_;
}
RectF rect_;
Color blendColor_ = Color::TRANSPARENT;
std::vector<double> transInfo_ = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
};

View File

@ -48,7 +48,7 @@ group("pattern_unittest") {
"marquee:marquee_test_ng",
"menu:menu_test_ng",
"navigation:navigation_test_ng",
"navigator:navigator_event_hub_test_ng",
"navigator:navigator_test_ng",
"navrouter:navrouter_test_ng",
"option:option_test_ng",
"overlay:overlay_manager_test_ng",
@ -68,7 +68,7 @@ group("pattern_unittest") {
"scroll_bar:scroll_bar_test_ng",
"scrollable:scrollable_test_ng",
"search:search_test_ng",
"security_component:security_component_pattern_test_ng",
"security_component:security_component_test_ng",
"select:select_pattern_test_ng",
"select_overlay:select_overlay_test_ng",
"shape:shape_test_ng",
@ -81,9 +81,9 @@ group("pattern_unittest") {
"text:text_test_ng",
"text_clock:text_clock_test_ng",
"text_drag:text_drag_test_ng",
"text_field:text_field_test_ng",
"text_picker:text_picker_test_ng",
"textfield:textfield_test_ng",
"texttimer:text_timer_test_ng",
"text_timer:text_timer_test_ng",
"time_picker:time_picker_test_ng",
"waterflow:water_flow_test_ng",
"web:web_pattern_unit_test",

View File

@ -19,7 +19,6 @@ ace_unittest("app_bar_test_ng") {
"$ace_root/frameworks/core/components_ng/test/mock/pattern/ui_extension/mock_ui_extension_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/theme/mock_theme_constants.cpp",
"$ace_root/test/mock/adapter/mock_app_bar_helper_impl.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"app_bar_test_ng.cpp",
]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("bubble_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"bubble_test_ng.cpp",
]
sources = [ "bubble_test_ng.cpp" ]
}

View File

@ -16,7 +16,6 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("button_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"button_test_ng.cpp",
"toggle_button_test_ng.cpp",
]

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("calendar_test_ng") {
flutter_skia = true
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"calendar_test_ng.cpp",
]
sources = [ "calendar_test_ng.cpp" ]
}

View File

@ -18,7 +18,6 @@ ace_unittest("calendar_picker_test_ng") {
sources = [
"$ace_root/frameworks/core/components/picker/picker_data.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"calendar_picker_test_ng.cpp",
]
}

View File

@ -19,7 +19,6 @@ ace_unittest("container_modal_test_ng") {
"$ace_root/frameworks/core/components_ng/test/mock/theme/mock_theme_constants.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/theme/mock_theme_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"container_modal_test_ng.cpp",
]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("counter_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"counter_test_ng.cpp",
]
sources = [ "counter_test_ng.cpp" ]
}

View File

@ -17,8 +17,5 @@ ace_unittest("dialog_test_ng") {
flutter_skia = true
render = true
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"dialog_test_ng.cpp",
]
sources = [ "dialog_test_ng.cpp" ]
}

View File

@ -27,7 +27,6 @@ ace_unittest("form_test_ng") {
"$ace_root/frameworks/core/components_ng/test/pattern/form/mock/mock_rosen_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/form/mock/mock_rs_surface_mode.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/form/mock/mock_sub_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"form_test_ng.cpp",
]

View File

@ -17,7 +17,6 @@ ace_unittest("gauge_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/common/font_loader.cpp",
"$ace_root/frameworks/core/common/font_manager.cpp",
"gauge_test_ng.cpp",
]
}

View File

@ -22,7 +22,6 @@ ace_unittest("grid_test_ng") {
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/frameworks/core/components_v2/grid/grid_event.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"grid_test_ng.cpp",
]
}

View File

@ -2627,8 +2627,9 @@ HWTEST_F(GridTestNg, EventHub001, TestSize.Level1)
gridModelNG.SetColumnsTemplate("1fr 1fr 1fr 1fr");
CreateVerticalItem(8);
});
RectF gridRect(0.f, 0.f, DEVICE_WIDTH, DEVICE_HEIGHT);
MockGetPaintRectWithTransform(frameNode_, gridRect);
RectF gridRect(0.f, 0.f, DEVICE_WIDTH, GRID_HEIGHT);
auto mockRenderContext = AceType::DynamicCast<MockRenderContext>(frameNode_->renderContext_);
mockRenderContext->rect_ = gridRect;
/**
* @tc.steps: step1. call GetInsertPosition func.
@ -4308,7 +4309,8 @@ HWTEST_F(GridTestNg, ScrollLayout001, TestSize.Level1)
});
const float smallerHeight = DEVICE_HEIGHT - ITEM_HEIGHT;
RectF gridRect(0.f, 0.f, DEVICE_WIDTH, smallerHeight);
MockGetPaintRectWithTransform(frameNode_, gridRect);
auto mockRenderContext = AceType::DynamicCast<MockRenderContext>(frameNode_->renderContext_);
mockRenderContext->rect_ = gridRect;
/**
* @tc.steps: step1. Change to smaller mainSize

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("grid_container_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"grid_container_test_ng.cpp",
]
sources = [ "grid_container_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("hyperlink_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"hyperlink_test_ng.cpp",
]
sources = [ "hyperlink_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("image_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"image_test_ng.cpp",
]
sources = [ "image_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("image_animator_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"image_animator_test_ng.cpp",
]
sources = [ "image_animator_test_ng.cpp" ]
}

View File

@ -19,7 +19,6 @@ ace_unittest("indexer_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"indexer_test_ng.cpp",
]
}

View File

@ -21,7 +21,6 @@ ace_unittest("list_test_ng") {
"$ace_root/frameworks/bridge/common/utils/utils.cpp",
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"list_test_ng.cpp",
]
}

View File

@ -2939,7 +2939,6 @@ HWTEST_F(ListTestNg, Event005, TestSize.Level1)
listModelNG.SetOnScrollStart(scrollStart);
listModelNG.SetOnScrollStop(scrollStop);
});
MockGetPaintRectWithTransform(frameNode_);
pattern_->OnScrollCallback(100.f, SCROLL_FROM_START);
EXPECT_TRUE(isScrollStartCalled);
@ -2993,7 +2992,6 @@ HWTEST_F(ListTestNg, EventHub001, TestSize.Level1)
CreateListWithItem([onItemDragStart](ListModelNG listModelNG) {
listModelNG.SetOnItemDragStart(onItemDragStart);
});
MockGetPaintRectWithTransform(frameNode_);
auto jsonStr = eventHub_->GetDragExtraParams("", Point(0, 250), DragEventType::MOVE);
EXPECT_EQ(jsonStr, "{\"insertIndex\":2}");
@ -5033,7 +5031,6 @@ HWTEST_F(ListTestNg, Pattern005, TestSize.Level1)
auto startFunc = GetDefaultSwiperBuilder(START_NODE_SIZE);
CreateListItemWithSwiper(startFunc, nullptr, V2::SwipeEdgeEffect::None);
});
MockGetPaintRectWithTransform(frameNode_);
// Set swiperItem_ to list pattern
DragSwiperItem(0, 1.f);
@ -5096,7 +5093,6 @@ HWTEST_F(ListTestNg, Pattern006, TestSize.Level1)
listModelNG.SetLanes(2);
CreateListItem(VIEWPORT_NUMBER);
});
MockGetPaintRectWithTransform(frameNode_);
/**
* @tc.steps: step1. When lanes > 1, call GetItemIndexByPosition
@ -5120,7 +5116,6 @@ HWTEST_F(ListTestNg, Pattern007, TestSize.Level1)
* @tc.expected: Would return the last itemIndex
*/
CreateList([](ListModelNG listModelNG) { CreateListItem(VIEWPORT_NUMBER); });
MockGetPaintRectWithTransform(frameNode_);
const Point point = Point(0, 1000.f);
int32_t itemIndex = pattern_->GetItemIndexByPosition(point.GetX(), point.GetY());
EXPECT_EQ(itemIndex, VIEWPORT_NUMBER);
@ -5138,7 +5133,6 @@ HWTEST_F(ListTestNg, Pattern008, TestSize.Level1)
* @tc.expected: Would return 0
*/
CreateList();
MockGetPaintRectWithTransform(frameNode_);
const Point point = Point(0, 1000.f);
int32_t itemIndex = pattern_->GetItemIndexByPosition(point.GetX(), point.GetY());
EXPECT_EQ(itemIndex, 0);

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("marquee_test_ng") {
type = "new"
flutter_skia = true
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"marquee_test_ng.cpp",
]
sources = [ "marquee_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("menu_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"menu_test_ng.cpp",
]
sources = [ "menu_test_ng.cpp" ]
}

View File

@ -3561,7 +3561,7 @@ HWTEST_F(MenuTestNg, MenuItemSetSelectedChangeEvent001, TestSize.Level1)
MenuItemProperties itemOption;
MneuItemModelInstance.Create(itemOption);
MneuItemModelInstance.SetSelectedChangeEvent(changeEvent);
auto itemNode = AceType::DynamicCast<FrameNode>(ViewStackProcessor::GetInstance()->Finish());
ASSERT_NE(itemNode, nullptr);
@ -4797,9 +4797,6 @@ HWTEST_F(MenuTestNg, MenuLayoutAlgorithmTestNg038, TestSize.Level1)
/**
* @tc.steps: step2. target is null but the geometry node of target is null
*/
auto mockRenderContext = AceType::DynamicCast<MockRenderContext>(target->GetRenderContext());
ASSERT_NE(mockRenderContext, nullptr);
EXPECT_CALL(*mockRenderContext, GetPaintRectWithTransform()).WillRepeatedly(Return(RectF(0.0f, 0.0f, 0.0f, 0.0f)));
menuLayoutAlgorithm->InitTargetSizeAndPosition(nullptr, true);
/**

View File

@ -11,231 +11,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("navigation_test_ng") {
module_out_path = pattern_test_output_path
ace_unittest("navigation_test_ng") {
type = "new"
render = true
sources = [
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/test/mock/mock_animatable_dimension.cpp",
"$ace_root/frameworks/base/test/mock/mock_drag_window.cpp",
"$ace_root/frameworks/base/test/mock/mock_frame_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_mouse_style.cpp",
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_subwindow_manager.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/base/thread/background_task_executor.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/animation/friction_motion.cpp",
"$ace_root/frameworks/core/animation/spring_curve.cpp",
"$ace_root/frameworks/core/animation/spring_model.cpp",
"$ace_root/frameworks/core/animation/spring_motion.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_scheduler.cpp",
"$ace_root/frameworks/core/common/clipboard/clipboard_proxy.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_layout_inspector.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/border.cpp",
"$ace_root/frameworks/core/components/common/properties/border_edge.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components/common/properties/text_style.cpp",
"$ace_root/frameworks/core/components/font/constants_converter.cpp",
"$ace_root/frameworks/core/components/scroll/scrollable.cpp",
"$ace_root/frameworks/core/components/xcomponent/native_interface_xcomponent_impl.cpp",
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_abstract.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/long_press_event.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_measure_layout_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node_base.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_pattern.cpp",
"$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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/linear_layout/linear_layout_utils.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",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/multi_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/sub_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_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",
"$ace_root/frameworks/core/components_ng/pattern/navigation/nav_bar_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/nav_bar_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/nav_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_content_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_group_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/navigation_stack.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/title_bar_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/title_bar_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/title_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/tool_bar_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigation/tool_bar_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navrouter/navdestination_group_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navrouter/navdestination_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navrouter/navdestination_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navrouter/navdestination_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",
"$ace_root/frameworks/core/components_ng/pattern/option/option_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/option/option_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/effect/scroll_fade_effect.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/inner/scroll_bar.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_layout_algorithm.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/pattern/scroll_bar/proxy/scroll_bar_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_content_modifier.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_modifier.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",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/span_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/span_node.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$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/property/accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/divider_painter.cpp",
"$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/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_loading_context.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/pattern/flex/mock_flex_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_bar_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/mock_scrollable_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_node.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_drawing_convertor.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_property.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",
"$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_layout_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_theme.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/pan_recognizer.cpp",
"$ace_root/frameworks/core/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/image/image_source_info.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/base/mock_jank_frame_report.cpp",
"$ace_root/test/mock/core/common/mock_ace_engine.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"$ace_root/test/mock/base/mock_subwindow.cpp",
"bar_item_test_ng.cpp",
"nav_bar_test_ng.cpp",
"navdestination_test_ng.cpp",
@ -243,18 +30,4 @@ ohos_unittest("navigation_test_ng") {
"title_bar_test_ng.cpp",
"tool_bar_test_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
"$ace_root/test/unittest:ace_unittest_log",
"$ace_root/test/unittest:ace_unittest_trace",
"$cjson_root:cjson",
"$graphic_2d_path/rosen/modules/2d_engine/rosen_text:rosen_text",
"$graphic_2d_path/rosen/modules/render_service_base:librender_service_base",
"//third_party/googletest:gmock_main",
]
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
}

View File

@ -11,17 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
import(
"//foundation/arkui/ace_engine/frameworks/core/components_ng/components.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("navigator_event_hub_test_ng") {
ace_unittest("navigator_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/navigator/navigator_pattern.cpp",
"navigator_event_hub_test_ng.cpp",
"navigator_pattern_test_ng.cpp",
]
}

View File

@ -16,10 +16,10 @@
#include "gtest/gtest.h"
#define private public
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/navigator/navigator_event_hub.h"
#include "core/components_ng/pattern/navigator/navigator_model.h"
#include "core/components_ng/pattern/navigator/navigator_model_ng.h"
#include "core/components_ng/pattern/navigator/navigator_pattern.h"
using namespace testing;
@ -48,12 +48,13 @@ protected:
RefPtr<FrameNode> NavigatorPatternTestNg::CreateNavigator(const TestProperty& testProperty)
{
NavigatorModel::GetInstance()->Create();
NavigatorModelNG navigator;
navigator.Create();
if (testProperty.typeValue.has_value()) {
NavigatorModel::GetInstance()->SetType(testProperty.typeValue.value());
NavigatorModel::GetInstance()->SetUri(testProperty.url.value());
NavigatorModel::GetInstance()->SetActive(testProperty.active.value());
NavigatorModel::GetInstance()->SetParams(testProperty.params.value());
navigator.SetType(testProperty.typeValue.value());
navigator.SetUri(testProperty.url.value());
navigator.SetActive(testProperty.active.value());
navigator.SetParams(testProperty.params.value());
}
RefPtr<UINode> element = ViewStackProcessor::GetInstance()->Finish(); // TextView pop

View File

@ -20,7 +20,6 @@ ace_unittest("navrouter_test_ng") {
sources = [
"$ace_root/frameworks/base/test/mock/mock_mouse_style.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"navrouter_test_ng.cpp",
]
}

View File

@ -17,8 +17,5 @@ ace_unittest("option_test_ng") {
render = true
flutter_skia = true
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"option_test_ng.cpp",
]
sources = [ "option_test_ng.cpp" ]
}

View File

@ -13,297 +13,11 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("overlay_manager_test_ng") {
module_out_path = pattern_test_output_path
ace_unittest("overlay_manager_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/base/subwindow/subwindow_manager.cpp",
"$ace_root/frameworks/base/test/mock/mock_animatable_dimension.cpp",
"$ace_root/frameworks/base/test/mock/mock_measure_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/chain_animation.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/animation/friction_motion.cpp",
"$ace_root/frameworks/core/animation/spring_curve.cpp",
"$ace_root/frameworks/core/animation/spring_model.cpp",
"$ace_root/frameworks/core/animation/spring_motion.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_scheduler.cpp",
"$ace_root/frameworks/core/common/ace_engine.cpp",
"$ace_root/frameworks/core/common/container.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/common/frontend.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
"$ace_root/frameworks/core/components/common/properties/border.cpp",
"$ace_root/frameworks/core/components/common/properties/border_edge.cpp",
"$ace_root/frameworks/core/components/common/properties/edge.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkbox/checkbox_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkbox/checkbox_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkbox/checkbox_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkbox/checkbox_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkbox/checkbox_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/checkboxgroup/checkboxgroup_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_view.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_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/multi_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/sub_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_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",
"$ace_root/frameworks/core/components_ng/pattern/option/option_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/option/option_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/modal_presentation_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_drag_bar_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_drag_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_presentation_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/root/root_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/effect/scroll_fade_controller.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/effect/scroll_fade_effect.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/inner/scroll_bar.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_layout_algorithm.cpp",
"$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/pattern/scroll/scroll_spring_effect.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/proxy/scroll_bar_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scrollable/nestable_scroll_container.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scrollable/scrollable_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/page_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/stage_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/stage_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/stage_pattern.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp",
"$ace_root/frameworks/core/components_ng/pattern/toast/toast_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/toast/toast_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/toast/toast_view.cpp",
"$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/event/scrollable_event/mock_scrollable.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/flex/mock_flex_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_bar_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_fade_painter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/moc_refresh_coordination.cpp",
"$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_pattern.cpp",
"$ace_root/frameworks/core/event/back_end_event_manager.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/base/mock_jank_frame_report.cpp",
"$ace_root/frameworks/core/components/picker/picker_data.cpp",
"overlay_manager_test_ng.cpp",
]
sources += [
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/geometry/quaternion.cpp",
"$ace_root/frameworks/base/geometry/transform_util.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/common/clipboard/clipboard_proxy.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/text_style.cpp",
"$ace_root/frameworks/core/components/picker/picker_animation.cpp",
"$ace_root/frameworks/core/components/picker/picker_data.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
"$ace_root/frameworks/core/components/theme/icon_theme.cpp",
"$ace_root/frameworks/core/components/theme/theme_attributes.cpp",
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/long_press_event.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/pattern/dialog/dialog_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_pattern.cpp",
"$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_modifier.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_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_content_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_event_hub.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",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_group_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_group_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_group_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_group_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_item_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_lanes_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/list/list_position_controller.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",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_column_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_column_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_dialog_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/datepicker_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/picker/toss_animation_controller.cpp",
"$ace_root/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_content_modifier.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_modifier.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",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/image_span_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_picker/textpicker_dialog_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_column_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_column_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_column_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_dialog_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_row_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/timepicker_row_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/time_picker/toss_animation_controller.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/divider_painter.cpp",
"$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp",
"$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/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.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_source_info.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/grid_container/mock_grid_container_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/nav_bar/mock_nav_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/syntax/mock_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/theme/mock_theme_constants.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/theme/mock_theme_utils.cpp",
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
"$ace_root/frameworks/core/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_subwindow.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/unittest/core/pipeline/mock_drag_drop_manager.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/googletest:gmock_main",
]
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
}

View File

@ -58,7 +58,6 @@
#include "core/components_ng/pattern/stage/stage_pattern.h"
#include "core/components_ng/pattern/toast/toast_layout_property.h"
#include "core/components_ng/pattern/toast/toast_pattern.h"
#include "core/components_ng/test/mock/pattern/picker/mock_picker_theme_manager.h"
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "core/pipeline_ng/pipeline_context.h"
@ -403,7 +402,7 @@ HWTEST_F(OverlayManagerTestNg, BindSheet001, TestSize.Level1)
auto sheetDragBarPaintProperty = sheetDragBarNode->GetPaintProperty<SheetDragBarPaintProperty>();
EXPECT_FALSE(sheetDragBarPaintProperty == nullptr);
SheetStyle sheetStyle1;
topSheetNode->GetGeometryNode()->SetFrameSize({10, 10});
topSheetNode->GetGeometryNode()->SetFrameSize({ 10, 10 });
// sheetStyle1.sheetMode is null.
sheetStyle1.sheetMode = std::nullopt;
@ -491,7 +490,7 @@ HWTEST_F(OverlayManagerTestNg, RemoveAllModalInOverlay001, TestSize.Level1)
EXPECT_FALSE(overlayManager->modalStack_.empty());
auto sheetNode = overlayManager->modalStack_.top().Upgrade();
EXPECT_EQ(sheetNode->GetTag(), V2::SHEET_PAGE_TAG);
/**
* @tc.steps: step4. run RemoveAllModalInOverlay func.
*/
@ -659,7 +658,7 @@ HWTEST_F(OverlayManagerTestNg, DestroySheet003, TestSize.Level1)
EXPECT_NE(sheetNode->GetPattern<SheetPresentationPattern>()->targetId_, targetId);
overlayManager->DestroySheet(sheetNode, targetId);
EXPECT_FALSE(overlayManager->modalStack_.empty());
sheetNode->tag_ = V2::SHEET_PAGE_TAG;
sheetNode->GetPattern<SheetPresentationPattern>()->targetId_ = targetId;
overlayManager->DestroySheet(sheetNode, targetId);
@ -1013,8 +1012,8 @@ HWTEST_F(OverlayManagerTestNg, MenuTest002, TestSize.Level1)
auto menuNode =
FrameNode::CreateFrameNode(V2::MENU_WRAPPER_ETS_TAG, menuId, AceType::MakeRefPtr<MenuWrapperPattern>(targetId));
auto subMenuId = ElementRegister::GetInstance()->MakeUniqueId();
auto subMenuNode = FrameNode::CreateFrameNode(V2::MENU_ETS_TAG,
subMenuId, AceType::MakeRefPtr<MenuPattern>(1, "Test", MenuType::MENU));
auto subMenuNode = FrameNode::CreateFrameNode(
V2::MENU_ETS_TAG, subMenuId, AceType::MakeRefPtr<MenuPattern>(1, "Test", MenuType::MENU));
subMenuNode->MountToParent(menuNode);
/**
* @tc.steps: step2. call showMenu when menuNode is nullptr and menuMap is empty.
@ -1480,6 +1479,7 @@ HWTEST_F(OverlayManagerTestNg, DialogTest002, TestSize.Level1)
EXPECT_TRUE(overlayManager->dialogMap_.empty());
EXPECT_FALSE(overlayManager->DialogInMapHoldingFocus());
}
/**
* @tc.name: DialogTest003
* @tc.desc: Test OverlayManager::ShowDateDialog->ShowTimeDialog->RemoveOverlay.
@ -1490,7 +1490,7 @@ HWTEST_F(OverlayManagerTestNg, DialogTest003, TestSize.Level1)
/**
* @tc.steps: step1. create root node and prepare dialogProperties.
*/
auto themeManager = AceType::MakeRefPtr<MockPickerThemeManager>();
auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
MockPipelineBase::GetCurrent()->SetThemeManager(themeManager);
auto rootNode = FrameNode::CreateFrameNode(V2::ROOT_ETS_TAG, 1, AceType::MakeRefPtr<RootPattern>());
DialogProperties dialogProperties;

View File

@ -20,7 +20,6 @@ ace_unittest("panel_test_ng") {
sources = [
"$ace_root/frameworks/core/components/panel/render_sliding_panel.cpp",
"$ace_root/frameworks/core/components/panel/sliding_events.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"close_icon_pattern_test_ng.cpp",
"dragBar_pattern_test_ng.cpp",
"panel_property_test_ng.cpp",

View File

@ -84,6 +84,7 @@ ohos_unittest("date_picker_test_ng") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
@ -207,7 +208,7 @@ ohos_unittest("date_picker_test_ng") {
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"$root_out_dir/arkui/framework/core/components/theme/theme_constants_default.cpp",
"datepicker_test_ng.cpp",
"date_picker_test_ng.cpp",
]
deps = [

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("progress_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"progress_test_ng.cpp",
]
sources = [ "progress_test_ng.cpp" ]
}

View File

@ -17,7 +17,6 @@ ace_unittest("refresh_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"refresh_test_ng.cpp",
]
}

View File

@ -28,7 +28,6 @@ ace_unittest("rich_editor_test_ng") {
"$ace_root/frameworks/core/components_ng/pattern/rich_editor/rich_editor_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/rich_editor/rich_editor_pattern.cpp",
"$ace_root/frameworks/core/event/key_event.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"rich_editor_test_ng.cpp",
]
}

View File

@ -17,7 +17,6 @@ ace_unittest("scroll_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"scroll_test_ng.cpp",
]
}

View File

@ -17,7 +17,6 @@ ace_unittest("search_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/base/test/mock/mock_mouse_style.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"search_test_ng.cpp",
]
}

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gtest/gtest.h"
#include "gmock/gmock-actions.h"
#define protected public
#define private public
@ -46,6 +46,9 @@
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
#undef protected
#undef private
using namespace testing;
using namespace testing::ext;
@ -91,15 +94,15 @@ void SearchTestNg::SetThemeInCreate()
auto textFieldTheme = AceType::MakeRefPtr<TextFieldTheme>();
auto searchTheme = AceType::MakeRefPtr<SearchTheme>();
auto iconTheme = AceType::MakeRefPtr<IconTheme>();
EXPECT_CALL(*themeManager, GetTheme(_))
.WillRepeatedly([=](ThemeType type) -> RefPtr<Theme> {
if (type == SearchTheme::TypeId()) {
return searchTheme;
} else if (type == IconTheme::TypeId()) {
return iconTheme;
}
return textFieldTheme;
});
EXPECT_CALL(*themeManager, GetTheme(_)).WillRepeatedly([=](ThemeType type) -> RefPtr<Theme> {
if (type == SearchTheme::TypeId()) {
return searchTheme;
}
if (type == IconTheme::TypeId()) {
return iconTheme;
}
return textFieldTheme;
});
}
void SearchTestNg::SetSearchTheme()
@ -800,7 +803,6 @@ HWTEST_F(SearchTestNg, PatternOnColorConfigurationUpdate011, TestSize.Level1)
*/
auto textFieldPattern = textFieldFrameNode->GetPattern<TextFieldPattern>();
ASSERT_NE(textFieldPattern, nullptr);
textFieldPattern->InitCaretPosition("");
auto textRect = textFieldPattern->GetTextRect();
textRect.SetTop(0.0);
textFieldPattern->SetTextRect(textRect);
@ -861,7 +863,6 @@ HWTEST_F(SearchTestNg, PatternOnColorConfigurationUpdate012, TestSize.Level1)
* @tc.step: step4. call HandleTextContentLines.
* @tc.expected: cover branch IsOperation is true and GetLineHeight value is 0.
*/
textFieldPattern->SetCaretOffsetX(0.0);
textFieldPattern->UpdateEditingValue("aaa", 0);
result = pattern->HandleTextContentLines();
EXPECT_EQ(result, 0);
@ -1592,7 +1593,7 @@ HWTEST_F(SearchTestNg, Pattern013, TestSize.Level1)
pattern->clickListener_->GetGestureEventFunc()(gestureEvent);
}
/**
/**
* @tc.name: OnColorConfigurationUpdate001
* @tc.desc: test Oncolorconfigurationupdate
* @tc.type: FUNC

View File

@ -11,40 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("security_component_pattern_test_ng") {
ohos_unittest("security_component_test_ng") {
module_out_path = pattern_test_output_path
sources = [
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/components_ng/base/view_abstract.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_paint_method.cpp",
"$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/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/mock/image_provider/mock_image_source_info.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/button/mock_button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/button/mock_button_pattern.cpp",
"$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_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/image/mock/mock_image_pattern.cpp",
# self
"$ace_root/frameworks/core/components_ng/pattern/security_component/location_button/location_button_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/security_component/paste_button/paste_button_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/security_component/save_button/save_button_model_ng.cpp",
@ -53,95 +25,24 @@ ohos_unittest("security_component_pattern_test_ng") {
"$ace_root/frameworks/core/components_ng/pattern/security_component/security_component_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/security_component/security_component_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/security_component/security_component_pattern.cpp",
"security_component_model_test_ng.cpp",
"security_component_test_ng.cpp",
]
sources += [
# base
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
# components
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
# components_ng
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp",
"$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp",
# components_v2
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
# pipeline
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
# mock
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/grid_container/mock_grid_container_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/syntax/mock_for_each_node.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_base",
"$ace_root/test/unittest:ace_components_base",
"$ace_root/test/unittest:ace_components_event",
"$ace_root/test/unittest:ace_components_gestures",
"$ace_root/test/unittest:ace_components_layout",
"$ace_root/test/unittest:ace_components_manager",
"$ace_root/test/unittest:ace_components_mock",
"$ace_root/test/unittest:ace_components_pattern",
"$ace_root/test/unittest:ace_components_property",
"$ace_root/test/unittest:ace_components_render",
"$ace_root/test/unittest:ace_components_syntax",
"$ace_root/test/unittest:ace_core_animation",
"$ace_root/test/unittest:ace_core_extra",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/googletest:gmock_main",

View File

@ -17,7 +17,6 @@ ace_unittest("select_pattern_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_v2/inspector/utils.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"select_pattern_test_ng.cpp",
]
}

View File

@ -13,197 +13,7 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("select_overlay_test_ng") {
module_out_path = pattern_test_output_path
sources = [
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/test/mock/mock_animatable_dimension.cpp",
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_subwindow_manager.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_scheduler.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/mock_icon_theme.cpp",
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.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_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_item_group/menu_item_group_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/multi_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/sub_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_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",
"$ace_root/frameworks/core/components_ng/pattern/option/option_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/option/option_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/inner/scroll_bar.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_layout_algorithm.cpp",
"$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/pattern/scroll_bar/proxy/scroll_bar_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_content_modifier.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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_node.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",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/stage_manager.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp",
"$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp",
"$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/event/scrollable_event/mock_scrollable.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.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/mock/image_provider/mock_image_source_info.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/grid_container/mock_grid_container_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_bar_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/moc_refresh_coordination.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/mock_scrollable_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/text/mock_rosen_render_custom_paint/mock_rosen_render_custom_paint.cpp",
"$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_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/syntax/mock_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/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/core/common/mock_ace_engine.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"select_overlay_test_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/googletest:gmock_main",
"//third_party/icu/icu4c:shared_icui18n",
"//third_party/icu/icu4c:shared_icuuc",
]
external_deps = []
if (enable_graphic_text_gine) {
external_deps += [ "graphic_2d:rosen_text" ]
}
defines = [ "ENABLE_ROSEN_BACKEND" ]
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
ace_unittest("select_overlay_test_ng") {
type = "new"
sources = [ "select_overlay_test_ng.cpp" ]
}

View File

@ -17,7 +17,6 @@ ace_unittest("side_bar_pattern_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/base/test/mock/mock_mouse_style.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"side_bar_layout_test_ng.cpp",
"side_bar_pattern_test_ng.cpp",
"side_bar_view_test_ng.cpp",

View File

@ -17,7 +17,6 @@ ace_unittest("slider_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_path_painter.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"slider_test_ng.cpp",
]
}

View File

@ -16,7 +16,6 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("stepper_pattern_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"stepper_accessibility_property_test_ng.cpp",
"stepper_item_pattern_test_ng.cpp",
"stepper_pattern_test_ng.cpp",

View File

@ -17,8 +17,5 @@ ace_unittest("swiper_test_ng") {
flutter_skia = true
render = true
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"swiper_test_ng.cpp",
]
sources = [ "swiper_test_ng.cpp" ]
}

View File

@ -11,185 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("tabs_test_ng") {
module_out_path = pattern_test_output_path
sources = [
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/animation/scheduler.cpp",
"$ace_root/frameworks/core/animation/scroll_motion.cpp",
"$ace_root/frameworks/core/animation/spring_curve.cpp",
"$ace_root/frameworks/core/animation/spring_model.cpp",
"$ace_root/frameworks/core/animation/spring_motion.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/components/theme/icon_theme.cpp",
"$ace_root/frameworks/core/components/theme/theme_constants.cpp",
"$ace_root/frameworks/core/components/theme/theme_utils.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/divider/divider_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.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",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_spring_effect.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scrollable/nestable_scroll_container.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper/swiper_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper/swiper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper/swiper_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper/swiper_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/digit_indicator/digit_indicator_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/indicator_common/swiper_arrow_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/swiper_indicator/indicator_common/swiper_indicator_pattern.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_styles.cpp",
"$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/render/divider_painter.cpp",
"$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/event/scrollable_event/mock_scrollable.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/mock/pattern/swiper_indicator/mock_swiper_arrow_pattern.cpp",
"$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",
# self
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_content_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tab_content_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tabs_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tabs_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tabs_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/tabs/tabs_pattern.cpp",
"tabs_test_ng.cpp",
]
sources += [
# base
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
# components
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
# components_ng
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/long_press_event.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp",
"$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp",
# components_v2
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
# pipeline
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
# mock
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/grid_container/mock_grid_container_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/syntax/mock_for_each_node.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/googletest:gmock_main",
]
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
ace_unittest("tabs_test_ng") {
type = "new"
sources = [ "tabs_test_ng.cpp" ]
}

View File

@ -10252,7 +10252,7 @@ HWTEST_F(TabsTestNg, TabBarPatternOnDirtyLayoutWrapperSwap002, TestSize.Level1)
EXPECT_EQ(tabBarPattern->tabBarStyles_[0], TabBarStyle::SUBTABBATSTYLE);
tabBarPattern->OnDirtyLayoutWrapperSwap(layoutWrapper, config);
EXPECT_EQ(tabBarPattern->indicator_, 0);
/**
* @tc.steps: step2. creat different conditions and invoke OnDirtyLayoutWrapperSwap.
* @tc.expected: step2. expect The function is run ok.

View File

@ -13,10 +13,13 @@
* limitations under the License.
*/
#define protected public
#define private public
#define protected public
#include "core/components_ng/test/pattern/test_ng.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/test/mock/render/mock_render_context.h"
namespace OHOS::Ace::NG {
void TestNG::SetWidth(const Dimension& width)
{
@ -43,6 +46,7 @@ void TestNG::RunMeasureAndLayout(const RefPtr<FrameNode>& frameNode, float width
LayoutConstraint.selfIdealSize = { width, height };
}
LayoutConstraint.maxSize = { DEVICE_WIDTH, DEVICE_HEIGHT };
frameNode->UpdateLayoutPropertyFlag();
frameNode->Measure(LayoutConstraint);
frameNode->Layout();
}

View File

@ -18,19 +18,15 @@
#include "gtest/gtest.h"
#include "base/geometry/axis.h"
#include "base/geometry/dimension.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "base/utils/utils.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/test/mock/render/mock_render_context.h"
namespace OHOS::Ace::NG {
namespace {
using namespace testing;
using namespace testing::ext;
constexpr int32_t PLATFORM_VERSION_TEN = 10;
constexpr int32_t PLATFORM_VERSION_ELEVEN = 11;
constexpr float DEVICE_WIDTH = 480.f;
@ -44,10 +40,9 @@ class TestNG {
public:
static void SetWidth(const Dimension& width);
static void SetHeight(const Dimension& height);
void RunMeasureAndLayout(const RefPtr<FrameNode>& frameNode,
float width = DEVICE_WIDTH, float height = DEVICE_HEIGHT);
void RunMeasureAndLayout(
const RefPtr<FrameNode>& frameNode, float width = DEVICE_WIDTH, float height = DEVICE_HEIGHT);
uint64_t GetActions(const RefPtr<AccessibilityProperty>& accessibilityProperty);
void MockGetPaintRectWithTransform(const RefPtr<FrameNode>& frameNode, RectF paintRect = RectF());
AssertionResult IsEqualOverScrollOffset(const OverScrollOffset& actual, const OverScrollOffset& expected)
{
@ -126,12 +121,11 @@ public:
{
return GetChildFrameNode(frameNode, index)->GetEventHub<T>();
}
const RectF& GetChildRect(const RefPtr<FrameNode>& frameNode, int32_t index)
{
return GetChildFrameNode(frameNode, index)->GetGeometryNode()->GetFrameRect();
}
};
} // namespace OHOS::Ace::NG
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_SCROLL_PATTERN_H

View File

@ -11,174 +11,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("text_test_ng") {
module_out_path = pattern_test_output_path
if (enable_graphic_text_gine) {
defines = [ "USE_GRAPHIC_TEXT_GINE" ]
} else {
include_dirs =
[ "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include" ]
}
ace_unittest("text_test_ng") {
type = "new"
render = true
sources = [
"$ace_root/adapter/preview/osal/ressched_report.cpp",
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/ressched/ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_drag_window.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_clipboard.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components/common/properties/text_style.cpp",
"$ace_root/frameworks/core/components/font/constants_converter.cpp",
"$ace_root/frameworks/core/components/theme/theme_utils.cpp",
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_abstract.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/long_press_event.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/image_provider/image_object.cpp",
"$ace_root/frameworks/core/components_ng/image_provider/image_provider.cpp",
"$ace_root/frameworks/core/components_ng/image_provider/image_state_manager.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp",
"$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_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_modifier.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/wrapper/menu_wrapper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_content_modifier.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_modifier.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",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/image_span_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/span_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/span_node.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$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/property/accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/adapter/svg_canvas_image.cpp",
"$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_cache.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/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/menu/mock_menu_wrapper_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/root/mock_root_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/select_overlay/mock_select_overlay_node.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_drawing_convertor.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/image/mock_icon_theme.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_layout_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_theme.cpp",
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
"$ace_root/frameworks/core/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/image/image_provider.cpp",
"$ace_root/frameworks/core/image/image_source_info.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"span_test_ng.cpp",
"text_test_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
"$ace_root/test/unittest:ace_unittest_log",
"$ace_root/test/unittest:ace_unittest_trace",
"$cjson_root:cjson",
"//foundation/graphic/graphic_2d/rosen/modules/render_service_base:librender_service_base",
"//third_party/googletest:gmock_main",
]
external_deps = []
if (enable_graphic_text_gine) {
external_deps += [ "graphic_2d:rosen_text" ]
}
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
}

View File

@ -1,35 +0,0 @@
/*
* Copyright (c) 2022 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.
*/
#define private public
#define protected public
#include "core/components/common/properties/color.h"
#include "core/components/text/text_theme.h"
#include "core/components/theme/theme_manager_impl.h"
namespace OHOS::Ace {
ThemeManagerImpl::ThemeManagerImpl() = default;
RefPtr<Theme> ThemeManagerImpl::GetTheme(ThemeType type)
{
RefPtr<TextTheme> theme = AceType::Claim(new TextTheme());
theme->textStyle_.SetTextColor(Color::BLACK);
theme->textStyle_.SetFontSize(Dimension(50));
// Styles below do not need to get from ThemeConstants, directly set at here.
theme->textStyle_.SetFontStyle(FontStyle::NORMAL);
theme->textStyle_.SetFontWeight(FontWeight::NORMAL);
theme->textStyle_.SetTextDecoration(TextDecoration::NONE);
return theme;
}
} // namespace OHOS::Ace

View File

@ -3890,9 +3890,6 @@ HWTEST_F(TextTestNg, PerformActionTest001, TestSize.Level1)
* @tc.steps: step3. When text CopyOptions is None, call the callback function in textAccessibilityProperty.
* @tc.expected: Related function is called.
*/
RectF rect(0.0f, 0.0f, 0.0f, 0.0f);
EXPECT_CALL(*AceType::DynamicCast<MockRenderContext>(frameNode->renderContext_), GetPaintRectWithTransform())
.WillRepeatedly(Return(rect));
EXPECT_TRUE(textAccessibilityProperty->ActActionSetSelection(1, TEXT_SIZE_INT));
EXPECT_TRUE(textAccessibilityProperty->ActActionClearSelection());
EXPECT_TRUE(textAccessibilityProperty->ActActionCopy());

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("text_clock_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"text_clock_test_ng.cpp",
]
sources = [ "text_clock_test_ng.cpp" ]
}

View File

@ -0,0 +1,19 @@
# Copyright (c) 2022-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.
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("text_field_test_ng") {
type = "new"
sources = [ "text_field_test_ng.cpp" ]
}

View File

@ -84,6 +84,7 @@ ohos_unittest("text_picker_test_ng") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
@ -176,7 +177,7 @@ ohos_unittest("text_picker_test_ng") {
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"$root_out_dir/arkui/framework/core/components/theme/theme_constants_default.cpp",
"textpicker_test_ng.cpp",
"text_picker_test_ng.cpp",
]
deps = [

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("text_timer_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"text_timer_test_ng.cpp",
]
sources = [ "text_timer_test_ng.cpp" ]
}

View File

@ -1,223 +0,0 @@
# Copyright (c) 2022-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.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("textfield_test_ng") {
module_out_path = pattern_test_output_path
sources = [
"$ace_root/frameworks/base/geometry/animatable_dimension.cpp",
"$ace_root/frameworks/base/geometry/dimension.cpp",
"$ace_root/frameworks/base/geometry/least_square_impl.cpp",
"$ace_root/frameworks/base/geometry/matrix3.cpp",
"$ace_root/frameworks/base/geometry/matrix4.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/test/mock/mock_drag_window.cpp",
"$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp",
"$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp",
"$ace_root/frameworks/base/test/mock/mock_subwindow_manager.cpp",
"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
"$ace_root/frameworks/base/utils/base_id.cpp",
"$ace_root/frameworks/base/utils/string_expression.cpp",
"$ace_root/frameworks/base/utils/string_utils.cpp",
"$ace_root/frameworks/base/utils/time_util.cpp",
"$ace_root/frameworks/core/animation/anticipate_curve.cpp",
"$ace_root/frameworks/core/animation/cubic_curve.cpp",
"$ace_root/frameworks/core/animation/curves.cpp",
"$ace_root/frameworks/core/animation/scheduler.cpp",
"$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/common/ime/text_editing_value.cpp",
"$ace_root/frameworks/core/common/ime/text_input_connection.cpp",
"$ace_root/frameworks/core/common/ime/text_input_proxy.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
"$ace_root/frameworks/core/common/test/mock/mock_clipboard.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp",
"$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp",
"$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp",
"$ace_root/frameworks/core/components/common/properties/alignment.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
"$ace_root/frameworks/core/components_ng/base/frame_node.cpp",
"$ace_root/frameworks/core/components_ng/base/geometry_node.cpp",
"$ace_root/frameworks/core/components_ng/base/modifier.cpp",
"$ace_root/frameworks/core/components_ng/base/ui_node.cpp",
"$ace_root/frameworks/core/components_ng/base/view_abstract.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
"$ace_root/frameworks/core/components_ng/event/click_event.cpp",
"$ace_root/frameworks/core/components_ng/event/drag_event.cpp",
"$ace_root/frameworks/core/components_ng/event/event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/focus_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event.cpp",
"$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/event/pan_event.cpp",
"$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp",
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
"$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp",
"$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp",
"$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_property.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/toggle_button_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp",
"$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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/image/image_paint_method.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",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/menu_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/multi_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/preview/menu_preview_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/sub_menu_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/menu/wrapper/menu_wrapper_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",
"$ace_root/frameworks/core/components_ng/pattern/option/option_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/option/option_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/inner/scroll_bar.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll/scroll_layout_algorithm.cpp",
"$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/pattern/scroll_bar/proxy/scroll_bar_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/search/search_event_hub.cpp",
"$ace_root/frameworks/core/components_ng/pattern/search/search_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_content_modifier.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_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_node.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",
"$ace_root/frameworks/core/components_ng/pattern/select_overlay/select_overlay_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/page_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/stage/stage_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/span_node.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",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text/text_overlay_modifier.cpp",
"$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/pattern/text_field/key_event_handler.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_content_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_controller.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_layout_algorithm.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_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp",
"$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/property/border_property.cpp",
"$ace_root/frameworks/core/components_ng/property/calc_length.cpp",
"$ace_root/frameworks/core/components_ng/property/grid_property.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/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp",
"$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/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_long_press_event.cpp",
"$ace_root/frameworks/core/components_ng/test/event/mock/mock_scrollable_event.cpp",
"$ace_root/frameworks/core/components_ng/test/event/scrollable_event/mock_scrollable.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/animation/mock_geometry_transition.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.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_source_info.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/pattern/grid_container/mock_grid_container_layout_property.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/root/mock_root_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_bar_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/moc_refresh_coordination.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scrollable/mock_scrollable_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/rosen/testing_typography_style.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/syntax/mock_for_each_node.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",
"$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_layout_adapter.cpp",
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
"$ace_root/frameworks/core/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp",
"$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/core/common/mock_ace_engine.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/unittest/core/pipeline/mock_drag_drop_manager.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"textfield_test_ng.cpp",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/googletest:gmock_main",
"//third_party/icu/icu4c:shared_icui18n",
"//third_party/icu/icu4c:shared_icuuc",
]
external_deps = []
if (enable_graphic_text_gine) {
external_deps += [ "graphic_2d:rosen_text" ]
}
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
}

View File

@ -85,6 +85,7 @@ ohos_unittest("time_picker_test_ng") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/button/button_layout_algorithm.cpp",
@ -176,7 +177,7 @@ ohos_unittest("time_picker_test_ng") {
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
"$root_out_dir/arkui/framework/core/components/theme/theme_constants_default.cpp",
"timepicker_test_ng.cpp",
"time_picker_test_ng.cpp",
]
deps = [

View File

@ -18,7 +18,6 @@ ace_unittest("water_flow_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/test/pattern/test_ng.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"water_flow_test_ng.cpp",
]
}

View File

@ -1,40 +0,0 @@
/*
* 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/window_scene/scene/window_pattern.h"
namespace OHOS::Ace::NG {
void WindowPattern::RegisterLifecycleListener() {}
void WindowPattern::UnregisterLifecycleListener() {}
void WindowPattern::CreateStartingNode() {}
void WindowPattern::CreateSnapshotNode(std::optional<std::shared_ptr<Media::PixelMap>> snapshot) {}
void WindowPattern::OnAttachToFrameNode() {}
void WindowPattern::DispatchPointerEvent(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent) {}
void WindowPattern::DispatchKeyEvent(const std::shared_ptr<OHOS::MMI::KeyEvent>& keyEvent) {}
void WindowPattern::DispatchKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed) {}
void WindowPattern::DisPatchFocusActiveEvent(bool isFocusActive) {}
void WindowPattern::OnModifyDone() {}
void WindowPattern::TransferFocusState(bool focusState) {}
} // namespace OHOS::Ace::NG

View File

@ -56,8 +56,8 @@ public:
MOCK_METHOD3(GetWordBoundary, bool(int32_t offset, int32_t& start, int32_t& end));
MOCK_METHOD3(
CalcCaretMetricsByPosition, bool(int32_t extent, CaretMetricsF& caretCaretMetric, TextAffinity textAffinity));
MOCK_METHOD3(
CalcCaretMetricsByPosition, bool(int32_t extent, CaretMetricsF& caretCaretMetric, OffsetF lastTouchOffsetF));
MOCK_METHOD3(CalcCaretMetricsByPosition,
bool(int32_t extent, CaretMetricsF& caretCaretMetric, const OffsetF& lastTouchOffsetF));
static RefPtr<MockParagraph> GetOrCreateMockParagraph();
static void TearDown();

View File

@ -214,6 +214,7 @@ ohos_source_set("ace_components_manager") {
"$ace_root/frameworks/core/components_ng/manager/drag_drop/drag_drop_proxy.cpp",
"$ace_root/frameworks/core/components_ng/manager/full_screen/full_screen_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/manager/shared_overlay/shared_overlay_manager.cpp",
@ -407,6 +408,7 @@ source_set("ace_components_mock") {
"$ace_root/test/mock/base/mock_jank_frame_report.cpp",
"$ace_root/test/mock/core/common/mock_ace_engine.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
@ -720,6 +722,7 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/search/search_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/search/search_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/search/search_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/search/search_text_field.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select/select_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select/select_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/select/select_model_ng.cpp",
@ -794,6 +797,7 @@ ohos_source_set("ace_components_pattern") {
"$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/pattern/text_area/text_area_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_clock/text_clock_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_clock/text_clock_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_clock/text_clock_layout_property.cpp",
@ -802,6 +806,7 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/text_drag/text_drag_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_drag/text_drag_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_drag/text_drag_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/content_controller.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/key_event_handler.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_content_modifier.cpp",
@ -813,6 +818,9 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_paint_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_input_response_area.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_field/text_select_controller.cpp",
"$ace_root/frameworks/core/components_ng/pattern/text_input/text_input_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/texttimer/text_timer_accessibility_property.cpp",
"$ace_root/frameworks/core/components_ng/pattern/texttimer/text_timer_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/texttimer/text_timer_layout_property.cpp",

View File

@ -72,6 +72,7 @@ template("ace_unittest") {
ace_unittest_deps += invoker.extra_deps
}
# ---------------------------- temporary support
if (render) {
ace_unittest_deps += [
"$graphic_2d_path/rosen/modules/render_service_base:librender_service_base",
@ -102,6 +103,8 @@ template("ace_unittest") {
flutter_external_deps = [ "eventhandler:libeventhandler" ]
}
# ----------------------------
if (type == "components") {
ohos_unittest(ace_unittest_name) {
module_out_path = "ace_engine/${module_output}"

View File

@ -316,7 +316,7 @@ HWTEST_F(FrameNodeTestNg, FrameNodeTouchTest, TestSize.Level1)
auto globalPoint = PointF(10, 10);
auto touchTestResult = std::list<RefPtr<TouchEventTarget>>();
EXPECT_CALL(*mockRenderContext, GetPaintRectWithTransform()).WillRepeatedly(Return(RectF(0, 0, 100, 100)));
mockRenderContext->rect_ = RectF(0, 0, 100, 100);
EXPECT_CALL(*mockRenderContext, GetPointWithTransform(_)).WillRepeatedly(DoAll(SetArgReferee<0>(localPoint)));
/**
@ -326,7 +326,7 @@ HWTEST_F(FrameNodeTestNg, FrameNodeTouchTest, TestSize.Level1)
childNode->SetExclusiveEventForChild(true);
auto mockRenderContextforChild = AceType::MakeRefPtr<MockRenderContext>();
childNode->renderContext_ = mockRenderContextforChild;
EXPECT_CALL(*mockRenderContextforChild, GetPaintRectWithTransform()).WillRepeatedly(Return(RectF(0, 0, 100, 100)));
mockRenderContext->rect_ = RectF(0, 0, 100, 100);
EXPECT_CALL(*mockRenderContextforChild, GetPointWithTransform(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(localPoint)));
childNode->GetOrCreateGestureEventHub();
@ -347,7 +347,7 @@ HWTEST_F(FrameNodeTestNg, FrameNodeTouchTest, TestSize.Level1)
auto grandChildNode = FrameNode::CreateFrameNode("main", 3, AceType::MakeRefPtr<Pattern>(), true);
grandChildNode->SetExclusiveEventForChild(true);
grandChildNode->renderContext_ = mockRenderContextforChild;
EXPECT_CALL(*mockRenderContextforChild, GetPaintRectWithTransform()).WillRepeatedly(Return(RectF(0, 0, 100, 100)));
mockRenderContext->rect_ = RectF(0, 0, 100, 100);
EXPECT_CALL(*mockRenderContextforChild, GetPointWithTransform(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(localPoint)));
grandChildNode->GetOrCreateGestureEventHub();
@ -1616,7 +1616,7 @@ HWTEST_F(FrameNodeTestNg, FrameNodeTouchTest042, TestSize.Level1)
auto mockRenderContextforChild = AceType::MakeRefPtr<MockRenderContext>();
childNode->renderContext_ = mockRenderContextforChild;
auto localPoint = PointF(10, 10);
EXPECT_CALL(*mockRenderContextforChild, GetPaintRectWithTransform()).WillRepeatedly(Return(RectF(0, 0, 100, 100)));
mockRenderContextforChild->rect_ = RectF(0, 0, 100, 100);
EXPECT_CALL(*mockRenderContextforChild, GetPointWithTransform(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(localPoint)));
auto childEventHub = childNode->GetOrCreateGestureEventHub();

View File

@ -11,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ohos_unittest("view_abstract_test_ng") {
@ -92,6 +91,9 @@ ohos_unittest("view_abstract_test_ng") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_paint_method.cpp",
"$ace_root/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp",
@ -206,8 +208,6 @@ ohos_unittest("view_abstract_test_ng") {
"$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_painter.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/nav_bar/mock_nav_bar_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/popup/mock_popup_base_pattern.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/pattern/scroll/mock_scroll_bar_overlay_modifier.cpp",

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("badge_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"badge_test_ng.cpp",
]
sources = [ "badge_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("TextFieldTest") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"text_field_test.cpp",
]
sources = [ "text_field_test.cpp" ]
}

View File

@ -13,21 +13,25 @@
* limitations under the License.
*/
#include <array>
#include <optional>
#include <string>
#include <utility>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "base/utils/string_utils.h"
#define private public
#define protected public
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/common/mock_container.h"
#include "test/mock/core/render/mock_paragraph.h"
#include "base/geometry/dimension.h"
#include "base/utils/utils.h"
#include "core/common/ime/text_input_type.h"
#include "core/components/common/layout/constants.h"
#include "core/components/common/properties/color.h"
@ -35,13 +39,13 @@
#include "core/components/scroll/scroll_bar_theme.h"
#include "core/components/text_field/textfield_theme.h"
#include "core/components/theme/theme_manager.h"
#include "core/components_ng/pattern/root/root_pattern.h"
#include "core/components_ng/pattern/text_field/text_field_manager.h"
#include "core/components_ng/pattern/text_field/text_field_model_ng.h"
#include "core/components_ng/pattern/text_field/text_field_pattern.h"
#include "core/components_ng/test/mock/render/mock_render_context.h"
#include "core/components_ng/test/mock/theme/mock_theme_manager.h"
#include "core/components_ng/test/pattern/test_ng.h"
#include "core/event/key_event.h"
#include "core/pipeline/base/element_register.h"
#include "core/pipeline_ng/test/mock/mock_pipeline_base.h"
#undef private
@ -51,7 +55,7 @@ using namespace testing;
using namespace testing::ext;
namespace OHOS::Ace::NG {
namespace {
template<typename CheckItem, typename Expected>
struct TestItem {
CheckItem item;
@ -63,105 +67,113 @@ struct TestItem {
TestItem() = default;
};
constexpr double ICON_SIZE = 24;
constexpr double ICON_HOT_ZONE_SIZE = 40;
constexpr double FONT_SIZE = 16;
constexpr int32_t DEFAULT_NODE_ID = 1;
const std::string DEFAULT_TEXT = "abcdefghijklmnopqrstuvwxyz";
const std::string DEFAULT_PLACE_HOLDER = "please input text here";
using TextFiledModelUpdater = std::function<void(TextFieldModelNG&)>;
} // namespace
class TextFieldTestBase : public testing::Test {
public:
protected:
static void SetUpTestSuite();
static void TearDownTestSuite();
void SetUp() override;
void TearDown() override;
protected:
RefPtr<FrameNode> CreateTextFieldNode(int32_t id, std::string text, std::string placeHolder, bool isTextArea,
TextFiledModelUpdater&& modelUpdater = nullptr);
void CreateOrUpdate(int32_t id, std::string text, std::string placeHolder, bool isTextArea,
TextFiledModelUpdater&& modelUpdater = nullptr);
void CreateTextFieldNode(const std::string& text, const std::string& placeHolder, bool isTextArea,
std::function<void(TextFieldModelNG&)>&& modelUpdater);
void RunMeasureAndLayout();
void GetFocus();
RefPtr<MockParagraph> paragraph_;
RefPtr<FrameNode> frameNode_;
RefPtr<TextFieldPattern> pattern_;
RefPtr<MockThemeManager> mockThemeManager_ = AceType::MakeRefPtr<MockThemeManager>();
int32_t id_ = -1;
std::string text_ = "abcedefghijklmnopqrstuvwxyz";
std::string placeHolder_ = "abcedefghijklmnopqrstuvwxyz";
};
void TextFieldTestBase::SetUpTestSuite()
{
MockContainer::SetUp();
MockPipelineBase::SetUp();
MockPipelineBase::GetCurrent()->SetRootSize(500, 500);
MockPipelineBase::GetCurrent()->rootNode_ =
FrameNode::CreateFrameNodeWithTree(V2::ROOT_ETS_TAG, 0, AceType::MakeRefPtr<RootPattern>());
MockPipelineBase::GetCurrent()->SetRootSize(DEVICE_WIDTH, DEVICE_HEIGHT);
auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
MockPipelineBase::GetCurrent()->SetThemeManager(themeManager);
auto textFieldTheme = AceType::MakeRefPtr<TextFieldTheme>();
textFieldTheme->iconSize_ = Dimension(ICON_SIZE, DimensionUnit::VP);
textFieldTheme->iconHotZoneSize_ = Dimension(ICON_HOT_ZONE_SIZE, DimensionUnit::VP);
textFieldTheme->fontSize_ = Dimension(FONT_SIZE, DimensionUnit::FP);
textFieldTheme->fontWeight_ = FontWeight::W400;
textFieldTheme->textColor_ = Color::FromString("#ff182431");
EXPECT_CALL(*themeManager, GetTheme(_))
.WillRepeatedly([textFieldTheme = textFieldTheme](ThemeType type) -> RefPtr<Theme> {
if (type == ScrollBarTheme::TypeId()) {
return AceType::MakeRefPtr<ScrollBarTheme>();
}
return textFieldTheme;
});
MockPipelineBase::GetCurrent()->SetTextFieldManager(AceType::MakeRefPtr<TextFieldManagerNG>());
MockContainer::Current()->taskExecutor_ = AceType::MakeRefPtr<MockTaskExecutor>();
}
void TextFieldTestBase::RunMeasureAndLayout()
{
frameNode_->SetRootMeasureNode(true);
frameNode_->UpdateLayoutPropertyFlag();
frameNode_->SetSkipSyncGeometryNode(false);
frameNode_->Measure(frameNode_->GetLayoutConstraint());
frameNode_->Layout();
frameNode_->SetRootMeasureNode(false);
}
void TextFieldTestBase::TearDownTestSuite()
{
MockContainer::TearDown();
MockPipelineBase::TearDown();
}
void TextFieldTestBase::SetUp()
{
MockPipelineBase::GetCurrent()->SetThemeManager(mockThemeManager_);
auto textFieldTheme = AceType::MakeRefPtr<TextFieldTheme>();
textFieldTheme->iconSize_ = Dimension(24, DimensionUnit::VP);
textFieldTheme->iconHotZoneSize_ = Dimension(40, DimensionUnit::VP);
textFieldTheme->fontSize_ = Dimension(16, DimensionUnit::FP);
textFieldTheme->fontWeight_ = FontWeight::W400;
textFieldTheme->textColor_ = Color::FromString("#ff182431");
EXPECT_CALL(*mockThemeManager_, GetTheme(_))
.WillRepeatedly([this, textFieldTheme = textFieldTheme](ThemeType type) -> RefPtr<Theme> {
if (type == ScrollBarTheme::TypeId()) {
return AceType::MakeRefPtr<ScrollBarTheme>();
}
return textFieldTheme;
});
CreateOrUpdate(1, text_, placeHolder_, false);
MockParagraph::TearDown();
}
void TextFieldTestBase::TearDown()
{
ElementRegister::GetInstance()->Clear();
auto* stack = ViewStackProcessor::GetInstance();
while (!stack->elementsStack_.empty()) {
stack->elementsStack_.pop();
}
pattern_ = nullptr;
frameNode_ = nullptr;
}
RefPtr<FrameNode> TextFieldTestBase::CreateTextFieldNode(
int32_t id, std::string text, std::string placeHolder, bool isTextArea, TextFiledModelUpdater&& modelUpdater)
void TextFieldTestBase::CreateTextFieldNode(const std::string& text, const std::string& placeHolder, bool isTextArea,
std::function<void(TextFieldModelNG&)>&& modelUpdater)
{
auto* stack = ViewStackProcessor::GetInstance();
stack->StartGetAccessRecordingFor(id);
stack->StartGetAccessRecordingFor(DEFAULT_NODE_ID);
TextFieldModelNG textFieldModelNG;
textFieldModelNG.CreateNode(placeHolder, text, isTextArea);
if (modelUpdater) {
modelUpdater(textFieldModelNG);
}
stack->StopGetAccessRecording();
auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode();
CHECK_NULL_RETURN(frameNode, nullptr);
stack->elementsStack_.pop();
ElementRegister::GetInstance()->AddUINode(frameNode);
return frameNode;
}
void TextFieldTestBase::CreateOrUpdate(
int32_t id, std::string text, std::string placeHolder, bool /*isTextArea*/, TextFiledModelUpdater&& modelUpdater)
{
frameNode_ = CreateTextFieldNode(1, text, placeHolder, false, std::move(modelUpdater));
ASSERT_NE(frameNode_, nullptr);
frameNode_ = AceType::DynamicCast<FrameNode>(stack->Finish());
pattern_ = frameNode_->GetPattern<TextFieldPattern>();
ASSERT_NE(pattern_, nullptr);
pattern_->OnModifyDone();
id_ = frameNode_->GetId();
paragraph_ = MockParagraph::GetOrCreateMockParagraph();
EXPECT_CALL(*paragraph_, PushStyle(_)).Times(AnyNumber());
EXPECT_CALL(*paragraph_, AddText(_)).Times(AnyNumber());
EXPECT_CALL(*paragraph_, PopStyle()).Times(AnyNumber());
EXPECT_CALL(*paragraph_, Build()).Times(AnyNumber());
EXPECT_CALL(*paragraph_, Layout(_)).Times(AnyNumber());
EXPECT_CALL(*paragraph_, GetHeight()).Times(AnyNumber());
EXPECT_CALL(*paragraph_, GetLongestLine()).Times(AnyNumber());
RunMeasureAndLayout();
}
void TextFieldTestBase::GetFocus()
{
auto focushHub = pattern_->GetFocusHub();
focushHub->currentFocus_ = true;
pattern_->HandleFocusEvent();
RunMeasureAndLayout();
}
namespace CaretTest {
class TextFieldCaretTest : public TextFieldTestBase {};
class TextFieldControllerTest : public TextFieldTestBase {};
class TextFieldKeyHandlerTest : public TextFieldTestBase {};
/**
* @tc.name: CaretPosition001
@ -171,28 +183,25 @@ class TextFieldCaretTest : public TextFieldTestBase {};
HWTEST_F(TextFieldCaretTest, CaretPosition001, TestSize.Level1)
{
/**
* @tc.steps: Check caret position when the text is unchanged.
* @tc.expected: Previous caret position is same as the current.
* @tc.steps: Create Text filed node with default text and placeholder
*/
ASSERT_NE(pattern_, nullptr);
auto prevCaretPosition = pattern_->GetTextEditingValue().GetWideText().length() / 2;
pattern_->SetCaretPosition(prevCaretPosition);
CreateOrUpdate(id_, text_, placeHolder_, false);
auto currentCaretPosition = pattern_->GetTextEditingValue().caretPosition;
EXPECT_EQ(prevCaretPosition, currentCaretPosition) << "caret position should not change when text unchanged";
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
/**
* @tc.steps: Check caret position when the text is changed.
* @tc.expected: Previous caret position is not same as the current.
* @tc.expected: Current caret position is end of text
*/
auto newText = text_ + "_new";
CreateOrUpdate(id_, newText, placeHolder_, false);
currentCaretPosition = pattern_->GetTextEditingValue().caretPosition;
EXPECT_NE(prevCaretPosition, currentCaretPosition) << "caret position should update when text changed";
auto actualCaretPosition = StringUtils::ToWstring(newText).length();
EXPECT_EQ(actualCaretPosition, currentCaretPosition)
<< "caret position should be at the end of the text when text changed";
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), DEFAULT_TEXT.size());
/**
* @tc.steps: Changed new text and remeasure and layout
*/
pattern_->InsertValue("new");
RunMeasureAndLayout();
/**
* @tc.expected: Current caret position is end of text
*/
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), DEFAULT_TEXT.size() + 3);
}
/**
@ -203,230 +212,270 @@ HWTEST_F(TextFieldCaretTest, CaretPosition001, TestSize.Level1)
HWTEST_F(TextFieldCaretTest, CaretPosition002, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call SetType.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Create Text filed node with default text and placeholder and set input type
*/
auto textLength = pattern_->GetTextEditingValue().GetWideText().length();
auto caretPosition = pattern_->GetTextEditingValue().caretPosition;
EXPECT_EQ(textLength, caretPosition) << "default input type";
std::string text = "openharmony@huawei.com+*0123456789";
std::vector<TestItem<TextInputType, int32_t>> testItems;
testItems.emplace_back(TextInputType::TEXT, 34, "TextInputType::TEXT");
testItems.emplace_back(TextInputType::TEXT, text.size(), "TextInputType::TEXT");
testItems.emplace_back(TextInputType::NUMBER, 10, "TextInputType::NUMBER");
testItems.emplace_back(TextInputType::PHONE, 12, "TextInputType::PHONE");
testItems.emplace_back(TextInputType::EMAIL_ADDRESS, 32, "TextInputType::EMAIL_ADDRESS");
testItems.emplace_back(TextInputType::VISIBLE_PASSWORD, 34, "TextInputType::VISIBLE_PASSWORD");
for (auto testItem : testItems) {
CreateOrUpdate(
id_, text, placeHolder_, false, [type = testItem.item](TextFieldModelNG& model) { model.SetType(type); });
auto errorMessage = "inputType is " + testItem.error + ", text is " + pattern_->GetEditingValue().text;
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, testItem.expected) << errorMessage;
testItems.emplace_back(TextInputType::EMAIL_ADDRESS, text.size() - 2, "TextInputType::EMAIL_ADDRESS");
testItems.emplace_back(TextInputType::VISIBLE_PASSWORD, text.size() - 2, "TextInputType::VISIBLE_PASSWORD");
/**
* @tc.expected: Check if the text filter rules for the input box are compliant
*/
for (const auto& testItem : testItems) {
CreateTextFieldNode(
text, DEFAULT_PLACE_HOLDER, false, [testItem](TextFieldModelNG& model) { model.SetType(testItem.item); });
auto errorMessage = "InputType is " + testItem.error + ", text is " + pattern_->GetTextValue();
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), testItem.expected) << errorMessage;
}
}
/**
* @tc.name: CaretPosition003
* @tc.desc: Test caret position on SetCaretPosition.
* @tc.desc: Test caret position on SetCaretPosition and SetMaxLength
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition003, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call SetCaretPosition.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Create Text filed node with default text and placeholder
* @tc.expected: Cursor movement position matches the actual position
*/
auto length = static_cast<int32_t>(pattern_->GetTextEditingValue().GetWideText().length());
std::vector<TestItem<int32_t, int32_t>> testItems;
for (auto position = 0; position <= length; position++) {
testItems.emplace_back(position, position);
}
for (auto testItem : testItems) {
pattern_->SetCaretPosition(testItem.item);
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, testItem.expected);
}
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
auto controller = pattern_->GetTextFieldController();
controller->CaretPosition(static_cast<int>(DEFAULT_TEXT.size() - 2));
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), static_cast<int>(DEFAULT_TEXT.size() - 2));
/**
* @tc.steps: Create Text filed node with default text and placeholder
* @tc.expected: Cursor movement position matches the actual position
*/
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false,
[](TextFieldModelNG& model) { model.SetMaxLength(DEFAULT_TEXT.size() - 2); });
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), DEFAULT_TEXT.size() - 2);
}
/**
* @tc.name: CaretPosition004
* @tc.desc: Test caret position on SetMaxLength.
* @tc.desc: Test caret position on SetInputFilter.
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition004, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call SetMaxLength.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Initialize text and filter patterns
*/
auto length = static_cast<int32_t>(pattern_->GetTextEditingValue().GetWideText().length());
pattern_->SetCaretPosition(length / 2);
std::string text = "abcdefghABCDEFG0123456789";
std::vector<TestItem<std::string, int32_t>> testItems;
testItems.emplace_back("", StringUtils::ToWstring(text).length());
testItems.emplace_back("[0-9]", 10);
testItems.emplace_back("[A-Z]", 7);
testItems.emplace_back("[a-z]", 8);
std::vector<TestItem<int32_t, int32_t>> testItems;
testItems.emplace_back(length, length / 2, "caret position is less than max length");
testItems.emplace_back(length / 2 - 1, length / 2 - 1, "caret position is greater than max length");
for (auto testItem : testItems) {
CreateOrUpdate(id_, text_, placeHolder_, false,
[maxLength = testItem.item](TextFieldModelNG& model) { model.SetMaxLength(maxLength); });
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, testItem.expected) << testItem.error;
/**
* @tc.expected: Check if the text filter patterns for the input box are compliant
*/
for (const auto& testItem : testItems) {
CreateTextFieldNode(text, DEFAULT_PLACE_HOLDER, false,
[testItem](TextFieldModelNG& model) { model.SetInputFilter(testItem.item, nullptr); });
auto errorMessage = "InputType is " + testItem.error + ", text is " + pattern_->GetTextValue();
EXPECT_EQ(pattern_->GetTextSelectController()->GetCaretIndex(), testItem.expected) << errorMessage;
}
}
/**
* @tc.name: CaretPosition005
* @tc.desc: Test caret position on SetInputFilter.
* @tc.desc: Test input string at the cursor position
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition005, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call SetInputFilter.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Initialize text input and get select controller, update caret position and insert value
*/
std::string text = "abcdefghABCDEFG0123456789";
std::vector<TestItem<std::string, int32_t>> testItems;
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
auto controller = pattern_->GetTextSelectController();
controller->UpdateCaretIndex(2);
pattern_->InsertValue("new");
RunMeasureAndLayout();
testItems.emplace_back("", StringUtils::ToWstring(text).length());
testItems.emplace_back("[0-9]", 10);
testItems.emplace_back("[A-Z]", 7);
testItems.emplace_back("[a-z]", 8);
for (auto testItem : testItems) {
CreateOrUpdate(id_, text, placeHolder_, false,
[filter = testItem.item](TextFieldModelNG& model) { model.SetInputFilter(filter, nullptr); });
auto errorMessage = "input filter is " + testItem.item + ", text is " + pattern_->GetEditingValue().text;
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, testItem.expected) << errorMessage;
}
/**
* @tc.expected: Check if the text and cursor position are correct
*/
EXPECT_EQ(pattern_->contentController_->GetTextValue(), "abnewcdefghijklmnopqrstuvwxyz");
EXPECT_EQ(controller->GetCaretIndex(), 5);
}
/**
* @tc.name: CaretPosition006
* @tc.desc: Test caret position when focus changed.
* @tc.desc: Test stop edting input mode
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition006, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call HandleFocusEvent or HandleBlurEvent.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Initialize text input node
*/
pattern_->HandleFocusEvent();
EXPECT_TRUE(pattern_->cursorVisible_) << "show cursor on focus";
pattern_->HandleBlurEvent();
EXPECT_FALSE(pattern_->cursorVisible_) << "hide cursor on blur";
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
/**
* @tc.expected: The cursor is neither blinking nor visible when unfocused
*/
EXPECT_EQ(pattern_->caretStatus_, CaretStatus::NONE);
EXPECT_FALSE(pattern_->GetCursorVisible());
/**
* @tc.steps: Manually trigger focus and perform measure and layout again
* @tc.expected: Check if the cursor is twinking
*/
GetFocus();
EXPECT_EQ(pattern_->caretStatus_, CaretStatus::SHOW);
EXPECT_TRUE(pattern_->GetCursorVisible());
/**
* @tc.steps: Get text filed controller and stop editing
*/
auto controller = pattern_->GetTextFieldController();
controller->StopEditing();
RunMeasureAndLayout();
/**
* @tc.expected: Check if the cursor stop twinking
*/
EXPECT_EQ(pattern_->caretStatus_, CaretStatus::HIDE);
EXPECT_FALSE(pattern_->GetCursorVisible());
}
/**
* @tc.name: CaretPosition007
* @tc.desc: Test caret position with the clipboard.
* @tc.desc: Test the text selection mode of the text controller
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition007, TestSize.Level1)
{
/**
* @tc.steps: Check caret position after call HandleOnCut,HandleOnPaste,HandleOnSelectAll.
* @tc.expected: caret position is same as the expected.
* @tc.steps: Initialize text input node and get focus
*/
CreateOrUpdate(
id_, text_, placeHolder_, false, [](TextFieldModelNG& model) { model.SetCopyOption(CopyOptions::InApp); });
auto len = pattern_->GetEditingValue().GetWideText().length();
auto selectStart = len / 2;
auto selectEnd = len;
pattern_->UpdateSelection(selectStart, selectEnd);
pattern_->SetInSelectMode(SelectionMode::SELECT);
pattern_->HandleOnCut();
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, selectStart)
<< "caret position should equals with first handle position";
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
GetFocus();
len = pattern_->GetEditingValue().GetWideText().length();
pattern_->SetInSelectMode(SelectionMode::SELECT);
pattern_->UpdateSelection(0, len / 2);
pattern_->HandleOnCopy();
EXPECT_TRUE(pattern_->cursorVisible_) << "show cursor when call HandleOnCopy";
pattern_->SetCaretPosition(len);
pattern_->HandleOnPaste();
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, len + len / 2)
<< ("caret position equals with [last position] + [copy data length]");
EXPECT_CALL(*paragraph_, GetRectsForRange(_, _, _)).Times(1);
auto controller = pattern_->GetTextFieldController();
controller->SetTextSelection(3, 5);
RunMeasureAndLayout();
len = pattern_->GetEditingValue().GetWideText().length();
pattern_->HandleOnSelectAll(false);
EXPECT_EQ(pattern_->GetEditingValue().caretPosition, len) << ("caret position equals with text length");
/**
* @tc.expected: Check if the cursor stop twinking and
* get select first and second handle info index
*/
auto selectController = pattern_->GetTextSelectController();
EXPECT_EQ(selectController->GetStartIndex(), 3);
EXPECT_EQ(selectController->GetEndIndex(), 5);
}
/**
* @tc.name: CaretPosition008
* @tc.desc: Test caret position with the keyboard event.
* @tc.name: ContentController001
* @tc.desc: Test ContentController in different input type
* @tc.type: FUNC
*/
HWTEST_F(TextFieldCaretTest, CaretPosition008, TestSize.Level1)
HWTEST_F(TextFieldControllerTest, ContentController001, TestSize.Level1)
{
/**
* @tc.steps: text is abcedefghijkl*mnopqrstuvwxyz, * is caret position.
* 1. abcedefghijkl*nopqrstuvwxyz -- delete forward
* 2. abcedefghijk*nopqrstuvwxyz -- delete backward
* 3. abcedefghijk@*nopqrstuvwxyz -- insert 8
* 4. abcedefghijk@*stuvwxyz -- select right 5(nopqr) and cut
* 5. abcedefghijk@nopqr*stuvwxyz -- paste 5(nopqr)
* 6. abcedefghijk@*stuvwxyz -- undo step 5
* 7. abcedefghijk@nopqr*stuvwxyz -- redo step 6
* 8. abcedefghijk@nopqrstuvwxyz* -- select all
* @tc.expected: caret position is same as the expected.
* @tc.steps: Initialize insert text and expected values
*/
auto length = static_cast<int>(pattern_->GetTextEditingValue().GetWideText().length());
pattern_->SetCaretPosition(length / 2);
pattern_->imeAttached_ = true;
KeyEvent event;
event.code = KeyCode::KEY_FORWARD_DEL;
event.action = KeyAction::DOWN;
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2) << "delete forward";
std::vector<std::string> insertValues = {
"openharmony123_ *+%$",
"openharmony123456*+&@huawei.com",
"openharmony#15612932075*.com",
"open_harmony@@huawei.com*+$helloworld",
"open_harmony123 password*+#",
};
std::vector<TestItem<TextInputType, std::string>> testItems;
testItems.emplace_back(TextInputType::TEXT, "openharmony123_ *+%$", "TextInputType::TEXT");
testItems.emplace_back(TextInputType::NUMBER, "123456", "TextInputType::NUMBER");
testItems.emplace_back(TextInputType::PHONE, "#15612932075*", "TextInputType::PHONE");
testItems.emplace_back(
TextInputType::EMAIL_ADDRESS, "open_harmony@huawei.comhelloworld", "TextInputType::EMAIL_ADDRESS");
testItems.emplace_back(
TextInputType::VISIBLE_PASSWORD, "openharmony123 password*+#", "TextInputType::VISIBLE_PASSWORD");
event.code = KeyCode::KEY_DEL;
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2 - 1) << "delete backward";
event.code = KeyCode::KEY_2;
event.pressedCodes = { KeyCode::KEY_SHIFT_LEFT, KeyCode::KEY_2 };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2) << "insert one";
event.code = KeyCode::KEY_DPAD_RIGHT;
event.pressedCodes = { KeyCode::KEY_SHIFT_LEFT, KeyCode::KEY_DPAD_RIGHT };
pattern_->UpdateSelection(length / 2);
auto selectCount = 5;
for (auto i = 0; i < selectCount; i++) {
pattern_->OnKeyEvent(event);
/**
* @tc.expected: Check if text filtering meets expectations
*/
int index = 0;
for (const auto& testItem : testItems) {
CreateTextFieldNode(
"", DEFAULT_PLACE_HOLDER, false, [testItem](TextFieldModelNG& model) { model.SetType(testItem.item); });
auto controller = pattern_->contentController_;
controller->InsertValue(0, insertValues[index]);
index++;
auto errorMessage = "InputType is " + testItem.error + ", text is " + pattern_->GetTextValue();
EXPECT_EQ(controller->GetTextValue().compare(testItem.expected), 0) << errorMessage;
}
event.code = KeyCode::KEY_X;
event.pressedCodes = { KeyCode::KEY_CTRL_LEFT, KeyCode::KEY_X };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2)
<< ("cut " + std::to_string(selectCount) + " characters");
event.code = KeyCode::KEY_V;
event.pressedCodes = { KeyCode::KEY_CTRL_LEFT, KeyCode::KEY_V };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2 + selectCount)
<< ("paste " + std::to_string(selectCount) + " characters");
event.code = KeyCode::KEY_Z;
event.pressedCodes = { KeyCode::KEY_CTRL_LEFT, KeyCode::KEY_Z };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2)
<< ("undo, the caret position is at last position");
event.code = KeyCode::KEY_Y;
event.pressedCodes = { KeyCode::KEY_CTRL_LEFT, KeyCode::KEY_Y };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length / 2 + selectCount)
<< ("redo, the caret position equals with step 5");
length = static_cast<int>(pattern_->GetTextEditingValue().GetWideText().length());
event.code = KeyCode::KEY_A;
event.pressedCodes = { KeyCode::KEY_CTRL_LEFT, KeyCode::KEY_A };
pattern_->OnKeyEvent(event);
EXPECT_EQ(pattern_->GetTextEditingValue().caretPosition, length)
<< ("select all, caret position is at the end of text");
pattern_->imeAttached_ = false;
}
} // namespace CaretTest
}; // namespace OHOS::Ace::NG
/**
* @tc.name: ContentController002
* @tc.desc: Test ContentController in different input filter
* @tc.type: FUNC
*/
HWTEST_F(TextFieldControllerTest, ContentController002, TestSize.Level1)
{
/**
* @tc.steps: Initialize text and filter patterns
*/
std::string text = "CabcdefgABhCDEFG0123a456A789";
std::vector<TestItem<std::string, std::string>> testItems;
testItems.emplace_back("", "CabcdefgABhCDEFG0123a456A789", "None");
testItems.emplace_back("[0-9]", "0123456789", "Input filter [0-9]");
testItems.emplace_back("[A-Z]", "CABCDEFGA", "Input filter [A-Z]");
testItems.emplace_back("[a-z]", "abcdefgha", "Input filter [a-z]");
/**
* @tc.expected: Check if the text filter patterns for the input box are compliant
*/
for (const auto& testItem : testItems) {
CreateTextFieldNode("", DEFAULT_PLACE_HOLDER, false,
[testItem](TextFieldModelNG& model) { model.SetInputFilter(testItem.item, nullptr); });
auto controller = pattern_->contentController_;
controller->InsertValue(0, text);
auto errorMessage = testItem.error + ", text is " + pattern_->GetTextValue();
EXPECT_EQ(controller->GetTextValue().compare(testItem.expected), 0) << errorMessage;
}
}
/**
* @tc.name: ContentController003
* @tc.desc: Test ContentController in different input filter
* @tc.type: FUNC
*/
HWTEST_F(TextFieldControllerTest, ContentController003, TestSize.Level1)
{
/**
* @tc.steps: Initialize text and filter patterns
*/
CreateTextFieldNode(DEFAULT_TEXT, DEFAULT_PLACE_HOLDER, false, nullptr);
auto controller = pattern_->contentController_;
/**
* @tc.expected: Check if text is selected based on corresponding left and right coordinates
*/
auto selectedValue = controller->GetSelectedValue(1, 4);
EXPECT_EQ(selectedValue.compare("bcd"), 0) << "Text is " + selectedValue;
/**
* @tc.expected: Check if text is selected based on preceding coordinates
*/
auto beforeSelectedValue = controller->GetValueBeforeIndex(3);
EXPECT_EQ(beforeSelectedValue.compare("abc"), 0) << "Text is " + beforeSelectedValue;
/**
* @tc.expected: Check if text is selected based on trailing coordinates
*/
auto afterSelectedValue = controller->GetValueAfterIndex(3);
EXPECT_EQ(afterSelectedValue.compare("defghijklmnopqrstuvwxyz"), 0) << "Text is " + afterSelectedValue;
}
} // namespace OHOS::Ace::NG

View File

@ -18,7 +18,6 @@ ace_unittest("video_test_ng") {
sources = [
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_media_player_creator.cpp",
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_path_painter.cpp",
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"video_test_ng.cpp",
]
}

View File

@ -130,6 +130,7 @@ ohos_unittest("pipeline_context_test_ng") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
"$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_client.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/select_overlay/select_overlay_proxy.cpp",
"$ace_root/frameworks/core/components_ng/pattern/app_bar/app_bar_view.cpp",