Check for correct button events in dragging tests

Previously, these unit tests did not check which events were sent to the
server, only how many events were sent. This commit adds checks to see
that the expected button events are sent.
This commit is contained in:
Adam Halim 2025-01-10 12:21:52 +01:00
parent dce8ab395b
commit 31d6a77af6
1 changed files with 10 additions and 0 deletions

View File

@ -690,6 +690,10 @@ describe('Remote Frame Buffer protocol client', function () {
sendMouseButtonEvent(13, 9, false, 0, client);
expect(RFB.messages.pointerEvent).to.have.been.calledTwice;
expect(RFB.messages.pointerEvent.firstCall).to.have.been.calledWith(client._sock,
13, 9, 0x1);
expect(RFB.messages.pointerEvent.secondCall).to.have.been.calledWith(client._sock,
13, 9, 0x0);
});
it('should send button messages when release with small movement', function () {
@ -699,6 +703,10 @@ describe('Remote Frame Buffer protocol client', function () {
sendMouseButtonEvent(15, 14, false, 0, client);
expect(RFB.messages.pointerEvent).to.have.been.calledTwice;
expect(RFB.messages.pointerEvent.firstCall).to.have.been.calledWith(client._sock,
15, 14, 0x1);
expect(RFB.messages.pointerEvent.secondCall).to.have.been.calledWith(client._sock,
15, 14, 0x0);
});
it('should not send button messages when in view only', function () {
@ -714,6 +722,8 @@ describe('Remote Frame Buffer protocol client', function () {
client.dragViewport = false;
sendMouseButtonEvent(13, 9, true, 0, client);
expect(RFB.messages.pointerEvent).to.have.been.calledOnce;
expect(RFB.messages.pointerEvent.firstCall).to.have.been.calledWith(client._sock,
13, 9, 0x1);
});
it('should be initiate viewport dragging on sufficient movement', function () {