1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
# coding: utf-8
require File.dirname(__FILE__) + "/spec_helper"
describe PDF::Reader::Filter do
describe "#with" do
context "when passed :ASCII85Decode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:ASCII85Decode).should be_a(PDF::Reader::Filter::Ascii85)
end
end
context "when passed :ASCIIHexDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:ASCIIHexDecode).should be_a(PDF::Reader::Filter::AsciiHex)
end
end
context "when passed :CCITTFaxDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:CCITTFaxDecode).should be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :DCTDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:DCTDecode).should be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :ASCII85Decode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:ASCII85Decode).should be_a(PDF::Reader::Filter::Ascii85)
end
end
context "when passed :FlateDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:FlateDecode).should be_a(PDF::Reader::Filter::Flate)
end
end
context "when passed :JBIG2ecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:JBIG2Decode).should be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :JPXDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:JPXDecode).should be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :LZWDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:LZWDecode).should be_a(PDF::Reader::Filter::Lzw)
end
end
context "when passed :RunLengthDecode" do
it "should return the appropriate class" do
PDF::Reader::Filter.with(:RunLengthDecode).should be_a(PDF::Reader::Filter::RunLength)
end
end
context "when passed an unrecognised filter" do
it "should raise an exception" do
lambda {
PDF::Reader::Filter.with(:FooDecode)
}.should raise_error(PDF::Reader::UnsupportedFeatureError)
end
end
end
end
|