tracksperanto 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/.gemtest +0 -0
  2. data/DEVELOPER_DOCS.rdoc +41 -39
  3. data/History.txt +7 -0
  4. data/Manifest.txt +3 -1
  5. data/{README.txt → README.rdoc} +11 -13
  6. data/Rakefile +3 -1
  7. data/lib/export/nuke_script.rb +3 -2
  8. data/lib/import/base.rb +20 -31
  9. data/lib/import/boujou.rb +4 -4
  10. data/lib/import/equalizer3.rb +5 -5
  11. data/lib/import/equalizer4.rb +3 -4
  12. data/lib/import/flame_stabilizer.rb +8 -20
  13. data/lib/import/match_mover.rb +3 -4
  14. data/lib/import/maya_live.rb +4 -4
  15. data/lib/import/nuke_grammar/utils.rb +32 -0
  16. data/lib/import/nuke_script.rb +7 -37
  17. data/lib/import/pftrack.rb +5 -5
  18. data/lib/import/shake_grammar/lexer.rb +3 -0
  19. data/lib/import/shake_script.rb +7 -4
  20. data/lib/import/shake_text.rb +4 -4
  21. data/lib/import/syntheyes.rb +4 -4
  22. data/lib/pipeline/base.rb +19 -11
  23. data/lib/tracksperanto.rb +1 -1
  24. data/lib/tracksperanto/accumulator.rb +45 -19
  25. data/lib/tracksperanto/buffer_io.rb +3 -2
  26. data/lib/tracksperanto/const_name.rb +2 -0
  27. data/lib/tracksperanto/progressive_io.rb +3 -1
  28. data/lib/tracksperanto/tracker.rb +2 -1
  29. data/lib/tracksperanto/uv_coordinates.rb +3 -1
  30. data/lib/tracksperanto/zip_tuples.rb +2 -1
  31. data/test/helper.rb +0 -5
  32. data/test/import/samples/shake_script/shake_tracker_nodes.shk +11 -299
  33. data/test/import/test_3de_import.rb +2 -5
  34. data/test/import/test_3de_import3.rb +2 -2
  35. data/test/import/test_boujou_import.rb +2 -2
  36. data/test/import/test_flame_import.rb +9 -8
  37. data/test/import/test_match_mover_import.rb +2 -4
  38. data/test/import/test_maya_live_import.rb +5 -4
  39. data/test/import/test_nuke_import.rb +20 -16
  40. data/test/import/test_pftrack_import.rb +10 -8
  41. data/test/import/test_shake_script_import.rb +12 -22
  42. data/test/import/test_shake_text_import.rb +2 -2
  43. data/test/import/test_syntheyes_import.rb +7 -8
  44. data/test/test_accumulator.rb +31 -0
  45. data/test/test_cli.rb +2 -2
  46. metadata +18 -13
@@ -12,11 +12,8 @@ class EqualizerImportTest < Test::Unit::TestCase
12
12
  def test_parsing_from_importable
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/3de_v4/3de_export_cube.txt')
14
14
 
15
- parser = Tracksperanto::Import::Equalizer4.new
16
- parser.width = 1024
17
- parser.height = 512
18
- trackers = parser.parse(fixture)
19
-
15
+ parser = Tracksperanto::Import::Equalizer4.new(:io => fixture, :width => 1024, :height => 512)
16
+ trackers = parser.to_a
20
17
  assert_equal 8, trackers.length
21
18
 
22
19
  first_t = trackers[0]
@@ -12,8 +12,8 @@ class Equalizer3ImportTest < Test::Unit::TestCase
12
12
  def test_parsing_from_importable
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/3de_v3/3de_export_v3.txt')
14
14
 
15
- parser = Tracksperanto::Import::Equalizer3.new
16
- trackers = parser.parse(fixture)
15
+ parser = Tracksperanto::Import::Equalizer3.new(:io => fixture)
16
+ trackers = parser.to_a
17
17
 
18
18
  assert_equal 2048, parser.width
