* [MM-58001] Fix an issue where the window position has a decimal number
* I accidentally a log
(cherry picked from commit a6ce24d184
)
Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
parent
7fc55f5759
commit
fc5a11d84a
|
@ -166,6 +166,22 @@ describe('main/app/utils', () => {
|
|||
resizeScreen(browserWindow);
|
||||
expect(browserWindow.setPosition).toHaveBeenCalledWith(690, 410);
|
||||
});
|
||||
|
||||
it('should never return non-integer value', () => {
|
||||
MainWindow.get.mockReturnValue({
|
||||
getPosition: () => [450, 350],
|
||||
getSize: () => [1280, 720],
|
||||
});
|
||||
const browserWindow = {
|
||||
getPosition: () => [450, 350],
|
||||
getSize: () => [1281, 721],
|
||||
setPosition: jest.fn(),
|
||||
center: jest.fn(),
|
||||
once: jest.fn(),
|
||||
};
|
||||
resizeScreen(browserWindow);
|
||||
expect(browserWindow.setPosition).toHaveBeenCalledWith(449, 349);
|
||||
});
|
||||
});
|
||||
|
||||
describe('migrateMacAppStore', () => {
|
||||
|
|
|
@ -155,8 +155,8 @@ function getNewWindowPosition(browserWindow: BrowserWindow) {
|
|||
const mainWindowPosition = mainWindow.getPosition();
|
||||
|
||||
return [
|
||||
mainWindowPosition[0] + ((mainWindowSize[0] - newWindowSize[0]) / 2),
|
||||
mainWindowPosition[1] + ((mainWindowSize[1] - newWindowSize[1]) / 2),
|
||||
Math.floor(mainWindowPosition[0] + ((mainWindowSize[0] - newWindowSize[0]) / 2)),
|
||||
Math.floor(mainWindowPosition[1] + ((mainWindowSize[1] - newWindowSize[1]) / 2)),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue