-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'contribute/EAV-269' into release51
- Loading branch information
Showing
15 changed files
with
569 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
packages/timeline-state-resolver/src/integrations/vmix/__tests__/connection.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* eslint-disable @typescript-eslint/unbound-method */ | ||
import { mock } from 'jest-mock-extended' | ||
import { VMixCommandSender, VMixConnection } from '../connection' | ||
import { VMixCommand } from 'timeline-state-resolver-types' | ||
|
||
function createTestee() { | ||
const mockConnection = mock<VMixConnection>() | ||
const sender = new VMixCommandSender(mockConnection) | ||
return { mockConnection, sender } | ||
} | ||
|
||
describe('VMixCommandSender', () => { | ||
it('sends layer input', async () => { | ||
const { sender, mockConnection } = createTestee() | ||
await sender.sendCommand({ | ||
command: VMixCommand.SET_LAYER_INPUT, | ||
index: 2, | ||
input: 5, | ||
value: 7, | ||
}) | ||
|
||
expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1) | ||
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SetMultiViewOverlay', { | ||
input: 5, | ||
value: '2,7', | ||
}) | ||
}) | ||
|
||
it('sends layer crop', async () => { | ||
const { sender, mockConnection } = createTestee() | ||
await sender.sendCommand({ | ||
command: VMixCommand.SET_LAYER_CROP, | ||
index: 2, | ||
input: 5, | ||
cropLeft: 0.1, | ||
cropTop: 0.2, | ||
cropRight: 0.3, | ||
cropBottom: 0.4, | ||
}) | ||
|
||
expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1) | ||
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SetLayer2Crop', { | ||
input: 5, | ||
value: '0.1,0.2,0.3,0.4', | ||
}) | ||
}) | ||
|
||
it('sends layer zoom', async () => { | ||
const { sender, mockConnection } = createTestee() | ||
await sender.sendCommand({ | ||
command: VMixCommand.SET_LAYER_ZOOM, | ||
index: 3, | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
|
||
expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1) | ||
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SetLayer3Zoom', { | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
}) | ||
|
||
it('sends layer panX', async () => { | ||
const { sender, mockConnection } = createTestee() | ||
await sender.sendCommand({ | ||
command: VMixCommand.SET_LAYER_PAN_X, | ||
index: 3, | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
|
||
expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1) | ||
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SetLayer3PanX', { | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
}) | ||
|
||
it('sends layer panY', async () => { | ||
const { sender, mockConnection } = createTestee() | ||
await sender.sendCommand({ | ||
command: VMixCommand.SET_LAYER_PAN_Y, | ||
index: 3, | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
|
||
expect(mockConnection.sendCommandFunction).toHaveBeenCalledTimes(1) | ||
expect(mockConnection.sendCommandFunction).toHaveBeenLastCalledWith('SetLayer3PanY', { | ||
input: 6, | ||
value: 1.5, | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.