[Android/iOS] Fix Rectangle Width broken#27280
[Android/iOS] Fix Rectangle Width broken#27280devanathan-vaithiyanathan wants to merge 15 commits intodotnet:mainfrom
Conversation
…sLayout is set for Tablet but not on mobile devices (dotnet#26152)" This reverts commit 0ddc794.
…msLayout is set for Tablet but not on mobile devices (dotnet#26152)" This reverts commit 4b9074c.
|
Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
@dotnet-policy-service terminate |
|
@dotnet-policy-service agree company="Syncfusion, Inc." |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| if (!double.IsInfinity(heightConstraint)) | ||
| { | ||
| result.Height = heightConstraint; | ||
| result.Height = HeightRequest < 0 ? heightConstraint : HeightRequest; |
There was a problem hiding this comment.
The PR is described as "modifying for Android/iOS" but this change affects all platforms, or not?
There was a problem hiding this comment.
@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
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This reverts commit b561219.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| [Category(UITestCategories.Shape)] | ||
| public void VerifyRectangleWidth() | ||
| { | ||
| App.WaitForElement("Rectangle"); |
There was a problem hiding this comment.
The test is failing on Windows:
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2311
at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2326
at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 663
at Microsoft.Maui.TestCases.Tests.Issues.Issue18628.VerifyRectangleWidth() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18628.cs:line 19
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
There was a problem hiding this comment.
Thanks for the suggestion, I have modified the test to resolve the issue.
|
/azp run |
|
/rebase |
|
This PR changes are included in the PR #27451 . Hence closing this PR |
Root Cause
The issue occurs in the Rectangle control, where in the Stretch.Fill case, widthConstraint and heightConstraint are directly assigned to result.Width and result.Height without considering WidthRequest and HeightRequest
Description of Change
Updated the Stretch.Fill logic in Shape.cs to apply the constraints (widthConstraint and heightConstraint) when WidthRequest and HeightRequest are less than 0; otherwise, it uses the specified WidthRequest and HeightRequest.
Issues Fixed
Fixes #18628
Tested the behavior in the following platforms.
Output Screenshot