From b8934a16d5f97154d6391cfe1870e3caa2fa779a Mon Sep 17 00:00:00 2001 From: chenjiafeng10 Date: Mon, 30 Jun 2025 11:13:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?Description:=20=E8=A1=A5=E5=85=85text=5Fsel?= =?UTF-8?q?ect=5Foverlay=E7=9A=84TDD=5F0625=20IssueNo:=20https://gitee.com?= =?UTF-8?q?/openharmony/arkui=5Face=5Fengine/issues/ICHOJQ=20Feature=20or?= =?UTF-8?q?=20Bugfix:=20Feature=20Binary=20Source:No=20Signed-off-by:=20ch?= =?UTF-8?q?enjiafeng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/pattern/text/text_testnine_ng.cpp | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/unittest/core/pattern/text/text_testnine_ng.cpp b/test/unittest/core/pattern/text/text_testnine_ng.cpp index 7cefeb911d4..425c9ea5388 100644 --- a/test/unittest/core/pattern/text/text_testnine_ng.cpp +++ b/test/unittest/core/pattern/text/text_testnine_ng.cpp @@ -227,6 +227,58 @@ HWTEST_F(TextTestNineNg, OnMenuItemAction001, TestSize.Level1) EXPECT_FALSE(pattern->SelectOverlayIsOn()); } +/** + * @tc.name: OnMenuItemAction002 + * @tc.desc: test OnMenuItemAction, call memuCallback.onAIMenuOption + * @tc.type: FUNC + */ +HWTEST_F(TextTestNineNg, OnMenuItemAction002, TestSize.Level1) +{ + /** + * @tc.steps: step1. get text pattern + */ + auto* stack = ViewStackProcessor::GetInstance(); + stack->StartGetAccessRecordingFor(0); + TextModelNG textModelNG; + textModelNG.Create("TextValue"); + stack->StopGetAccessRecording(); + auto frameNode = AceType::DynamicCast(stack->Finish()); + auto pattern = frameNode->GetPattern(); + auto layoutProperty = frameNode->GetLayoutProperty(); + FlushUITasks(frameNode); + + /** + * @tc.steps: step2. request focus + */ + auto focusHub = frameNode->GetOrCreateFocusHub(); + focusHub->RequestFocusImmediately(); + FlushUITasks(frameNode); + + /** + * @tc.step: step3. create a scene where the text menu has popped up + */ + + pattern->textSelector_.Update(0, 2); + pattern->CalculateHandleOffsetAndShowOverlay(); + OverlayRequest request; + request.menuIsShow = true; + request.hideHandle = false; + request.animation = false; + request.hideHandleLine = false; + request.requestCode = 0; + pattern->ShowSelectOverlay(request); + + /** + * @tc.step: step4. test OnMenuItemAction + */ + pattern->isMousePressed_ = true; + auto info = pattern->selectOverlay_->selectOverlayInfo_; + info->memuCallback.onAIMenuOption(OptionMenuActionId::AI_MENU_OPTION, ""); + EXPECT_FALSE(pattern->SelectOverlayIsOn()); + info->memuCallback.onAIMenuOption(OptionMenuActionId::AI_MENU_OPTION, "test"); + EXPECT_FALSE(pattern->SelectOverlayIsOn()); +} + HWTEST_F(TextTestNineNg, CheckHandleVisible001, TestSize.Level1) { /** -- Gitee From 0dbac0954f2ba4e621b284729cf06a0dea995e97 Mon Sep 17 00:00:00 2001 From: chenjiafeng10 Date: Mon, 30 Jun 2025 13:59:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?Description:=20=E8=A1=A5=E5=85=85text=5Fsel?= =?UTF-8?q?ect=5Foverlay=E7=9A=84TDD=5F0625=20IssueNo:=20https://gitee.com?= =?UTF-8?q?/openharmony/arkui=5Face=5Fengine/issues/ICHOJQ=20Feature=20or?= =?UTF-8?q?=20Bugfix:=20Feature=20Binary=20Source:No=20Signed-off-by:=20ch?= =?UTF-8?q?enjiafeng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unittest/core/pattern/text/text_testnine_ng.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unittest/core/pattern/text/text_testnine_ng.cpp b/test/unittest/core/pattern/text/text_testnine_ng.cpp index 425c9ea5388..290faa0c778 100644 --- a/test/unittest/core/pattern/text/text_testnine_ng.cpp +++ b/test/unittest/core/pattern/text/text_testnine_ng.cpp @@ -272,10 +272,11 @@ HWTEST_F(TextTestNineNg, OnMenuItemAction002, TestSize.Level1) * @tc.step: step4. test OnMenuItemAction */ pattern->isMousePressed_ = true; - auto info = pattern->selectOverlay_->selectOverlayInfo_; - info->memuCallback.onAIMenuOption(OptionMenuActionId::AI_MENU_OPTION, ""); + auto pipeline = PipelineContext::GetCurrentContext(); + auto info = pipeline->GetSelectOverlayManager()->selectOverlayInfo_; + info.memuCallback.onAIMenuOption(""); EXPECT_FALSE(pattern->SelectOverlayIsOn()); - info->memuCallback.onAIMenuOption(OptionMenuActionId::AI_MENU_OPTION, "test"); + info.memuCallback.onAIMenuOption("test"); EXPECT_FALSE(pattern->SelectOverlayIsOn()); } -- Gitee From 9c21a5fc36614c7b03bddc241c8a020ac7430f0b Mon Sep 17 00:00:00 2001 From: chenjiafeng10 Date: Mon, 30 Jun 2025 23:26:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Description:=20=E8=A1=A5=E5=85=85text=5Fsel?= =?UTF-8?q?ect=5Foverlay=E7=9A=84TDD=5F0625=20IssueNo:=20https://gitee.com?= =?UTF-8?q?/openharmony/arkui=5Face=5Fengine/issues/ICHOJQ=20Feature=20or?= =?UTF-8?q?=20Bugfix:=20Feature=20Binary=20Source:No=20Signed-off-by:=20ch?= =?UTF-8?q?enjiafeng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unittest/core/pattern/text/text_testnine_ng.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/unittest/core/pattern/text/text_testnine_ng.cpp b/test/unittest/core/pattern/text/text_testnine_ng.cpp index 290faa0c778..83e93edffe2 100644 --- a/test/unittest/core/pattern/text/text_testnine_ng.cpp +++ b/test/unittest/core/pattern/text/text_testnine_ng.cpp @@ -272,11 +272,10 @@ HWTEST_F(TextTestNineNg, OnMenuItemAction002, TestSize.Level1) * @tc.step: step4. test OnMenuItemAction */ pattern->isMousePressed_ = true; - auto pipeline = PipelineContext::GetCurrentContext(); - auto info = pipeline->GetSelectOverlayManager()->selectOverlayInfo_; - info.memuCallback.onAIMenuOption(""); + auto info = pattern->selectOverlay_->GetSelectOverlayInfo(); + info->memuCallback.onAIMenuOption(""); EXPECT_FALSE(pattern->SelectOverlayIsOn()); - info.memuCallback.onAIMenuOption("test"); + info->memuCallback.onAIMenuOption("test"); EXPECT_FALSE(pattern->SelectOverlayIsOn()); } -- Gitee From de5cbe3f9d23b5a35b747d5e3bd64db878e1b9b3 Mon Sep 17 00:00:00 2001 From: chenjiafeng10 Date: Tue, 22 Jul 2025 22:32:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?Description:=20=E8=A1=A5=E5=85=85text=5Fsel?= =?UTF-8?q?ect=5Foverlay=E7=9A=84TDD=5F0625=20IssueNo:=20https://gitee.com?= =?UTF-8?q?/openharmony/arkui=5Face=5Fengine/issues/ICHOJQ=20Feature=20or?= =?UTF-8?q?=20Bugfix:=20Feature=20Binary=20Source:No=20Signed-off-by:=20ch?= =?UTF-8?q?enjiafeng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/pages/01-style/08-barState.ets | 2 +- .../entry/src/main/ets/pages/01-style/09-maxLines.ets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/08-barState.ets b/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/08-barState.ets index 973002442d9..677ea50896b 100644 --- a/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/08-barState.ets +++ b/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/08-barState.ets @@ -24,7 +24,7 @@ struct struct_01_style_08_barState { TextInput({ text: '没有设置 barState ' }).style(TextInputStyle.Inline) TextInput({ text: ' .barState(BarState.Auto) ' }).style(TextInputStyle.Inline).barState(BarState.Auto) TextInput({ text: ' .barState(undefined) ' }).style(TextInputStyle.Inline).barState(undefined) - }.borderWidth(2) + } } } diff --git a/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/09-maxLines.ets b/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/09-maxLines.ets index 9842d82b8a1..a7cd2fcce7b 100644 --- a/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/09-maxLines.ets +++ b/examples/TextInputComponentTest/entry/src/main/ets/pages/01-style/09-maxLines.ets @@ -30,7 +30,7 @@ struct struct_01_style_09_maxLines { TextInput({ text: ` .maxLines(0) ${this.message}` }).style(TextInputStyle.Inline).maxLines(0) TextInput({ text: ` .maxLines(0.5) ${this.message}` }).style(TextInputStyle.Inline).maxLines(0.5) TextInput({ text: ` .maxLines(-5) ${this.message}` }).style(TextInputStyle.Inline).maxLines(-5) - }.borderWidth(2) + } } } -- Gitee From 3df5aed68746d25644548afe9e2a055cbfd16c77 Mon Sep 17 00:00:00 2001 From: chenjiafeng10 Date: Sun, 27 Jul 2025 22:50:28 +0800 Subject: [PATCH 5/5] =?UTF-8?q?Description:=20=E8=A1=A5=E5=85=85text=5Fsel?= =?UTF-8?q?ect=5Foverlay=E7=9A=84TDD=5F0625=20IssueNo:=20https://gitee.com?= =?UTF-8?q?/openharmony/arkui=5Face=5Fengine/issues/ICHOJQ=20Feature=20or?= =?UTF-8?q?=20Bugfix:=20Feature=20Binary=20Source:No=20Signed-off-by:=20ch?= =?UTF-8?q?enjiafeng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unittest/core/pattern/text/text_testnine_ng.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unittest/core/pattern/text/text_testnine_ng.cpp b/test/unittest/core/pattern/text/text_testnine_ng.cpp index 83e93edffe2..f5bdf2b4b68 100644 --- a/test/unittest/core/pattern/text/text_testnine_ng.cpp +++ b/test/unittest/core/pattern/text/text_testnine_ng.cpp @@ -272,10 +272,10 @@ HWTEST_F(TextTestNineNg, OnMenuItemAction002, TestSize.Level1) * @tc.step: step4. test OnMenuItemAction */ pattern->isMousePressed_ = true; - auto info = pattern->selectOverlay_->GetSelectOverlayInfo(); - info->memuCallback.onAIMenuOption(""); + auto info = pattern->selectOverlay_->GetSelectOverlayInfos(); + info->menuCallback.onAIMenuOption(""); EXPECT_FALSE(pattern->SelectOverlayIsOn()); - info->memuCallback.onAIMenuOption("test"); + info->menuCallback.onAIMenuOption("test"); EXPECT_FALSE(pattern->SelectOverlayIsOn()); } -- Gitee