aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-17 15:06:57 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-17 15:06:57 +0200
commitd472725167c1d335996059d24b7b74f3730768fb (patch)
tree1ffca323c9dfe682c8fff2a20da1cfae0106f830 /packages/meshbay-hub/tests
parent30980ba0994d3e99d41c5252555320d6cbb1f5a9 (diff)
downloadmeshbay-d472725167c1d335996059d24b7b74f3730768fb.tar.gz
feat: tell a forced subtitle track from a full one
Reported as "I click a subtitle and nothing appears", on three films. Nothing was broken. The track selected was the container's forced track, which carries signage and foreign dialogue only: measured on the film in question, 30 cues and 77 seconds of text across 2h32 — 0.8% of the running time, against 1559 cues and 41.8% for the full track sitting beside it under the same language tag. At all three positions tested there was genuinely no cue to show; the full track would have shown one at two of them. So the defect is that the menu could not say which was which. The label used the container's title tag, which said "Forced" on that film and says nothing at all on most, and no other field was carried. The disposition is the half that is always there: `probe_video` now reads `forced` and `hearing_impaired`, `stream_init` carries them, and the label states them in the reader's own language rather than repeating an English word a muxer happened to type. The node fixture grows a forced track with no title, because a title would let the old code pass. The label harness's `t` stub took a parameters object unconditionally and threw on a key that has none — a fixture narrower than production, fixed here rather than worked around. Also removes the activeCues probe that found this. It answered its question: mode showing, cues 30, active 0, none due at that instant. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UGY17EPph5LsLzePPXhUVc
Diffstat (limited to 'packages/meshbay-hub/tests')
-rw-r--r--packages/meshbay-hub/tests/test_video_subtitles.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/packages/meshbay-hub/tests/test_video_subtitles.py b/packages/meshbay-hub/tests/test_video_subtitles.py
index 9f0c08d..6867076 100644
--- a/packages/meshbay-hub/tests/test_video_subtitles.py
+++ b/packages/meshbay-hub/tests/test_video_subtitles.py
@@ -110,7 +110,10 @@ def _label_cases(tmp_path, app, cases, locale="en"):
])
script.write_text(
f"const getLocale = () => '{locale}';\n"
- "const t = (k, p) => `${k}:${p.n}`;\n"
+ # Not every key is interpolated — the forced/SDH qualifiers take no
+ # parameters — and a stub that assumes one throws where the real `t`
+ # returns a string. A fixture narrower than production tests itself.
+ "const t = (k, p) => (p ? `${k}:${p.n}` : k);\n"
+ src
+ "\nconst out = JSON.parse(process.argv[2]).map(subtitleTrackLabel);\n"
"console.log(JSON.stringify(out));\n")
@@ -150,6 +153,38 @@ def test_the_container_title_tells_a_forced_track_from_a_full_one(tmp_path, app)
assert "Forced" in out[0] and "SDH" in out[1]
+def test_a_forced_track_is_named_as_one_in_the_reader_s_language(tmp_path, app):
+ """The entry that was reported as a broken feature.
+
+ A forced track shows signage and foreign dialogue only — on a real film,
+ 77 seconds of text across 2h32 — so picking it and seeing nothing is its
+ normal behaviour. It has to be possible to tell it from the full track
+ beside it, which carries the same language tag, and the disposition says
+ so where the container's English title tag is often simply absent.
+ """
+ out = _label_cases(tmp_path, app, [
+ {"i": 0, "lang": "fre", "forced": True},
+ {"i": 1, "lang": "fre"},
+ {"i": 2, "lang": "eng", "sdh": True},
+ ])
+ assert out[0] != out[1], f"a forced track must not read like the full one: {out}"
+ # The catalogues are stubbed here, so what is asserted is that the label
+ # goes through `t` at all: the qualifier has to be translated, not the
+ # English word a muxer typed into the container.
+ assert out[0] == 'French — video.subtitles_forced', out
+ assert out[1] == 'French', out
+ assert out[2] == 'English — video.subtitles_sdh', out
+
+
+def test_the_disposition_wins_over_the_container_title(tmp_path, app):
+ """A muxer's "Forced" is one spelling of many, and in one language."""
+ out = _label_cases(tmp_path, app, [
+ {"i": 0, "lang": "fre", "title": "FORCE VF", "forced": True},
+ ])
+ assert 'FORCE VF' not in out[0], out
+ assert out[0] == 'French — video.subtitles_forced', out
+
+
def test_an_untagged_track_is_numbered_not_called_unknown(tmp_path, app):
"""A file with no language tags still needs distinguishable entries."""
out = _label_cases(tmp_path, app, [{"i": 3, "lang": None}, {"i": 4, "lang": "und"}])