fix: NativeImage serialization of <webview>.capturePage() result (#20825)
This commit is contained in:
parent
c0657a4ca7
commit
1d596f616d
12 changed files with 67 additions and 44 deletions
|
@ -1022,6 +1022,20 @@ describe('<webview> tag', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('<webview>.capturePage()', () => {
|
||||
it('returns a Promise with a NativeImage', async () => {
|
||||
const src = 'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E'
|
||||
await loadWebView(webview, { src })
|
||||
|
||||
const image = await webview.capturePage()
|
||||
const imgBuffer = image.toPNG()
|
||||
|
||||
// Check the 25th byte in the PNG.
|
||||
// Values can be 0,2,3,4, or 6. We want 6, which is RGB + Alpha
|
||||
expect(imgBuffer[25]).to.equal(6)
|
||||
})
|
||||
})
|
||||
|
||||
describe('<webview>.printToPDF()', () => {
|
||||
before(function () {
|
||||
if (!features.isPrintingEnabled()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue