Sha256: 28673f3190de83d6be4b7541ca9718d4b5b8018cbfbe955cf75f0a79a28c8768

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

# 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
    expect(1.mm).to be_within(0.000000001).of(2.834645669)
    expect(1.mm).to eq(72 / 25.4)
    expect(2.mm).to eq(2 * 72 / 25.4)
    expect(3.mm).to eq(3 * 72 / 25.4)
    expect(-3.mm).to eq(-3 * 72 / 25.4)
    expect(1.cm).to eq(10 * 72 / 25.4)
    expect(1.dm).to eq(100 * 72 / 25.4)
    expect(1.m).to eq(1000 * 72 / 25.4)

    expect(1.in).to eq(72)
    expect(1.ft).to eq(72 * 12)
    expect(1.yd).to eq(72 * 12 * 3)
    expect(1.pt).to eq(1)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-2.1.0 spec/measurement_units_spec.rb
prawn-2.0.2 spec/measurement_units_spec.rb