about summary refs log tree commit homepage
path: root/test/test_rg_state.rb
blob: 72ff45fe525e67600653ef8967694ed9f048bc83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- encoding: binary -*-
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# 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