Sha256: e19189b8a1cbb735c89f4dfe920724cdcc67fe520f5fca74306a8d6ec6516619

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe AviGlitch, 'datamosh cli' do

  before :all do
    here = File.dirname(__FILE__)
    lib = Pathname.new(File.join(here, '..', 'lib')).realpath
    datamosh = Pathname.new(File.join(here, '..', 'bin/datamosh')).realpath
    @cmd = "ruby -I%s %s -o %s " % [lib, datamosh, @out]
  end

  it 'should correctly process files' do
    a = AviGlitch.open @in
    keys = a.frames.inject(0) do |c, f|
      c += 1 if f.is_keyframe?
      c
    end
    total = a.frames.size
    first_keyframe = a.frames.index(a.frames.first_of(:keyframe))
    a.close

    system [@cmd, @in].join(' ')
    o = AviGlitch.open @out
    o.frames.size.should == total
    o.frames[first_keyframe].is_keyframe?.should be true
    o.has_keyframe?.should be true
    o.close
    AviGlitch::Base.surely_formatted?(@out, true).should be true

    system [@cmd, '-a', @in].join(' ')
    o = AviGlitch.open @out
    o.frames.size.should == total
    o.frames[first_keyframe].is_keyframe?.should be false
    o.has_keyframe?.should be false
    o.close
    AviGlitch::Base.surely_formatted?(@out, true).should be true

    system [@cmd, @in, @in, @in].join(' ')
    o = AviGlitch.open @out
    o.frames.size.should == total * 3
    o.frames[first_keyframe].is_keyframe?.should be true
    o.close
    AviGlitch::Base.surely_formatted?(@out, true).should be true

    system [@cmd, '--fake', @in].join(' ')
    o = AviGlitch.open @out
    o.has_keyframe?.should be false
    o.close

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aviglitch-0.2.2 spec/datamosh_spec.rb
aviglitch-0.2.0 spec/datamosh_spec.rb