mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-10-07 08:24:11 +00:00
!43877 【挑单】【Menu】修复自由多窗模式下,bindContextMenu二级菜单布局异常
Merge pull request !43877 from 王一卉/cherry-pick-1726714195
This commit is contained in:
commit
94078c3fa8
@ -232,27 +232,13 @@ float SubMenuLayoutAlgorithm::HorizontalLayoutSubMenu(
|
||||
void SubMenuLayoutAlgorithm::ModifySubMenuWrapper(LayoutWrapper* layoutWrapper)
|
||||
{
|
||||
CHECK_NULL_VOID(layoutWrapper);
|
||||
auto props = AceType::DynamicCast<MenuLayoutProperty>(layoutWrapper->GetLayoutProperty());
|
||||
CHECK_NULL_VOID(props);
|
||||
auto pipelineContext = PipelineContext::GetMainPipelineContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
auto safeAreaManager = pipelineContext->GetSafeAreaManager();
|
||||
CHECK_NULL_VOID(safeAreaManager);
|
||||
auto theme = pipelineContext->GetTheme<SelectTheme>();
|
||||
CHECK_NULL_VOID(theme);
|
||||
auto expandDisplay = theme->GetExpandDisplay();
|
||||
auto windowGlobalRect = pipelineContext->GetDisplayWindowRectInfo();
|
||||
auto bottom = safeAreaManager->GetSystemSafeArea().bottom_.Length();
|
||||
auto menuNode = layoutWrapper->GetHostNode();
|
||||
CHECK_NULL_VOID(menuNode);
|
||||
auto menuPattern = menuNode->GetPattern<MenuPattern>();
|
||||
CHECK_NULL_VOID(menuPattern);
|
||||
auto mainMenuPattern = menuPattern->GetMainMenuPattern();
|
||||
auto isContextMenu = false;
|
||||
if (mainMenuPattern) {
|
||||
isContextMenu = mainMenuPattern->IsContextMenu();
|
||||
}
|
||||
if (isContextMenu && !expandDisplay) {
|
||||
if (!hierarchicalParameters_) {
|
||||
wrapperSize_ = SizeF(windowGlobalRect.Width(), windowGlobalRect.Height() - bottom);
|
||||
} else {
|
||||
wrapperSize_ = SizeF(wrapperSize_.Width(), wrapperSize_.Height());
|
||||
|
@ -1479,7 +1479,7 @@ HWTEST_F(MenuLayout2TestNg, SubMenuLayoutAlgorithmTestNg001, TestSize.Level1)
|
||||
* @tc.expected: wrapperSize_ is not Data anomalies
|
||||
*/
|
||||
algorithm->ModifySubMenuWrapper(wrapper);
|
||||
ASSERT_NE(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
ASSERT_EQ(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1544,7 +1544,7 @@ HWTEST_F(MenuLayout2TestNg, SubMenuLayoutAlgorithmTestNg002, TestSize.Level1)
|
||||
* @tc.expected: wrapperSize_ is not Data anomalies
|
||||
*/
|
||||
algorithm->ModifySubMenuWrapper(wrapper);
|
||||
ASSERT_NE(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
ASSERT_EQ(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
|
||||
/**
|
||||
* @tc.steps: step3. call the InitializePaddingAPI12 method.
|
||||
@ -1621,7 +1621,7 @@ HWTEST_F(MenuLayout2TestNg, SubMenuLayoutAlgorithmTestNg003, TestSize.Level1)
|
||||
* @tc.expected: wrapperSize_ is not Data anomalies
|
||||
*/
|
||||
algorithm->ModifySubMenuWrapper(wrapper);
|
||||
ASSERT_NE(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
ASSERT_EQ(algorithm->wrapperSize_, SizeF(0, 0));
|
||||
|
||||
/**
|
||||
* @tc.cases: case2. layering parameter is false.
|
||||
|
Loading…
Reference in New Issue
Block a user