about summary refs log tree commit homepage
path: root/test/test_rg_state.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-24 09:54:45 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-24 09:54:45 +0000
commit3e09ac0c10c95bb24a08af62393b4f761e2743d0 (patch)
tree778dffa2ba8798503fc047db0feef6d65426ea22 /test/test_rg_state.rb
downloaddtas-3e09ac0c10c95bb24a08af62393b4f761e2743d0.tar.gz
Diffstat (limited to 'test/test_rg_state.rb')
-rw-r--r--test/test_rg_state.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test_rg_state.rb b/test/test_rg_state.rb
new file mode 100644
index 0000000..f591ac8
--- /dev/null
+++ b/test/test_rg_state.rb
@@ -0,0 +1,32 @@
+# -*- encoding: binary -*-
+# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net>
+# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+require './test/helper'
+require 'dtas/rg_state'
+
+class TestRGState < Minitest::Unit::TestCase
+
+  def test_rg_state
+    rg = DTAS::RGState.new
+    assert_equal({}, rg.to_hsh)
+    rg.preamp = 0.1
+    assert_equal({"preamp" => 0.1}, rg.to_hsh)
+    rg.preamp = 0
+    assert_equal({}, rg.to_hsh)
+  end
+
+  def test_load
+    rg = DTAS::RGState.load("preamp" => 0.666)
+    assert_equal({"preamp" => 0.666}, rg.to_hsh)
+  end
+
+  def test_mode_set
+    rg = DTAS::RGState.new
+    orig = rg.mode
+    assert_equal DTAS::RGState::RG_DEFAULT["mode"], orig
+    %w(album_gain track_gain album_peak track_peak).each do |t|
+      rg.mode = t
+      assert_equal t, rg.mode
+    end
+  end
+end