[Android] BoxView should fall back to BackgroundColor (#3392) fixes #3342

* Add repro for #3342

* [Android] BoxView should fall back to BackgroundColor

* Fix test name

* Remove flaky test
This commit is contained in:
Samantha Houts 2018-08-06 07:22:40 -07:00 коммит произвёл Rui Marinho
Родитель 21b26ac860
Коммит 4f696a3b6d
3 изменённых файлов: 63 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,59 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 3342, "[Android] BoxView BackgroundColor not working on 3.2.0-pre1", PlatformAffected.Android)]
public class Issue3342 : TestContentPage
{
protected override void Init()
{
var instructions = new Label
{
Text = "You should see a green BoxView. You should not see the text that says FAIL."
};
var hiddenLabel = new Label
{
Text = "FAIL"
};
var target = new BoxView
{
HeightRequest = 200,
WidthRequest = 200,
BackgroundColor = Color.Green,
CornerRadius = new CornerRadius(3)
};
var grid = new Grid
{
ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } },
RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }}
};
grid.Children.Add(instructions);
grid.Children.Add(hiddenLabel, 0, 1);
grid.Children.Add(target, 0, 1);
Content = grid;
}
#if UITEST
[Test]
public void Issue3342Test ()
{
RunningApp.Screenshot ("I am at Issue 3342");
//RunningApp.WaitForNoElement (q => q.Marked ("FAIL"));
RunningApp.Screenshot ("I see the green box");
}
#endif
}
}

Просмотреть файл

@ -477,6 +477,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue2837.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue2740.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1939.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3342.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3415.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla56298.cs" />

Просмотреть файл

@ -56,6 +56,9 @@ namespace Xamarin.Forms.Platform.Android
{
Color colorToSet = Element.Color;
if (colorToSet == Color.Default)
colorToSet = Element.BackgroundColor;
if (_backgroundDrawable == null)
_backgroundDrawable = new GradientDrawable();