From 157b75aa71bb2d9e7140cd72f29451fa234a902a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Aug 2013 09:36:22 +0000 Subject: format: decouple from soxi We'll be supporting reading the format from avprobe and ffprobe, so we should avoid tying ourselves to soxi --- test/test_format.rb | 14 -------------- test/test_source_sox.rb | 13 +++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test_format.rb b/test/test_format.rb index ba039a7..00fb3e3 100644 --- a/test/test_format.rb +++ b/test/test_format.rb @@ -34,20 +34,6 @@ class TestFormat < Minitest::Unit::TestCase assert_nil hash["channels"] end - def test_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::Format.new - fmt.from_file tmp.path - assert_equal 96000, fmt.rate - assert_equal 2, fmt.channels - tmp.unlink - end - end - def test_bytes_per_sample fmt = DTAS::Format.new assert_equal 4, fmt.bytes_per_sample 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 -- cgit v1.2.3-24-ge0c7