Files
opsxshell/test/utils/desktopResolution.test.ts

35 lines
1.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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,
})
})
})