Skip to content
Closed
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
4 changes: 2 additions & 2 deletions src/Controls/src/Core/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,12 @@ protected override Size MeasureOverride(double widthConstraint, double heightCon
case Stretch.Fill:
if (!double.IsInfinity(heightConstraint))
{
result.Height = heightConstraint;
result.Height = HeightRequest < 0 ? heightConstraint : HeightRequest;
Copy link
Copy Markdown
Contributor

@MartyIX MartyIX Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is described as "modifying for Android/iOS" but this change affects all platforms, or not?

Copy link
Copy Markdown
Contributor Author

@devanathan-vaithiyanathan devanathan-vaithiyanathan Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartyIX Yes, these changes affect all the platforms. Windows is working properly even when the parent constraint size is returned to the shape, as the framework itself considers the defined size for the native view and returns the proper size for the drawing area. However, Android and iOS determine the size based on this measured value. We have ensured that the UI is now consistently rendered across all platforms

}

if (!double.IsInfinity(widthConstraint))
{
result.Width = widthConstraint;
result.Width = WidthRequest < 0 ? widthConstraint : WidthRequest;
}
break;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue18628.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Microsoft.Maui.Controls.Shapes;

namespace Maui.Controls.Sample.Issues
{

[Issue(IssueTracker.Github, 18628, "[Android/iOS] Rectangle rendering is broken")]
public class Issue18628 : ContentPage
{
public Issue18628()
{
var grid = new Grid
{
WidthRequest = 600,
HeightRequest = 250,
RowDefinitions = new RowDefinitionCollection
{
new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }
}
};

var label = new Label
{
Text = "RectangleWidth Test",
HorizontalOptions = LayoutOptions.Center,
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Start,
HeightRequest = 100,
AutomationId = "Label"
};

grid.Children.Add(label);
Grid.SetRow(label, 0);

var rectangle = new Rectangle
{
Fill = Colors.Red,
AutomationId="Rectangle",
WidthRequest = 10,
VerticalOptions = LayoutOptions.Fill
};

grid.Children.Add(rectangle);
Grid.SetRow(rectangle, 1);

var ellipse = new Ellipse
{
Fill = Colors.Blue,
VerticalOptions = LayoutOptions.Fill,
WidthRequest = 300
};

grid.Children.Add(ellipse);
Grid.SetRow(ellipse, 2);

Content = grid;
}
}
}
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.TestCases.Tests.Issues
{
public class Issue18628 : _IssuesUITest
{
public Issue18628(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Android/iOS] Rectangle rendering is broken";

[Test]
[Category(UITestCategories.Shape)]
public void VerifyRectangleWidth()
{
App.WaitForElement("Label");
VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.