Skip to content

Commit

Permalink
Add tests for expected client size fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
und3f committed Aug 28, 2023
1 parent 88ccc18 commit afdd0cb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test.rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit afdd0cb

Please sign in to comment.