Skip to content

Commit

Permalink
FFmpegProcessor.crop() fixes partially overlapping cropping area.
Browse files Browse the repository at this point in the history
  • Loading branch information
eseifert committed Aug 6, 2018
1 parent addaf8c commit 03785d4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,19 @@ def test_crop_returns_asset_with_correct_dimensions(self, processor, video_asset
assert cropped_asset.width == crop_width
assert cropped_asset.height == crop_height

@pytest.mark.parametrize('x, y, width, height, cropped_width, cropped_height', [
(-DEFAULT_WIDTH//2, -DEFAULT_HEIGHT//2, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH//2, DEFAULT_HEIGHT//2),
(DEFAULT_WIDTH//2, DEFAULT_HEIGHT//2, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH//2, DEFAULT_HEIGHT//2),
])
def test_crop_fixes_partially_overlapping_cropping_area(self, processor, video_asset,
x, y, width, height, cropped_width, cropped_height):
crop_operator = processor.crop(x=x, y=y, width=width, height=height)

cropped_asset = crop_operator(video_asset)

assert cropped_asset.width == cropped_width
assert cropped_asset.height == cropped_height

@pytest.mark.parametrize('x, y, width, height', [
(-DEFAULT_WIDTH, -DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_HEIGHT),
(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_HEIGHT),
Expand Down

0 comments on commit 03785d4

Please sign in to comment.