fix: handle async nature of [NSWindow -toggleFullScreen] (#25470)
This commit is contained in:
parent
7063b5ef2c
commit
503d24a473
7 changed files with 127 additions and 17 deletions
|
@ -8,7 +8,7 @@ import * as http from 'http';
|
|||
import { AddressInfo } from 'net';
|
||||
import { app, BrowserWindow, BrowserView, ipcMain, OnBeforeSendHeadersListenerDetails, protocol, screen, webContents, session, WebContents, BrowserWindowConstructorOptions } from 'electron/main';
|
||||
|
||||
import { emittedOnce, emittedUntil } from './events-helpers';
|
||||
import { emittedOnce, emittedUntil, emittedNTimes } from './events-helpers';
|
||||
import { ifit, ifdescribe, defer, delay } from './spec-helpers';
|
||||
import { closeWindow, closeAllWindows } from './window-helpers';
|
||||
|
||||
|
@ -4070,6 +4070,42 @@ describe('BrowserWindow module', () => {
|
|||
expect(w.isFullScreen()).to.be.false('isFullScreen');
|
||||
});
|
||||
|
||||
it('handles several transitions starting with fullscreen', async () => {
|
||||
const w = new BrowserWindow({ fullscreen: true, show: true });
|
||||
|
||||
expect(w.isFullScreen()).to.be.true('not fullscreen');
|
||||
|
||||
w.setFullScreen(false);
|
||||
w.setFullScreen(true);
|
||||
|
||||
const enterFullScreen = emittedNTimes(w, 'enter-full-screen', 2);
|
||||
await enterFullScreen;
|
||||
|
||||
expect(w.isFullScreen()).to.be.true('not fullscreen');
|
||||
|
||||
await delay();
|
||||
const leaveFullScreen = emittedOnce(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
await leaveFullScreen;
|
||||
|
||||
expect(w.isFullScreen()).to.be.false('is fullscreen');
|
||||
});
|
||||
|
||||
it('handles several transitions in close proximity', async () => {
|
||||
const w = new BrowserWindow();
|
||||
|
||||
expect(w.isFullScreen()).to.be.false('is fullscreen');
|
||||
|
||||
w.setFullScreen(true);
|
||||
w.setFullScreen(false);
|
||||
w.setFullScreen(true);
|
||||
|
||||
const enterFullScreen = emittedNTimes(w, 'enter-full-screen', 2);
|
||||
await enterFullScreen;
|
||||
|
||||
expect(w.isFullScreen()).to.be.true('not fullscreen');
|
||||
});
|
||||
|
||||
it('does not crash when exiting simpleFullScreen (properties)', async () => {
|
||||
const w = new BrowserWindow();
|
||||
w.setSimpleFullScreen(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue