Skip to content

Commit

Permalink
Crop off the 3 button nav at the bottom of Android screens.
Browse files Browse the repository at this point in the history
  • Loading branch information
BretJohnson committed Aug 7, 2023
1 parent 5062948 commit 9571d0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Controls/tests/UITests/Tests/UITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,27 @@ public void VerifyScreenshot(string? name = null)

// For Android and iOS, crop off the OS status bar at the top since it's not part of the
// app itself and contains the time, which always changes
int topStatusBarHeight = _testDevice switch
int cropFromTop = _testDevice switch
{
TestDevice.Android => 60,
TestDevice.iOS => 90,
_ => -1,
_ => 0,
};

if (topStatusBarHeight != -1)
// For Android also crop the 3 button nav from the bottom, since it's not part of the
// app itself and the button color can vary (the buttons change clear briefly when tapped)
int cropFromBottom = _testDevice switch
{
TestDevice.Android => 125,
_ => 0,
};

if (cropFromTop > 0 || cropFromBottom > 0)
{
IImageEditor imageEditor = _imageEditorFactory.CreateImageEditor(actualImage);
(int width, int height) = imageEditor.GetSize();

imageEditor.Crop(0, topStatusBarHeight, width, height - topStatusBarHeight);
imageEditor.Crop(0, cropFromTop, width, height - cropFromTop - cropFromBottom);

actualImage = imageEditor.GetUpdatedImage();
}
Expand Down
Binary file modified src/Controls/tests/UITests/snapshots/android/Issue15330Test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9571d0d

Please sign in to comment.