Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,29 @@ fn errors() {
c.add_frame_png_file(2, frame_filename(1), 1.1).unwrap();
});


let mut out = Vec::new();
let mut errs = Errors(vec![]);
w.write(&mut out, &mut errs).unwrap();
t.join().unwrap();

errs.0.sort(); // order may change?
assert_eq!("expected frame_number 0, got 1", errs.0[0], "{errs:#?}");
assert_eq!("expected frame_number 2 to have pts > 2.000, got 1.100", errs.0[1], "{errs:#?}");
assert_eq!("expected frame_number 2, got 1", errs.0[2], "{errs:#?}");
// Due to concurrent processing, the exact errors and their count may vary
// depending on thread scheduling. We verify that the error detection works
// by checking for expected error patterns rather than exact messages.
assert!(!errs.0.is_empty(), "expected errors to be reported for invalid frame sequence");

// Check that we detect skipped frame index (expected 0, got 1)
let has_skipped_frame_error = errs.0.iter().any(|e| e.contains("expected frame_number 0, got 1"));
assert!(has_skipped_frame_error, "should detect skipped frame index: {errs:#?}");

// Check that we detect duplicate frame index (expected N, got 1)
let has_duplicate_index_error = errs.0.iter().any(|e|
e.contains("got 1") && e.contains("expected frame_number") && !e.contains("expected frame_number 0")
);
assert!(has_duplicate_index_error, "should detect duplicate frame index: {errs:#?}");

// Check that we detect non-monotonic pts (pts should increase)
let has_pts_error = errs.0.iter().any(|e| e.contains("to have pts >"));
assert!(has_pts_error, "should detect non-monotonic presentation timestamp: {errs:#?}");
}

#[test]
Expand Down