Sha256: 5f49163fae1f464481f97a8a1e36af2cdbeb60b73897e061468d6ec6e1f099b0

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

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

describe AviGlitch, 'AVI2.0' do

  it 'should save same file when nothing has changed' do
    avi = AviGlitch.open @in2
    avi.glitch do |d|
      d
    end
    avi.output @out
    FileUtils.cmp(@in2, @out).should be true
  end

  it 'should be AVI1.0 when its size has reduced less than 1GB' do
    a = AviGlitch.open @in2
    size = 0
    a.glitch do |d|
      size += d.size
      size < 1024 ** 3 ? d : nil
    end
    a.output @out
    b = AviGlitch.open @out
    b.avi.was_avi2?.should be false
    b.close
  end

  it 'should be AVI2.0 when its size has increased over 1GB' do
    a = AviGlitch.open @in
    n = Math.log(1024.0 ** 3 / a.frames.data_size.to_f, 2).ceil
    f = a.frames[0..-1]
    n.times do
      fx = f[0..-1]
      f.concat fx
      fx.terminate
    end
    f.to_avi.output @out
    b = AviGlitch.open @out
    b.avi.was_avi2?.should be true
    b.close
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aviglitch-0.2.2 spec/avi2_spec.rb