capture: name the render source in the exact-bounds refusal, and put its one-frame tolerance under test

The tolerance is unchanged and now derived, not assumed: frameCountFor lands in {floor(L), ceil(L)}, so a non-frame-aligned window can never miss by more than a frame. Naming the source is what tells a self-bounding render from a short one.
This commit is contained in:
2026-08-02 06:37:40 -04:00
parent 6e937b9c61
commit a91df760cc
9 changed files with 157 additions and 20 deletions
+24
View File
@@ -10,6 +10,7 @@
#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
@@ -63,6 +64,28 @@ static void testRealtimeIsUnsupportedOffline() {
CHECK(!renderSettingsFor(SourceMode::Realtime, 1.0).supported);
}
static void testEveryRenderSourceIsNameable() {
// The bounds refusal quotes this label to say WHICH render source missed the
// window, so every mode must name itself and no two may read alike.
const SourceMode all[] = {
SourceMode::MasterMix, SourceMode::TimeSelection, SourceMode::SelectedTracks,
SourceMode::SelectedItems, SourceMode::RazorArea, SourceMode::Realtime,
};
for (std::size_t i = 0; i < sizeof(all) / sizeof(all[0]); ++i) {
const char* label = renderSourceLabel(all[i]);
CHECK(label != nullptr && label[0] != '\0');
CHECK(std::strcmp(label, "unknown") != 0);
for (std::size_t j = i + 1; j < sizeof(all) / sizeof(all[0]); ++j)
CHECK(std::strcmp(label, renderSourceLabel(all[j])) != 0);
}
// The two the refusal must tell apart: a source that derives its own bounds vs
// the time-bounded render.
CHECK(std::strcmp(renderSourceLabel(SourceMode::SelectedItems),
"selected media items") == 0);
CHECK(std::strcmp(renderSourceLabel(SourceMode::SelectedTracks),
"selected tracks via master") == 0);
}
// --- tail: TailMode -> RENDER_* mapping (docs/product/capture-tail.md) --------
static void testTailNoneIsExactBounds() {
@@ -395,6 +418,7 @@ int main() {
testSelectedItemsSingleFile();
testRazorSingleFile();
testRealtimeIsUnsupportedOffline();
testEveryRenderSourceIsNameable();
testTailNoneIsExactBounds();
testTailAutoIsSurgicalTrim();
testAutoTrimRatioDerivesFromDb();