-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] Fix FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar #25857
Open
devanathan-vaithiyanathan
wants to merge
5
commits into
dotnet:main
Choose a base branch
from
devanathan-vaithiyanathan:fix-24547
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+82
−0
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
42c5ef3
Fixed-ToolBarVisible-Issue
prakashKannanSf3972 4c64e38
Added-Platform-Condition
prakashKannanSf3972 96248f1
Removed
prakashKannanSf3972 f392560
Modified-TestCases-Added-SnapShot
prakashKannanSf3972 87afa4a
Added-Windows-SnapShot
prakashKannanSf3972 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+8.22 KB
.../TestCases.Android.Tests/snapshots/android/VerifyInitialToolbarButtonHidden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.22 KB
...ses.Android.Tests/snapshots/android/VerifyToolbarButtonHiddenOnNavigateBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions
109
src/Controls/tests/TestCases.HostApp/Issues/Issue24547.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 24547, "[Windows] FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar", PlatformAffected.UWP)] | ||
public class Issue24547 : NavigationPage | ||
{ | ||
|
||
public Issue24547() : base(new Issue24547PopoverPage()) | ||
{ | ||
|
||
} | ||
public partial class Issue24547PopoverPage : FlyoutPage | ||
{ | ||
public Issue24547PopoverPage() | ||
{ | ||
FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover; | ||
|
||
Flyout = new ContentPage | ||
{ | ||
Title = "Flyout", | ||
BackgroundColor = Colors.Red, | ||
Content = new StackLayout | ||
{ | ||
Children = { | ||
new Label { Text = "Flyout" } | ||
} | ||
} | ||
}; | ||
|
||
ContentPage contentPage = new ContentPage | ||
{ | ||
BackgroundColor = Colors.Green, | ||
Title = "Detail", | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
CreateDetailButton() | ||
} | ||
} | ||
}; | ||
|
||
Detail = new NavigationPage(contentPage); | ||
Button button = new Button() { Text = "Menu", AutomationId = "MenuButton" }; | ||
button.Clicked += (s, e) => IsPresented = true; | ||
NavigationPage.SetTitleView(contentPage, button); | ||
} | ||
|
||
private Button CreateDetailButton() | ||
{ | ||
Button button = new Button | ||
{ | ||
Text = "Detail", | ||
AutomationId = "DetailButton" | ||
}; | ||
|
||
button.Clicked += OnDetailButtonClicked; | ||
return button; | ||
} | ||
|
||
private async void OnDetailButtonClicked(object sender, EventArgs e) | ||
{ | ||
await this.Window.Page.Navigation.PushAsync(new NavigationPage(new Issue24547Page1())); | ||
} | ||
|
||
public override bool ShouldShowToolbarButton() | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public partial class Issue24547Page1 : ContentPage | ||
{ | ||
public Issue24547Page1() | ||
{ | ||
Title = "Content Page"; | ||
VerticalStackLayout layout = new VerticalStackLayout | ||
{ | ||
Children = | ||
{ | ||
CreatePopButton() | ||
} | ||
}; | ||
Content = layout; | ||
|
||
ToolbarItems.Add(new ToolbarItem | ||
{ | ||
Text = "Item One", | ||
}); | ||
} | ||
|
||
private Button CreatePopButton() | ||
{ | ||
Button button = new Button | ||
{ | ||
Text = "Pop Button", | ||
AutomationId = "PopButton", | ||
}; | ||
|
||
button.Clicked += OnPopButtonClicked; | ||
return button; | ||
} | ||
|
||
private async void OnPopButtonClicked(object sender, EventArgs e) | ||
{ | ||
await this.Window.Page.Navigation.PopAsync(); | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24547.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
public class Issue24547: _IssuesUITest | ||
{ | ||
public Issue24547(TestDevice device) : base(device) { } | ||
|
||
public override string Issue => "[Windows] FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar"; | ||
|
||
[Test] | ||
[Category(UITestCategories.FlyoutPage)] | ||
public void VerifyInitialToolbarButtonHidden() | ||
{ | ||
App.WaitForElement("DetailButton"); | ||
VerifyScreenshot(); | ||
} | ||
|
||
[Test] | ||
[Category(UITestCategories.FlyoutPage)] | ||
public void VerifyToolbarButtonHiddenOnNavigateBack() | ||
{ | ||
App.WaitForElement("DetailButton"); | ||
App.Tap("DetailButton"); | ||
App.WaitForElement("PopButton"); | ||
App.Tap("PopButton"); | ||
App.WaitForElement("DetailButton"); | ||
VerifyScreenshot(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triggered build. There are some pending snapshots. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We updated the test cases. Pending screenshots will be attached after the next CI trigger. |
||
} | ||
} |
Binary file added
BIN
+16.4 KB
...ls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyInitialToolbarButtonHidden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.4 KB
...s/TestCases.iOS.Tests/snapshots/ios/VerifyToolbarButtonHiddenOnNavigateBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the partial keyword, could you please check once and let me know.