From afdd0cbd5926aedfff084835c9c0d36a85d308ba Mon Sep 17 00:00:00 2001 From: Sergii Zasenko Date: Mon, 28 Aug 2023 12:15:53 +0300 Subject: [PATCH] Add tests for expected client size fixup --- tests/test.rfb.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test.rfb.js b/tests/test.rfb.js index bf12a4600..eb44669ae 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -776,6 +776,25 @@ describe('Remote Frame Buffer Protocol Client', function () { expect(client._display.autoscale).to.have.been.calledWith(40, 50); }); + it('should update the scaling when the container returns to previous size', function () { + client._saveExpectedClientSize(); + + sinon.spy(client._display, "autoscale"); + + container.style.width = '40px'; + container.style.height = '50px'; + fakeResizeObserver.fire(); + clock.tick(1000); + + container.style.width = '70px'; + container.style.height = '80px'; + fakeResizeObserver.fire(); + clock.tick(1000); + + expect(client._display.autoscale).to.have.been.calledTwice; + expect(client._display.autoscale).to.have.been.calledWith(70, 80); + }); + it('should update the scaling when the remote session resizes', function () { // Simple ExtendedDesktopSize FBU message const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,