remotion
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -6,8 +6,24 @@ "use strict"; | ||
const CompositionManager_1 = require("../CompositionManager"); | ||
const is_remote_asset_1 = require("../is-remote-asset"); | ||
const random_1 = require("../random"); | ||
const sequencing_1 = require("../sequencing"); | ||
const use_frame_1 = require("../use-frame"); | ||
const volume_prop_1 = require("../volume-prop"); | ||
const use_audio_frame_1 = require("./use-audio-frame"); | ||
const AudioForRendering = (props) => { | ||
const absoluteFrame = use_frame_1.useAbsoluteCurrentFrame(); | ||
const sequenceFrame = use_frame_1.useCurrentFrame(); | ||
const audioFrame = use_audio_frame_1.useAudioFrame(); | ||
const frame = use_frame_1.useCurrentFrame(); | ||
const sequenceContext = react_1.useContext(sequencing_1.SequenceContext); | ||
const { registerAsset, unregisterAsset } = react_1.useContext(CompositionManager_1.CompositionManager); | ||
const [id] = react_1.useState(() => String(Math.random())); | ||
// Generate a string that's as unique as possible for this asset | ||
// but at the same time the same on all threads | ||
const id = react_1.useMemo(() => { | ||
var _a; | ||
return `audio-${random_1.random((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`; | ||
}, [props.muted, props.src, sequenceContext]); | ||
const volume = volume_prop_1.evaluateVolume({ | ||
volume: props.volume, | ||
frame: audioFrame, | ||
}); | ||
react_1.useEffect(() => { | ||
@@ -17,2 +33,5 @@ if (!props.src) { | ||
} | ||
if (props.muted) { | ||
return; | ||
} | ||
registerAsset({ | ||
@@ -22,6 +41,10 @@ type: 'audio', | ||
id, | ||
sequenceFrame, | ||
frame: absoluteFrame, | ||
volume, | ||
isRemote: is_remote_asset_1.isRemoteAsset(props.src), | ||
mediaFrame: frame, | ||
}); | ||
return () => unregisterAsset(id); | ||
}, [ | ||
props.muted, | ||
props.src, | ||
@@ -32,3 +55,5 @@ registerAsset, | ||
unregisterAsset, | ||
sequenceFrame, | ||
volume, | ||
audioFrame, | ||
frame, | ||
]); | ||
@@ -35,0 +60,0 @@ return null; |
@@ -71,3 +71,3 @@ "use strict"; | ||
for (const value of parsed) { | ||
if (typeof value !== 'number') { | ||
if (isNaN(value)) { | ||
throw new Error('--frames flag must be a single number, or 2 numbers separated by `-`'); | ||
@@ -74,0 +74,0 @@ } |
@@ -22,3 +22,3 @@ import { Browser } from './browser'; | ||
*/ | ||
readonly setBrowserExecutable: (newBrowserExecutablePath: BrowserExecutable) => void; | ||
readonly setBrowserExecutable: (newBrowserExecutablePath: string | null) => void; | ||
}; | ||
@@ -30,3 +30,3 @@ readonly Rendering: { | ||
*/ | ||
readonly setConcurrency: (newConcurrency: Concurrency) => void; | ||
readonly setConcurrency: (newConcurrency: number | null) => void; | ||
/** | ||
@@ -33,0 +33,0 @@ * Set the JPEG quality for the frames. |
import React from 'react'; | ||
export declare const Img: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "onLoad" | "onError" | "key" | "alt" | "crossOrigin" | "decoding" | "height" | "loading" | "referrerPolicy" | "sizes" | "src" | "srcSet" | "useMap" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoadCapture" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLImageElement>>; | ||
export declare const Img: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "width" | "key" | "loading" | "referrerPolicy" | "src" | "alt" | "crossOrigin" | "decoding" | "sizes" | "srcSet" | "useMap"> & React.RefAttributes<HTMLImageElement>>; | ||
//# sourceMappingURL=Img.d.ts.map |
@@ -14,7 +14,7 @@ /// <reference types="react" /> | ||
getRoot: () => import("react").FC<{}> | null; | ||
getBrowserExecutable: () => import("./config/browser-executable").BrowserExecutable; | ||
getBrowserExecutable: () => string | null; | ||
getCompositionName: () => string; | ||
getIsEvaluation: () => boolean; | ||
getPixelFormat: () => "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le"; | ||
getConcurrency: () => import("./config/concurrency").Concurrency; | ||
getConcurrency: () => number | null; | ||
getShouldOverwrite: () => boolean; | ||
@@ -28,3 +28,3 @@ getOutputCodecOrUndefined: () => import("./config/codec").CodecOrUndefined; | ||
codec: import("./config/codec").CodecOrUndefined; | ||
fileExtension: import("./config/browser-executable").BrowserExecutable; | ||
fileExtension: string | null; | ||
emitWarning: boolean; | ||
@@ -31,0 +31,0 @@ }) => "h264" | "h265" | "vp8" | "vp9"; |
@@ -9,2 +9,4 @@ "use strict"; | ||
expect(interpolate_1.interpolate(Math.PI, [0, 1, 4, 9], [0, 2, 1000, -1000])).toEqual(714.4364894275378); | ||
expect(interpolate_1.interpolate(Infinity, [0, 1], [0, 2])).toEqual(Infinity); | ||
expect(interpolate_1.interpolate(Infinity, [0, 1], [1, 0])).toEqual(-Infinity); | ||
}); | ||
@@ -16,29 +18,41 @@ test('Must be the same length', () => { | ||
}); | ||
test('Test against Infinity values', () => { | ||
test('Must pass at least 2 elements for input range', () => { | ||
expect_to_throw_1.expectToThrow(() => { | ||
interpolate_1.interpolate(1, [-Infinity, Infinity], [0, 2]); | ||
}, /inputRange must contain only finite numbers, but got \[-Infinity,Infinity\]/); | ||
}); | ||
test('Must pass at least 2 elements', () => { | ||
expect_to_throw_1.expectToThrow(() => { | ||
interpolate_1.interpolate(1, [0], [9]); | ||
}, /inputRange must have at least 2 elements/); | ||
}); | ||
test('Input range must be monotonically non-decreasing', () => { | ||
test('Input range must be strictly monotonically non-decreasing', () => { | ||
expect_to_throw_1.expectToThrow(() => { | ||
interpolate_1.interpolate(1, [0, 1, 0.5], [0, 2, 0.2]); | ||
}, /inputRange must be monotonically non-decreasing/); | ||
}, /inputRange must be strictly monotonically non-decreasing/); | ||
expect_to_throw_1.expectToThrow(() => { | ||
interpolate_1.interpolate(0.75, [0, 1, 1], [0, 2, 0]); | ||
}, /inputRange must be strictly monotonically non-decreasing/); | ||
}); | ||
test('Output range can be monotonically decreasing', () => { | ||
test('Output range can be non-monotonic', () => { | ||
expect(interpolate_1.interpolate(0.75, [0, 0.5, 1], [0, 2, 0])).toEqual(1); | ||
}); | ||
test('Output range monotonically decreasing', () => { | ||
expect(interpolate_1.interpolate(0.75, [0, 0.5, 1], [0, 2, 2])).toEqual(2); | ||
}); | ||
test('Cannot have Infinity in input range', () => { | ||
expect_to_throw_1.expectToThrow(() => { | ||
interpolate_1.interpolate(1, [-Infinity, 0], [0, 2]); | ||
}, /inputRange must contain only finite numbers, but got \[-Infinity,0\]/); | ||
}); | ||
test('Cannot have Infinity in output Range', () => { | ||
expect_to_throw_1.expectToThrow(() => interpolate_1.interpolate(1, [0, 1], [Infinity, 2]), /outputRange must contain only finite numbers, but got \[Infinity,2\]/); | ||
}); | ||
test('Should throw if passing 2x infinity', () => { | ||
test('Should throw if passing 2x infinity input range', () => { | ||
expect_to_throw_1.expectToThrow(() => interpolate_1.interpolate(1, [Infinity, Infinity], [0, 2]), /inputRange must contain only finite numbers, but got \[Infinity,Infinity\]/); | ||
}); | ||
test('Should throw if passing 2x infinity output range', () => { | ||
expect_to_throw_1.expectToThrow(() => interpolate_1.interpolate(1, [0, 1], [-Infinity, Infinity]), /outputRange must contain only finite numbers, but got \[-Infinity,Infinity\]/); | ||
}); | ||
test('Should throw on Infinity as third argument', () => { | ||
expect_to_throw_1.expectToThrow(() => interpolate_1.interpolate(1, [0, 1, Infinity], [0, 2, 3]), /inputRange must contain only finite numbers, but got \[0,1,Infinity\]/); | ||
}); | ||
test('Should throw on Infinity as third argument', () => { | ||
expect_to_throw_1.expectToThrow(() => interpolate_1.interpolate(1, [0, 1, Infinity], [0, 2, 3]), /inputRange must contain only finite numbers, but got \[0,1,Infinity\]/); | ||
}); | ||
test('Easing test', () => { | ||
@@ -50,17 +64,25 @@ expect(interpolate_1.interpolate(0.5, [0, 1], [0, 1], { | ||
test('Extrapolation left test', () => { | ||
expect(interpolate_1.interpolate(-3, [0, 1, 2], [0, 0.5, 1], { | ||
extrapolateRight: 'extend', | ||
})).toEqual(-1.5); | ||
expect(interpolate_1.interpolate(-3, [0, 1, 2], [0, 0.5, 1])).toEqual(-1.5); | ||
const testValues = ['extend', undefined]; | ||
testValues.forEach((entry) => { | ||
expect(interpolate_1.interpolate(-3, [0, 1, 2], [0, 0.5, 1], { | ||
extrapolateRight: entry, | ||
})).toEqual(-1.5); | ||
}); | ||
}); | ||
test('Extrapolation right test', () => { | ||
expect(interpolate_1.interpolate(3, [0, 1, 2], [0, 0.5, 1], { | ||
extrapolateRight: 'extend', | ||
})).toEqual(1.5); | ||
expect(interpolate_1.interpolate(3, [0, 1, 2], [0, 0.5, 1])).toEqual(1.5); | ||
const testValues = ['extend', undefined]; | ||
testValues.forEach((entry) => { | ||
expect(interpolate_1.interpolate(3, [0, 1, 2], [0, 0.5, 1], { | ||
extrapolateRight: entry, | ||
})).toEqual(1.5); | ||
}); | ||
}); | ||
test('Extrapolation identity', () => { | ||
expect(interpolate_1.interpolate(1000, [0, 1, 2], [0, 2, 4], { | ||
extrapolateRight: 'identity', | ||
})).toBe(1000); | ||
const testValues = [ | ||
[1000, { extrapolateRight: 'identity' }], | ||
[-1000, { extrapolateLeft: 'identity' }], | ||
]; | ||
testValues.forEach((entry) => { | ||
expect(interpolate_1.interpolate(entry[0], [0, 1, 2], [0, 2, 4], entry[1])).toBe(entry[0]); | ||
}); | ||
}); | ||
@@ -78,6 +100,11 @@ test('Clamp right test', () => { | ||
test('Zig-zag test', () => { | ||
expect(interpolate_1.interpolate(3.5, [1, 2, 3, 4, 5], [0, 1000, 0, -1000, 1000])).toBe(-500); | ||
expect(interpolate_1.interpolate(4, [1, 2, 3, 4, 5], [0, 1000, 0, -1000, 1000])).toBe(-1000); | ||
expect(interpolate_1.interpolate(6, [1, 2, 3, 4, 5], [0, 1000, 0, -1000, 1000])).toBe(3000); | ||
expect(interpolate_1.interpolate(-0.1, [1, 2, 3, 4, 5], [0, 1000, 0, -1000, 1000])).toBe(-1100); | ||
const testValues = [ | ||
[3.5, -500], | ||
[4, -1000], | ||
[6, 3000], | ||
[-0.1, -1100], | ||
]; | ||
testValues.forEach((entry) => { | ||
expect(interpolate_1.interpolate(entry[0], [1, 2, 3, 4, 5], [0, 1000, 0, -1000, 1000])).toBe(entry[1]); | ||
}); | ||
}); | ||
@@ -90,2 +117,4 @@ test('Handle bad types', () => { | ||
// @ts-expect-error | ||
expect(() => interpolate_1.interpolate('1', [0, 1], [1, 0])).toThrowError(/Cannot interpolation an input which is not a number/); | ||
// @ts-expect-error | ||
expect(() => interpolate_1.interpolate(1, 'string', 'string')).toThrowError(/inputRange must contain only numbers/); | ||
@@ -92,0 +121,0 @@ // @ts-expect-error |
@@ -6,3 +6,3 @@ "use strict"; | ||
const expect_to_throw_1 = require("./expect-to-throw"); | ||
test('Frame range tests', () => { | ||
test('Frame range should throw exception with invalid inputs', () => { | ||
expect_to_throw_1.expectToThrow(() => frame_range_1.setFrameRange(-1), /non-negative/); | ||
@@ -27,2 +27,4 @@ expect_to_throw_1.expectToThrow(() => frame_range_1.setFrameRange(1.111), /Frame must be an integer, but got a float \(1.111\)/); | ||
() => frame_range_1.setFrameRange('10'), /Frame range must be a number or a tuple of numbers, but got object of type string/); | ||
}); | ||
test('Frame range tests with valid inputs', () => { | ||
frame_range_1.setFrameRange(null); | ||
@@ -32,3 +34,21 @@ expect(internals_1.Internals.getRange()).toEqual(null); | ||
expect(internals_1.Internals.getRange()).toEqual([10, 20]); | ||
frame_range_1.setFrameRange(10); | ||
expect(internals_1.Internals.getRange()).toBe(10); | ||
frame_range_1.setFrameRange(0); | ||
expect(internals_1.Internals.getRange()).toBe(0); | ||
}); | ||
test('Frame range CLI should throw exception with invalid inputs', () => { | ||
expect_to_throw_1.expectToThrow(() => frame_range_1.setFrameRangeFromCli('1-2-3'), /--frames flag must be a number or 2 numbers separated by '-', instead got 3 numbers/); | ||
expect_to_throw_1.expectToThrow(() => frame_range_1.setFrameRangeFromCli('2-1'), /The second number of the --frames flag number should be greater or equal than first number/); | ||
expect_to_throw_1.expectToThrow(() => frame_range_1.setFrameRangeFromCli('one-two'), /--frames flag must be a single number, or 2 numbers separated by `-`/); | ||
}); | ||
test('Frame range CLI tests with valid inputs', () => { | ||
frame_range_1.setFrameRange(null); | ||
frame_range_1.setFrameRangeFromCli(0); | ||
expect(internals_1.Internals.getRange()).toEqual(0); | ||
frame_range_1.setFrameRangeFromCli(10); | ||
expect(internals_1.Internals.getRange()).toEqual(10); | ||
frame_range_1.setFrameRangeFromCli('1-10'); | ||
expect(internals_1.Internals.getRange()).toEqual([1, 10]); | ||
}); | ||
//# sourceMappingURL=range.test.js.map |
{ | ||
"name": "remotion", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "Render videos in React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
328439
402
3862