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
|
@ -9,7 +9,7 @@ import * as http from 'node:http';
|
|||
import * as auth from 'basic-auth';
|
||||
import { once } from 'node:events';
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
import { HexColors, ScreenCapture } from './lib/screen-helpers';
|
||||
import { HexColors, ScreenCapture, hasCapturableScreen } from './lib/screen-helpers';
|
||||
|
||||
declare let WebView: any;
|
||||
const features = process._linkedBinding('electron_common_features');
|
||||
|
@ -796,41 +796,32 @@ describe('<webview> tag', function () {
|
|||
});
|
||||
after(() => w.close());
|
||||
|
||||
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
|
||||
ifit(process.platform === 'darwin' && process.arch === 'x64')('is transparent by default', async () => {
|
||||
ifit(hasCapturableScreen())('is transparent by default', async () => {
|
||||
await loadWebView(w.webContents, {
|
||||
src: 'data:text/html,foo'
|
||||
});
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.create();
|
||||
const screenCapture = new ScreenCapture();
|
||||
await screenCapture.expectColorAtCenterMatches(WINDOW_BACKGROUND_COLOR);
|
||||
});
|
||||
|
||||
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
|
||||
ifit(process.platform === 'darwin' && process.arch === 'x64')('remains transparent when set', async () => {
|
||||
ifit(hasCapturableScreen())('remains transparent when set', async () => {
|
||||
await loadWebView(w.webContents, {
|
||||
src: 'data:text/html,foo',
|
||||
webpreferences: 'transparent=yes'
|
||||
});
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.create();
|
||||
const screenCapture = new ScreenCapture();
|
||||
await screenCapture.expectColorAtCenterMatches(WINDOW_BACKGROUND_COLOR);
|
||||
});
|
||||
|
||||
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
|
||||
ifit(process.platform === 'darwin' && process.arch === 'x64')('can disable transparency', async () => {
|
||||
ifit(hasCapturableScreen())('can disable transparency', async () => {
|
||||
await loadWebView(w.webContents, {
|
||||
src: 'data:text/html,foo',
|
||||
webpreferences: 'transparent=no'
|
||||
});
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
const screenCapture = await ScreenCapture.create();
|
||||
const screenCapture = new ScreenCapture();
|
||||
await screenCapture.expectColorAtCenterMatches(HexColors.WHITE);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue