fix: maximized window bounds when toggle setResizable (#40503)

This commit is contained in:
Tomasz 2023-11-22 07:21:18 +01:00 committed by GitHub
parent 2029224a84
commit 3340bc1bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 4 deletions

View file

@ -5091,6 +5091,55 @@ describe('BrowserWindow module', () => {
w.setContentSize(10, 10);
expectBoundsEqual(w.getContentSize(), [10, 10]);
});
ifit(process.platform === 'win32')('do not change window with frame bounds when maximized', () => {
const w = new BrowserWindow({
show: true,
frame: true,
thickFrame: true
});
expect(w.isResizable()).to.be.true('resizable');
w.maximize();
expect(w.isMaximized()).to.be.true('maximized');
const bounds = w.getBounds();
w.setResizable(false);
expectBoundsEqual(w.getBounds(), bounds);
w.setResizable(true);
expectBoundsEqual(w.getBounds(), bounds);
});
ifit(process.platform === 'win32')('do not change window without frame bounds when maximized', () => {
const w = new BrowserWindow({
show: true,
frame: false,
thickFrame: true
});
expect(w.isResizable()).to.be.true('resizable');
w.maximize();
expect(w.isMaximized()).to.be.true('maximized');
const bounds = w.getBounds();
w.setResizable(false);
expectBoundsEqual(w.getBounds(), bounds);
w.setResizable(true);
expectBoundsEqual(w.getBounds(), bounds);
});
ifit(process.platform === 'win32')('do not change window transparent without frame bounds when maximized', () => {
const w = new BrowserWindow({
show: true,
frame: false,
thickFrame: true,
transparent: true
});
expect(w.isResizable()).to.be.true('resizable');
w.maximize();
expect(w.isMaximized()).to.be.true('maximized');
const bounds = w.getBounds();
w.setResizable(false);
expectBoundsEqual(w.getBounds(), bounds);
w.setResizable(true);
expectBoundsEqual(w.getBounds(), bounds);
});
});
describe('loading main frame state', () => {