mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 00:55:16 -07:00
feat(config): add configuration window (#70)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { selectAutoplayStartupCue } from './autoplay-subtitle-primer';
|
||||
|
||||
test('selectAutoplayStartupCue returns the active cue at the current time', () => {
|
||||
assert.deepEqual(
|
||||
selectAutoplayStartupCue(
|
||||
[
|
||||
{ startTime: 1, endTime: 3, text: 'first' },
|
||||
{ startTime: 4, endTime: 5, text: 'second' },
|
||||
],
|
||||
2,
|
||||
1,
|
||||
),
|
||||
{ startTime: 1, endTime: 3, text: 'first' },
|
||||
);
|
||||
});
|
||||
|
||||
test('selectAutoplayStartupCue returns the next imminent cue before playback starts', () => {
|
||||
assert.deepEqual(
|
||||
selectAutoplayStartupCue(
|
||||
[
|
||||
{ startTime: 1.2, endTime: 3, text: 'first' },
|
||||
{ startTime: 4, endTime: 5, text: 'second' },
|
||||
],
|
||||
0,
|
||||
2,
|
||||
),
|
||||
{ startTime: 1.2, endTime: 3, text: 'first' },
|
||||
);
|
||||
});
|
||||
|
||||
test('selectAutoplayStartupCue clamps negative current time to startup', () => {
|
||||
assert.deepEqual(
|
||||
selectAutoplayStartupCue([{ startTime: 0, endTime: 1, text: 'startup' }], -0.5, 0),
|
||||
{ startTime: 0, endTime: 1, text: 'startup' },
|
||||
);
|
||||
});
|
||||
|
||||
test('selectAutoplayStartupCue does not reveal far future subtitle text', () => {
|
||||
assert.equal(
|
||||
selectAutoplayStartupCue([{ startTime: 12, endTime: 15, text: 'later' }], 0, 2),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test('selectAutoplayStartupCue skips blank cues', () => {
|
||||
assert.deepEqual(
|
||||
selectAutoplayStartupCue(
|
||||
[
|
||||
{ startTime: 0, endTime: 1, text: ' ' },
|
||||
{ startTime: 0.5, endTime: 2, text: 'visible' },
|
||||
],
|
||||
0.75,
|
||||
1,
|
||||
),
|
||||
{ startTime: 0.5, endTime: 2, text: 'visible' },
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user