about summary refs log tree commit homepage
path: root/test/test_trimfx.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-13 08:54:05 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-13 08:57:06 +0000
commitbbd2a006152cce4e5fa28bb2793d239ebdfdb491 (patch)
treedd4569a64dc6ef337d9d06187fffdad8a25174c6 /test/test_trimfx.rb
parent36d6b71a4bcf476f3acda6b249486844d76128ef (diff)
downloaddtas-bbd2a006152cce4e5fa28bb2793d239ebdfdb491.tar.gz
This will allow editing individual portions of audio of
a larger file while creating cross fade effects to join
them.
Diffstat (limited to 'test/test_trimfx.rb')
-rw-r--r--test/test_trimfx.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_trimfx.rb b/test/test_trimfx.rb
new file mode 100644
index 0000000..107946f
--- /dev/null
+++ b/test/test_trimfx.rb
@@ -0,0 +1,35 @@
+# 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/trimfx'
+require 'yaml'
+
+class TestTrimFX < Testcase
+  def test_example
+    ex = YAML.load(File.read("examples/trimfx.sample.yml"))
+    effects = []
+    ex["effects"].each do |line|
+      words = Shellwords.split(line)
+      case words[0]
+      when "trim"
+        tfx = DTAS::TrimFX.new(words)
+        assert_equal 52.0, tfx.tbeg
+        assert_equal 1.0, tfx.tlen
+        effects << tfx
+      end
+    end
+    assert_equal 4, effects.size
+  end
+
+  def test_all
+    tfx = DTAS::TrimFX.new(%w(all))
+    assert_equal 0, tfx.tbeg
+    assert_nil tfx.tlen
+  end
+
+  def test_time
+    tfx = DTAS::TrimFX.new(%w(trim 2:30 3.1))
+    assert_equal 150, tfx.tbeg
+    assert_equal 3.1, tfx.tlen
+  end
+end