about summary refs log tree commit homepage
path: root/test/test_rg_integration.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-25 06:14:08 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-25 06:14:08 +0000
commit3fb233fd768f3dbce2a3073ba596458871cec93e (patch)
treeb113aba02bbf187a170f07a74259fe0f6f61bdd6 /test/test_rg_integration.rb
parent93a6944e23e30b3940c7fa8d7c0c9a042036ec05 (diff)
downloaddtas-3fb233fd768f3dbce2a3073ba596458871cec93e.tar.gz
We documented this behavior in dtas-player.txt but failed to
implement it.  Now our behavior matches the documentation!
Diffstat (limited to 'test/test_rg_integration.rb')
-rw-r--r--test/test_rg_integration.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_rg_integration.rb b/test/test_rg_integration.rb
index d8a8b85..b9ef2b9 100644
--- a/test/test_rg_integration.rb
+++ b/test/test_rg_integration.rb
@@ -114,4 +114,34 @@ class TestRgIntegration < Minitest::Unit::TestCase
 
     stop_playback(default_pid, s)
   end
+
+  def test_rg_env_in_source
+    s = client_socket
+    s.preq("rg mode=album_gain")
+    assert_equal "OK", s.readpartial(666)
+    pluck, len = tmp_pluck
+    cmd = DTAS::Source::SOURCE_DEFAULTS["command"]
+    fifo = tmpfifo
+    s.preq("source ed command='env > #{fifo}; #{cmd}'")
+    assert_equal "OK", s.readpartial(666)
+    s.preq("sink ed default command='cat >/dev/null' active=true")
+    assert_equal "OK", s.readpartial(666)
+    s.preq(%W(enq #{pluck.path}))
+    assert_equal "OK", s.readpartial(666)
+
+    rg = {}
+    File.readlines(fifo).each do |line|
+      line =~ /\AREPLAYGAIN_/ or next
+      k, v = line.chomp!.split(/=/)
+      rg[k] = v
+    end
+    expect = {
+      "REPLAYGAIN_TRACK_GAIN" => "-2",
+      "REPLAYGAIN_ALBUM_GAIN" => "-3.0",
+      "REPLAYGAIN_TRACK_PEAK" => "0.666",
+      "REPLAYGAIN_ALBUM_PEAK" => "0.999",
+      "REPLAYGAIN_REFERENCE_LOUDNESS" => nil
+    }
+    assert_equal expect, rg
+  end
 end