diff options
author | George Claghorn <george@basecamp.com> | 2018-01-20 14:47:04 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-01-20 14:47:09 -0500 |
commit | cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba (patch) | |
tree | 54a1baae7ad146af9fc9d48c7c88a8f7efc0c025 /activestorage/test | |
parent | 9bf41f249535cf333ca006490def702c1c89cc88 (diff) | |
download | rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.tar.gz rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.tar.bz2 rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.zip |
Cope with videos with undefined display aspect ratios
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/analyzer/video_analyzer_test.rb | 9 | ||||
-rw-r--r-- | activestorage/test/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 | bin | 0 -> 128737 bytes |
2 files changed, 9 insertions, 0 deletions
diff --git a/activestorage/test/analyzer/video_analyzer_test.rb b/activestorage/test/analyzer/video_analyzer_test.rb index fa65877de3..2612006551 100644 --- a/activestorage/test/analyzer/video_analyzer_test.rb +++ b/activestorage/test/analyzer/video_analyzer_test.rb @@ -37,6 +37,15 @@ class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase assert_equal [16, 9], metadata[:display_aspect_ratio] end + test "analyzing a video with an undefined display aspect ratio" do + blob = create_file_blob(filename: "video_with_undefined_display_aspect_ratio.mp4", content_type: "video/mp4") + metadata = extract_metadata_from(blob) + + assert_equal 640, metadata[:width] + assert_equal 480, metadata[:height] + assert_nil metadata[:display_aspect_ratio] + end + test "analyzing a video without a video stream" do blob = create_file_blob(filename: "video_without_video_stream.mp4", content_type: "video/mp4") metadata = extract_metadata_from(blob) diff --git a/activestorage/test/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 b/activestorage/test/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 Binary files differnew file mode 100644 index 0000000000..eb354e756f --- /dev/null +++ b/activestorage/test/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 |