Fix UITest screenshot taking on MacCatalyst#27531
Merged
rmarinho merged 16 commits intodotnet:mainfrom Feb 6, 2025
Merged
Conversation
This was referenced Feb 3, 2025
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
albyrock87
commented
Feb 3, 2025
Contributor
|
New macOS snapshots available. I am going to commit the changes. |
jsuarezruiz
suggested changes
Feb 3, 2025
Contributor
jsuarezruiz
left a comment
There was a problem hiding this comment.
Include a condition for macOS to crop off the TitleBar:
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Member
|
/rebase |
665944d to
3b1ede7
Compare
4 tasks
Contributor
|
/azp run |
4 tasks
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
jsuarezruiz
approved these changes
Feb 6, 2025
rmarinho
approved these changes
Feb 6, 2025
This was referenced Feb 12, 2025
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Description of Change
MacCatalyst
VerifyScreenshotnow extracts the window's content instead of the entire screen.I've added an option to include titlebar (for testing purposes).
In the future, we may want to replace constants with the actual title bar height.
In the past the title bar height changed on MacOS (11) so we should be aware of that.
The trick on MacOS may be to look at the Y coordinate of the first maroon-like pixel.
ImageMagickprovides access to pixels colors, but pay attention that night "Night Shift" or "True Tone" may affect the output color, so we may need to verify a given color range.On Windows this is not working and we need to find a better strategy.
So for now we rolled back to constants.
This is the code we used as tentative.
Issues Fixed
Taking screenshot on MacCatalyst in CI and on developer machine is a nightmare: