about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-09-10 09:21:17 +0000
committerEric Wong <normalperson@yhbt.net>2013-09-10 10:10:17 +0000
commit699a1217fbfa06b0cde58e4430a35825c384167f (patch)
tree1dba4fdcaf4f12f55456db95774218c6f918815a /test
parenta910d2ce86fa2cee0bed31e801173a981330fac1 (diff)
downloaddtas-699a1217fbfa06b0cde58e4430a35825c384167f.tar.gz
These are common output targets, at least for my workflow.
Diffstat (limited to 'test')
-rw-r--r--test/test_splitfx.rb36
1 files changed, 33 insertions, 3 deletions
diff --git a/test/test_splitfx.rb b/test/test_splitfx.rb
index 9408f66..9ba4664 100644
--- a/test/test_splitfx.rb
+++ b/test/test_splitfx.rb
@@ -27,12 +27,13 @@ class TestSplitfx < Testcase
         assert system(cmd), cmd.inspect
         sfx.import(hash, {})
         opts = { jobs: nil, silent: true }
-        WAIT_ALL_MTX.synchronize do
-          sfx.run("flac", opts)
-        end
+
+        # ensure default FLAC target works
+        WAIT_ALL_MTX.synchronize { sfx.run("flac", opts) }
         expect = %w(1.flac 2.flac foo.flac)
         assert_equal expect, Dir["*.flac"].sort
 
+        # compare results with expected output
         res_cmd = "sox 1.flac 2.flac -ts32 -c2 -r44100 result.s32"
         res_pid = fork { exec res_cmd }
         exp_cmd = "sox foo.flac -ts32 -c2 -r44100 expect.s32 trim 4"
@@ -43,6 +44,35 @@ class TestSplitfx < Testcase
         assert s.success?, "#{exp_cmd}: #{s.inspect}"
         cmp = "cmp result.s32 expect.s32"
         assert system(cmp), cmp
+
+        # try Ogg Opus, use opusenc/opusdec for now since that's available
+        # in Debian 7.0 (sox.git currently has opusfile support, but that
+        # hasn't made it into Debian, yet)
+        if `which opusenc 2>/dev/null`.size > 0 &&
+           `which opusdec 2>/dev/null`.size > 0
+          err = $stderr.dup
+          begin
+            $stderr.reopen("/dev/null", "a")
+            WAIT_ALL_MTX.synchronize { sfx.run("opus", opts) }
+          ensure
+            $stderr.reopen(err)
+          end
+
+          # ensure opus lengths match flac ones, we decode using opusdec
+          # since sox does not yet have opus support in Debian 7.0
+          %w(1 2).each do |nr|
+            cmd = "opusdec #{nr}.opus #{nr}.wav 2>/dev/null"
+            assert system(cmd), cmd
+            assert_equal `soxi -D #{nr}.flac`, `soxi -D #{nr}.wav`
+          end
+        end
+
+        # ensure 16/44.1kHz FLAC works (CDDA-like)
+        File.unlink('1.flac', '2.flac')
+        WAIT_ALL_MTX.synchronize { sfx.run("flac-cdda", opts) }
+        %w(1 2).each do |nr|
+          assert_equal `soxi -D #{nr}.flac`, `soxi -D #{nr}.wav`
+        end
       end
     end
   end