feat(remote-desktop): expose display zoom controls for RDP (#1514)

This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-09-30 09:45:49 -05:00
1 parent 12a373e598
commit a1f72b9e53
2 files changed
+36 -29

No files matched your search

@@ -385,7 +385,7 @@ export const GuacamoleToolbar: React.FC<GuacamoleToolbarProps> = ({
</> </>
)} )}
{protocol === "vnc" && ( {isRdpVnc && (
<> <>
<div className={SEP} /> <div className={SEP} />
<TipIconBtn <TipIconBtn
@@ -54,35 +54,42 @@ describe("GuacamoleToolbar Windows key", () => {
expect(sendKey).toHaveBeenCalledWith(0xffeb, true); expect(sendKey).toHaveBeenCalledWith(0xffeb, true);
}); });
it("exposes VNC zoom controls without showing them for RDP", () => { it.each(["vnc", "rdp"] as const)(
const zoomIn = vi.fn(() => 1.25); "exposes working zoom controls for %s",
const zoomOut = vi.fn(() => 0.75); (protocol) => {
const resetZoom = vi.fn(() => 1); const zoomIn = vi.fn(() => 1.25);
const displayRef = { const zoomOut = vi.fn(() => 0.75);
current: { const resetZoom = vi.fn(() => 1);
disconnect: vi.fn(), const displayRef = {
isConnected: () => true, current: {
sendKey: vi.fn(), disconnect: vi.fn(),
sendMouse: vi.fn(), isConnected: () => true,
setClipboard: vi.fn(), sendKey: vi.fn(),
getFilesystem: () => null, sendMouse: vi.fn(),
uploadFile: async () => {}, setClipboard: vi.fn(),
zoomIn, getFilesystem: () => null,
zoomOut, uploadFile: async () => {},
resetZoom, zoomIn,
} satisfies GuacamoleDisplayHandle, zoomOut,
} as React.RefObject<GuacamoleDisplayHandle>; resetZoom,
const { getByLabelText, getByText } = render( } satisfies GuacamoleDisplayHandle,
<GuacamoleToolbar displayRef={displayRef} protocol="vnc" zoom={1.25} />, } as React.RefObject<GuacamoleDisplayHandle>;
); const { getByLabelText, getByText } = render(
<GuacamoleToolbar
displayRef={displayRef}
protocol={protocol}
zoom={1.25}
/>,
);
fireEvent.click(getByLabelText("remoteDesktop.toolbar.zoomOut")); fireEvent.click(getByLabelText("remoteDesktop.toolbar.zoomOut"));
fireEvent.click(getByLabelText("remoteDesktop.toolbar.zoomIn")); fireEvent.click(getByLabelText("remoteDesktop.toolbar.zoomIn"));
fireEvent.click(getByText("125%")); fireEvent.click(getByText("125%"));
expect(zoomOut).toHaveBeenCalledOnce(); expect(zoomOut).toHaveBeenCalledOnce();
expect(zoomIn).toHaveBeenCalledOnce(); expect(zoomIn).toHaveBeenCalledOnce();
expect(resetZoom).toHaveBeenCalledOnce(); expect(resetZoom).toHaveBeenCalledOnce();
}); },
);
it("offers an explicit session-only hide action", () => { it("offers an explicit session-only hide action", () => {
const onHide = vi.fn(); const onHide = vi.fn();