Sha256: 3fb6373f4d65eb55c22900c4ee8dfa94cac5c72f103a2ec4da8ca6ce446ab898

Contents?: true

Size: 1.19 KB

Versions: 36

Compression:

Stored size: 1.19 KB

Contents

# -*- encoding: utf-8 -*-

require 'test_helper'
require 'hexapdf/document'
require 'hexapdf/type/catalog'

describe HexaPDF::Type::Catalog do
  before do
    @doc = HexaPDF::Document.new
    @catalog = @doc.add({Type: :Catalog})
  end

  it "must always be indirect" do
    @catalog.must_be_indirect = false
    assert(@catalog.must_be_indirect?)
  end

  it "creates the page tree on access" do
    assert_nil(@catalog[:Pages])
    pages = @catalog.pages
    assert_equal(:Pages, pages.type)
  end

  describe "acro_form" do
    it "returns an existing form object" do
      @catalog[:AcroForm] = :test
      assert_equal(:test, @catalog.acro_form)
    end

    it "returns an existing form object even if create: true" do
      @catalog[:AcroForm] = :test
      assert_equal(:test, @catalog.acro_form(create: true))
    end

    it "creates a new AcroForm object with defaults if create: true" do
      form = @catalog.acro_form(create: true)
      assert_kind_of(HexaPDF::Type::AcroForm::Form, form)
      assert(form[:DA])
    end
  end

  describe "validation" do
    it "creates the page tree if necessary" do
      refute(@catalog.validate(auto_correct: false))
      assert(@catalog.validate)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hexapdf-0.22.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.21.1 test/hexapdf/type/test_catalog.rb
hexapdf-0.21.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.20.4 test/hexapdf/type/test_catalog.rb
hexapdf-0.20.3 test/hexapdf/type/test_catalog.rb
hexapdf-0.20.2 test/hexapdf/type/test_catalog.rb
hexapdf-0.20.1 test/hexapdf/type/test_catalog.rb
hexapdf-0.20.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.19.3 test/hexapdf/type/test_catalog.rb
hexapdf-0.19.2 test/hexapdf/type/test_catalog.rb
hexapdf-0.19.1 test/hexapdf/type/test_catalog.rb
hexapdf-0.19.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.18.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.17.3 test/hexapdf/type/test_catalog.rb
hexapdf-0.17.2 test/hexapdf/type/test_catalog.rb
hexapdf-0.16.0 test/hexapdf/type/test_catalog.rb
hexapdf-0.15.9 test/hexapdf/type/test_catalog.rb
hexapdf-0.15.8 test/hexapdf/type/test_catalog.rb
hexapdf-0.15.7 test/hexapdf/type/test_catalog.rb
hexapdf-0.15.6 test/hexapdf/type/test_catalog.rb