This commit is contained in:
Родитель
5643a16cb1
Коммит
0932e8c4d5
|
@ -0,0 +1,54 @@
|
|||
using Xamarin.Forms.CustomAttributes;
|
||||
|
||||
#if UITEST
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Issue(IssueTracker.Github, 9951, "Android 10 Setting ThumbColor on Switch causes a square block", PlatformAffected.Android)]
|
||||
#if UITEST
|
||||
[NUnit.Framework.Category(UITestCategories.ManualReview)]
|
||||
#endif
|
||||
public class Issue9951 : TestContentPage
|
||||
{
|
||||
private const string switchId = "switch";
|
||||
|
||||
public Issue9951()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
var stackLayout = new StackLayout();
|
||||
|
||||
stackLayout.Children.Add(new Switch()
|
||||
{
|
||||
ThumbColor = Color.Red,
|
||||
OnColor = Color.Yellow,
|
||||
AutomationId = switchId
|
||||
});
|
||||
|
||||
Content = stackLayout;
|
||||
}
|
||||
|
||||
#if UITEST && __ANDROID__
|
||||
[Test]
|
||||
public async Task SwitchColorTest()
|
||||
{
|
||||
RunningApp.WaitForElement(switchId);
|
||||
|
||||
RunningApp.Screenshot("Initial switch state");
|
||||
|
||||
RunningApp.Tap(switchId);
|
||||
|
||||
//Delay so that the switch toggling is finished
|
||||
await Task.Delay(200);
|
||||
|
||||
RunningApp.Screenshot("Toggled switch state");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1337,6 +1337,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue9417.xaml.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue8272.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue8964.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue9951.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
}
|
||||
else
|
||||
{
|
||||
Control.TrackDrawable?.SetColorFilter(Element.OnColor, FilterMode.Multiply);
|
||||
Control.TrackDrawable?.SetColorFilter(Element.OnColor, FilterMode.SrcAtop);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -150,7 +150,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
|
||||
if (Element.ThumbColor != Color.Default)
|
||||
{
|
||||
Control.ThumbDrawable?.SetColorFilter(Element.ThumbColor, FilterMode.Multiply);
|
||||
Control.ThumbDrawable?.SetColorFilter(Element.ThumbColor, FilterMode.SrcAtop);
|
||||
_changedThumbColor = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
if (Forms.SdkInt >= BuildVersionCodes.JellyBean)
|
||||
{
|
||||
Control.TrackDrawable?.SetColorFilter(Element.OnColor.ToAndroid(), FilterMode.Multiply);
|
||||
Control.TrackDrawable?.SetColorFilter(Element.OnColor.ToAndroid(), FilterMode.SrcAtop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
if (Element.ThumbColor != Color.Default)
|
||||
{
|
||||
Control.ThumbDrawable.SetColorFilter(Element.ThumbColor, FilterMode.Multiply);
|
||||
Control.ThumbDrawable.SetColorFilter(Element.ThumbColor, FilterMode.SrcAtop);
|
||||
_changedThumbColor = true;
|
||||
}
|
||||
else
|
||||
|
@ -150,7 +150,8 @@ namespace Xamarin.Forms.Platform.Android
|
|||
_changedThumbColor = false;
|
||||
}
|
||||
}
|
||||
Control.ThumbDrawable.SetColorFilter(Element.ThumbColor, FilterMode.Multiply);
|
||||
|
||||
Control.ThumbDrawable.SetColorFilter(Element.ThumbColor, FilterMode.SrcAtop);
|
||||
}
|
||||
|
||||
void HandleToggled(object sender, EventArgs e)
|
||||
|
|
Загрузка…
Ссылка в новой задаче