Skip to content

Commit

Permalink
Fix Frame offsets inner content view by 1pt (#24582)
Browse files Browse the repository at this point in the history
* fix added

* UI test added

* test case platform affected changes added

* test case changes added

* UI test changes added

* script file method name updated

* ui test changes added

* script file platform condition added

* output snapshots images added

* ui test file changes added

* Fix Shell title update issue

* images added for all platform

* changes reverted

* fix added

* UI test added

* test case platform affected changes added

* test case changes added

* UI test changes added

* script file method name updated

* ui test changes added

* script file platform condition added

* output snapshots images added

* ui test file changes added

* Fix Shell title update issue

* images added for all platform

* changes reverted

* image added

* image added
  • Loading branch information
devanathan-vaithiyanathan authored Sep 25, 2024
1 parent 68524c8 commit 3ef2d92
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Controls/src/Core/Frame/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ IShadow IView.Shadow
Size ICrossPlatformLayout.CrossPlatformArrange(Graphics.Rect bounds)
{
#if !WINDOWS
bounds = bounds.Inset(((IBorderElement)this).BorderWidth); // Windows' implementation would cause an incorrect double-counting of the inset
if (BorderColor is not null)
bounds = bounds.Inset(((IBorderElement)this).BorderWidth); // Windows' implementation would cause an incorrect double-counting of the inset
#endif
this.ArrangeContent(bounds);
return bounds.Size;
Expand All @@ -121,7 +122,8 @@ Size ICrossPlatformLayout.CrossPlatformMeasure(double widthConstraint, double he
{
var inset = Padding;
#if !WINDOWS
inset += ((IBorderElement)this).BorderWidth; // Windows' implementation would cause an incorrect double-counting of the inset
if (BorderColor is not null)
inset += ((IBorderElement)this).BorderWidth; // Windows' implementation would cause an incorrect double-counting of the inset
#endif
return this.MeasureContent(inset, widthConstraint, heightConstraint);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23333.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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.Issue23333">

<VerticalStackLayout>
<Label Text="Frame With Image" AutomationId="FrameWithImage" />
<Frame CornerRadius="100"
Margin="10"
VerticalOptions="Start"
HorizontalOptions="Start"
HeightRequest="200"
WidthRequest="200"
IsClippedToBounds="True"
BackgroundColor="Red">
<Frame.Content>
<Image Source="dotnet_bot.png"
Background="Tan" />
</Frame.Content>
</Frame>
</VerticalStackLayout>

</ContentPage>
15 changes: 15 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23333.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 23333, "Frame offsets inner content view by 1pt", PlatformAffected.Android | PlatformAffected.iOS | PlatformAffected.macOS)]
public partial class Issue23333 : ContentPage
{
public Issue23333()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#if !MACCATALYST
using NUnit.Framework;
using NUnit.Framework.Legacy;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue23333 : _IssuesUITest
{
public override string Issue => "Frame offsets inner content view by 1pt";

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

[Test]
[Category(UITestCategories.Frame)]
public void ValidateFrameOffsets()
{
App.WaitForElement("FrameWithImage");
VerifyScreenshot();
}
}
}
#endif
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.

0 comments on commit 3ef2d92

Please sign in to comment.