Sha256: f996951daab08a87521a1f540d0abe80fc994b58bb1813708f143d79848bd0ce

Contents?: true

Size: 895 Bytes

Versions: 8

Compression:

Stored size: 895 Bytes

Contents

# encoding: utf-8

require_relative "spec_helper"

FILTERS = {
  :FlateDecode    => {'test' => "x\x9C+I-.\x01\x00\x04]\x01\xC1".force_encoding(Encoding::ASCII_8BIT) },
  :DCTDecode      => {'test' => "test"}
}

FILTERS.each do |filter_name, examples|
  filter = PDF::Core::Filters.const_get(filter_name)

  describe "#{filter_name} filter" do
    it "should encode stream" do
      examples.each do |in_stream, out_stream|
        filter.encode(in_stream).should == out_stream
      end
    end

    it "should decode stream" do
      examples.each do |in_stream, out_stream|
        filter.decode(out_stream).should == in_stream
      end
    end

    it "should be symmetric" do
      examples.each do |in_stream, out_stream|
        filter.decode(filter.encode(in_stream)).should == in_stream

        filter.encode(filter.decode(out_stream)).should == out_stream
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pdf-core-0.6.1 spec/filters_spec.rb
pdf-core-0.6.0 spec/filters_spec.rb
pdf-core-0.5.1 spec/filters_spec.rb
pdf-core-0.5.0 spec/filters_spec.rb
pdf-core-0.4.0 spec/filters_spec.rb
pdf-core-0.3.1 spec/filters_spec.rb
pdf-core-0.3.0 spec/filters_spec.rb
pdf-core-0.2.5 spec/filters_spec.rb