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
|
# typed: false
# coding: utf-8
describe PDF::Reader::Filter do
describe "#with" do
context "when passed :ASCII85Decode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:ASCII85Decode)).to be_a(PDF::Reader::Filter::Ascii85)
end
end
context "when passed :ASCIIHexDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:ASCIIHexDecode)).to be_a(PDF::Reader::Filter::AsciiHex)
end
end
context "when passed :CCITTFaxDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:CCITTFaxDecode)).to be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :DCTDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:DCTDecode)).to be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :ASCII85Decode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:ASCII85Decode)).to be_a(PDF::Reader::Filter::Ascii85)
end
end
context "when passed :FlateDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:FlateDecode)).to be_a(PDF::Reader::Filter::Flate)
end
end
context "when passed :JBIG2ecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:JBIG2Decode)).to be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :JPXDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:JPXDecode)).to be_a(PDF::Reader::Filter::Null)
end
end
context "when passed :LZWDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:LZWDecode)).to be_a(PDF::Reader::Filter::Lzw)
end
end
context "when passed :RunLengthDecode" do
it "returns the appropriate class" do
expect(PDF::Reader::Filter.with(:RunLengthDecode)).to be_a(PDF::Reader::Filter::RunLength)
end
end
context "when passed an unrecognised filter" do
it "raises an exception" do
expect {
PDF::Reader::Filter.with(:FooDecode)
}.to raise_error(PDF::Reader::UnsupportedFeatureError)
end
end
end
end
|