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

Page cannot scroll to the bottom while using RoundRectangle #27451

Merged
merged 7 commits into from
Feb 13, 2025
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
8 changes: 4 additions & 4 deletions src/Controls/src/Core/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,14 @@ protected override Size MeasureOverride(double widthConstraint, double heightCon
break;

case Stretch.Fill:
if (!double.IsInfinity(heightConstraint))
if (!double.IsInfinity(heightConstraint) || HeightRequest > 0)
{
result.Height = heightConstraint;
result.Height = HeightRequest < 0 ? heightConstraint : HeightRequest;
}

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

Expand Down
106 changes: 106 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue26877.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using Microsoft.Maui.Controls.Shapes;

namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 26877, "The iOS platform page cannot scroll to the bottom", PlatformAffected.iOS)]
public class Issue26877 : ContentPage
{
public Issue26877()
{
var scrollView = new ScrollView
{
BackgroundColor = Colors.AliceBlue
};

var stackLayout = new StackLayout();
stackLayout.Children.Add(new Label
{
Text = "ScrollToBottomPage",
TextColor = Colors.Black,
AutomationId = "ScrollToBottomPage"
});

stackLayout.Children.Add(new RoundRectangle
{
BackgroundColor = Colors.Red,
HeightRequest = 100,
});

stackLayout.Children.Add(new Rectangle
{
BackgroundColor = Colors.Azure,
HeightRequest = 100
});

stackLayout.Children.Add(new Ellipse
{
BackgroundColor = Colors.BlanchedAlmond,
HeightRequest = 100
});

stackLayout.Children.Add(new RoundRectangle
{
BackgroundColor = Colors.Red,
HeightRequest = 100,
});

stackLayout.Children.Add(new Rectangle
{
BackgroundColor = Colors.Azure,
HeightRequest = 100
});

stackLayout.Children.Add(new Ellipse
{
BackgroundColor = Colors.BlanchedAlmond,
HeightRequest = 100
});

stackLayout.Children.Add(new RoundRectangle
{
BackgroundColor = Colors.Red,
HeightRequest = 100,
});

stackLayout.Children.Add(new Rectangle
{
BackgroundColor = Colors.Azure,
HeightRequest = 100
});

stackLayout.Children.Add(new Ellipse
{
BackgroundColor = Colors.BlanchedAlmond,
HeightRequest = 100
});

stackLayout.Children.Add(new RoundRectangle
{
BackgroundColor = Colors.Red,
HeightRequest = 100,
});

stackLayout.Children.Add(new Rectangle
{
BackgroundColor = Colors.Azure,
HeightRequest = 100
});

stackLayout.Children.Add(new Ellipse
{
BackgroundColor = Colors.BlanchedAlmond,
HeightRequest = 100
});

stackLayout.Children.Add(new Label
{
Text = "2. The test passes if you were able to scroll down to this message.",
TextColor = Colors.Black,
AutomationId = "Label"
});

scrollView.Content = stackLayout;
Content = scrollView;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue26877 : _IssuesUITest
{
public Issue26877(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "The iOS platform page cannot scroll to the bottom";

[Test]
[Category(UITestCategories.Shape)]
[Category(UITestCategories.ScrollView)]
public void ScrollToBottom()
{
App.WaitForElement("ScrollToBottomPage");
App.ScrollTo("Label");
App.WaitForElement("Label");
}
}
}
Loading