fix: clipboard.writeBuffer raw format access (#31116)
* fix: clipboard.writeBuffer raw format access * test: clipboard.writeBuffer raw format access * test: clipboard win32 test skip * fixup spec * cleanup patch Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
f8df634197
commit
3c33d70294
4 changed files with 76 additions and 3 deletions
|
@ -129,5 +129,16 @@ ifdescribe(process.platform !== 'win32' || process.arch !== 'arm64')('clipboard
|
|||
clipboard.writeBuffer('public/utf8-plain-text', 'hello');
|
||||
}).to.throw(/buffer must be a node Buffer/);
|
||||
});
|
||||
|
||||
ifit(process.platform !== 'win32')('writes a Buffer using a raw format that is used by native apps', function () {
|
||||
const message = 'Hello from Electron!';
|
||||
const buffer = Buffer.from(message);
|
||||
let rawFormat = 'text/plain';
|
||||
if (process.platform === 'darwin') {
|
||||
rawFormat = 'public.utf8-plain-text';
|
||||
}
|
||||
clipboard.writeBuffer(rawFormat, buffer);
|
||||
expect(clipboard.readText()).to.equal(message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue