!47370 TDD:Navigation的dump能力增强

Merge pull request !47370 from Zhang Jinyu/dumpTdd
This commit is contained in:
openharmony_ci 2024-11-05 03:02:46 +00:00 committed by Gitee
commit 66783f8c85
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1236,6 +1236,52 @@ HWTEST_F(NavigationPatternTestTwoNg, NavigationPatternTestOne_046, TestSize.Leve
EXPECT_EQ(ret, true);
}
/**
* @tc.name: NavigationPatternTestOne_047
* @tc.desc: Test Register dump
* @tc.type: FUNC
*/
HWTEST_F(NavigationPatternTestTwoNg, NavigationPatternTestOne_047, TestSize.Level1)
{
/**
* @tc.steps: step1. create navigation contentNode.
*/
auto navigationNode = NavigationGroupNode::GetOrCreateGroupNode(
V2::NAVIGATION_VIEW_ETS_TAG, 11, []() { return AceType::MakeRefPtr<NavigationPattern>(); });
ASSERT_NE(navigationNode, nullptr);
auto navigationStack = AceType::MakeRefPtr<NavigationStack>();
ASSERT_NE(navigationStack, nullptr);
navigationNode->GetPattern<NavigationPattern>()->SetNavigationStack(std::move(navigationStack));
auto navigationPattern = navigationNode->GetPattern<NavigationPattern>();
ASSERT_NE(navigationPattern, nullptr);
navigationPattern->navigationMode_ = NavigationMode::SPLIT;
navigationNode->depth_ = 7;
/**
* @tc.steps: step2. create navDestination contentNode.
*/
auto navDestinationNode = NavDestinationGroupNode::GetOrCreateGroupNode(
V2::NAVDESTINATION_VIEW_ETS_TAG, 22, []() { return AceType::MakeRefPtr<NavDestinationPattern>(); });
ASSERT_NE(navDestinationNode, nullptr);
auto navDestinationPattern = navDestinationNode->GetPattern<NavDestinationPattern>();
ASSERT_NE(navDestinationPattern, nullptr);
navDestinationNode->index_ = 0;
navDestinationNode->mode_ = NavDestinationMode::STANDARD;
navDestinationPattern->name_ = "pageOne";
navDestinationPattern->isOnShow_ = true;
navDestinationPattern->navDestinationId_ = 22;
/**
* @tc.steps: step3. check dumpString.
*/
std::string navigationDumpInfo = "|-> Navigation ID: 11, Depth: 7, Mode: \"AUTO(SPLIT)\", NavDestinations:";
std::string navDestinationDumpInfo = "| [0]{ ID: 22, Name: \"pageOne\", Mode: \"STANDARD\", IsOnShow: \"TRUE\" }";
std::string navigationDumpString = navigationNode->ToDumpString();
EXPECT_EQ(navigationDumpString, navigationDumpInfo);
std::string navDestinationDumpString = navDestinationNode->ToDumpString();
EXPECT_EQ(navDestinationDumpString, navDestinationDumpInfo);
}
/**
* @tc.name: UpdatePreNavDesZIndex001
* @tc.desc: Increase the coverage of NavigationPattern::UpdatePreNavDesZIndex function.