diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-25 09:36:22 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-25 09:36:22 +0000 |
commit | 157b75aa71bb2d9e7140cd72f29451fa234a902a (patch) | |
tree | dd6c29146acbef5a0d8e4322507fc4b6ef5fd0f1 /test/test_source_sox.rb | |
parent | 68ffa097e187da663fa3f537b430428ea5e8de2e (diff) | |
download | dtas-157b75aa71bb2d9e7140cd72f29451fa234a902a.tar.gz |
We'll be supporting reading the format from avprobe and ffprobe, so we should avoid tying ourselves to soxi
Diffstat (limited to 'test/test_source_sox.rb')
-rw-r--r-- | test/test_source_sox.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_source_sox.rb b/test/test_source_sox.rb index 6bf5071..f2e0699 100644 --- a/test/test_source_sox.rb +++ b/test/test_source_sox.rb @@ -99,4 +99,17 @@ class TestSource < Minitest::Unit::TestCase source = DTAS::Source::Sox.new(tmp.path, '1') assert_equal 1000000.0, source.offset_us end + + def test_format_from_file + Tempfile.open(%w(tmp .wav)) do |tmp| + # generate an empty file with 1s of audio + cmd = %W(sox -r 96000 -b 24 -c 2 -n #{tmp.path} trim 0 1) + system(*cmd) + assert $?.success?, "#{cmd.inspect} failed: #$?" + fmt = DTAS::Source::Sox.new(tmp.path).format + assert_equal 96000, fmt.rate + assert_equal 2, fmt.channels + tmp.unlink + end + end end |