Sha256: 31bffe44efecbee2574f03abe5e0a8a9c40443c35bfc435be7c0949119ee4a7e

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module X11Recorder
  describe Display do
    let(:mock_process) { double(ChildProcess, :start => nil, :stop => nil, :io => double('io').as_null_object) }

    it "can start recorder with default mp4 options" do
      display = ENV['DISPLAY'] || ':1'
      ChildProcess.should_receive(:build).with(
        'ffmpeg',
        '-an',
        '-y',
        '-f', 'x11grab',
        '-r', '5',
        '-s', '1024x768',
        '-i', display,
        '-vcodec', 'mpeg4',
        './test.mp4'
      ).and_return(mock_process)
      mock_process.should_receive(:start)
      mock_process.should_receive(:stop)

      recorder = X11Recorder::Display.new
      recorder.start
      recorder.stop
    end

    it "can start recorder with non-default mp4 options" do
      ChildProcess.should_receive(:build).with(
        'ffmpeg',
        '-an',
        '-y',
        '-f', 'x11grab',
        '-r', '6',
        '-s', '768x768',
        '-i', ':42',
        '-vcodec', 'v8',
        './test.webm'
      ).and_return(mock_process)
      mock_process.should_receive(:start)
      mock_process.should_receive(:stop)

      recorder = X11Recorder::Display.new(
        :filename => './test.webm',
        :codec => 'v8',
        :display => ':42',
        :frame_rate => '6',
        :frame_size => '768x768'
      )
      recorder.start
      recorder.stop
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
x11_recorder-0.0.1 spec/x11_recorder/display_spec.rb