fix: clipboard.read() crash (#31566)
This commit is contained in:
parent
78626a5cc6
commit
deb7ab2a40
2 changed files with 23 additions and 20 deletions
|
@ -44,13 +44,7 @@ ifdescribe(process.platform !== 'win32' || process.arch !== 'arm64')('clipboard
|
|||
});
|
||||
});
|
||||
|
||||
describe('clipboard.readBookmark', () => {
|
||||
before(function () {
|
||||
if (process.platform === 'linux') {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'linux')('clipboard.readBookmark', () => {
|
||||
it('returns title and url', () => {
|
||||
clipboard.writeBookmark('a title', 'https://electronjs.org');
|
||||
|
||||
|
@ -68,6 +62,16 @@ ifdescribe(process.platform !== 'win32' || process.arch !== 'arm64')('clipboard
|
|||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'linux')('clipboard.read()', () => {
|
||||
it('does not crash when reading various custom clipboard types', () => {
|
||||
const type = process.platform === 'darwin' ? 'NSFilenamesPboardType' : 'FileNameW';
|
||||
|
||||
expect(() => {
|
||||
const result = clipboard.read(type);
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
||||
describe('clipboard.write()', () => {
|
||||
it('returns data correctly', () => {
|
||||
const text = 'test';
|
||||
|
@ -100,13 +104,7 @@ ifdescribe(process.platform !== 'win32' || process.arch !== 'arm64')('clipboard
|
|||
});
|
||||
});
|
||||
|
||||
describe('clipboard.read/writeFindText(text)', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'darwin') {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'darwin')('clipboard.read/writeFindText(text)', () => {
|
||||
it('reads and write text to the find pasteboard', () => {
|
||||
clipboard.writeFindText('find this');
|
||||
expect(clipboard.readFindText()).to.equal('find this');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue