Sha256: e2cd73da0c1c8253389ded1c7f878050ccf4d59176bb394298f596132e9a7269

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 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}
    value = @field.field_value
    assert_kind_of(HexaPDF::DigitalSignature::Signature, value)
    assert_equal({Empty: :True}, 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

8 entries across 8 versions & 1 rubygems

Version Path
hexapdf-1.2.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.1.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.1.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.0.3 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.0.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.0.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-1.0.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.47.0 test/hexapdf/type/acro_form/test_signature_field.rb