test/test_edl.rb in edl-0.1.3 vs test/test_edl.rb in edl-0.1.4
- old
+ new
@@ -1,15 +1,15 @@
+require "rubygems"
+require "bundler"
+Bundler.require(:default, :development)
+require 'flexmock/test_unit'
+
+
require File.dirname(__FILE__) + '/../lib/edl'
require File.dirname(__FILE__) + '/../lib/edl/cutter'
require File.dirname(__FILE__) + '/../lib/edl/grabber'
-require 'rubygems'
-require 'test/unit'
-require 'test/spec'
-require 'flexmock'
-require 'flexmock/test_unit'
-
TRAILER_EDL = File.dirname(__FILE__) + '/samples/TRAILER_EDL.edl'
SIMPLE_DISSOLVE = File.dirname(__FILE__) + '/samples/SIMPLE_DISSOLVE.EDL'
SPLICEME = File.dirname(__FILE__) + '/samples/SPLICEME.EDL'
SIMPLE_TIMEWARP = File.dirname(__FILE__) + '/samples/TIMEWARP.EDL'
SLOMO_TIMEWARP = File.dirname(__FILE__) + '/samples/TIMEWARP_HALF.EDL'
@@ -17,266 +17,260 @@
AVID_REVERSE = File.dirname(__FILE__) + '/samples/REVERSE.EDL'
SPEEDUP_AND_FADEOUT = File.dirname(__FILE__) + '/samples/SPEEDUP_AND_FADEOUT.EDL'
SPEEDUP_REVERSE_AND_FADEOUT = File.dirname(__FILE__) + '/samples/SPEEDUP_REVERSE_AND_FADEOUT.EDL'
FCP_REVERSE = File.dirname(__FILE__) + '/samples/FCP_REVERSE.EDL'
PLATES = File.dirname(__FILE__) + '/samples/PLATES.EDL'
+KEY = File.dirname(__FILE__) + '/samples/KEY_TRANSITION.EDL'
+CLIP_NAMES = File.dirname(__FILE__) + '/samples/REEL_IS_CLIP.txt'
class String
def tc(fps = Timecode::DEFAULT_FPS)
Timecode.parse(self, fps)
end
end
-context "An Event should" do
- specify "define the needed attributes" do
- evt = EDL::Event.new
- %w( num reel track src_start_tc src_end_tc rec_start_tc rec_end_tc ).each do | em |
- evt.should.respond_to em
- end
+class EDLTest < Test::Unit::TestCase
+
+ def assert_zero(v, message = "Should be zero")
+ assert v.zero?, message
end
- specify "support hash initialization" do
+context "An Event" do
+ should "support hash initialization" do
evt = EDL::Event.new(:src_start_tc => "01:00:00:00".tc)
- evt.src_start_tc.should.equal "01:00:00:00".tc
+ assert_equal "01:00:00:00".tc, evt.src_start_tc
end
- specify "support block initialization" do
+ should "support block initialization" do
evt = EDL::Event.new do | e |
e.src_start_tc = "01:00:00:04".tc
end
- evt.src_start_tc.should.equal "01:00:00:04".tc
+ assert_equal "01:00:00:04".tc, evt.src_start_tc
end
- specify "respond to ends_with_transition? with false if outgoing_transition_duration is zero" do
+ should "respond to ends_with_transition? with false if outgoing_transition_duration is zero" do
evt = EDL::Event.new
evt.outgoing_transition_duration = 0
- evt.ends_with_transition?.should.equal false
+ assert !evt.ends_with_transition?
end
-
- specify "respond to ends_with_transition? with true if outgoing_transition_duration set above zero" do
+
+ should "respond to ends_with_transition? with true if outgoing_transition_duration set above zero" do
evt = EDL::Event.new
evt.outgoing_transition_duration = 24
- evt.ends_with_transition?.should.equal true
+ assert evt.ends_with_transition?
end
-
- specify "respond to has_timewarp? with false if no timewarp assigned" do
+
+ should "respond to has_timewarp? with false if no timewarp assigned" do
evt = EDL::Event.new(:timewarp => nil)
- evt.has_timewarp?.should.equal false
+ assert !evt.has_timewarp?
end
- specify "respond to has_timewarp? with true if a timewarp is assigned" do
+ should "respond to has_timewarp? with true if a timewarp is assigned" do
evt = EDL::Event.new(:timewarp => true)
- evt.has_timewarp?.should.equal true
+ assert evt.has_timewarp?
end
-
- specify "report rec_length as a difference of record timecodes" do
+
+ should "report rec_length as a difference of record timecodes" do
evt = EDL::Event.new(:rec_start_tc => "1h".tc, :rec_end_tc => "1h 10s 2f".tc )
- evt.rec_length.should.equal "10s 2f".tc.to_i
+ assert_equal "10s 2f".tc.to_i, evt.rec_length
end
- specify "report rec_length_with_transition as a difference of record timecodes if no transition set" do
+ should "report rec_length_with_transition as a difference of record timecodes if no transition set" do
evt = EDL::Event.new(:rec_start_tc => "1h".tc, :rec_end_tc => "1h 10s 2f".tc, :outgoing_transition_duration => 0)
- evt.rec_length_with_transition.should.equal "10s 2f".tc.to_i
+ assert_equal "10s 2f".tc.to_i, evt.rec_length_with_transition
end
- specify "add transition length to rec_length_with_transition if a transition is set" do
+ should "add transition length to rec_length_with_transition if a transition is set" do
evt = EDL::Event.new(:rec_start_tc => "1h".tc, :rec_end_tc => "1h 10s 2f".tc, :outgoing_transition_duration => 10)
- evt.rec_length_with_transition.should.equal("10s 2f".tc.to_i + 10)
+ assert_equal "10s 2f".tc.to_i + 10, evt.rec_length_with_transition
end
- specify "return a default array for comments" do
- EDL::Event.new.comments.should.be.kind_of Enumerable
+ should "return a default array for comments" do
+ assert_kind_of Enumerable, EDL::Event.new.comments
end
- specify "respond false to has_transition? if incoming transition is set" do
- EDL::Event.new(:transition => nil).has_transition?.should.equal false
+ should "respond false to has_transition? if incoming transition is set" do
+ assert !EDL::Event.new(:transition => nil).has_transition?
end
- specify "respond true to has_transition? if incoming transition is set" do
- EDL::Event.new(:transition => true).has_transition?.should.equal true
+ should "respond true to has_transition? if incoming transition is set" do
+ assert EDL::Event.new(:transition => true).has_transition?
end
-
- specify "respond true to black? if reel is BL" do
- EDL::Event.new(:reel => "BL").should.black
- EDL::Event.new(:reel => "001").should.not.black
+
+ should "respond true to black? if reel is BL" do
+ assert EDL::Event.new(:reel => "BL").black?
+ assert !EDL::Event.new(:reel => "001").black?
end
- specify "respond true to generator? if reel is BL or AX" do
- EDL::Event.new(:reel => "BL").should.generator
- EDL::Event.new(:reel => "AX").should.generator
- EDL::Event.new(:reel => "001").should.not.generator
+ should "respond true to generator? if reel is BL or AX" do
+ assert EDL::Event.new(:reel => "BL").generator?
+ assert EDL::Event.new(:reel => "AX").generator?
+ assert !EDL::Event.new(:reel => "001").generator?
end
-
- specify "report src_length as rec_length_with_transition" do
+
+ should "report src_length as rec_length_with_transition" do
e = EDL::Event.new(:rec_start_tc => "2h".tc, :rec_end_tc => "2h 2s".tc)
- e.src_length.should.equal "2s".tc.to_i
+ assert_equal "2s".tc.to_i, e.src_length
end
-
- specify "support line_number" do
- EDL::Event.new.line_number.should.be.nil
- EDL::Event.new(:line_number => 3).line_number.should.equal 3
+
+ should "support line_number" do
+ assert_nil EDL::Event.new.line_number
+ assert_equal 3, EDL::Event.new(:line_number => 3).line_number
end
-
- specify "support capture_length as an alias to src_length" do
+
+ should "support capture_length as an alias to src_length" do
tw = flexmock
tw.should_receive(:actual_length_of_source).and_return(:something)
e = EDL::Event.new(:timewarp => tw)
- e.src_length.should.equal e.capture_length
+ assert_equal e.capture_length, e.src_length
end
-
- specify "delegate src_length to the timewarp if it is there" do
+
+ should "delegate src_length to the timewarp if it is there" do
tw = flexmock
tw.should_receive(:actual_length_of_source).and_return(:something).once
e = EDL::Event.new(:timewarp => tw)
- e.src_length.should.equal :something
+ assert_equal :something, e.src_length
end
-
- specify "report reverse? and reversed? based on the timewarp" do
+
+ should "report reverse? and reversed? based on the timewarp" do
e = EDL::Event.new(:timewarp => nil)
- e.should.not.be.reverse
- e.should.not.be.reversed
+ assert !e.reverse?
+ assert !e.reversed?
tw = flexmock
tw.should_receive(:reverse?).and_return(true)
e = EDL::Event.new(:timewarp => tw)
- e.should.be.reverse
- e.should.be.reversed
+ assert e.reverse?
+ assert e.reversed?
end
-
- specify "report speed as 100 percent without a timewarp" do
+
+ should "report speed as 100 percent without a timewarp" do
e = EDL::Event.new
- e.speed.should.be.kind_of Float
- e.speed.should.equal 100.0
+ assert_equal 100.0, e.speed
end
- specify "consult the timewarp for speed" do
+ should "consult the timewarp for speed" do
tw = flexmock
tw.should_receive(:speed).and_return(:something)
e = EDL::Event.new(:timewarp => tw)
- e.speed.should.equal :something
+ assert_equal :something, e.speed
end
- specify "report false for starts_with_transition? if transision is nil" do
- e = EDL::Event.new
- e.should.respond_to :starts_with_transition?
- e.should.not.be.starts_with_transition
+ should "report false for starts_with_transition? if transision is nil" do
+ assert !EDL::Event.new.starts_with_transition?
end
- specify "report zero for incoming_transition_duration if transision is nil" do
- e = EDL::Event.new
- e.should.respond_to :incoming_transition_duration
- e.incoming_transition_duration.should.zero
+ should "report zero for incoming_transition_duration if transision is nil" do
+ assert_zero EDL::Event.new.incoming_transition_duration
end
- specify "report true for starts_with_transition? if transision is not nil" do
+ should "report true for starts_with_transition? if transision is not nil" do
e = EDL::Event.new :transition => true
- e.should.respond_to :starts_with_transition?
- e.should.starts_with_transition
+ assert e.starts_with_transition?
end
- specify "consult the transition for incoming_transition_duration if it's present" do
+ should "consult the transition for incoming_transition_duration if it's present" do
tr = flexmock
tr.should_receive(:duration).and_return(:something)
-
+
e = EDL::Event.new(:transition => tr)
- e.should.respond_to :incoming_transition_duration
- e.incoming_transition_duration.should.equal :something
+ assert_equal :something, e.incoming_transition_duration
end
-
- specify "report capture_from_tc as the source start without a timewarp" do
+
+ should "report capture_from_tc as the source start without a timewarp" do
e = EDL::Event.new(:src_start_tc => "1h".tc)
- e.capture_from_tc.should.equal "1h".tc
+ assert_equal "1h".tc, e.capture_from_tc
end
-
- specify "consult the timewarp for capture_from_tc if a timewarp is there" do
+
+ should "consult the timewarp for capture_from_tc if a timewarp is there" do
tw = flexmock
tw.should_receive(:source_used_from).and_return(:something)
-
+
e = EDL::Event.new(:timewarp => tw)
- e.capture_from_tc.should.equal :something
+ assert_equal :something, e.capture_from_tc
end
- specify "report capture_to_tc as record length plus transition when no timewarp present" do
+ should "report capture_to_tc as record length plus transition when no timewarp present" do
e = EDL::Event.new(:src_end_tc => "1h 10s".tc, :outgoing_transition_duration => 2 )
- e.capture_to_tc.should.equal "1h 10s 2f".tc
+ assert_equal "1h 10s 2f".tc, e.capture_to_tc
end
- specify "report capture_to_and_including_tc as record length plus transition when no timewarp present" do
+ should "report capture_to_and_including_tc as record length plus transition when no timewarp present" do
e = EDL::Event.new(:src_end_tc => "1h 10s".tc, :outgoing_transition_duration => 2 )
- e.capture_to_and_including_tc.should.equal "1h 10s 1f".tc
+ assert_equal "1h 10s 1f".tc, e.capture_to_and_including_tc
end
- specify "consult the timewarp for capture_to_tc if timewarp is present" do
+ should "consult the timewarp for capture_to_tc if timewarp is present" do
tw = flexmock
tw.should_receive(:source_used_upto).and_return(:something)
e = EDL::Event.new(:timewarp => tw)
- e.capture_to_tc.should.equal :something
+ assert_equal :something, e.capture_to_tc
end
-
-
end
-context "A Parser should" do
-
- specify "store the passed framerate" do
+context "A Parser" do
+ should "store the passed framerate" do
p = EDL::Parser.new(45)
- p.should.respond_to :fps
- p.fps.should.equal 45
+ assert_equal 45, p.fps
end
- specify "return matchers tuned with the passed framerate" do
+ should "return matchers tuned with the passed framerate" do
p = EDL::Parser.new(30)
matchers = p.get_matchers
event_matcher = matchers.find{|e| e.is_a?(EDL::EventMatcher) }
- event_matcher.fps.should.equal 30
+ assert_equal 30, event_matcher.fps
end
- specify "create a Timecode from stringified elements" do
+ should "create a Timecode from stringified elements" do
elems = ["08", "04", "24", "24"]
- lambda{ @tc = EDL::Parser.timecode_from_line_elements(elems, 30) }.should.not.raise
+ assert_nothing_raised do
+ @tc = EDL::Parser.timecode_from_line_elements(elems, 30)
+ end
- @tc.should.be.kind_of Timecode
- @tc.should.equal "08:04:24:24".tc(30)
+ assert_kind_of Timecode, @tc
+ assert_equal "08:04:24:24".tc(30), @tc
- elems.length.should.equal 0
+ assert_zero elems.length
end
- specify "parse from a String" do
+ should "parse from a String" do
p = EDL::Parser.new
- lambda{ @edl = p.parse File.read(SIMPLE_DISSOLVE) }.should.not.raise
+ assert_nothing_raised do
+ @edl = p.parse File.read(SIMPLE_DISSOLVE)
+ end
- @edl.should.be.kind_of EDL::List
- @edl.length.should.equal 2
+ assert_kind_of EDL::List, @edl
+ assert_equal 2, @edl.length
end
- specify "parse from a File/IOish" do
+ should "parse from a File/IOish" do
p = EDL::Parser.new
- lambda{ @edl = p.parse File.open(SIMPLE_DISSOLVE) }.should.not.raise
+ assert_nothing_raised do
+ @edl = p.parse File.open(SIMPLE_DISSOLVE)
+ end
- @edl.should.be.kind_of EDL::List
- @edl.length.should.equal 2
+ assert_kind_of EDL::List, @edl
+ assert_equal 2, @edl.length
end
- specify "properly parse a dissolve" do
+ should "properly parse a dissolve" do
# TODO: reformulate
p = EDL::Parser.new
- lambda{ @edl = p.parse File.open(SIMPLE_DISSOLVE) }.should.not.raise
-
- @edl.should.be.kind_of EDL::List
- @edl.length.should.equal 2
+ @edl = p.parse File.open(SIMPLE_DISSOLVE)
first, second = @edl
- first.should.be.kind_of EDL::Event
- second.should.be.kind_of EDL::Event
- second.has_transition?.should.equal true
- first.ends_with_transition?.should.equal true
- second.ends_with_transition?.should.equal false
+ assert_kind_of EDL::Event, first
+ assert_kind_of EDL::Event, second
+ assert second.has_transition?
+ assert first.ends_with_transition?
+ assert !second.ends_with_transition?
+
no_trans = @edl.without_transitions
assert_equal 2, no_trans.length
target_tc = (Timecode.parse('01:00:00:00') + 43)
assert_equal target_tc, no_trans[0].rec_end_tc,
@@ -285,319 +279,353 @@
target_tc = Timecode.parse('01:00:00:00')
assert_equal target_tc, no_trans[1].rec_start_tc
"The outgoing clip should have been left in place"
end
- specify "return a spliced EDL if the sources allow" do
- lambda{ @spliced = EDL::Parser.new.parse(File.open(SPLICEME)).spliced }.should.not.raise
-
- @spliced.length.should.equal 1
- @spliced[0].src_start_tc.should.equal '06:42:50:18'.tc
- @spliced[0].src_end_tc.should.equal '06:42:52:16'.tc
+ should "return a spliced EDL if the sources allow" do
+ @spliced = EDL::Parser.new.parse(File.open(SPLICEME)).spliced
+
+ assert_equal 1, @spliced.length
+ evt = @spliced[0]
+
+ assert_equal '06:42:50:18'.tc, evt.src_start_tc
+ assert_equal '06:42:52:16'.tc, evt.src_end_tc
end
- specify "not apply any Matchers if a match is found" do
+ should "not apply any Matchers if a match is found" do
p = EDL::Parser.new
m1 = flexmock
m1.should_receive(:matches?).with("plop").once.and_return(true)
m1.should_receive(:apply).once
flexmock(p).should_receive(:get_matchers).once.and_return([m1, m1])
result = p.parse("plop")
- result.should.be.empty
+ assert result.empty?
end
- specify "register line numbers of the detected events" do
+ should "register line numbers of the detected events" do
p = EDL::Parser.new
events = p.parse(File.open(SPLICEME))
- events[0].line_number.should.not.be.nil
- events[0].line_number.should.equal 4
-
- events[1].line_number.should.not.be.nil
- events[1].line_number.should.equal 5
+ assert_equal 4, events[0].line_number
+ assert_equal 5, events[1].line_number
end
end
-context "A TimewarpMatcher should" do
+context "A TimewarpMatcher" do
- specify "not create any extra events when used within a Parser" do
+ should "not create any extra events when used within a Parser" do
@edl = EDL::Parser.new.parse(File.open(SIMPLE_TIMEWARP))
- @edl.length.should.equal 1
+ assert_equal 1, @edl.length
end
- specify "properly describe a speedup" do
+ should "properly describe a speedup" do
clip = EDL::Parser.new.parse(File.open(SIMPLE_TIMEWARP)).pop
tw = clip.timewarp
- tw.should.be.kind_of EDL::Timewarp
- tw.source_used_upto.should.be > clip.src_end_tc
+ assert_kind_of EDL::Timewarp, tw
+ assert_operator tw.source_used_upto, :>, clip.src_end_tc
- tw.source_used_from.should.equal clip.src_start_tc
- clip.timewarp.actual_length_of_source.should.equal 124
-
- tw.reverse?.should.be false
+ assert_equal clip.src_start_tc, tw.source_used_from
+ assert_equal 124, clip.timewarp.actual_length_of_source
+ assert !tw.reverse?
end
- specify "properly describe a slomo" do
+ should "properly describe a slomo" do
clip = EDL::Parser.new.parse(File.open(SLOMO_TIMEWARP)).pop
- clip.rec_length.should.equal 10
- clip.src_length.should.equal 5
+ assert_equal 10, clip.rec_length
+ assert_equal 5, clip.src_length
tw = clip.timewarp
- tw.should.be.kind_of EDL::Timewarp
+
+ assert_operator tw.source_used_upto, :<, clip.src_end_tc
- tw.source_used_upto.should.be < clip.src_end_tc
- tw.source_used_upto.should.equal "03:03:19:24".tc
- tw.speed_in_percent.to_i.should.equal 50
- tw.actual_length_of_source.should.equal 5
+ assert_equal "03:03:19:24".tc, tw.source_used_upto
- tw.should.not.be.reverse
+ assert_equal 50, tw.speed_in_percent.to_i
+ assert_equal 5, tw.actual_length_of_source
+ assert !tw.reverse?
end
end
-context "A reverse timewarp EDL coming from Avid should" do
+context "A reverse timewarp EDL coming from Avid" do
- specify "be parsed properly" do
+ should "be parsed properly" do
clip = EDL::Parser.new.parse(File.open(AVID_REVERSE)).pop
- clip.rec_length.should.equal 52
+ assert_equal 52, clip.rec_length
tw = clip.timewarp
- tw.actual_framerate.to_i.should.equal -25
- tw.should.be.reverse
+ assert_equal -25, tw.actual_framerate.to_i
+ assert tw.reverse?
+ assert_equal 52, tw.actual_length_of_source
- tw.actual_length_of_source.should.equal 52
-
assert_equal 52, clip.src_length, "The src length should be computed the same as its just a reverse"
assert_equal -100.0, clip.timewarp.speed
end
end
-context "A Final Cut Pro originating reverse should" do
+context "EDL with clip reels in comments" do
+ should "parse clip names into the reel field" do
+ clips = EDL::Parser.new.parse(File.open(CLIP_NAMES))
+ # flunk "This still has to be finalized"
+ end
+end
+
+context "A Final Cut Pro originating reverse" do
- specify "be interpreted properly" do
+ should "be interpreted properly" do
e = EDL::Parser.new.parse(File.open(FCP_REVERSE)).pop
- e.rec_length.should.equal 1000
- e.src_length.should.equal 1000
+ assert_equal 1000, e.rec_length
+ assert_equal 1000, e.src_length
- e.rec_start_tc.should.equal "1h".tc
- e.rec_end_tc.should.equal "1h 40s".tc
+ assert_equal "1h".tc, e.rec_start_tc
+ assert_equal "1h 40s".tc, e.rec_end_tc
- e.should.be.reverse
- e.timewarp.should.not.be nil
+ assert e.reverse?
+ assert_not_nil e.timewarp
tw = e.timewarp
- tw.speed.should.equal -100.0
- e.speed.should.equal -100.0
+ assert_equal -100, tw.speed
+ assert_equal e.speed, tw.speed
- tw.source_used_from.should.equal "1h".tc
- tw.source_used_upto.should.equal "1h 40s".tc
+ assert_equal "1h".tc, tw.source_used_from
+ assert_equal "1h 40s".tc, tw.source_used_upto
end
end
-context "EventMatcher should" do
+# context "An edit with keyer transition" do
+# should "parse correctly" do
+# events = EDL::Parser.new.parse(File.open(KEY))
+# assert_equal 2, events.length
+# flunk "Key transition processing is not reliable yet - no reference"
+# end
+# end
+context "EventMatcher" do
+
EVT_PATTERNS = [
'020 008C V C 08:04:24:24 08:04:25:19 01:00:25:22 01:00:26:17',
'021 009 V C 00:39:04:21 00:39:05:09 01:00:26:17 01:00:27:05',
'022 008C V C 08:08:01:23 08:08:02:18 01:00:27:05 01:00:28:00',
'023 008C V C 08:07:30:02 08:07:30:21 01:00:28:00 01:00:28:19',
'024 AX V C 00:00:00:00 00:00:01:00 01:00:28:19 01:00:29:19',
'025 BL V C 00:00:00:00 00:00:00:00 01:00:29:19 01:00:29:19',
'025 GEN V D 025 00:00:55:10 00:00:58:11 01:00:29:19 01:00:32:20',
'002 REDACTED V C 03:09:00:13 03:09:55:19 01:00:43:12 01:01:38:18',
+# '0004 KASS1 A1234V C 00:00:00:00 00:00:16:06 10:00:41:08 10:00:57:14'
]
-
- specify "produce an Event" do
+
+# should 'handle the event with multiple audio tracks' do
+# m = EDL::EventMatcher.new(25)
+#
+# clip = m.apply([],
+# '0004 KASS1 A1234V C 00:00:00:00 00:00:16:06 10:00:41:08 10:00:57:14'
+# )
+# assert_kind_of EDL::Event, clip
+# assert_equal "A1234", clip.track
+# end
+
+ should "produce an Event" do
m = EDL::EventMatcher.new(25)
clip = m.apply([],
'020 008C V C 08:04:24:24 08:04:25:19 01:00:25:22 01:00:26:17'
)
- clip.should.be.kind_of EDL::Event
+ assert_kind_of EDL::Event, clip
- clip.num.should.equal "020"
- clip.reel.should.equal "008C"
- clip.track.should.equal "V"
+ assert_equal "020", clip.num
+ assert_equal "008C", clip.reel
+ assert_equal "V", clip.track
- clip.src_start_tc.should.equal '08:04:24:24'.tc
+ assert_equal '08:04:24:24'.tc, clip.src_start_tc
- clip.src_end_tc.should.equal '08:04:25:19'.tc
- clip.rec_start_tc.should.equal '01:00:25:22'.tc
- clip.rec_end_tc.should.equal '01:00:26:17'.tc
+ assert_equal '08:04:25:19'.tc, clip.src_end_tc
+ assert_equal '01:00:25:22'.tc, clip.rec_start_tc
+ assert_equal '01:00:26:17'.tc, clip.rec_end_tc
- clip.transition.should.be nil
- clip.timewarp.should.be nil
- clip.outgoing_transition_duration.should.be.zero
-
+ assert_nil clip.transition
+ assert_nil clip.timewarp
+ assert_zero clip.outgoing_transition_duration
end
- specify "produce an Event with dissolve" do
+ should "produce an Event with dissolve" do
m = EDL::EventMatcher.new(25)
dissolve = m.apply([],
'025 GEN V D 025 00:00:55:10 00:00:58:11 01:00:29:19 01:00:32:20'
)
- dissolve.should.be.kind_of EDL::Event
+ assert_kind_of EDL::Event, dissolve
- dissolve.num.should.equal "025"
- dissolve.reel.should.equal "GEN"
- dissolve.track.should.equal "V"
+ assert_equal "025", dissolve.num
+ assert_equal 'GEN', dissolve.reel
+ assert_equal 'V', dissolve.track
+ assert dissolve.has_transition?
- dissolve.should.be.has_transition
-
tr = dissolve.transition
- tr.should.be.kind_of EDL::Dissolve
- tr.duration.should.equal 25
+ assert_kind_of EDL::Dissolve, tr
+ assert_equal 25, tr.duration
end
- specify "produce a vanilla Event with proper source length" do
+ should "produce a vanilla Event with proper source length" do
+ # This one has EXACTLY 4 frames of source
m = EDL::EventMatcher.new(25)
clip = m.apply([], '001 GEN V C 00:01:00:00 00:01:00:04 01:00:00:00 01:00:00:04')
- clip.should.be.kind_of EDL::Event
- clip.src_length.should.equal 4
+ assert_kind_of EDL::Event, clip
+ assert_equal 4, clip.src_length
end
- specify "set flag on the previous event in the stack when a dissolve is encountered" do
+ should "set flag on the previous event in the stack when a dissolve is encountered" do
m = EDL::EventMatcher.new(25)
previous_evt = flexmock
previous_evt.should_receive(:outgoing_transition_duration=).with(25).once
m.apply([previous_evt],
'025 GEN V D 025 00:00:55:10 00:00:58:11 01:00:29:19 01:00:32:20'
)
end
- specify "generate a Wipe" do
+ should "generate a Wipe" do
m = EDL::EventMatcher.new(25)
wipe = m.apply([],
'025 GEN V W001 025 00:00:55:10 00:00:58:11 01:00:29:19 01:00:32:20'
)
tr = wipe.transition
- tr.should.be.kind_of EDL::Wipe
- tr.duration.should.equal 25
- tr.smpte_wipe_index.should.equal '001'
+ assert_kind_of EDL::Wipe, tr
+ assert_equal 25, tr.duration
+ assert_equal '001', tr.smpte_wipe_index
end
- specify "match the widest range of patterns" do
- EVT_PATTERNS.each do | pat |
- assert EDL::EventMatcher.new(25).matches?(pat), "EventMatcher should match #{pat}"
+ EVT_PATTERNS.each do | pat |
+ should "match #{pat.inspect}" do
+ assert EDL::EventMatcher.new(25).matches?(pat)
end
end
- specify "pass the framerate that it received upon instantiation to the Timecodes being created" do
+ should "pass the framerate that it received upon instantiation to the Timecodes being created" do
m = EDL::EventMatcher.new(30)
clip = m.apply([],
'020 008C V C 08:04:24:24 08:04:25:19 01:00:25:22 01:00:26:17'
)
- clip.rec_start_tc.fps.should.equal 30
- clip.rec_end_tc.fps.should.equal 30
- clip.src_start_tc.fps.should.equal 30
- clip.src_end_tc.fps.should.equal 30
+ assert_equal 30, clip.rec_start_tc.fps
+ assert_equal 30, clip.rec_end_tc.fps
+ assert_equal 30, clip.src_start_tc.fps
+ assert_equal 30, clip.src_end_tc.fps
end
end
-context "CommentMatcher should" do
- specify "match a comment" do
+context "CommentMatcher" do
+ should "match a comment" do
line = "* COMMENT: PURE BULLSHIT"
assert EDL::CommentMatcher.new.matches?(line)
end
- specify "apply the comment to the last clip on the stack" do
+ should "apply the comment to the last clip on the stack" do
line = "* COMMENT: PURE BULLSHIT"
comments = []
mok_evt = flexmock
2.times { mok_evt.should_receive(:comments).and_return(comments) }
2.times { EDL::CommentMatcher.new.apply([mok_evt], line) }
- mok_evt.comments.should.equal ["* COMMENT: PURE BULLSHIT", "* COMMENT: PURE BULLSHIT"]
+ assert_equal ["* COMMENT: PURE BULLSHIT", "* COMMENT: PURE BULLSHIT"], mok_evt.comments
end
end
-context "FallbackMatcher should" do
- specify "match anything" do
+context "FallbackMatcher" do
+ should "match anything" do
line = "SOME"
- EDL::FallbackMatcher.new.matches?(line).should.equal true
-
+ assert EDL::FallbackMatcher.new.matches?(line)
+
line = "OR ANOTHER "
- EDL::FallbackMatcher.new.matches?(line).should.equal true
+ assert EDL::FallbackMatcher.new.matches?(line)
end
- specify "not match whitespace" do
+ should "not match whitespace" do
line = "\s\s\s\r\n\r"
- EDL::FallbackMatcher.new.matches?(line).should.equal false
+ assert !EDL::FallbackMatcher.new.matches?(line)
end
- specify "append the matched content to comments" do
+ should "append the matched content to comments" do
e = flexmock
cmts = []
e.should_receive(:comments).and_return(cmts)
EDL::FallbackMatcher.new.apply([e], "FOOBAR")
- cmts.should.equal ["FOOBAR"]
+ assert_equal ["FOOBAR"], cmts
EDL::FallbackMatcher.new.apply([e], "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I")
- cmts.should.equal ["FOOBAR", "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I"]
+ assert_equal ["FOOBAR", "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I"], cmts
end
- specify "raise an ApplyError if no clip is on the stack" do
- lambda { EDL::FallbackMatcher.new.apply([], "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I") }.should.raise(EDL::Matcher::ApplyError)
+ should "raise an ApplyError if no clip is on the stack" do
+ assert_raise(EDL::Matcher::ApplyError) do
+ EDL::FallbackMatcher.new.apply([], "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I")
+ end
end
end
-context "ClipNameMatcher should" do
- specify "match a clip name" do
+context "ClipNameMatcher" do
+ should "match a clip name" do
line = "* FROM CLIP NAME: TAPE_6-10.MOV"
- EDL::NameMatcher.new.matches?(line).should.equal true
+ assert EDL::NameMatcher.new.matches?(line)
end
- specify "not match a simple comment" do
+ should "match a clip name without space after star" do
+ line = "*FROM CLIP NAME: TAPE_6-10.MOV"
+ assert EDL::NameMatcher.new.matches?(line)
+ end
+
+ should "not match a simple comment" do
line = "* CRAP"
- EDL::NameMatcher.new.matches?(line).should.equal false
+ assert !EDL::NameMatcher.new.matches?(line)
end
- specify "apply the name to the last event on the stack" do
+ should "apply the name to the last event on the stack" do
line = "* FROM CLIP NAME: TAPE_6-10.MOV"
mok_evt = flexmock
comments = []
mok_evt.should_receive(:clip_name=).with('TAPE_6-10.MOV').once
mok_evt.should_receive(:comments).and_return(comments).once
EDL::NameMatcher.new.apply([mok_evt], line)
- comments.should.equal ["* FROM CLIP NAME: TAPE_6-10.MOV"]
+ assert_equal ["* FROM CLIP NAME: TAPE_6-10.MOV"], comments
end
end
-context "EffectMatcher should" do
- specify "not match a simple comment" do
+context "EffectMatcher" do
+ should "not match a simple comment" do
line = "* STUFF"
- EDL::EffectMatcher.new.matches?(line).should.equal false
+ assert !EDL::EffectMatcher.new.matches?(line)
end
- specify "match a dissolve name" do
+ should "match a dissolve name" do
line = "* EFFECT NAME: CROSS DISSOLVE"
- EDL::EffectMatcher.new.matches?(line).should.equal true
+ assert EDL::EffectMatcher.new.matches?(line)
end
- specify "apply the effect name to the transition of the last event on the stack" do
+ should "match a dissolve name without space after the asterisk" do
+ line = "*EFFECT NAME: CROSS DISSOLVE"
+ assert EDL::EffectMatcher.new.matches?(line)
+ end
+
+ should "apply the effect name to the transition of the last event on the stack" do
line = "* EFFECT NAME: CROSS DISSOLVE"
mok_evt, mok_transition = flexmock, flexmock
cmt = []
mok_evt.should_receive(:transition).once.and_return(mok_transition)
@@ -605,79 +633,81 @@
mok_transition.should_receive(:effect=).with("CROSS DISSOLVE").once
EDL::EffectMatcher.new.apply([mok_evt], line)
- cmt.should.equal ["* EFFECT NAME: CROSS DISSOLVE"]
+ assert_equal ["* EFFECT NAME: CROSS DISSOLVE"], cmt
end
end
-context "A complex EDL passed via Parser should" do
- specify "parse without errors" do
+context "A complex EDL passed via Parser" do
+ should "parse without errors" do
assert_nothing_raised { EDL::Parser.new.parse(File.open(FORTY_FIVER)) }
end
-
- specify "parse the EDL with \\r line breaks properly" do
+
+ should "parse the EDL with \\r line breaks properly" do
evts = EDL::Parser.new.parse(File.read(PLATES))
assert_equal 3, evts.length
end
-
+
# TODO: this does not belong here
- specify "be properly rewritten from zero" do
+ should "be properly rewritten from zero" do
complex = EDL::Parser.new.parse(File.open(FORTY_FIVER))
from_zero = complex.from_zero
-
- # Should have the same number of events
- from_zero.length.should.equal complex.length
-
- from_zero[0].rec_start_tc.should.be.zero
- from_zero[-1].rec_end_tc.should.equal '00:00:42:16'.tc
+
+ assert_equal complex.length, from_zero.length, "Should have the same number of events"
+
+ assert_zero from_zero[0].rec_start_tc
+ assert_equal '00:00:42:16'.tc, from_zero[-1].rec_end_tc
end
end
-context "A FinalCutPro speedup with fade at the end should" do
- specify "be parsed cleanly" do
+context "A FinalCutPro speedup with fade at the end" do
+ should "be parsed cleanly" do
list = EDL::Parser.new.parse(File.open(SPEEDUP_AND_FADEOUT))
+
+ assert_equal 2, list.length
- list.length.should.equal 2
-
first_evt = list[0]
-
+
tw = first_evt.timewarp
- tw.should.be.kind_of EDL::Timewarp
+ assert_kind_of EDL::Timewarp, tw
+
+ assert_equal 689, first_evt.rec_length
+ assert_equal 714, first_evt.rec_length_with_transition
- first_evt.rec_length.should.equal 689
- first_evt.rec_length_with_transition.should.equal 714
+ assert_equal 1000, tw.actual_length_of_source
+ assert_equal 140, tw.speed
- tw.actual_length_of_source.should.equal 1000
- tw.speed.should.equal 140
-
assert_equal 1000, first_evt.src_length
-
+
assert_equal "01:00:00:00", first_evt.capture_from_tc.to_s
assert_equal "01:00:40:00", first_evt.capture_to_tc.to_s
end
end
-
-context "In the trailer EDL the event 4 should" do
- specify "not have too many comments" do
+
+context "In the trailer EDL the event 4" do
+ should "not have too many comments" do
evts = EDL::Parser.new.parse(File.open(TRAILER_EDL))
evt = evts[6]
- evt.comments.length.should.equal(5)
+ assert_equal 5, evt.comments.length
end
end
-context "A FinalCutPro speedup and reverse with fade at the end should" do
- specify "parse cleanly" do
+context "A FinalCutPro speedup and reverse with fade at the end" do
+ should "parse cleanly" do
first_evt = EDL::Parser.new.parse(File.open(SPEEDUP_REVERSE_AND_FADEOUT)).shift
+
+ assert first_evt.reverse?
- first_evt.should.be.reverse
+ assert_equal 689, first_evt.rec_length
+ assert_equal 714, first_evt.rec_length_with_transition
- first_evt.rec_length.should.equal 689
- first_evt.rec_length_with_transition.should.equal 714
-
tw = first_evt.timewarp
- tw.source_used_from.should.equal "1h 1f".tc
- tw.source_used_upto.should.equal "1h 40s".tc
+
+ assert_equal "1h 1f".tc, tw.source_used_from
+ assert_equal "1h 40s".tc, tw.source_used_upto
end
-end
\ No newline at end of file
+end
+
+end