about summary refs log tree commit homepage
path: root/test/test_source_av.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-26 02:00:05 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-26 02:17:57 +0000
commit3d96e3d4a3ad7fbf45b38c81478f04cffb329e25 (patch)
treed5ec3b7db1316e1930980bf836feca70dfa233df /test/test_source_av.rb
parent6d67d9c2af57233743187a92b7e651174d6eb42b (diff)
downloaddtas-3d96e3d4a3ad7fbf45b38c81478f04cffb329e25.tar.gz
This should better prepare us to make "source ed" into
"source <av|sox> ed" and set per-source priorities.

We also now treat @env consistently for all per-source commands
(such as soxi/avprobe) so we can be sure we're using the same
installation of sox or libav if using a non-standard PATH, or if we
want to set AV_LOG_FORCE_NOCOLOR
Diffstat (limited to 'test/test_source_av.rb')
-rw-r--r--test/test_source_av.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test_source_av.rb b/test/test_source_av.rb
index 4dba559..78015b3 100644
--- a/test/test_source_av.rb
+++ b/test/test_source_av.rb
@@ -33,7 +33,7 @@ class TestSourceAv < Minitest::Unit::TestCase
 
     x(%W(metaflac --set-tag=FOO=BAR #{tmp.path}))
     x(%W(metaflac --add-replay-gain #{tmp.path}))
-    source = DTAS::Source::Av.new(tmp.path)
+    source = DTAS::Source::Av.new.try(tmp.path)
     assert_equal source.comments["FOO"], "BAR", source.inspect
     rg = source.replaygain
     assert_kind_of DTAS::ReplayGain, rg
@@ -60,7 +60,7 @@ class TestSourceAv < Minitest::Unit::TestCase
       end
     end
 
-    source = DTAS::Source::Av.new(a.path)
+    source = DTAS::Source::Av.new.try(a.path)
     rg = source.replaygain
     assert_kind_of DTAS::ReplayGain, rg
     assert_in_delta 0.0, rg.track_peak.to_f, 0.00000001
@@ -71,31 +71,31 @@ class TestSourceAv < Minitest::Unit::TestCase
 
   def test_offset
     tmp = new_file('flac') or return
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 5s))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 5s))
     assert_equal 5, source.offset_samples
 
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 1:00:00.5))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 1:00:00.5))
     expect = 1 * 60 * 60 * 44100 + (44100/2)
     assert_equal expect, source.offset_samples
 
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 1:10.5))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 1:10.5))
     expect = 1 * 60 * 44100 + (10 * 44100) + (44100/2)
     assert_equal expect, source.offset_samples
 
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 10.03))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 10.03))
     expect = (10 * 44100) + (44100 * 3/100.0)
     assert_equal expect, source.offset_samples
   end
 
   def test_offset_us
     tmp = new_file('flac') or return
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 441s))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 441s))
     assert_equal 10000.0, source.offset_us
 
-    source = DTAS::Source::Av.new(*%W(#{tmp.path} 22050s))
+    source = DTAS::Source::Av.new.try(*%W(#{tmp.path} 22050s))
     assert_equal 500000.0, source.offset_us
 
-    source = DTAS::Source::Av.new(tmp.path, '1')
+    source = DTAS::Source::Av.new.try(tmp.path, '1')
     assert_equal 1000000.0, source.offset_us
   end
 end