19
19
  assert_equal 778, parser.height
@@ -12,8 +12,8 @@ class BoujouImportTest < Test::Unit::TestCase
12
12
  def test_parsing_from_fixture
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/boujou_features_text/boujou_txt_export.txt')
14
14
 
15
- parser = Tracksperanto::Import::Boujou.new(:width => 2560, :height => 1200)
16
- trackers = parser.parse(fixture)
15
+ parser = Tracksperanto::Import::Boujou.new(:io => fixture, :width => 2560, :height => 1200)
16
+ trackers = parser.to_a
17
17
 
18
18
  assert_equal 21, trackers.length
19
19
 
@@ -86,9 +86,9 @@ class FlameImportTest < Test::Unit::TestCase
86
86
  def test_parsing_from_flame
87
87
  fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/hugeFlameSetup.stabilizer')
88
88
 
89
- parser = Tracksperanto::Import::FlameStabilizer.new
89
+ parser = Tracksperanto::Import::FlameStabilizer.new(:io => fixture)
90
+ trackers = parser.to_a
90
91
 
91
- trackers = parser.parse(fixture)
92
92
  assert_equal 2048, parser.width
93
93
  assert_equal 1176, parser.height
94
94
 
@@ -115,9 +115,9 @@ class FlameImportTest < Test::Unit::TestCase
115
115
  def test_parsing_another_track
116
116
  fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/megaTrack.action.3dtrack.stabilizer')
117
117
 
118
- parser = Tracksperanto::Import::FlameStabilizer.new
118
+ parser = Tracksperanto::Import::FlameStabilizer.new(:io => fixture)
119
+ trackers = parser.to_a
119
120
 
120
- trackers = parser.parse(fixture)
121
121
  assert_equal 1920, parser.width
122
122
  assert_equal 1080, parser.height
123
123
 
@@ -127,9 +127,9 @@ class FlameImportTest < Test::Unit::TestCase
127
127
  def test_simple_from_combustion
128
128
  fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer')
129
129
 
130
- parser = Tracksperanto::Import::FlameStabilizer.new
130
+ parser = Tracksperanto::Import::FlameStabilizer.new(:io => fixture)
131
+ trackers = parser.to_a
131
132
 
132
- trackers = parser.parse(fixture)
133
133
  assert_equal 1280, parser.width
134
134
  assert_equal 540, parser.height
135
135
 
@@ -151,8 +151,9 @@ class FlameImportTest < Test::Unit::TestCase
151
151
 
152
152
  def test_from_tracksperanto
153
153
  fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/fromTracksperanto.stabilizer')
154
- parser = Tracksperanto::Import::FlameStabilizer.new
155
- trackers = parser.parse(fixture)
154
+ parser = Tracksperanto::Import::FlameStabilizer.new(:io => fixture)
155
+ trackers = parser.to_a
156
+
156
157
  assert_equal 3, trackers.length
157
158
  assert_equal 3, trackers[0].length
158
159
  end
@@ -14,11 +14,9 @@ class MatchMoverImportTest < Test::Unit::TestCase
14
14
  def test_parsing_from_matchmover
15
15
  fixture = File.open(P)
16
16
 
17
- parser = Tracksperanto::Import::MatchMover.new
18
- parser.width = 2048
19
- parser.height = 1176
17
+ parser = Tracksperanto::Import::MatchMover.new(:io => fixture, :width => 2048, :height => 1176)
18
+ trackers = parser.to_a
20
19
 
21
- trackers = parser.parse(fixture)
22
20
  assert_equal 2560, parser.width
23
21
  assert_equal 1080, parser.height
24
22
 
@@ -12,8 +12,8 @@ class MayaLiveImportTest < Test::Unit::TestCase
12
12
  def test_parse_file
13
13
  f = File.open(File.dirname(__FILE__) + "/samples/mayalive/mayalive_kipShot.txt")
14
14
 
