File: measurement_units_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-- 623 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

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

describe "Measurement units" do

  it "should convert units to PostScriptPoints" do
    1.mm.should be_within(0.000000001).of(2.834645669)
    1.mm.should == (72 / 25.4)
    2.mm.should == (2 * 72 / 25.4)
    3.mm.should == 3 * 72 / 25.4
    -3.mm.should == -3 * 72/25.4
    1.cm.should == 10 * 72 / 25.4
    1.dm.should == 100 * 72 / 25.4
    1.m.should == 1000 * 72 / 25.4

    1.in.should == 72
    1.ft.should == 72 * 12
    1.yd.should == 72 * 12 * 3
    1.pt.should == 1
  end

end