forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the issue dotnet#22042 & added a UITest
- Loading branch information
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Controls/samples/Controls.Sample.UITests/Issues/Issue22042.xaml
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue22042" | ||
Title="Issue22042"> | ||
|
||
<ContentPage.Resources> | ||
<RadialGradientBrush x:Key="PurpleGradiant" | ||
Center="0.8,0.5"> | ||
<GradientStop Color="#AD27FF" | ||
Offset="0.25" /> | ||
<GradientStop Color="#4447FE" | ||
Offset="0.75" /> | ||
</RadialGradientBrush> | ||
</ContentPage.Resources> | ||
|
||
<Border x:Name="border" | ||
VerticalOptions="Center" | ||
AutomationId="border" | ||
StrokeThickness="2"> | ||
<Label Text="Hello, World!" /> | ||
<Border.GestureRecognizers> | ||
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/> | ||
</Border.GestureRecognizers> | ||
</Border> | ||
</ContentPage> |
26 changes: 26 additions & 0 deletions
26
src/Controls/samples/Controls.Sample.UITests/Issues/Issue22042.xaml.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,26 @@ | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
using Microsoft.Maui.Graphics; | ||
|
||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 22042, "[Android] Border Stroke GradiantBrush can only switch to another gradiantbrush", PlatformAffected.Android)] | ||
|
||
public partial class Issue22042 : ContentPage | ||
{ | ||
private Brush _gradiantPurpleBrush => Resources.TryGetValue("PurpleGradiant", out object laColor) ? (Brush)laColor : null; | ||
|
||
public Issue22042() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e) | ||
{ | ||
if (border.Stroke == _gradiantPurpleBrush) | ||
border.Stroke = Colors.Red; | ||
else | ||
border.Stroke = _gradiantPurpleBrush; | ||
} | ||
} |
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.AppiumTests.Issues | ||
{ | ||
public class Issue22042 : _IssuesUITest | ||
{ | ||
public Issue22042(TestDevice device) : base(device) | ||
{ | ||
} | ||
|
||
public override string Issue => "[Android] Border Stroke GradiantBrush can only switch to another gradiantbrush"; | ||
|
||
[Test] | ||
public void BorderCollorShouldChange() | ||
{ | ||
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.iOS, TestDevice.Mac, TestDevice.Windows }); | ||
|
||
App.WaitForElement("border"); | ||
|
||
//Applies a gradient | ||
App.Click("border"); | ||
|
||
//Applies a solid color | ||
App.Click("border"); | ||
|
||
VerifyScreenshot(); | ||
} | ||
} | ||
} |
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