15
- p = Tracksperanto::Import::MayaLive.new
16
- trackers = p.parse(f)
15
+ p = Tracksperanto::Import::MayaLive.new(:io => f)
16
+ trackers = p.to_a
17
17
 
18
18
  assert_in_delta 2.37, p.aspect, DELTA
19
19
  assert_equal 1280, p.width
@@ -34,9 +34,10 @@ class MayaLiveImportTest < Test::Unit::TestCase
34
34
  def test_parse_file_with_custom_aspect
35
35
  f = File.open(File.dirname(__FILE__) + "/samples/mayalive/mayalive_kipShot.txt")
36
36
 
37
- p = Tracksperanto::Import::MayaLive.new
37
+ p = Tracksperanto::Import::MayaLive.new(:io => f)
38
38
  p.aspect = 1.78
39
- trackers = p.parse(f)
39
+ trackers = p.to_a
40
+
40
41
  assert_in_delta 1.78, p.aspect, DELTA
41
42
 
42
43
  assert_equal 1280, p.width
@@ -11,21 +11,22 @@ class NukeImportTest < Test::Unit::TestCase
11
11
 
12
12
  def test_parsing_big_file_from_nuke
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/45trackers.nk')
14
- parser = Tracksperanto::Import::NukeScript.new
14
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
15
15
  parser.width = 2048
16
16
  parser.height = 1176
17
- trackers = parser.parse(fixture)
17
+
18
+ trackers = parser.to_a
18
19
  assert_equal 45, trackers.length
19
20
  end
20
21
 
21
22
  def test_parsing_from_nuke
22
23
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/one_tracker_with_break.nk')
23
24
 
24
- parser = Tracksperanto::Import::NukeScript.new
25
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
25
26
  parser.width = 2048
26
27
  parser.height = 1176
27
28
 
28
- trackers = parser.parse(fixture)
29
+ trackers = parser.to_a
29
30
 
30
31
  assert_equal 2, trackers.length
31
32
  sec_tracker = trackers[1]
@@ -37,19 +38,21 @@ class NukeImportTest < Test::Unit::TestCase
37
38
 
38
39
  def test_parsing_many_tracks_per_node
39
40
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/018.nk')
40
- parser = Tracksperanto::Import::NukeScript.new
41
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
41
42
  parser.width = 1920
42
43
  parser.height = 1080
43
- trackers = parser.parse(fixture)
44
+ trackers = parser.to_a
45
+
44
46
  assert_equal 21, trackers.length
45
47
  end
46
48
 
47
49
  def test_parsing_node_with_gaps
48
50
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/tracker_with_differing_gaps.nk')
49
- parser = Tracksperanto::Import::NukeScript.new
51
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
50
52
  parser.width = 2048
51
53
  parser.height = 3112
52
- trackers = parser.parse(fixture)
54
+
55
+ trackers = parser.to_a
53
56
  assert_equal 1, trackers.length
54
57
  t = trackers[0]
55
58
  assert_equal 45, t.length
@@ -62,10 +65,10 @@ class NukeImportTest < Test::Unit::TestCase
62
65
 
63
66
  def test_parsing_node_with_succesive_gaps_larger_than_one_frame
64
67
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/tracker_with_repeating_gaps.nk')
65
- parser = Tracksperanto::Import::NukeScript.new
68
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
66
69
  parser.width = 2048
67
70
  parser.height = 1556
68
- trackers = parser.parse(fixture)
71
+ trackers = parser.to_a
69
72
  assert_equal 1, trackers.length
70
73
  t = trackers[0]
71
74
  assert_equal 5, t[3].frame
@@ -76,11 +79,11 @@ class NukeImportTest < Test::Unit::TestCase
76
79
  def test_parsing_from_nuke_group
77
80
  fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/one_tracker_with_break_in_grp.nk')
78
81
 
79
- parser = Tracksperanto::Import::NukeScript.new
82
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
80
83
  parser.width = 2048
81
84
  parser.height = 1176
82
85
 
83
- trackers = parser.parse(fixture)
86
+ trackers = parser.to_a
84
87
  assert_equal 2, trackers.length
