Sha256: dc8dc5adbd128c324b3f9cdf3c5021bbbd8d441b7111ea4b0591cdcac6b56bd3

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "minitest/autorun"
require "pdfmult"


describe Pdfmult::LaTeXDocument do

  before do
    @layout_class = Pdfmult::Layout
  end

  it "should return the expected LaTeX code for 4 pages" do
    args = {
      pdffile: "sample.pdf",
      layout: @layout_class.new(4),
      page_count: 3
    }
    document_lines = Pdfmult::LaTeXDocument.new(args).to_s.split("\n")
    _(document_lines[0]).must_equal  '\documentclass[a4paper]{article}'
    _(document_lines[-2]).must_equal '\includepdf[pages={3,3,3,3},nup=2x2]{sample.pdf}%'
    _(document_lines.grep(/includepdf/).size).must_equal args[:page_count]
  end

  it "should return the expected LaTeX code for 8 pages" do
    args = {
      pdffile: "sample.pdf",
      layout: @layout_class.new(8),
      page_count: 5
    }
    document_lines = Pdfmult::LaTeXDocument.new(args).to_s.split("\n")
    _(document_lines[0]).must_equal  '\documentclass[a4paper,landscape]{article}'
    _(document_lines[-2]).must_equal '\includepdf[pages={5,5,5,5,5,5,5,5},nup=4x2]{sample.pdf}%'
    _(document_lines.grep(/includepdf/).size).must_equal args[:page_count]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdfmult-1.4.0 test/test_latex_document.rb