fix: delegate multi-line digit selection to visible overlay (#78)

This commit is contained in:
2026-05-24 00:39:23 -07:00
committed by GitHub
parent c02edc90cc
commit da3c971ee6
62 changed files with 1822 additions and 209 deletions
@@ -1,6 +1,9 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createResolveActiveSubtitleSidebarSourceHandler } from './subtitle-prefetch-runtime';
import {
createRefreshSubtitlePrefetchFromActiveTrackHandler,
createResolveActiveSubtitleSidebarSourceHandler,
} from './subtitle-prefetch-runtime';
test('subtitle prefetch runtime resolves direct external subtitle sources first', async () => {
const resolveSource = createResolveActiveSubtitleSidebarSourceHandler({
@@ -57,3 +60,43 @@ test('subtitle prefetch runtime extracts internal subtitle tracks into a stable
cleanup: resolved?.cleanup,
});
});
test('subtitle prefetch runtime preserves parsed cues when YouTube active track source is unresolved', async () => {
const calls: string[] = [];
const refresh = createRefreshSubtitlePrefetchFromActiveTrackHandler({
getMpvClient: () => ({
connected: true,
requestProperty: async (name) => {
if (name === 'path') return 'https://www.youtube.com/watch?v=video123';
if (name === 'track-list') {
return [
{
type: 'sub',
id: 4,
lang: 'ja',
title: 'Japanese',
external: true,
},
];
}
if (name === 'sid') return 4;
return null;
},
}),
getLastObservedTimePos: () => 12,
subtitlePrefetchInitController: {
cancelPendingInit: () => {
calls.push('cancel');
},
initSubtitlePrefetch: async () => {
calls.push('init');
},
},
resolveActiveSubtitleSidebarSource: async () => null,
shouldKeepExistingCuesOnMissingSource: (videoPath) => videoPath.includes('youtube.com'),
});
await refresh();
assert.deepEqual(calls, []);
});