85
88
 
86
89
  sec_tracker = trackers[1]
@@ -92,9 +95,10 @@ class NukeImportTest < Test::Unit::TestCase
92
95
 
93
96
  def test_parsing_nuke_curve
94
97
  curve = '{curve x742 888 890.2463989 891.6602783 \
95
- 893.5056763 895.6155396 s95 897.2791748 899.1762695 x754 912.0731812 x755 913.7190552 916.0959473 918.1025391 920.0751953 922.1898804}'
96
- p = Tracksperanto::Import::NukeScript.new
97
- result = p.send(:parse_curve, curve)
98
+ 893.5056763 895.6155396 s95 897.2791748 899.1762695 \
99
+ x754 912.0731812 x755 913.7190552 916.0959473 918.1025391 920.0751953 922.1898804}'
100
+ p = Tracksperanto::NukeGrammarUtils.new
101
+ result = p.parse_curve(curve)
98
102
  assert_kind_of Array, result
99
103
  assert_equal 13, result.length
100
104
  assert_equal 742, result[0][0]
@@ -104,7 +108,7 @@ class NukeImportTest < Test::Unit::TestCase
104
108
  def test_zip_channels
105
109
  tuples_x = [[1, 125], [3, 234], [5, 456], [9,876]]
106
110
  tuples_y = [[2, 437], [3, 123], [6, 432], [9, 430]]
107
- result = Tracksperanto::Import::NukeScript.new.send(:zip_curve_tuples, tuples_x, tuples_y)
111
+ result = Tracksperanto::Import::NukeScript.new(:io => StringIO.new).send(:zip_curve_tuples, tuples_x, tuples_y)
108
112
  assert_equal [[3, 234, 123], [9, 876, 430]], result
109
113
  end
110
114
  end
@@ -11,9 +11,9 @@ class PFTrackImportTest < Test::Unit::TestCase
11
11
 
12
12
  def test_parsing_from_pftrack5_with_digit_names
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack5/apft.2dt')
14
- parser = Tracksperanto::Import::PFTrack.new(:width => 1920, :height => 1080)
14
+ parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
15
15
 
16
- trackers = parser.parse(fixture)
16
+ trackers = parser.to_a
17
17
  assert_equal 4, trackers.length
18
18
  second_tracker = trackers[1]
19
19
  assert_equal "1015_Primary", second_tracker.name
@@ -23,11 +23,11 @@ class PFTrackImportTest < Test::Unit::TestCase
23
23
 
24
24
  fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack4/sourcefile_pftrack.2dt')
25
25
 
26
- parser = Tracksperanto::Import::PFTrack.new
26
+ parser = Tracksperanto::Import::PFTrack.new(:io => fixture)
27
27
  parser.width = 2560
28
28
  parser.height = 1080
29
29
 
30
- trackers = parser.parse(fixture)
30
+ trackers = parser.to_a
31
31
  assert_equal 43, trackers.length
32
32
 
33
33
  first_kf = trackers[0].keyframes[0]
@@ -50,8 +50,9 @@ class PFTrackImportTest < Test::Unit::TestCase
50
50
 
51
51
  def test_garage_shot_from_pftrack_5
52
52
  fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack5/garage.2dt')
53
- parser = Tracksperanto::Import::PFTrack.new(:width => 1920, :height => 1080)
54
- trackers = parser.parse(fixture)
53
+ parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
54
+
55
+ trackers = parser.to_a
55
56
  assert_equal 250, trackers.length
56
57
  assert_equal "Tracker121_Primary", trackers[0].name
57
58
  assert_equal 189, trackers[0].length
@@ -59,8 +60,9 @@ class PFTrackImportTest < Test::Unit::TestCase
59
60
 
60
61
  def test_pfmatchit_file
61
62
  fixture = File.open(File.dirname(__FILE__) + '/samples/pfmatchit/pfmatchit_example.2dt')
