|
@@ -1452,6 +1452,17 @@ describe('BrowserWindow module', () => {
|
|
|
expect(hiddenImage.isEmpty()).to.equal(isEmpty);
|
|
|
});
|
|
|
|
|
|
+ it('resolves after the window is hidden and capturer count is non-zero', async () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ w.webContents.setBackgroundThrottling(false);
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'a.html'));
|
|
|
+ await emittedOnce(w, 'ready-to-show');
|
|
|
+
|
|
|
+ w.webContents.incrementCapturerCount();
|
|
|
+ const image = await w.capturePage();
|
|
|
+ expect(image.isEmpty()).to.equal(false);
|
|
|
+ });
|
|
|
+
|
|
|
it('preserves transparency', async () => {
|
|
|
const w = new BrowserWindow({ show: false, transparent: true });
|
|
|
w.loadFile(path.join(fixtures, 'pages', 'theme-color.html'));
|
|
@@ -1465,6 +1476,14 @@ describe('BrowserWindow module', () => {
|
|
|
// Values can be 0,2,3,4, or 6. We want 6, which is RGB + Alpha
|
|
|
expect(imgBuffer[25]).to.equal(6);
|
|
|
});
|
|
|
+
|
|
|
+ it('should increase the capturer count', () => {
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ w.webContents.incrementCapturerCount();
|
|
|
+ expect(w.webContents.isBeingCaptured()).to.be.true();
|
|
|
+ w.webContents.decrementCapturerCount();
|
|
|
+ expect(w.webContents.isBeingCaptured()).to.be.false();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
describe('BrowserWindow.setProgressBar(progress)', () => {
|