-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Fix ShellContent Title Does Not Update at Runtime #26062
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7611f5f
fix added
devanathan-vaithiyanathan a9abd80
ios snap added
devanathan-vaithiyanathan ae6a031
new changes added
devanathan-vaithiyanathan 5ac6d71
Revert "new changes added"
devanathan-vaithiyanathan c925552
fix added for runtime changes
devanathan-vaithiyanathan 223a693
removed mac platform restriction in test case
devanathan-vaithiyanathan a8b89a9
Merge remote-tracking branch 'upstream/main' into fix-26049
devanathan-vaithiyanathan 9c070e5
testcase modified
devanathan-vaithiyanathan 05a8e7e
reverted issue7453
devanathan-vaithiyanathan f61463c
script file modified
devanathan-vaithiyanathan cdba2e2
iOS snap added
devanathan-vaithiyanathan f8764a5
script file changes modified
devanathan-vaithiyanathan ca9e2b4
keyword removed
devanathan-vaithiyanathan 817c496
mac snapshot added
devanathan-vaithiyanathan 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 hidden or 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
60 changes: 60 additions & 0 deletions
60
src/Controls/tests/TestCases.HostApp/Issues/Issue26049.xaml
This file contains hidden or 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,60 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue26049" | ||
| FlyoutBehavior="Disabled" | ||
| Title="Issue26049"> | ||
| <TabBar AutomationId="TabBar"> | ||
| <Tab Title="Nested Tabs" x:Name="tabs" AutomationId="tabbar"> | ||
| <ShellContent x:Name="tab1" Title="Home"> | ||
| <ContentPage> | ||
| <StackLayout HorizontalOptions="Center" Spacing="20"> | ||
|
|
||
| <HorizontalStackLayout> | ||
| <Label Text="Current Shell Title: " FontAttributes="Bold"/> | ||
| <Label Text="{Binding Source={x:Reference tab1}, Path=Title}" AutomationId="FirstTabLabel"/> | ||
| </HorizontalStackLayout> | ||
|
|
||
| <HorizontalStackLayout> | ||
| <Label Text="New Tab Title: " FontAttributes="Bold"/> | ||
| <Label x:Name="newTabTitleLabel" AutomationId="NewTabTitleLabel"/> | ||
| </HorizontalStackLayout> | ||
|
|
||
| <HorizontalStackLayout> | ||
| <Label Text="Third Tab Title: " FontAttributes="Bold"/> | ||
| <Label x:Name="thirdTabTitleLabel" Text="{Binding Source={x:Reference tab3}, Path=Title}" AutomationId="ThirdTabTitleLabel"/> | ||
| </HorizontalStackLayout> | ||
|
|
||
| <Button Text="Change Title" AutomationId="ChangeShellContentTitle" VerticalOptions="Center" HorizontalOptions="Center" WidthRequest="150" HeightRequest="40" Clicked="OnButtonClicked"/> | ||
|
|
||
| <Button Text="Add New Tab" AutomationId="AddShellContent" | ||
| Clicked="OnAddShellContentClicked"/> | ||
|
|
||
| <Button Text="Update New Tab Title" AutomationId="UpdateNewShellContentTitle" | ||
| Clicked="OnUpdateNewShellContentTitleClicked"/> | ||
|
|
||
| <Button Text="Remove New Tab" AutomationId="RemoveShellContent" | ||
| Clicked="OnRemoveShellContentClicked"/> | ||
|
|
||
| <Button Text="Update Third Tab Title" AutomationId="UpdateThirdTabTitle" | ||
| Clicked="OnUpdateThirdTabTitleClicked"/> | ||
|
|
||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
|
|
||
| <ShellContent x:Name="tab2" Title="Settings"> | ||
| <ContentPage> | ||
| <Label Text="This is Settings page"/> | ||
| </ContentPage> | ||
| </ShellContent> | ||
|
|
||
| <ShellContent x:Name="tab3" Title="Profile"> | ||
| <ContentPage> | ||
| <Label Text="This is Profile page"/> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </Tab> | ||
| </TabBar> | ||
|
|
||
| </Shell> |
65 changes: 65 additions & 0 deletions
65
src/Controls/tests/TestCases.HostApp/Issues/Issue26049.xaml.cs
This file contains hidden or 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,65 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 26049, "[iOS] Fix ShellContent Title Does Not Update at Runtime", PlatformAffected.iOS | PlatformAffected.macOS)] | ||
| public partial class Issue26049 : Shell | ||
| { | ||
| ShellContent _dynamicShellContent; | ||
|
|
||
| public Issue26049() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| void OnButtonClicked(object sender, EventArgs e) | ||
| { | ||
| this.tab1.Title = "Updated"; | ||
| } | ||
|
|
||
| void OnAddShellContentClicked(object sender, EventArgs e) | ||
| { | ||
| if (_dynamicShellContent == null) | ||
| { | ||
| _dynamicShellContent = new ShellContent | ||
| { | ||
| Title = "New Tab", | ||
| Content = new ContentPage | ||
| { | ||
| Content = new Label { Text = "This is a dynamically added tab." } | ||
| } | ||
| }; | ||
|
|
||
| this.tabs.Items.Add(_dynamicShellContent); | ||
| UpdateNewTabTitleLabel(); | ||
| } | ||
| } | ||
|
|
||
| void OnUpdateNewShellContentTitleClicked(object sender, EventArgs e) | ||
| { | ||
| if (_dynamicShellContent != null) | ||
| { | ||
| _dynamicShellContent.Title = "Updated Title"; | ||
| UpdateNewTabTitleLabel(); | ||
| } | ||
| } | ||
|
|
||
| void OnRemoveShellContentClicked(object sender, EventArgs e) | ||
| { | ||
| if (_dynamicShellContent != null) | ||
| { | ||
| this.tabs.Items.Remove(_dynamicShellContent); | ||
| _dynamicShellContent = null; | ||
| newTabTitleLabel.Text = ""; | ||
| } | ||
| } | ||
|
|
||
| void OnUpdateThirdTabTitleClicked(object sender, EventArgs e) | ||
| { | ||
| this.tab3.Title = "Updated Profile"; | ||
| thirdTabTitleLabel.Text = this.tab3.Title; | ||
| } | ||
|
|
||
| void UpdateNewTabTitleLabel() | ||
| { | ||
| newTabTitleLabel.Text = _dynamicShellContent?.Title; | ||
| } | ||
| } |
46 changes: 46 additions & 0 deletions
46
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26049.cs
This file contains hidden or 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,46 @@ | ||
| #if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS //More information - https://github.com/dotnet/maui/issues/27494 | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue26049 : _IssuesUITest | ||
| { | ||
| public Issue26049(TestDevice device) : base(device) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "[iOS] Fix ShellContent Title Does Not Update at Runtime"; | ||
|
|
||
| [Test, Order(1)] | ||
| [Category(UITestCategories.Shell)] | ||
| public void VerifyFirstShellContentTitle() | ||
| { | ||
| App.WaitForElement("ChangeShellContentTitle"); | ||
| App.Click("ChangeShellContentTitle"); | ||
| VerifyScreenshot(); | ||
| } | ||
|
|
||
| [Test, Order(2)] | ||
| [Category(UITestCategories.Shell)] | ||
| public void VerifyNewlyAddedShellContentTitle() | ||
jfversluis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| App.WaitForElement("AddShellContent"); | ||
| App.Click("AddShellContent"); | ||
| App.Click("UpdateNewShellContentTitle"); | ||
| VerifyScreenshot(); | ||
| } | ||
|
|
||
| [Test, Order(3)] | ||
| [Category(UITestCategories.Shell)] | ||
| public void VerifyExistingTabTitle() | ||
| { | ||
| App.WaitForElement("RemoveShellContent"); | ||
| App.Click("RemoveShellContent"); | ||
| App.Click("UpdateThirdTabTitle"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
Binary file modified
BIN
+1.61 KB
(100%)
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ChangeShellContentTitle.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
+69.4 KB
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyExistingTabTitle.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
+76.3 KB
...ntrols/tests/TestCases.iOS.Tests/snapshots/ios/VerifyFirstShellContentTitle.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
+70.3 KB
...s/tests/TestCases.iOS.Tests/snapshots/ios/VerifyNewlyAddedShellContentTitle.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.
Uh oh!
There was an error while loading. Please reload this page.