-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IllegalArgumentException when changing number of tabbar pages - fix #22589
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
efa95f7
Fix #18251
kubaflo 3047f66
Added a UI Test (#18251)
kubaflo 8aeb5f2
Update BottomNavigationViewUtils.cs
kubaflo 139e708
Update BottomNavigationViewUtils.cs
kubaflo 76c480b
Update BottomNavigationViewUtils.cs
kubaflo cdadefc
Update BottomNavigationViewUtils.cs
kubaflo deb4e77
Ui Test improvement
kubaflo 1dafc18
Updated test
jsuarezruiz 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
26 changes: 26 additions & 0 deletions
26
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.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,26 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue18251 : _IssuesUITest | ||
| { | ||
| public Issue18251(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "IllegalArgumentException when changing number of tabbar pages"; | ||
|
|
||
| [Test] | ||
| public void NoExceptionShouldBeThrownAddingShellTabs() | ||
| { | ||
| App.WaitForElement("button"); | ||
|
|
||
| for (int i = 0; i < 2; i++) | ||
| { | ||
| App.Click("button"); | ||
| } | ||
|
|
||
| // The test passes if no crash is observed | ||
| } | ||
| } | ||
| } |
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,30 @@ | ||
| <?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.Issue18251" | ||
| xmlns:local="clr-namespace:Maui.Controls.Sample.Issues" | ||
| Title="FlyoutTapClose" | ||
| x:Name="shell"> | ||
|
|
||
| <TabBar FlexLayout.AlignSelf="Auto"> | ||
| <ShellContent Title="Page 1" ContentTemplate="{DataTemplate local:Issue18251Page}" /> | ||
| <Tab Title="Page 2" IsVisible="{Binding IsLoggedIn}" > | ||
| <ShellContent Title="Page 2-A" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 2-B" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| </Tab> | ||
| <ShellContent Title="LogIn/Out" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="LogIn/Out" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedOut}"/> | ||
| <ShellContent Title="Page 5" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedOut}" /> | ||
| <ShellContent Title="Page 6" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedOut}" /> | ||
| <ShellContent Title="Page 7" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 8" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 9" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 10" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 11" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| <ShellContent Title="Page 12" ContentTemplate="{DataTemplate local:Issue18251Page}" /> | ||
| <ShellContent Title="Page 13" ContentTemplate="{DataTemplate local:Issue18251Page}" /> | ||
| <ShellContent Title="Page 14" ContentTemplate="{DataTemplate local:Issue18251Page}" /> | ||
| <ShellContent Title="Page 15" ContentTemplate="{DataTemplate local:Issue18251Page}" IsVisible="{Binding IsLoggedIn}" /> | ||
| </TabBar> | ||
| </Shell> |
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,68 @@ | ||
| using Microsoft.Maui.Controls; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 18251, "IllegalArgumentException when changing number of tabbar pages", PlatformAffected.Android)] | ||
| public partial class Issue18251 : Shell | ||
| { | ||
| internal static Issue18251ViewModel ViewModel; | ||
|
|
||
| public Issue18251() | ||
| { | ||
| InitializeComponent(); | ||
| BindingContext = ViewModel = new(); | ||
| } | ||
| } | ||
|
|
||
| public class Issue18251Page : ContentPage | ||
| { | ||
| public Issue18251Page() | ||
| { | ||
| Content = | ||
| new VerticalStackLayout() { | ||
| new Button() | ||
| { | ||
| AutomationId = "button", | ||
| Command = Issue18251.ViewModel.LoginCommand, | ||
| Text = "Click to change tabs" | ||
| } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| public class Issue18251ViewModel : BindableObject | ||
| { | ||
| private bool _isLoggedIn; | ||
| public bool IsLoggedIn | ||
| { | ||
| get => _isLoggedIn; | ||
| set | ||
| { | ||
| _isLoggedIn = value; | ||
| OnPropertyChanged(); | ||
| } | ||
| } | ||
|
|
||
| private bool _isLoggedOut = true; | ||
| public bool IsLoggedOut | ||
| { | ||
| get => _isLoggedOut; | ||
| set | ||
| { | ||
| _isLoggedOut = value; | ||
| OnPropertyChanged(); | ||
| } | ||
| } | ||
|
|
||
| public Command LoginCommand { get; set; } | ||
|
|
||
| public Issue18251ViewModel() | ||
| { | ||
| LoginCommand = new Command(() => | ||
| { | ||
| IsLoggedIn = !IsLoggedIn; | ||
| IsLoggedOut = !IsLoggedIn; | ||
| }); | ||
| } | ||
| } | ||
| } |
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.