test/test_pipeline.rb in tracksperanto-1.9.3 vs test/test_pipeline.rb in tracksperanto-1.9.4
- old
+ new
@@ -3,10 +3,11 @@
class PipelineTest < Test::Unit::TestCase
def setup
@old_dir = Dir.pwd
Dir.chdir(File.dirname(__FILE__))
+ super
end
def create_stabilizer_file
@stabilizer = "./input.stabilizer"
trackers = %w( Foo Bar Baz).map do | name |
@@ -24,10 +25,11 @@
end
def teardown
Dir.glob("./input*.*").each(&File.method(:unlink))
Dir.chdir(@old_dir)
+ super
end
def test_supports_block_init
pipeline = Tracksperanto::Pipeline::Base.new(:middleware_tuples => [:a, :b])
assert_equal [:a, :b], pipeline.middleware_tuples
@@ -37,9 +39,28 @@
create_stabilizer_file
pipeline = Tracksperanto::Pipeline::Base.new
assert_nothing_raised { pipeline.run(@stabilizer) }
assert_equal 3, pipeline.converted_points
assert_equal 9, pipeline.converted_keyframes, "Should report conversion of 9 keyframes"
+ end
+
+ def test_middleware_initialization_from_tuples
+ create_stabilizer_file
+
+ pipeline = Tracksperanto::Pipeline::Base.new
+ pipeline.middleware_tuples = [
+ ["Bla", {:foo=> 234}]
+ ]
+
+ mock_mux = flexmock("MUX")
+ flexmock(Tracksperanto::Export::Mux).should_receive(:new).and_return(mock_mux)
+ m = flexmock("middleware object")
+ mock_middleware_class = flexmock("middleware class")
+
+ flexmock(Tracksperanto).should_receive(:get_middleware).with("Bla").once.and_return(mock_middleware_class)
+ mock_middleware_class.should_receive(:new).with(mock_mux, {:foo => 234}).once
+
+ assert_raise(NoMethodError) { pipeline.run(@stabilizer) }
end
def test_run_with_autodetected_importer_that_requires_size
FileUtils.cp("./import/samples/shake_script/four_tracks_in_one_stabilizer.shk", "./input.shk")
pipeline = Tracksperanto::Pipeline::Base.new
\ No newline at end of file