framecurve 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ # http://framecurve.org/specification-v1
2
+ # at_frame use_frame_of_source
3
+ -1 -123.45
@@ -0,0 +1,2 @@
1
+ # http://framecurve.org/specification-v1
2
+ # at_frame use_frame_of_source
@@ -0,0 +1,6 @@
1
+ # http://framecurve.org/specification-v1
2
+ # at_frame use_frame_of_source
3
+ 1 1
4
+ 5 12.34
5
+ 9 15.678
6
+ 15 25.764
@@ -0,0 +1,6 @@
1
+ # http://framecurve.org/specification-v1
2
+ # at_frame use_frame_of_source
3
+ 1 1
4
+ 5 12.34
5
+ 9 15.678
6
+ 15 25.764
@@ -0,0 +1,39 @@
1
+ require 'helper'
2
+ require "fileutils"
3
+
4
+ class TestFramecurveFromFCPXML < Test::Unit::TestCase
5
+ BINARY = File.expand_path(File.dirname(__FILE__) + "/../bin/framecurve_from_fcp_xml")
6
+ FILE_PATH = File.expand_path(File.dirname(__FILE__) + "/fixtures/fcp_xml/CountDOWN.xml")
7
+ HERE = File.expand_path(File.dirname(__FILE__))
8
+
9
+ # Run the binary under test with passed options, and return [exit_code, stdout_content, stderr_content]
10
+ def cli(commandline_arguments)
11
+ CLITest.new(BINARY).run(commandline_arguments)
12
+ end
13
+
14
+ def teardown
15
+ Dir.glob(File.dirname(FILE_PATH) + "/*.framecurve.txt").each do | f |
16
+ File.unlink(f)
17
+ end
18
+ end
19
+
20
+ def test_cli_with_valid_file
21
+ s, o, e = cli(FILE_PATH)
22
+
23
+ assert_equal 0, s
24
+ assert e.include?("timewarp")
25
+
26
+ curve = Framecurve::Parser.new.parse(HERE + "/fixtures/fcp_xml/CountDOWN.xml.SEQ1-V1-CLIP1.framecurve.txt")
27
+
28
+ assert_equal 11, curve.length
29
+ assert_match /From FCP XML/, curve[2].text
30
+ assert_equal "Information from /xmeml/project/children/sequence/media/video/track/clipitem[1]", curve[3].text
31
+ assert_equal Framecurve::Tuple.new(1, 13.0), curve[4]
32
+ assert_equal Framecurve::Tuple.new(51, 63.0), curve[-1]
33
+
34
+ curve2 = Framecurve::Parser.new.parse(HERE + "/fixtures/fcp_xml/CountDOWN.xml.SEQ1-V1-CLIP3.framecurve.txt")
35
+ assert_equal 11, curve.length
36
+
37
+ end
38
+
39
+ end
@@ -1,17 +1,35 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestFramecurveSerializer < Test::Unit::TestCase
4
- def test_output
4
+ def test_writes_preamble_if_needed
5
5
  f = Framecurve::Curve.new(Framecurve::Tuple.new(10, 123))
6
6
  s = StringIO.new
7
7
  Framecurve::Serializer.new.serialize(s, f)
8
8
  assert_equal "# http://framecurve.org/specification-v1\n# at_frame\tuse_frame_of_source\n10\t123.00000\r\n", s.string
9
9
  end
10
10
 
11
- def test_materializes_frames
11
+ def test_writes_only_existing_frames
12
12
  f = Framecurve::Curve.new(Framecurve::Tuple.new(10, 123), Framecurve::Tuple.new(12, 456))
13
13
  s = StringIO.new
14
+
14
15
  Framecurve::Serializer.new.serialize(s, f)
15
- assert_equal "# http://framecurve.org/specification-v1\n# at_frame\tuse_frame_of_source\n10\t123.00000\r\n11\t289.00000\r\n12\t456.00000\r\n", s.string
16
+ assert_equal "# http://framecurve.org/specification-v1\n# at_frame\tuse_frame_of_source\n10\t123.00000\r\n12\t456.00000\r\n", s.string
16
17
  end
18
+
19
+ def test_validate_and_serialize_with_invalid_input
20
+ f = Framecurve::Curve.new
21
+ s = StringIO.new
22
+ assert_raise(Framecurve::Malformed) do
23
+ Framecurve::Serializer.new.validate_and_serialize(s, f)
24
+ end
25
+ end
26
+
27
+ def test_validate_and_serialize_with_valid_input_works_without_errors
28
+ f = Framecurve::Curve.new(Framecurve::Tuple.new(10, 123))
29
+ s = StringIO.new
30
+
31
+ assert_nothing_raised { Framecurve::Serializer.new.validate_and_serialize(s, f) }
32
+ assert_equal "# http://framecurve.org/specification-v1\n# at_frame\tuse_frame_of_source\n10\t123.00000\r\n", s.string
33
+ end
34
+
17
35
  end
@@ -77,12 +77,47 @@ class TestFramecurveValidator < Test::Unit::TestCase
77
77
  end
78
78
 
79
79
  def test_should_error_out_with_neg_source_and_dest_values
