From da8d53851bd45c2b9086aaa497b35718836d300c Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Wed, 2 Sep 2026 18:07:43 -0500 Subject: [PATCH] Render the container row for a video nothing could name (#199) ConverterScreen.kt:668's null arm -- DetailRow("Container", probe.container?.label ?: "Unknown") in the VIDEO branch -- had never rendered. Every video case in FileCardTest uses VIDEO_PROBE, which carries container = MP4. The argument for adding it is the asymmetry, not the coverage. FileCard renders that exact expression twice, once in AUDIO_ONLY (:660) and once in VIDEO (:668), and "an audio-only file nothing else could describe degrades one row at a time" drives only the first. Same expression, same fallback, one kind covered and one not -- which is the same argument CLAUDE.md records for including ContainerCapabilities:94. Nor is null an edge case here. InputProbe.container's own KDoc says MediaExtractor cannot report a container at all, so it comes from FFprobe alone: any run where FFprobe did not answer produces exactly this shape -- real codec, real dimensions, real duration, no container. An empty value in its place would read as a rendering bug rather than as a probe that got half its sources. The other three rows are asserted alongside, which is what keeps this from being a copy of the audio-only case. There, everything is unknown at once; here one field is missing from a probe that is otherwise complete, and the rest have to be unaffected by it. Mutation: `?: "Unknown"` -> `?: ""` at :668 only, run and restored. The AUDIO_ONLY twin at :660 is a separate expression, and mutating that one would redden the existing test instead -- which would prove nothing about this one. Co-Authored-By: Claude Opus 5 (1M context) --- .../convert/FileCardTest.kt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/src/test/java/org/libremediaconverter/convert/FileCardTest.kt b/app/src/test/java/org/libremediaconverter/convert/FileCardTest.kt index a6e8112..7826daa 100644 --- a/app/src/test/java/org/libremediaconverter/convert/FileCardTest.kt +++ b/app/src/test/java/org/libremediaconverter/convert/FileCardTest.kt @@ -205,6 +205,34 @@ class FileCardTest { assertNoRow("Length") } + /** + * A video the app knows a great deal about and cannot name the container of. + * + * Not an edge case. `InputProbe.container`'s own KDoc says `MediaExtractor` cannot report a + * container at all -- it comes from FFprobe -- so any run where FFprobe did not answer produces + * exactly this: real codec, real dimensions, real duration, `container = null`. + * + * **The twin was already tested and this one was not**, which is the argument for adding it. + * `FileCard` renders `probe.container?.label ?: "Unknown"` twice, once in the `AUDIO_ONLY` + * branch (`ConverterScreen.kt:660`) and once in the `VIDEO` branch (`:668`), and + * `an audio-only file nothing else could describe degrades one row at a time` drives only the + * first. Same expression, same fallback, one kind covered. That asymmetry is the same one + * `CLAUDE.md` records for including `ContainerCapabilities:94`. + * + * The other rows are asserted alongside so this is not a copy of the audio-only case: there, + * everything is unknown at once; here, one field is missing from a probe that is otherwise + * complete, and the rest must be unaffected by it. + */ + @Test + fun `a video file whose container nothing identified says so and keeps its other rows`() { + setFileCard(input(probe = VIDEO_PROBE.copy(container = null))) + + assertRow("Container", "Unknown") + assertRow("Video", "${VideoCodec.H264.label} · 1920×1080") + assertRow("Audio", AudioCodec.AAC.label) + assertRow("Length", "1:30") + } + /** * The row is one node, not a label node beside a value node. A test matching on `"Container"` * alone would pass against either shape.