From 4327660dfbc6b4d72aa4b33c9046dabf2fc6e97e Mon Sep 17 00:00:00 2001 From: Balte de Wit Date: Mon, 5 Aug 2019 16:50:56 +0200 Subject: [PATCH] fix: consistent API for super source methods --- src/__tests__/index.spec.ts | 16 ++++++++-------- src/atem.ts | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/__tests__/index.spec.ts b/src/__tests__/index.spec.ts index 3b78573ed..fc714db05 100644 --- a/src/__tests__/index.spec.ts +++ b/src/__tests__/index.spec.ts @@ -35,10 +35,10 @@ test('setSuperSourceProperties - 7.2', async () => { try { expect(conn.sendCommand).not.toHaveBeenCalled() - await conn.setSuperSourceProperties(2, { + await conn.setSuperSourceProperties({ artPreMultiplied: true, artOption: Enums.SuperSourceArtOption.Background - }) + }, 2) expect(conn.sendCommand).toHaveBeenCalledTimes(1) expect(conn.sendCommand).toHaveBeenNthCalledWith(1, { rawName: 'CSSc', @@ -58,10 +58,10 @@ test('setSuperSourceProperties - 8.0', async () => { try { expect(conn.sendCommand).not.toHaveBeenCalled() - await conn.setSuperSourceProperties(2, { + await conn.setSuperSourceProperties({ artPreMultiplied: true, artOption: Enums.SuperSourceArtOption.Background - }) + }, 2) expect(conn.sendCommand).toHaveBeenCalledTimes(1) expect(conn.sendCommand).toHaveBeenNthCalledWith(1, { rawName: 'CSSc', @@ -83,10 +83,10 @@ test('setSuperSourceBorder - 7.2', async () => { try { expect(conn.sendCommand).not.toHaveBeenCalled() - await conn.setSuperSourceBorder(2, { + await conn.setSuperSourceBorder({ borderBevelSoftness: 12, borderLuma: 3 - }) + }, 2) expect(conn.sendCommand).toHaveBeenCalledTimes(1) expect(conn.sendCommand).toHaveBeenNthCalledWith(1, { rawName: 'CSSc', @@ -106,10 +106,10 @@ test('setSuperSourceBorder - 8.0', async () => { try { expect(conn.sendCommand).not.toHaveBeenCalled() - await conn.setSuperSourceBorder(2, { + await conn.setSuperSourceBorder({ borderBevelSoftness: 12, borderLuma: 3 - }) + }, 2) expect(conn.sendCommand).toHaveBeenCalledTimes(1) expect(conn.sendCommand).toHaveBeenNthCalledWith(1, { rawName: 'CSBd', diff --git a/src/atem.ts b/src/atem.ts index 383d7d72e..7578af954 100644 --- a/src/atem.ts +++ b/src/atem.ts @@ -341,7 +341,7 @@ export class Atem extends EventEmitter { return this.sendCommand(command) } - setSuperSourceBoxSettings (ssrcId: number, newProps: Partial, box = 0) { + setSuperSourceBoxSettings (newProps: Partial, box = 0, ssrcId = 0) { const command = new Commands.SuperSourceBoxParametersCommand() command.ssrcId = ssrcId command.boxId = box @@ -349,7 +349,7 @@ export class Atem extends EventEmitter { return this.sendCommand(command) } - setSuperSourceProperties (ssrcId: number, newProps: Partial) { + setSuperSourceProperties (newProps: Partial, ssrcId = 0) { if (this.state.info.apiVersion >= Enums.ProtocolVersion.V8_0) { const command = new Commands.SuperSourcePropertiesV8Command() command.ssrcId = ssrcId @@ -362,7 +362,7 @@ export class Atem extends EventEmitter { } } - setSuperSourceBorder (ssrcId: number, newProps: Partial) { + setSuperSourceBorder (newProps: Partial, ssrcId = 0) { if (this.state.info.apiVersion >= Enums.ProtocolVersion.V8_0) { const command = new Commands.SuperSourceBorderCommand() command.ssrcId = ssrcId