From 7a377a67b287ded4fbac5881ccb41eefadd61867 Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Thu, 13 Jun 2024 20:04:52 +0200 Subject: [PATCH] Add shape changing test --- tests/test_find_bad_tracks.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_find_bad_tracks.py b/tests/test_find_bad_tracks.py index 75eb693..c345132 100644 --- a/tests/test_find_bad_tracks.py +++ b/tests/test_find_bad_tracks.py @@ -77,6 +77,36 @@ def test_find_bad_tracks_all_good() -> None: } +def test_find_bad_tracks_with_shape_change() -> None: + clip = make_clip() + + # Originally [-1, -1] + cast(TestMovieTrackingMarkers, clip.tracking.tracks[0].markers).coordinates[0] = ( + -11.0, # Originally -1.0, this value is 10 off + -1.0, + ) + + assert find_bad_tracks(clip) == { + "Track 0": Badness(1.0, 1), # Badness gets normalized to 1.0 + "Track 1": Badness(0.0, 1), + "Track 2": Badness(0.0, 1), + "Track 3": Badness(0.0, 1), + } + + # Originally [-1, -1] + cast(TestMovieTrackingMarkers, clip.tracking.tracks[0].markers).coordinates[0] = ( + -1.0, + 9.0, # Originally -1.0, this value is 10 off + ) + + assert find_bad_tracks(clip) == { + "Track 0": Badness(1.0, 1), # Badness gets normalized to 1.0 + "Track 1": Badness(0.0, 1), + "Track 2": Badness(0.0, 1), + "Track 3": Badness(0.0, 1), + } + + def test_compute_badness_score() -> None: movingRight = TrackWithFloat(MovieTrackingTrack(), 10.0, 1) movingLeft = TrackWithFloat(MovieTrackingTrack(), -10.0, 1)