fix: capturePage not resolving with hidden windows (#27883)
This commit is contained in:
parent
f6949dd197
commit
d9997c303f
3 changed files with 29 additions and 1 deletions
|
|
@ -1338,6 +1338,22 @@ describe('BrowserWindow module', () => {
|
|||
expect(image.isEmpty()).to.equal(true);
|
||||
});
|
||||
|
||||
it('resolves after the window is hidden', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadFile(path.join(fixtures, 'pages', 'a.html'));
|
||||
await emittedOnce(w, 'ready-to-show');
|
||||
w.show();
|
||||
|
||||
const visibleImage = await w.capturePage();
|
||||
expect(visibleImage.isEmpty()).to.equal(false);
|
||||
|
||||
w.hide();
|
||||
|
||||
const hiddenImage = await w.capturePage();
|
||||
const isEmpty = process.platform !== 'darwin';
|
||||
expect(hiddenImage.isEmpty()).to.equal(isEmpty);
|
||||
});
|
||||
|
||||
it('preserves transparency', async () => {
|
||||
const w = new BrowserWindow({ show: false, transparent: true });
|
||||
w.loadFile(path.join(fixtures, 'pages', 'theme-color.html'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue