|
@@ -1228,6 +1228,7 @@ describe('BrowserWindow module', () => {
|
|
|
await resize;
|
|
|
expectBoundsEqual(w.getNormalBounds(), w.getBounds());
|
|
|
});
|
|
|
+
|
|
|
it('checks normal bounds after move', async () => {
|
|
|
const pos = [10, 10];
|
|
|
const move = emittedOnce(w, 'move');
|
|
@@ -1246,6 +1247,51 @@ describe('BrowserWindow module', () => {
|
|
|
await maximize;
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
+
|
|
|
+ it('updates normal bounds after resize and maximize', async () => {
|
|
|
+ const size = [300, 400];
|
|
|
+ const resize = emittedOnce(w, 'resize');
|
|
|
+ w.setSize(size[0], size[1]);
|
|
|
+ await resize;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const maximize = emittedOnce(w, 'maximize');
|
|
|
+ w.maximize();
|
|
|
+ await maximize;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('updates normal bounds after move and maximize', async () => {
|
|
|
+ const pos = [10, 10];
|
|
|
+ const move = emittedOnce(w, 'move');
|
|
|
+ w.setPosition(pos[0], pos[1]);
|
|
|
+ await move;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const maximize = emittedOnce(w, 'maximize');
|
|
|
+ w.maximize();
|
|
|
+ await maximize;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
it('checks normal bounds when unmaximized', async () => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('maximize', () => {
|
|
@@ -1257,6 +1303,7 @@ describe('BrowserWindow module', () => {
|
|
|
await unmaximize;
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
+
|
|
|
it('does not change size for a frameless window with min size', async () => {
|
|
|
w.destroy();
|
|
|
w = new BrowserWindow({
|
|
@@ -1277,6 +1324,7 @@ describe('BrowserWindow module', () => {
|
|
|
await unmaximize;
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
+
|
|
|
it('correctly checks transparent window maximization state', async () => {
|
|
|
w.destroy();
|
|
|
w = new BrowserWindow({
|
|
@@ -1296,6 +1344,7 @@ describe('BrowserWindow module', () => {
|
|
|
await unmaximize;
|
|
|
expect(w.isMaximized()).to.equal(false);
|
|
|
});
|
|
|
+
|
|
|
it('returns the correct value for windows with an aspect ratio', async () => {
|
|
|
w.destroy();
|
|
|
w = new BrowserWindow({
|
|
@@ -1325,6 +1374,41 @@ describe('BrowserWindow module', () => {
|
|
|
await minimize;
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
+
|
|
|
+ it('updates normal bounds after move and minimize', async () => {
|
|
|
+ const pos = [10, 10];
|
|
|
+ const move = emittedOnce(w, 'move');
|
|
|
+ w.setPosition(pos[0], pos[1]);
|
|
|
+ await move;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const minimize = emittedOnce(w, 'minimize');
|
|
|
+ w.minimize();
|
|
|
+ await minimize;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+
|
|
|
+ expect(original).to.deep.equal(normal);
|
|
|
+ expectBoundsEqual(normal, w.getBounds());
|
|
|
+ });
|
|
|
+
|
|
|
+ it('updates normal bounds after resize and minimize', async () => {
|
|
|
+ const size = [300, 400];
|
|
|
+ const resize = emittedOnce(w, 'resize');
|
|
|
+ w.setSize(size[0], size[1]);
|
|
|
+ await resize;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const minimize = emittedOnce(w, 'minimize');
|
|
|
+ w.minimize();
|
|
|
+ await minimize;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+
|
|
|
+ expect(original).to.deep.equal(normal);
|
|
|
+ expectBoundsEqual(normal, w.getBounds());
|
|
|
+ });
|
|
|
+
|
|
|
it('checks normal bounds when restored', async () => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('minimize', () => {
|
|
@@ -1336,6 +1420,7 @@ describe('BrowserWindow module', () => {
|
|
|
await restore;
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
+
|
|
|
it('does not change size for a frameless window with min size', async () => {
|
|
|
w.destroy();
|
|
|
w = new BrowserWindow({
|
|
@@ -1381,6 +1466,50 @@ describe('BrowserWindow module', () => {
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
|
|
|
+ it('updates normal bounds after resize and fullscreen', async () => {
|
|
|
+ const size = [300, 400];
|
|
|
+ const resize = emittedOnce(w, 'resize');
|
|
|
+ w.setSize(size[0], size[1]);
|
|
|
+ await resize;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const fsc = emittedOnce(w, 'enter-full-screen');
|
|
|
+ w.fullScreen = true;
|
|
|
+ await fsc;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('updates normal bounds after move and fullscreen', async () => {
|
|
|
+ const pos = [10, 10];
|
|
|
+ const move = emittedOnce(w, 'move');
|
|
|
+ w.setPosition(pos[0], pos[1]);
|
|
|
+ await move;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const fsc = emittedOnce(w, 'enter-full-screen');
|
|
|
+ w.fullScreen = true;
|
|
|
+ await fsc;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
it('checks normal bounds when unfullscreen\'ed', async () => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.once('enter-full-screen', () => {
|
|
@@ -1418,6 +1547,50 @@ describe('BrowserWindow module', () => {
|
|
|
expectBoundsEqual(w.getNormalBounds(), bounds);
|
|
|
});
|
|
|
|
|
|
+ it('updates normal bounds after resize and fullscreen', async () => {
|
|
|
+ const size = [300, 400];
|
|
|
+ const resize = emittedOnce(w, 'resize');
|
|
|
+ w.setSize(size[0], size[1]);
|
|
|
+ await resize;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const fsc = emittedOnce(w, 'enter-full-screen');
|
|
|
+ w.setFullScreen(true);
|
|
|
+ await fsc;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
+ it('updates normal bounds after move and fullscreen', async () => {
|
|
|
+ const pos = [10, 10];
|
|
|
+ const move = emittedOnce(w, 'move');
|
|
|
+ w.setPosition(pos[0], pos[1]);
|
|
|
+ await move;
|
|
|
+ const original = w.getBounds();
|
|
|
+
|
|
|
+ const fsc = emittedOnce(w, 'enter-full-screen');
|
|
|
+ w.setFullScreen(true);
|
|
|
+ await fsc;
|
|
|
+
|
|
|
+ const normal = w.getNormalBounds();
|
|
|
+ const bounds = w.getBounds();
|
|
|
+
|
|
|
+ expect(normal).to.deep.equal(original);
|
|
|
+ expect(normal).to.not.deep.equal(bounds);
|
|
|
+
|
|
|
+ const close = emittedOnce(w, 'close');
|
|
|
+ w.close();
|
|
|
+ await close;
|
|
|
+ });
|
|
|
+
|
|
|
it('checks normal bounds when unfullscreen\'ed', async () => {
|
|
|
const bounds = w.getBounds();
|
|
|
w.show();
|