mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { resolveWindowsCaptureDisplay } from './windowsCaptureSelection'
|
|
|
|
describe('resolveWindowsCaptureDisplay', () => {
|
|
const primaryDisplay = {
|
|
id: 101,
|
|
bounds: {
|
|
x: 0,
|
|
y: 0,
|
|
width: 1920,
|
|
height: 1080,
|
|
},
|
|
}
|
|
|
|
const secondaryDisplay = {
|
|
id: 202,
|
|
bounds: {
|
|
x: 1920,
|
|
y: -40,
|
|
width: 2560,
|
|
height: 1440,
|
|
},
|
|
}
|
|
|
|
it('uses the requested secondary display bounds for WGC fallback metadata', () => {
|
|
const resolved = resolveWindowsCaptureDisplay(
|
|
{ display_id: String(secondaryDisplay.id) },
|
|
[primaryDisplay, secondaryDisplay],
|
|
primaryDisplay,
|
|
)
|
|
|
|
expect(resolved).toEqual({
|
|
displayId: secondaryDisplay.id,
|
|
bounds: secondaryDisplay.bounds,
|
|
})
|
|
})
|
|
|
|
it('falls back to the primary display when the source has no display id', () => {
|
|
const resolved = resolveWindowsCaptureDisplay(undefined, [primaryDisplay, secondaryDisplay], primaryDisplay)
|
|
|
|
expect(resolved).toEqual({
|
|
displayId: primaryDisplay.id,
|
|
bounds: primaryDisplay.bounds,
|
|
})
|
|
})
|
|
|
|
it('keeps the requested display id even if Electron cannot rematch it, while using primary bounds', () => {
|
|
const resolved = resolveWindowsCaptureDisplay(
|
|
{ display_id: '303' },
|
|
[primaryDisplay, secondaryDisplay],
|
|
primaryDisplay,
|
|
)
|
|
|
|
expect(resolved).toEqual({
|
|
displayId: 303,
|
|
bounds: primaryDisplay.bounds,
|
|
})
|
|
})
|
|
}) |