Sha256: 6c0013c38000b114eb5928218962eaacd26648ea76982778a42c3a342dad0e61

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

# encoding: utf-8

require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")

FILTERS = {
  :FlateDecode    => {'test' => ruby_19 { "x\x9C+I-.\x01\x00\x04]\x01\xC1".force_encoding(Encoding::ASCII_8BIT) } || "x\x9C+I-.\x01\x00\x04]\x01\xC1" },
  :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

1 entries across 1 versions & 1 rubygems

Version Path
prawn-0.13.0 spec/filters_spec.rb