[MM-58001] Fix an issue where the window position has a decimal number (#3017)
* [MM-58001] Fix an issue where the window position has a decimal number * I accidentally a log
This commit is contained in:
@@ -166,6 +166,22 @@ describe('main/app/utils', () => {
|
|||||||
resizeScreen(browserWindow);
|
resizeScreen(browserWindow);
|
||||||
expect(browserWindow.setPosition).toHaveBeenCalledWith(690, 410);
|
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', () => {
|
describe('migrateMacAppStore', () => {
|
||||||
|
@@ -155,8 +155,8 @@ function getNewWindowPosition(browserWindow: BrowserWindow) {
|
|||||||
const mainWindowPosition = mainWindow.getPosition();
|
const mainWindowPosition = mainWindow.getPosition();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
mainWindowPosition[0] + ((mainWindowSize[0] - newWindowSize[0]) / 2),
|
Math.floor(mainWindowPosition[0] + ((mainWindowSize[0] - newWindowSize[0]) / 2)),
|
||||||
mainWindowPosition[1] + ((mainWindowSize[1] - newWindowSize[1]) / 2),
|
Math.floor(mainWindowPosition[1] + ((mainWindowSize[1] - newWindowSize[1]) / 2)),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user