Sha256: 8cbd71ffb2f62b17bd272be63c6ae74f6122f4df30e6dbd137a2a62de0bfcb40

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require "minitest/autorun"
require "pdfmult"


describe Pdfmult::Layout do

  before do
    @layout = Pdfmult::Layout.new(2)
  end

  it "can return the number of pages" do
    _(@layout.pages).must_equal 2
  end

  it "can return the geometry" do
    _(@layout.geometry).must_equal "2x1"
  end

  it "knows whether it is landscape" do
    _(@layout.landscape?).must_equal true
  end

  it "returns the correct layout for 2 pages" do
    layout = Pdfmult::Layout.new(2)
    _(layout.geometry).must_equal "2x1"
    _(layout.landscape?).must_equal true
  end

  it "returns the correct layout for 4 pages" do
    layout = Pdfmult::Layout.new(4)
    _(layout.geometry).must_equal "2x2"
    _(layout.landscape?).must_equal false
  end

  it "returns the correct layout for 8 pages" do
    layout = Pdfmult::Layout.new(8)
    _(layout.geometry).must_equal "4x2"
    _(layout.landscape?).must_equal true
  end

  it "returns the correct layout for 9 pages" do
    layout = Pdfmult::Layout.new(9)
    _(layout.geometry).must_equal "3x3"
    _(layout.landscape?).must_equal false
  end

  it "returns the correct layout for 16 pages" do
    layout = Pdfmult::Layout.new(16)
    _(layout.geometry).must_equal "4x4"
    _(layout.landscape?).must_equal false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdfmult-1.4.0 test/test_layout.rb