There was a case as described in the ticket below where a user could get the window to display off the screen. This was due to a flaw in isInsideRectangle where we weren't checking the bounds correctly (we were only checking that it was inside from the top-left corner, which is fine in single-monitor setups, but not multi-monitor). Additionally, I had expected getMatchingScreen to return false if it doesn't find one, but it always just gets the primary screen in the worse case.
This PR fixes and adds tests for isInsideRectangle, as well removes the null check for getMatchingScreen
Summary
There was a case as described in the ticket below where a user could get the window to display off the screen. This was due to a flaw in
isInsideRectangle
where we weren't checking the bounds correctly (we were only checking that it was inside from the top-left corner, which is fine in single-monitor setups, but not multi-monitor). Additionally, I had expectedgetMatchingScreen
to returnfalse
if it doesn't find one, but it always just gets the primary screen in the worse case.This PR fixes and adds tests for
isInsideRectangle
, as well removes the null check forgetMatchingScreen
Ticket Link
https://mattermost.atlassian.net/browse/MM-59492 Closes https://github.com/mattermost/desktop/issues/3087