Fix ImageButton not rendering correctly based on its bounds#28309
Conversation
|
Hey there @Shalini-Ashokan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues |
There was a problem hiding this comment.
Super-nit: After #28040, you can convert this to file-scope namespace by CTRL+. in Visual Studio (I believe it's the same in VS Code).
If it is converted, then new files will use file-scope namespaces more and more as people IMO copy old files to create new code.
There was a problem hiding this comment.
Thanks for the suggestion , I have changed the file-scope namespace.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| public void Issue25558VerifyImageButtonAspects() | ||
| { | ||
| App.WaitForElement("imageButton"); | ||
| VerifyScreenshot(); |
There was a problem hiding this comment.
@jsuarezruiz, I have committed the image.
|
|
||
| [Test] | ||
| [Category(UITestCategories.ImageButton)] | ||
| public void Issue25558VerifyImageButtonAspects() |
There was a problem hiding this comment.
This 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 2367
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 2384
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 665
at Microsoft.Maui.TestCases.Tests.Issues.Issue25558.Issue25558VerifyImageButtonAspects() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25558.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.
@jsuarezruiz, I have modified the test to resolve the failing.
|
@jsuarezruiz, The Issue18242Test failure is related to my changes. Previously, the ImageButton without a specified height was not rendering correctly. Shall I commit the newly generated image? |
In that case, yes. |
@jsuarezruiz, I have committed the failure image. |
|
/rebase |
d88c6af to
71b4c79
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
e1fdd77 to
6cadf7d
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
6cadf7d to
8a174ad
Compare
|
/rebase |



Issue Details
The ImageButton image rendered on Android was not adjusting its bounds correctly, leading to improper scaling.
Root Cause
The image button was not rendering based on its bounds value.
Description of Change
In ImageButton Android Handler, set true for SetAdjustViewBounds(), when you enable view bounds adjustment, the ImageView will automatically resize to maintain the image's aspect ratio.
Validated the behavior in the following platforms
Issues Fixed
Fixes #25558
Fixes #14346
Output ScreenShot