62
- parser = Tracksperanto::Import::PFTrack.new(:width => 1920, :height => 1080)
63
- trackers = parser.parse(fixture)
63
+ parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
64
+
65
+ trackers = parser.to_a
64
66
  assert_equal 2, trackers.length
65
67
  assert_equal "Feature1_1", trackers[0].name
66
68
  assert_equal 37, trackers[0].length
@@ -6,8 +6,8 @@ class ShakeScriptImportTest < Test::Unit::TestCase
6
6
  def test_parsing_fifty_tracker_nodes_with_one_track_each
7
7
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_tracker_nodes.shk')
8
8
 
9
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
10
- assert_equal 50, trackers.length
9
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
10
+ assert_equal 26, trackers.length
11
11
 
12
12
  t = trackers[-1]
13
13
  assert_equal "Tracker8_track1", t.name
@@ -26,7 +26,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
26
26
  def test_parse_tracker_node_with_no_animation
27
27
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_tracker_with_no_anim.shk')
28
28
  assert_nothing_raised do
29
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
29
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
30
30
  assert_equal 0, trackers.length
31
31
  end
32
32
  end
@@ -34,7 +34,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
34
34
  def test_parsing_two_tracks_in_one_tracker_node
35
35
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/two_tracks_in_one_tracker.shk')
36
36
 
37
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
37
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
38
38
  assert_equal 2, trackers.length
39
39
 
40
40
  t = trackers[0]
@@ -57,7 +57,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
57
57
  def test_parsing_three_tracks_in_one_stabilizer_node
58
58
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/three_tracks_in_one_stabilizer.shk')
59
59
 
60
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
60
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
61
61
  ft = trackers[0]
62
62
  assert_equal "Stabilize1_track1", ft.name
63
63
  assert_equal 3, trackers.length
@@ -66,7 +66,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
66
66
  def test_parsing_four_tracks_in_one_stabilizer_node
67
67
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/four_tracks_in_one_stabilizer.shk')
68
68
 
69
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
69
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
70
70
  ft = trackers[0]
71
71
  assert_equal "Stabilize2_track1", ft.name
72
72
  assert_equal 4, trackers.length
@@ -75,7 +75,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
75
75
  def test_parsing_four_tracks_in_one_matchmove_node
76
76
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/four_tracks_in_one_matchmove.shk')
77
77
 
78
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
78
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
79
79
  assert_equal 4, trackers.length
80
80
 
81
81
  ft = trackers[0]
@@ -85,21 +85,21 @@ class ShakeScriptImportTest < Test::Unit::TestCase
85
85
  def test_parsing_from_nspline_curves
86
86
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_trackers_with_Nspline.shk')
87
87
 
88
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
88
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
89
89
  assert_equal 3, trackers.length
90
90
  assert_equal 160, trackers[0].length
91
91
  end
92
92
 
93
93
  def test_boujou_exported_script
94
94
  fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/shake_script_from_boujou.shk")
95
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
95
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
96
96
  assert_equal 1, trackers.length
97
97
  assert_equal 387, trackers[0].length
98
98
  end
99
99
 
100
100
  def test_hermite_interpolation
101
101
  fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/stabilize_nodes_with_hermite.shk")
102
- trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
102
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
103
103
  assert_equal 3, trackers.length
104
104
  last_t = trackers[0]
105
105
  assert_equal "Stabilize1_track1", last_t.name
@@ -113,24 +113,14 @@ class ShakeScriptImportTest < Test::Unit::TestCase
113
113
 
114
114
  def test_file_from_matchmover
115
115
  fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/from_matchmover.shk")
116
- trackers = Tracksperanto::Import::ShakeScript.new(:width => 1920, :height => 1080).parse(fixture)
116
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 1920, :height => 1080).to_a
117
117
  assert_equal 8, trackers.length
118
118
  end
119
119
 
120
120
  def test_tracker_node_from_stoneage_shake_version
121
121
  fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/oldTrackerNode.shk")
