-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[net7.0] [Android] Fix crash setting SelectedTabColor on TabbedPage (#…
…13396) * Fix crash setting SelectedTabColor on Android TabbedPage * Update src/Controls/src/Core/Platform/Android/TabbedPageManager.cs Co-authored-by: Manuel de la Pena <mandel@microsoft.com> * Refactoring code * Small refactoring and included comments * Changes based on feedback --------- Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
- Loading branch information
1 parent
54c209e
commit b7f7c0b
Showing
2 changed files
with
48 additions
and
11 deletions.
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
28 changes: 28 additions & 0 deletions
28
src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.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,28 @@ | ||
using System.Threading.Tasks; | ||
using AndroidX.ViewPager2.Widget; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.DeviceTests.Stubs; | ||
using Microsoft.Maui.Graphics; | ||
using Xunit; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public partial class TabbedPageTests | ||
{ | ||
[Fact(DisplayName = "Using SelectedTab Color doesnt crash")] | ||
public async Task SelectedTabColorNoDoesntCrash() | ||
{ | ||
SetupBuilder(); | ||
|
||
var tabbedPage = CreateBasicTabbedPage(); | ||
tabbedPage.SelectedTabColor = Colors.Red; | ||
|
||
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(tabbedPage), (handler) => | ||
{ | ||
var platformView = tabbedPage.Handler.PlatformView as ViewPager2; | ||
Assert.NotNull(platformView); | ||
return Task.CompletedTask; | ||
}); | ||
} | ||
} | ||
} |