-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed BoxView in AbsoluteLayout did not return to its default AutoSize for Height and Width after reset #31648
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
Open
Dhivya-SF4094
wants to merge
8
commits into
dotnet:main
Choose a base branch
from
Dhivya-SF4094:fix-31496
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
860e7a3
Fixed BoxView in AbsoluteLayout does not return to default AutoSize
Dhivya-SF4094 c358da2
Removed unwanted lines
Dhivya-SF4094 d31eaba
Added snapshots
Dhivya-SF4094 ee21ac5
Merge branch 'dotnet:main' into fix-31496
Dhivya-SF4094 b571b0a
Fixed BoxView in AbsoluteLayout does not return to default AutoSize
Dhivya-SF4094 dec7a08
Removed unwanted lines
Dhivya-SF4094 b511d1d
Added snapshots
Dhivya-SF4094 181a05a
Merge branch 'fix-31496' of https://github.com/Dhivya-SF4094/maui int…
Dhivya-SF4094 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+32.8 KB
...oid.Tests/snapshots/android/BoxViewInAbsoluteLayoutReturnsToDefaultAutoSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using Microsoft.Maui.Layouts; | ||
|
||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[Issue(IssueTracker.Github, 31496, "BoxView in AbsoluteLayout does not return to default AutoSize", PlatformAffected.iOS | PlatformAffected.macOS)] | ||
public class Issue31496 : ContentPage | ||
{ | ||
AbsoluteLayout absoluteLayout; | ||
BoxView boxView; | ||
readonly Rect defaultBounds = new Rect(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize); | ||
|
||
public Issue31496() | ||
{ | ||
absoluteLayout = new AbsoluteLayout | ||
{ | ||
BackgroundColor = Colors.LightGray | ||
}; | ||
|
||
var label = new Label | ||
{ | ||
Text = "The test passes if a BoxView is not visible in view.", | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(label, new Rect(0.5, 0.80, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); | ||
AbsoluteLayout.SetLayoutFlags(label, AbsoluteLayoutFlags.PositionProportional); | ||
|
||
boxView = new BoxView | ||
{ | ||
Color = Colors.Green | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(boxView, new Rect(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); | ||
AbsoluteLayout.SetLayoutFlags(boxView, AbsoluteLayoutFlags.None); | ||
|
||
var changeBoundsButton = new Button | ||
{ | ||
Text = "Change Bounds", | ||
AutomationId = "Issue31496ChangeBoundsButton" | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(changeBoundsButton, new Rect(0.5, 0.90, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); | ||
AbsoluteLayout.SetLayoutFlags(changeBoundsButton, AbsoluteLayoutFlags.PositionProportional); | ||
changeBoundsButton.Clicked += OnChangeBoundsClicked; | ||
|
||
var resetBoundsButton = new Button | ||
{ | ||
Text = "Reset Bounds", | ||
AutomationId = "Issue31496ResetButton" | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(resetBoundsButton, new Rect(0.5, 0.99, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); | ||
AbsoluteLayout.SetLayoutFlags(resetBoundsButton, AbsoluteLayoutFlags.PositionProportional); | ||
resetBoundsButton.Clicked += OnResetBoundsClicked; | ||
|
||
absoluteLayout.Children.Add(boxView); | ||
absoluteLayout.Children.Add(label); | ||
absoluteLayout.Children.Add(changeBoundsButton); | ||
absoluteLayout.Children.Add(resetBoundsButton); | ||
|
||
Content = absoluteLayout; | ||
} | ||
|
||
void OnChangeBoundsClicked(object sender, EventArgs e) | ||
{ | ||
AbsoluteLayout.SetLayoutBounds(boxView, new Rect(50, 50, 100, 100)); | ||
} | ||
|
||
void OnResetBoundsClicked(object sender, EventArgs e) | ||
{ | ||
AbsoluteLayout.SetLayoutBounds(boxView, defaultBounds); | ||
} | ||
} |
Binary file added
BIN
+16.7 KB
...ses.Mac.Tests/snapshots/mac/BoxViewInAbsoluteLayoutReturnsToDefaultAutoSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31496.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
||
public class Issue31496 : _IssuesUITest | ||
{ | ||
public Issue31496(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
public override string Issue => "BoxView in AbsoluteLayout does not return to default AutoSize"; | ||
|
||
[Test] | ||
[Category(UITestCategories.Layout)] | ||
public void BoxViewInAbsoluteLayoutReturnsToDefaultAutoSize() | ||
{ | ||
App.WaitForElement("Issue31496ChangeBoundsButton"); | ||
App.Tap("Issue31496ChangeBoundsButton"); | ||
App.WaitForElement("Issue31496ResetButton"); | ||
App.Tap("Issue31496ResetButton"); | ||
VerifyScreenshot(); | ||
} | ||
} |
Binary file added
BIN
+10.2 KB
...nUI.Tests/snapshots/windows/BoxViewInAbsoluteLayoutReturnsToDefaultAutoSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.5 KB
...ses.iOS.Tests/snapshots/ios/BoxViewInAbsoluteLayoutReturnsToDefaultAutoSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is causing some failing tests on iOS and Mac.

Could you take a look?
Example:

Shape_Polygon_Pentagon
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsuarezruiz,
The test case Line_StrokeColor_Thickness passed with my fix.
The following four test cases failed both with and without my fix. So failure is not related to my fix.
I have ensured with net 10 branch and test fails in net 10 also.
For example: