Skip to content

Commit

Permalink
run ffmpeg tests on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
codez committed Oct 16, 2019
1 parent 3c42f57 commit 21914b5
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions test/services/import/recording/chooser_test.rb
Expand Up @@ -4,29 +4,24 @@ class Import::Recording::ChooserTest < ActiveSupport::TestCase

include RecordingHelper

# Travis has ffmpeg 0.8.17, which reports "Unknown input format: 'lavfi'"
unless ENV['TRAVIS']
test '#best returns the file with the longest audio' do
file1 = file('2016-01-01T235959+0200_001.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file1, 2)
file2 = file('2016-01-01T225959+0100_001.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file2, 5)
variants = [file1, file2].collect { |f| Import::Recording::File.new(f) }
best = Import::Recording::Chooser.new(variants).best
assert_equal file2, best.path
end

test '#best returns the file with the longest audio' do
file1 = file('2016-01-01T235959+0200_001.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file1, 2)
file2 = file('2016-01-01T225959+0100_001.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file2, 5)
variants = [file1, file2].collect { |f| Import::Recording::File.new(f) }
best = Import::Recording::Chooser.new(variants).best
assert_equal file2, best.path
end

test '#best returns the first file if audio lengths are equal within tolerance' do
file1 = file('2016-01-01T235959+0200_002.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file1, 1)
file2 = file('2016-01-01T225959+0100_002.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file2, 2)
variants = [file1, file2].collect { |f| Import::Recording::File.new(f) }
best = Import::Recording::Chooser.new(variants).best
assert_equal file1, best.path
end

end
test '#best returns the first file if audio lengths are equal within tolerance' do
file1 = file('2016-01-01T235959+0200_002.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file1, 1)
file2 = file('2016-01-01T225959+0100_002.mp3')
AudioGenerator.new.silent_file(AudioFormat.new('mp3', 96, 1), file2, 2)
variants = [file1, file2].collect { |f| Import::Recording::File.new(f) }
best = Import::Recording::Chooser.new(variants).best
assert_equal file1, best.path
end

end

0 comments on commit 21914b5

Please sign in to comment.