80
- c = Framecurve::Curve.new( Framecurve::Tuple.new(-10, 123.4), Framecurve::Tuple.new(1, -345.67) )
81
- v = Framecurve::Validator.new
82
- v.validate(c)
83
- assert v.any_errors?
84
- errs = ["The tuple 1 had a negative at_frame value (-10). The spec mandates positive frames.",
85
- "The tuple 2 had a negative use_frame_of_source value (-345.67000). The spec mandates positive frames."]
86
- assert_equal errs, v.errors
87
- end
80
+ c = Framecurve::Curve.new( Framecurve::Tuple.new(-10, 123.4), Framecurve::Tuple.new(1, -345.67) )
81
+ v = Framecurve::Validator.new
82
+ v.validate(c)
83
+ assert v.any_errors?
84
+ errs = ["The line 1 had it's at_frame value (-10) below 1. The spec mandates at_frame >= 1.",
85
+ "The line 2 had a use_frame_of_source value (-345.67000) below 0. The spec mandates use_frame_of_source >= 0."]
86
+ assert_equal errs, v.errors
87
+ end
88
+
89
+ def test_parse_from_err_bad_extension
90
+ v = Framecurve::Validator.new
91
+ v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/incorrect.extension")
92
+ assert_equal ["The framecurve file has to have the .framecurve.txt double extension, but had \".extension\""], v.errors
93
+ end
94
+
95
+ def test_parse_from_err_neg_frames
96
+ v = Framecurve::Validator.new
97
+ v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/err-neg-frames.framecurve.txt")
98
+ assert_equal ["The line 3 had it's at_frame value (-1) below 1. The spec mandates at_frame >= 1."], v.errors
99
+ end
100
+
101
+ def test_parse_from_err_no_tuples
102
+ v = Framecurve::Validator.new
103
+ v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/err-no-tuples.framecurve.txt")
104
+ assert_equal ["The framecurve did not contain any frame correlation records"], v.errors
105
+ end
106
+
107
+ def test_should_warn_without_preamble_url
108
+ c = Framecurve::Curve.new( Framecurve::Tuple.new(10, 123.4))
109
+ v = Framecurve::Validator.new
110
+ v.validate(c)
111
+ assert v.any_warnings?
112
+ assert_equal "It is recommended that a framecurve starts with a comment with the specification URL", v.warnings[0]
113
+ end
114
+
115
+ def test_should_warn_without_preamble_headers
116
+ c = Framecurve::Curve.new( Framecurve::Comment.new("http://framecurve.org/specification-v1"), Framecurve::Tuple.new(10, 123.4))
117
+ v = Framecurve::Validator.new
118
+ v.validate(c)
119
+ assert v.any_warnings?
120
+ assert_equal "It is recommended for the second comment to provide a column header", v.warnings[0]
121
+ end
122
+
88
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: framecurve
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-30 00:00:00.000000000 Z
12
+ date: 2012-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &10767710 !ruby/object:Gem::Requirement
16
+ requirement: &11839020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10767710
24
+ version_requirements: *11839020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &10767420 !ruby/object:Gem::Requirement
27
+ requirement: &11838780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.4
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *10767420
35
+ version_requirements: *11838780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &10767130 !ruby/object:Gem::Requirement
38
+ requirement: &11838540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *10767130
46
+ version_requirements: *11838540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cli_test
49
- requirement: &10766770 !ruby/object:Gem::Requirement
49
+ requirement: &11838300 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,11 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *10766770
57
+ version_requirements: *11838300
58
58
  description: ! ' Parser, validation and interpolation'
59
59
  email: me@julik.nl
60
60
  executables:
61
+ - framecurve_from_fcp_xml
61
62
  - framecurve_validator
62
63
  extensions: []
63
64
  extra_rdoc_files:
@@ -66,21 +67,31 @@ extra_rdoc_files:
66
67
  files:
67
68
  - .document
68
69
  - Gemfile
70
+ - History.txt
69
71
  - LICENSE.txt
70
72
  - README.rdoc
71
73
  - Rakefile
74
+ - bin/framecurve_from_fcp_xml
72
75
  - bin/framecurve_validator
73
76
  - framecurve.gemspec
74
77
  - lib/framecurve.rb
75
78
  - lib/framecurve/comment.rb
76
79
  - lib/framecurve/curve.rb
80
+ - lib/framecurve/extractors/fcp_xml.rb
81
+ - lib/framecurve/extractors/xml_bridge.rb
77
82
  - lib/framecurve/parser.rb
78
83
  - lib/framecurve/serializer.rb
79
84
  - lib/framecurve/tuple.rb
80
85
  - lib/framecurve/validator.rb
86
+ - test/fixtures/fcp_xml/CountDOWN.xml
87
+ - test/fixtures/framecurves/err-neg-frames.framecurve.txt
88
+ - test/fixtures/framecurves/err-no-tuples.framecurve.txt
89
+ - test/fixtures/framecurves/incorrect.extension
90
+ - test/fixtures/framecurves/sample_framecurve1.framecurve.txt
81
91
  - test/helper.rb
82
92
  - test/test_framecurve_comment.rb
83
93
  - test/test_framecurve_curve.rb
94
+ - test/test_framecurve_from_fcp_xml_binary.rb
84
95
  - test/test_framecurve_parser.rb
85
96
  - test/test_framecurve_serializer.rb
86
97
  - test/test_framecurve_tuple.rb