35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
||
import { desktopCanvasDisplaySize, resolutionFromPane } from '../../src/utils/desktopResolution'
|
||
|
||
describe('desktopCanvasDisplaySize', () => {
|
||
it('lets RDP fill a taller pane instead of letterboxing 1280×800', () => {
|
||
expect(desktopCanvasDisplaySize('rdp', 1100, 980, 1280, 800)).toEqual({
|
||
width: 1100,
|
||
height: 980,
|
||
})
|
||
})
|
||
|
||
it('keeps VNC aspect ratio so the framebuffer is not stretched', () => {
|
||
expect(desktopCanvasDisplaySize('vnc', 1100, 980, 1280, 800)).toEqual({
|
||
width: 1100,
|
||
height: 687,
|
||
})
|
||
})
|
||
})
|
||
|
||
describe('resolutionFromPane', () => {
|
||
it('uses the pane when it is large enough for a desktop session', () => {
|
||
expect(resolutionFromPane(1420, 900, { width: 1280, height: 800 })).toEqual({
|
||
width: 1420,
|
||
height: 900,
|
||
})
|
||
})
|
||
|
||
it('falls back when the pane is still collapsing or hidden', () => {
|
||
expect(resolutionFromPane(0, 0, { width: 1280, height: 800 })).toEqual({
|
||
width: 1280,
|
||
height: 800,
|
||
})
|
||
})
|
||
})
|