poppler 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/poppler/rbpoppler-page.c +1 -1
 - data/test/fixtures/image.png +0 -0
 - data/test/poppler-test-utils.rb +4 -0
 - data/test/test_page.rb +17 -0
 - metadata +3 -2
 
| 
         @@ -44,7 +44,7 @@ page_render_to_ps(VALUE self, VALUE ps_file) 
     | 
|
| 
       44 
44 
     | 
    
         
             
            }
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
            static VALUE
         
     | 
| 
       47 
     | 
    
         
            -
            rg_render(VALUE  
     | 
| 
      
 47 
     | 
    
         
            +
            rg_render(VALUE self, VALUE ps_file_or_cairo)
         
     | 
| 
       48 
48 
     | 
    
         
             
            {
         
     | 
| 
       49 
49 
     | 
    
         
             
                if (RVAL2CBOOL(rb_obj_is_kind_of(ps_file_or_cairo, cPSFile))) {
         
     | 
| 
       50 
50 
     | 
    
         
             
                    return page_render_to_ps(self, ps_file_or_cairo);
         
     | 
| 
         Binary file 
     | 
    
        data/test/poppler-test-utils.rb
    CHANGED
    
    | 
         @@ -33,6 +33,10 @@ module PopplerTestUtils 
     | 
|
| 
       33 
33 
     | 
    
         
             
                File.join(fixtures_dir, "image.pdf")
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
      
 36 
     | 
    
         
            +
              def image_png
         
     | 
| 
      
 37 
     | 
    
         
            +
                File.join(fixtures_dir, "image.png")
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       36 
40 
     | 
    
         
             
              def later_version?(major, minor, micro=nil)
         
     | 
| 
       37 
41 
     | 
    
         
             
                micro ||= 0
         
     | 
| 
       38 
42 
     | 
    
         
             
                (Poppler::BUILD_VERSION <=> [major, minor, micro]) >= 0
         
     | 
    
        data/test/test_page.rb
    CHANGED
    
    | 
         @@ -30,6 +30,23 @@ class TestPage < Test::Unit::TestCase 
     | 
|
| 
       30 
30 
     | 
    
         
             
                assert_kind_of(Poppler::Annotation, mapping.annotation)
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
      
 33 
     | 
    
         
            +
              def test_render
         
     | 
| 
      
 34 
     | 
    
         
            +
                document = Poppler::Document.new(image_pdf)
         
     | 
| 
      
 35 
     | 
    
         
            +
                page = document[0]
         
     | 
| 
      
 36 
     | 
    
         
            +
                png = StringIO.new
         
     | 
| 
      
 37 
     | 
    
         
            +
                png.set_encoding("ASCII-8BIT")
         
     | 
| 
      
 38 
     | 
    
         
            +
                Cairo::ImageSurface.new(:argb32, *page.size) do |surface|
         
     | 
| 
      
 39 
     | 
    
         
            +
                  Cairo::Context.new(surface) do |context|
         
     | 
| 
      
 40 
     | 
    
         
            +
                    page.render(context)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                  surface.write_to_png(png)
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
                File.open(image_png, "rb") do |image|
         
     | 
| 
      
 45 
     | 
    
         
            +
                  # TODO: support image diff
         
     | 
| 
      
 46 
     | 
    
         
            +
                  assert_equal(image.read, png.string)
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       33 
50 
     | 
    
         
             
              private
         
     | 
| 
       34 
51 
     | 
    
         
             
              def find_first_image_mapping(document)
         
     | 
| 
       35 
52 
     | 
    
         
             
                document.each do |page|
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: poppler
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.6
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-04-04 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       14 
14 
     | 
    
         
             
            description: Ruby/Poppler is a Ruby binding of poppler-glib.
         
     | 
| 
       15 
15 
     | 
    
         
             
            email: ruby-gnome2-devel-en@lists.sourceforge.net
         
     | 
| 
         @@ -60,6 +60,7 @@ files: 
     | 
|
| 
       60 
60 
     | 
    
         
             
            - sample/pdfcrop.rb
         
     | 
| 
       61 
61 
     | 
    
         
             
            - sample/pdfdiv.rb
         
     | 
| 
       62 
62 
     | 
    
         
             
            - test/fixtures/image.pdf
         
     | 
| 
      
 63 
     | 
    
         
            +
            - test/fixtures/image.png
         
     | 
| 
       63 
64 
     | 
    
         
             
            - test/poppler-test-utils.rb
         
     | 
| 
       64 
65 
     | 
    
         
             
            - test/run-test.rb
         
     | 
| 
       65 
66 
     | 
    
         
             
            - test/test_annotation.rb
         
     |