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
|
@ -6510,8 +6510,8 @@ describe('BrowserWindow module', () => {
|
|||
expect(w.getBounds()).to.deep.equal(newBounds);
|
||||
});
|
||||
|
||||
// FIXME(codebytere): figure out why these are failing on macOS arm64.
|
||||
ifit(process.platform === 'darwin' && process.arch !== 'arm64')('should not display a visible background', async () => {
|
||||
// FIXME(codebytere): figure out why these are failing on MAS arm64.
|
||||
ifit(hasCapturableScreen() && !(process.mas && process.arch === 'arm64'))('should not display a visible background', async () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
|
||||
const backgroundWindow = new BrowserWindow({
|
||||
|
@ -6534,9 +6534,7 @@ describe('BrowserWindow module', () => {
|
|||
const colorFile = path.join(__dirname, 'fixtures', 'pages', 'half-background-color.html');
|
||||
await foregroundWindow.loadFile(colorFile);
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.createForDisplay(display);
|
||||
const screenCapture = new ScreenCapture(display);
|
||||
await screenCapture.expectColorAtPointOnDisplayMatches(
|
||||
HexColors.GREEN,
|
||||
(size) => ({
|
||||
|
@ -6553,8 +6551,8 @@ describe('BrowserWindow module', () => {
|
|||
);
|
||||
});
|
||||
|
||||
// FIXME(codebytere): figure out why these are failing on macOS arm64.
|
||||
ifit(process.platform === 'darwin' && process.arch !== 'arm64')('Allows setting a transparent window via CSS', async () => {
|
||||
// FIXME(codebytere): figure out why these are failing on MAS arm64.
|
||||
ifit(hasCapturableScreen() && !(process.mas && process.arch === 'arm64'))('Allows setting a transparent window via CSS', async () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
|
||||
const backgroundWindow = new BrowserWindow({
|
||||
|
@ -6580,14 +6578,11 @@ describe('BrowserWindow module', () => {
|
|||
foregroundWindow.loadFile(path.join(__dirname, 'fixtures', 'pages', 'css-transparent.html'));
|
||||
await once(ipcMain, 'set-transparent');
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.createForDisplay(display);
|
||||
const screenCapture = new ScreenCapture(display);
|
||||
await screenCapture.expectColorAtCenterMatches(HexColors.PURPLE);
|
||||
});
|
||||
|
||||
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
|
||||
ifit(process.platform === 'darwin' && process.arch === 'x64')('should not make background transparent if falsy', async () => {
|
||||
ifit(hasCapturableScreen())('should not make background transparent if falsy', async () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
|
||||
for (const transparent of [false, undefined]) {
|
||||
|
@ -6599,8 +6594,7 @@ describe('BrowserWindow module', () => {
|
|||
await once(window, 'show');
|
||||
await window.webContents.loadURL('data:text/html,<head><meta name="color-scheme" content="dark"></head>');
|
||||
|
||||
await setTimeout(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);
|
||||
|
||||
|
@ -6612,8 +6606,7 @@ describe('BrowserWindow module', () => {
|
|||
describe('"backgroundColor" option', () => {
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
// Linux/WOA doesn't return any capture sources.
|
||||
ifit(process.platform === 'darwin')('should display the set color', async () => {
|
||||
ifit(hasCapturableScreen())('should display the set color', async () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
|
||||
const w = new BrowserWindow({
|
||||
|
@ -6625,9 +6618,7 @@ describe('BrowserWindow module', () => {
|
|||
w.loadURL('about:blank');
|
||||
await once(w, 'ready-to-show');
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.createForDisplay(display);
|
||||
const screenCapture = new ScreenCapture(display);
|
||||
await screenCapture.expectColorAtCenterMatches(HexColors.BLUE);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue