|
1 | 1 | using System; |
| 2 | +using System.Threading.Tasks; |
2 | 3 | using Microsoft.Maui.Controls.Internals; |
3 | 4 | using Microsoft.Maui.Devices; |
4 | 5 | using Microsoft.Maui.Graphics; |
@@ -463,6 +464,59 @@ public void FlyoutPageAppearingAndDisappearingPropagatesToDetail() |
463 | 464 | Assert.Equal(1, disappearing); |
464 | 465 | Assert.Equal(1, appearing); |
465 | 466 | } |
| 467 | + |
| 468 | + [Theory] |
| 469 | + [InlineData(0)] |
| 470 | + [InlineData(1)] |
| 471 | + [InlineData(2)] |
| 472 | + [InlineData(3)] |
| 473 | + public async Task VerifyToolbarButtonVisibilityWhenFlyoutReset(int depth) |
| 474 | + { |
| 475 | + ContentPage detailContentPage = new ContentPage(); |
| 476 | + |
| 477 | + Page flyout = new ContentPage() |
| 478 | + { |
| 479 | + Title = "Initial Flyout" |
| 480 | + }; |
| 481 | + |
| 482 | + NavigationPage.SetHasNavigationBar(flyout, false); |
| 483 | + |
| 484 | + var flyoutContentPage = flyout; |
| 485 | + |
| 486 | + for (int i = 0; i < depth; i++) |
| 487 | + { |
| 488 | + flyout = new NavigationPage(flyout) |
| 489 | + { |
| 490 | + Title = "Flyout " + i |
| 491 | + }; |
| 492 | + } |
| 493 | + |
| 494 | + FlyoutPage flyoutPage = new FlyoutPage |
| 495 | + { |
| 496 | + Flyout = flyout, |
| 497 | + Detail = new NavigationPage(detailContentPage) |
| 498 | + }; |
| 499 | + |
| 500 | + _ = new TestWindow(flyoutPage); |
| 501 | + |
| 502 | + Toolbar flyoutToolBar = flyoutPage.Toolbar; |
| 503 | + Assert.True(flyoutToolBar.IsVisible); |
| 504 | + |
| 505 | + if (depth >= 1) |
| 506 | + { |
| 507 | + var page = new ContentPage(); |
| 508 | + NavigationPage.SetHasNavigationBar(page, false); |
| 509 | + await flyoutContentPage.Navigation.PushAsync(page); |
| 510 | + } |
| 511 | + else |
| 512 | + { |
| 513 | + var page = new ContentPage { Title = "Reborn Flyout" }; |
| 514 | + NavigationPage.SetHasNavigationBar(page, false); |
| 515 | + flyoutPage.Flyout = new ContentPage { Title = "Reborn Flyout" }; |
| 516 | + } |
| 517 | + |
| 518 | + Assert.True(flyoutToolBar.IsVisible); |
| 519 | + } |
466 | 520 | } |
467 | 521 |
|
468 | 522 | } |
0 commit comments