fix: desktopCapturer
and screen
display ids should match (#42890)
* fix: `desktopCapturer` and `screen` display IDs should match Co-authored-by: clavin <clavin@electronjs.org> * simplify wide-to-utf8 conversion Co-authored-by: clavin <clavin@electronjs.org> * remove unnecessary include Co-authored-by: clavin <clavin@electronjs.org> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org>
This commit is contained in:
parent
05abc2bab2
commit
5c2a8b9047
2 changed files with 24 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
|||
import { expect } from 'chai';
|
||||
import { Display, screen, desktopCapturer } from 'electron/main';
|
||||
import { ifit } from './lib/spec-helpers';
|
||||
|
||||
describe('screen module', () => {
|
||||
describe('methods reassignment', () => {
|
||||
|
@ -24,14 +23,14 @@ describe('screen module', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// desktopCapturer.getSources does not work as expected in Windows CI.
|
||||
ifit(process.platform !== 'win32')('returns displays with IDs matching desktopCapturer source display IDs', async () => {
|
||||
it('returns displays with IDs matching desktopCapturer source display IDs', async () => {
|
||||
const displayIds = screen.getAllDisplays().map(d => `${d.id}`);
|
||||
|
||||
const sources = await desktopCapturer.getSources({ types: ['screen'] });
|
||||
const sourceIds = sources.map(s => s.display_id);
|
||||
|
||||
expect(displayIds).to.have.members(sourceIds);
|
||||
expect(displayIds).to.have.length(sources.length);
|
||||
expect(displayIds).to.have.same.members(sourceIds);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue