UNPKG

@testwizard/commands-video

Version:

37 lines (27 loc) 1.14 kB
'use strict'; const Commands = require('@testwizard/commands-core'); const Result = Commands.ResultForOk; class SetTextOnScreenDisplayCommand extends Commands.CommandBase { constructor(testObject) { super(testObject, 'SetTextOnScreenDisplay'); } async execute(osdText, osdArea, textColor, backgroundColor, duration) { if (osdText === undefined) throw new Error('osdText is required'); const requestObj = [osdText] if (osdArea !== undefined) { requestObj.push(osdArea); if (textColor !== undefined) { requestObj.push(textColor); if (backgroundColor !== undefined) { requestObj.push(backgroundColor); if (duration !== undefined) requestObj.push(duration); } } } const json = await this.executeCommand(requestObj); return new Result(json, 'setTextOnScreenDisplay was successful', 'setTextOnScreenDisplay failed'); } } module.exports = SetTextOnScreenDisplayCommand;