feat: customize border radius of Views (#42320)
* feat: add View#setBorderRadius test: initial setBorderRadius tests fix: robustly set border radius chore: add PAUSE_CAPTURE_TESTS for easier screencap dev feat: add view border radius support test: view border radius refactor: cleanup view code * maybe delay capture to fix tests? * refactor: retry screen captures in an attempt to fix flakiness * refactor: ScreenCapture constructor no longer async * increase screen capture timeout, feels a little short * refactor: move rounded rect util into chromium_src * skip some capture tests on mas
This commit is contained in:
parent
cbd11bb605
commit
778d3098a0
15 changed files with 261 additions and 90 deletions
|
@ -1,10 +1,9 @@
|
|||
import { BrowserWindow, screen } from 'electron';
|
||||
import { expect, assert } from 'chai';
|
||||
import { HexColors, ScreenCapture } from './lib/screen-helpers';
|
||||
import { HexColors, ScreenCapture, hasCapturableScreen } from './lib/screen-helpers';
|
||||
import { ifit, listen } from './lib/spec-helpers';
|
||||
import { closeAllWindows } from './lib/window-helpers';
|
||||
import { once } from 'node:events';
|
||||
import { setTimeout as setTimeoutAsync } from 'node:timers/promises';
|
||||
import * as http from 'node:http';
|
||||
|
||||
describe('webContents.setWindowOpenHandler', () => {
|
||||
|
@ -201,8 +200,7 @@ describe('webContents.setWindowOpenHandler', () => {
|
|||
expect(await browserWindow.webContents.executeJavaScript('42')).to.equal(42);
|
||||
});
|
||||
|
||||
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
|
||||
ifit(process.platform === 'darwin' && process.arch === 'x64')('should not make child window background transparent', async () => {
|
||||
ifit(hasCapturableScreen())('should not make child window background transparent', async () => {
|
||||
browserWindow.webContents.setWindowOpenHandler(() => ({ action: 'allow' }));
|
||||
const didCreateWindow = once(browserWindow.webContents, 'did-create-window');
|
||||
browserWindow.webContents.executeJavaScript("window.open('about:blank') && true");
|
||||
|
@ -210,8 +208,7 @@ describe('webContents.setWindowOpenHandler', () => {
|
|||
const display = screen.getPrimaryDisplay();
|
||||
childWindow.setBounds(display.bounds);
|
||||
await childWindow.webContents.executeJavaScript("const meta = document.createElement('meta'); meta.name = 'color-scheme'; meta.content = 'dark'; document.head.appendChild(meta); true;");
|
||||
await setTimeoutAsync(1000);
|
||||
const screenCapture = await ScreenCapture.createForDisplay(display);
|
||||
const screenCapture = new ScreenCapture(display);
|
||||
// color-scheme is set to dark so background should not be white
|
||||
await screenCapture.expectColorAtCenterDoesNotMatch(HexColors.WHITE);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue