Sha256: 5f11797e6a114a5774738d89e03384d1734109c30320679e5e7e25c6c5388f81

Contents?: true

Size: 1.15 KB

Versions: 24

Compression:

Stored size: 1.15 KB

Contents

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

require 'test_helper'
require 'hexapdf/document'
require 'hexapdf/type/acro_form/signature_field'

describe HexaPDF::Type::AcroForm::SignatureField::LockDictionary do
  it "validates the presence of the /Fields key" do
    doc = HexaPDF::Document.new
    obj = HexaPDF::Type::AcroForm::SignatureField::LockDictionary.new({Action: :All}, document: doc)
    assert(obj.validate)
    obj[:Action] = :Include
    refute(obj.validate)
  end
end

describe HexaPDF::Type::AcroForm::SignatureField do
  before do
    @doc = HexaPDF::Document.new
    @field = @doc.wrap({}, type: :XXAcroFormField, subtype: :Sig)
  end

  it "identifies as an :XXAcroFormField type" do
    assert_equal(:XXAcroFormField, @field.type)
  end

  it "sets the field value" do
    @field.field_value = {Empty: :True}
    assert_equal({Empty: :True}, @field[:V].value)
  end

  it "gets the field value" do
    @field[:V] = {Empty: :True}
    assert_equal({Empty: :True}, @field.field_value.value)
  end

  it "validates the value of the /FT field" do
    refute(@field.validate(auto_correct: false))
    assert(@field.validate)
    assert_equal(:Sig, @field.field_type)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hexapdf-0.46.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.45.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.44.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.41.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.40.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.39.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.39.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.38.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.37.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.37.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.37.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.36.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.35.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.35.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.34.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.34.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.33.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.32.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.32.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.32.0 test/hexapdf/type/acro_form/test_signature_field.rb