Skip to content
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

Border has a 1 pixel thickness even when it's thickness property is set to 0 - fix #21197

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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.Issue20156"
Title="Issue20156">
<VerticalStackLayout
Padding="30,0"
BackgroundColor="Red"
Spacing="0">

<Border StrokeThickness="0"
BackgroundColor="Blue"
HeightRequest="100"
StrokeShape="RoundRectangle 0"/>

<Border StrokeThickness="0"
BackgroundColor="Blue"
HeightRequest="100"
StrokeShape="RoundRectangle 0"/>

<Border StrokeThickness="0"
BackgroundColor="Blue"
HeightRequest="100"
StrokeShape="RoundRectangle 0"/>

<Button Text="WaitForStubControl" AutomationId="WaitForStubControl"/>

</VerticalStackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;
namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 20156, "Border has a 1 pixel thickness even when it's thickness property is set to 0", PlatformAffected.All)]

public partial class Issue20156 : ContentPage
{
public Issue20156()
{
InitializeComponent();
}
}
10 changes: 7 additions & 3 deletions src/Controls/src/Core/Border/Border.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,15 @@ protected override void OnPropertyChanged([CallerMemberName] string? propertyNam
base.OnPropertyChanged(propertyName);

if (propertyName == HeightProperty.PropertyName ||
propertyName == WidthProperty.PropertyName ||
propertyName == StrokeShapeProperty.PropertyName)
propertyName == WidthProperty.PropertyName)
{
Handler?.UpdateValue(nameof(IBorderStroke.Shape));
else if (propertyName == StrokeThicknessProperty.PropertyName)
}
else if (propertyName == StrokeThicknessProperty.PropertyName ||
propertyName == StrokeShapeProperty.PropertyName)
{
UpdateStrokeShape();
}
else if (propertyName == StrokeDashArrayProperty.PropertyName)
Handler?.UpdateValue(nameof(IBorderStroke.StrokeDashPattern));
}
Expand Down
23 changes: 23 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue20156.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues;

public class Issue20156 : _IssuesUITest
{
public override string Issue => "Border has a 1 pixel thickness even when it's thickness property is set to 0";

public Issue20156(TestDevice device)
: base(device)
{ }

[Test]
public void BorderShouldHaveNoThickness()
{
_ = App.WaitForElement("WaitForStubControl");

// The test passes if there's no gap between the borders
VerifyScreenshot();
mattleibow marked this conversation as resolved.
Show resolved Hide resolved
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading