aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_stream_subtitle_tracks.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests/test_stream_subtitle_tracks.py')
-rw-r--r--packages/meshbay-node/tests/test_stream_subtitle_tracks.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_stream_subtitle_tracks.py b/packages/meshbay-node/tests/test_stream_subtitle_tracks.py
index cafb2e3..9a09edb 100644
--- a/packages/meshbay-node/tests/test_stream_subtitle_tracks.py
+++ b/packages/meshbay-node/tests/test_stream_subtitle_tracks.py
@@ -95,6 +95,9 @@ def _make_subtitled_clip(path: Path) -> None:
"-metadata:s:s:0", "language=fre",
"-metadata:s:s:1", "language=fre",
"-metadata:s:s:2", "language=eng",
+ # Ordinal 1 is the forced one, and carries no title saying so — which
+ # is the case the disposition exists for.
+ "-disposition:s:1", "forced",
str(path)],
check=True, capture_output=True)
@@ -209,6 +212,31 @@ def test_bitmap_codecs_are_not_offered():
@pytest.mark.asyncio
+async def test_a_forced_track_says_so_without_needing_a_title(tmp_path):
+ """The distinction a viewer cannot make for themselves.
+
+ A forced track carries signage and foreign dialogue only — on a real film,
+ 30 cues and 77 seconds of text across 2h32, against 1559 cues and 41% of
+ the running time for the full track beside it. Selecting it and seeing
+ nothing for ten minutes is its normal behaviour, and was reported as a
+ broken feature. The container's title tag would say it too, when it is
+ there; the disposition is the half that is always there.
+ """
+ clip = tmp_path / "clip.mp4"
+ _make_subtitled_clip(clip)
+
+ probe = await _probe_video(str(clip))
+ by_ordinal = {tr.ordinal: tr for tr in probe.subtitle_tracks}
+
+ assert by_ordinal[1].forced is True
+ assert by_ordinal[2].forced is False
+ assert by_ordinal[1].title is None, (
+ "the fixture must carry no title on the forced track, or it does not "
+ "exercise the case the disposition is for")
+ assert all(not tr.hearing_impaired for tr in probe.subtitle_tracks)
+
+
+@pytest.mark.asyncio
async def test_stream_init_announces_the_tracks(tmp_path):
"""How a client discovers this node can do subtitles at all.
@@ -226,6 +254,9 @@ async def test_stream_init_announces_the_tracks(tmp_path):
init = next(m for m in session.sent if m.get("type") == "stream_init")
assert [tr["i"] for tr in init["subtitle_tracks"]] == [1, 2]
assert [tr["lang"] for tr in init["subtitle_tracks"]] == ["fre", "eng"]
+ assert [tr["forced"] for tr in init["subtitle_tracks"]] == [True, False], (
+ "the client cannot mark a forced track it was never told about")
+ assert [tr["sdh"] for tr in init["subtitle_tracks"]] == [False, False]
@pytest.mark.parametrize("track", [1, 2])