test/import/test_flame_import.rb in tracksperanto-2.6.0 vs test/import/test_flame_import.rb in tracksperanto-2.6.1
- old
+ new
@@ -1,90 +1,10 @@
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
class FlameImportTest < Test::Unit::TestCase
DELTA = 0.1
- BLOCK_WITH_NO_KF = %{Channel tracker1/ref/width
- Extrapolation constant
- Value 10
- Colour 50 50 50
- End
- }
- BLOCK_WITH_KEYFRAMES = %{
- Channel tracker1/ref/dx
- Extrapolation constant
- Value 0
- Size 5
- KeyVersion 1
- Key 0
- Frame 0
- Value 0
- ValueLock yes
- DeleteLock yes
- Interpolation constant
- End
- Key 1
- Frame 1
- Value 0
- Interpolation constant
- RightSlope -1.9947
- LeftSlope -1.9947
- End
- Key 2
- Frame 44
- Value -87.7668
- FrameLock yes
- Interpolation constant
- RightSlope -2.31503
- LeftSlope -2.31503
- End
- Key 3
- Frame 74
- Value -168.997
- FrameLock yes
- Interpolation constant
- RightSlope -2.24203
- LeftSlope -2.24203
- End
- Key 4
- Frame 115
- Value -246.951
- FrameLock yes
- Interpolation constant
- End
- Colour 50 50 50
- End
- }
-
- def test_channel_block_for_channel_without_keyframes
- io = StringIO.new(BLOCK_WITH_NO_KF)
- first_line = io.gets
- name = "foo/bar"
- c = Tracksperanto::Import::FlameStabilizer::ChannelBlock.new(io, name)
-
- assert_equal 0, c.length
- assert_in_delta 10.0, c.base_value, DELTA
- end
- def test_channel_block_for_channel_with_5_keyframes
- io = StringIO.new(BLOCK_WITH_KEYFRAMES)
- first_line = io.gets
- name = "foo/bar"
- c = Tracksperanto::Import::FlameStabilizer::ChannelBlock.new(io, name)
-
- assert_equal 5, c.length
-
- first_key = c[0]
- assert_in_delta 0.0, first_key[1], DELTA
- assert_equal 0, first_key[0]
-
- key_four = c[4]
- assert_not_nil key_four, "The last keyframe should not be nil"
-
- assert_in_delta -246.951, key_four[1], DELTA
- assert_equal 115, key_four[0]
- end
-
def test_parsing_from_flame
fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/hugeFlameSetup.stabilizer')
parser = Tracksperanto::Import::FlameStabilizer.new(:io => fixture)
trackers = parser.to_a
@@ -162,7 +82,15 @@
fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/Flame_Stabilizer_2012.stabilizer')
trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a
assert_equal 5, trackers.length
assert_equal 61, trackers[0].length
+ end
+
+ # a failing setup from flame 2012
+ def test_from_flame2012
+ fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/flame_2012_another.stabilizer')
+ trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a
+ assert_equal 1, trackers.length
+ assert_equal 100, trackers[0].length
end
end
\ No newline at end of file