Sha256: f305c8db5cbf34c388dc06ea3d1aeab21a8e7e5adb1fdd48a2e0613e0b0de477

Contents?: true

Size: 1.05 KB

Versions: 35

Compression:

Stored size: 1.05 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 "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

35 entries across 35 versions & 1 rubygems

Version Path
hexapdf-0.27.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.26.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.26.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.26.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.25.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.24.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.24.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.24.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.23.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.22.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.21.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.21.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.20.4 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.20.3 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.20.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.20.1 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.20.0 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.19.3 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.19.2 test/hexapdf/type/acro_form/test_signature_field.rb
hexapdf-0.19.1 test/hexapdf/type/acro_form/test_signature_field.rb