Skip to content

Commit

Permalink
Add shape changing test
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Jun 13, 2024
1 parent bcbe01c commit 7a377a6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_find_bad_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7a377a6

Please sign in to comment.