-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Fix ImageHandler Vertical&Horizontal Options with AspectFit
#30936
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
640423b
Fix `ImageHandler` Vertical&Horizontal Options with AspectFit
morning4coffe-dev 908985c
Add testcases screenshots
morning4coffe-dev 7abeb6a
Add comments for added GetDesiredSize override
morning4coffe-dev 77ea7a5
Refactor GetDesiredSize and MapSourceAsync for improved aspect handling
morning4coffe-dev 3d982d1
Adjust GetDesiredSize and MapHeight for different alignment values
morning4coffe-dev 2eaa6f9
Update test case snapshots for `NoScrollbars` and `ShadowsDontRespect…
morning4coffe-dev 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
+100 KB
...ts/snapshots/android/ImageRespectsVerticalAndHorizontalOptionsWithAspectFit.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,26 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 30403, "Image under WinUI does not respect VerticalOptions and HorizontalOptions with AspectFit", PlatformAffected.UWP)] | ||
| public class Issue30403 : TestContentPage | ||
| { | ||
| protected override void Init() | ||
| { | ||
| Title = "Issue 30403"; | ||
|
|
||
| Content = new Grid | ||
| { | ||
| BackgroundColor = Colors.LightGray, | ||
| Children = | ||
| { | ||
| new Image | ||
| { | ||
| AutomationId = "TestImage", | ||
| Source = "dotnet_bot.png", | ||
| Aspect = Aspect.AspectFit, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Binary file added
BIN
+27 KB
....Tests/snapshots/mac/ImageRespectsVerticalAndHorizontalOptionsWithAspectFit.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/Issue30403.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 NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue30403 : _IssuesUITest | ||
| { | ||
| public Issue30403(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "Image under WinUI does not respect VerticalOptions and HorizontalOptions with AspectFit"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Image)] | ||
| public void ImageRespectsVerticalAndHorizontalOptionsWithAspectFit() | ||
| { | ||
| App.WaitForElement("TestImage"); | ||
|
|
||
| // Verify that the image is positioned correctly according to VerticalOptions.Center and HorizontalOptions.Center | ||
| // with AspectFit aspect ratio. The image should appear in the center of the Grid. | ||
| VerifyScreenshot(); | ||
morning4coffe-dev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Binary file added
BIN
+30.8 KB
...ts/snapshots/windows/ImageRespectsVerticalAndHorizontalOptionsWithAspectFit.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 modified
BIN
-5.12 KB
(75%)
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/LoadAndVerifyGif.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 modified
BIN
-68.8 KB
(88%)
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/LoadAndVerifyJpg.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 modified
BIN
-43.5 KB
(46%)
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/LoadAndVerifyPng.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 modified
BIN
-79.8 KB
(32%)
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/LoadAndVerifySvg.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 modified
BIN
-2.25 KB
(94%)
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/NoScrollbarsTest.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 modified
BIN
-10.3 KB
(52%)
...ests/TestCases.WinUI.Tests/snapshots/windows/RadioButtonContentNotRendering.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 modified
BIN
-3.57 KB
(93%)
...ests/TestCases.WinUI.Tests/snapshots/windows/ShadowsDontRespectControlShape.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 modified
BIN
-1.65 KB
(94%)
...ts/windows/VerifyModelItemsObservableCollectionWhenMultipleModePreSelection.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 modified
BIN
-1.66 KB
(94%)
...hots/windows/VerifyModelItemsObservableCollectionWhenSingleModePreSelection.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
+94 KB
....Tests/snapshots/ios/ImageRespectsVerticalAndHorizontalOptionsWithAspectFit.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
Oops, something went wrong.
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.
Could modify a little bit this test? Could you include a StackLayout with 2-3 images?
Leave the current one, but could also validate:
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.
Created a separate issue to create the tests #31686