122
- p = Tracksperanto::Import::ShakeScript.new(:width => 5000, :height => 5000)
123
- trackers = p.parse(fixture)
122
+ trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 5000, :height => 5000).to_a
124
123
  assert_equal 1, trackers.length
125
124
  assert_equal 850, trackers[0].length
126
125
  end
127
-
128
- def test_script_with_stabilizer_node_without_animation
129
- fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/track.shk")
130
- p = Tracksperanto::Import::ShakeScript.new(:width => 1920, :height => 1080)
131
- trackers = p.parse(fixture)
132
- assert_equal 2, trackers.length
133
- assert_equal 261, trackers[0].length
134
- end
135
-
136
126
  end
@@ -11,7 +11,7 @@ class ShakeTextImportTest < Test::Unit::TestCase
11
11
 
12
12
  def test_parsing
13
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_text/one_shake_tracker.txt')
14
- trackers = Tracksperanto::Import::ShakeText.new.parse(fixture)
14
+ trackers = Tracksperanto::Import::ShakeText.new(:io => fixture).to_a
15
15
 
16
16
  assert_kind_of Enumerable, trackers
17
17
  assert_equal 1, trackers.length
@@ -31,7 +31,7 @@ class ShakeTextImportTest < Test::Unit::TestCase
31
31
 
32
32
  def test_parsing_two_trackers
33
33
  fixture = File.open(File.dirname(__FILE__) + '/samples/shake_text/two_shake_trackers.txt')
34
- trackers = Tracksperanto::Import::ShakeText.new.parse(fixture)
34
+ trackers = Tracksperanto::Import::ShakeText.new(:io => fixture).to_a
35
35
 
36
36
  assert_kind_of Enumerable, trackers
37
37
  assert_equal 2, trackers.length
@@ -2,6 +2,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../helper'
2
2
 
3
3
  class SyntheyesImportTest < Test::Unit::TestCase
4
4
  DELTA = 0.9 # our SynthEyes sample is somewhat inaccurate :-P
5
+
5
6
  def test_introspects_properly
6
7
  i = Tracksperanto::Import::Syntheyes
7
8
  assert_equal "Syntheyes 2D tracker paths file", i.human_name
@@ -10,9 +11,8 @@ class SyntheyesImportTest < Test::Unit::TestCase
10
11
 
11
12
  def test_parsing_from_importable
12
13
  fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/shake_tracker_nodes_to_syntheyes.txt')
13
- parser = Tracksperanto::Import::Syntheyes.new(:width => 2560, :height => 1080)
14
+ trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 2560, :height => 1080).to_a
14
15
 
15
- trackers = parser.parse(fixture)
16
16
  assert_equal 50, trackers.length
17
17
 
18
18
  first_kf = trackers[0].keyframes[0]
@@ -27,24 +27,23 @@ class SyntheyesImportTest < Test::Unit::TestCase
27
27
 
28
28
  def test_parsing_cola_plate
29
29
  fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/cola_plate.txt')
30
- parser = Tracksperanto::Import::Syntheyes.new(:width => 1920, :height => 1080)
30
+ trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
31
31
 
32
- trackers = parser.parse(fixture)
33
32
  assert_equal 6, trackers.length
34
33
  end
35
34
 
36
35
  def test_parsing_with_one_tracker
37
36
  fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/one_tracker.txt')
38
- parser = Tracksperanto::Import::Syntheyes.new(:width => 1920, :height => 1080)
39
- trackers = parser.parse(fixture)
37
+ trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
38
+
40
39
  assert_equal 1, trackers.length
41
40
  assert_equal 49, trackers[0].length
42
41
  end
43
42
 
44
43
  def test_parsing_from_sy_2010
45
44
  fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/morePoints_sy2010.txt')
46
- parser = Tracksperanto::Import::Syntheyes.new(:width => 1920, :height => 1080)
47
- trackers = parser.parse(fixture)
45
+ trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
46
+
48
47
  assert_equal 26, trackers.length
49
48
  end
50
49
  end