File: jpg_spec.rb

package info (click to toggle)
ruby-prawn 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,936 kB
  • ctags: 802
  • sloc: ruby: 13,906; sh: 43; makefile: 15
file content (25 lines) | stat: -rw-r--r-- 681 bytes parent folder | download
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
# encoding: utf-8

# Spec'ing the PNG class. Not complete yet - still needs to check the
# contents of palette and transparency to ensure they're correct.
# Need to find files that have these sections first.

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

describe "When reading a JPEG file" do

  before(:each) do
    @filename = "#{Prawn::DATADIR}/images/pigs.jpg"
    @img_data = File.open(@filename, "rb") { |f| f.read }
  end

  it "should read the basic attributes correctly" do
    jpg = Prawn::Images::JPG.new(@img_data)

    jpg.width.should == 604
    jpg.height.should == 453
    jpg.bits.should == 8
    jpg.channels.should == 3
  end
end