Skip to content

frame_format to support all listed by animation writers #17909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ def validate_movie_writer(s):


validate_movie_frame_fmt = ValidateInStrings(
'animation.frame_format', ['png', 'jpeg', 'tiff', 'raw', 'rgba'],
'animation.frame_format', ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm',
'sgi', 'bmp', 'pbm', 'svg'],
_deprecated_since="3.3")
validate_axis_locator = ValidateInStrings(
'major', ['minor', 'both', 'major'], _deprecated_since="3.3")
Expand Down Expand Up @@ -1491,7 +1492,8 @@ def _convert_validator_spec(key, conv):
"animation.codec": validate_string,
"animation.bitrate": validate_int,
# Controls image format when frames are written to disk
"animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba"],
"animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba", "ppm",
"sgi", "bmp", "pbm", "svg"],
# Additional arguments for HTML writer
"animation.html_args": validate_stringlist,
# Path to ffmpeg binary. If just binary name, subprocess uses $PATH.
Expand Down
9 changes: 9 additions & 0 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ def test_Issue_1713(tmpdir):
assert rc.get('timezone') == 'UTC'


def test_animation_frame_formats():
# Animation frame_format should allow any of the following
# if any of these are not allowed, an exception will be raised
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally add another test checking the exception for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, but I think that correctness is implied by an already existing test for validate_stringlist.

# test for gh issue #17908
for fmt in ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm',
'sgi', 'bmp', 'pbm', 'svg']:
mpl.rcParams['animation.frame_format'] = fmt


def generate_validator_testcases(valid):
validation_tests = (
{'validator': validate_bool,
Expand Down