pdf-core 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- puts "PDF::Core specs: Running on Ruby Version: #{RUBY_VERSION}"
4
-
5
- require "bundler"
6
- Bundler.setup
7
-
8
- if ENV["COVERAGE"]
9
- require "simplecov"
10
- SimpleCov.start
11
- end
12
-
13
- require_relative "../lib/pdf/core"
14
-
15
-
16
- require "rspec"
17
- require "pdf/reader"
18
- require "pdf/inspector"
19
-
20
- RSpec.configure do |config|
21
- config.treat_symbols_as_metadata_keys_with_true_values = true
22
- end
23
-
24
- RSpec::Matchers.define :have_parseable_xobjects do
25
- match do |actual|
26
- expect { PDF::Inspector::XObject.analyze(actual.render) }.not_to raise_error
27
- true
28
- end
29
- failure_message_for_should do |actual|
30
- "expected that #{actual}'s XObjects could be successfully parsed"
31
- end
32
- end
@@ -1,59 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require_relative "spec_helper"
4
-
5
- describe "Stream object" do
6
- it "should compress a stream upon request" do
7
- stream = PDF::Core::Stream.new
8
- stream << "Hi There " * 20
9
-
10
- cstream = PDF::Core::Stream.new
11
- cstream << "Hi There " * 20
12
- cstream.compress!
13
-
14
- cstream.filtered_stream.length.should be < stream.length,
15
- "compressed stream expected to be smaller than source but wasn't"
16
- cstream.data[:Filter].should == [:FlateDecode]
17
- end
18
-
19
- it "should expose sompression state" do
20
- stream = PDF::Core::Stream.new
21
- stream << "Hello"
22
- stream.compress!
23
-
24
- stream.should be_compressed
25
- end
26
-
27
- it "should detect from filters if stream is compressed" do
28
- stream = PDF::Core::Stream.new
29
- stream << "Hello"
30
- stream.filters << :FlateDecode
31
-
32
- stream.should be_compressed
33
- end
34
-
35
- it "should have Length if in data" do
36
- stream = PDF::Core::Stream.new
37
- stream << "hello"
38
-
39
- stream.data[:Length].should == 5
40
- end
41
-
42
- it "should update Length when updated" do
43
- stream = PDF::Core::Stream.new
44
- stream << "hello"
45
- stream.data[:Length].should == 5
46
-
47
- stream << " world"
48
- stream.data[:Length].should == 11
49
- end
50
-
51
- it "should corecly handle decode params" do
52
- stream = PDF::Core::Stream.new
53
- stream << "Hello"
54
- stream.filters << { :FlateDecode => { :Predictor => 15 } }
55
-
56
- stream.data[:DecodeParms].should == [{ :Predictor => 15 }]
57
- end
58
- end
59
-