Sha256: e7c58f59e327e913b572fad80e4923f3527bf531f8b252922905459b891b1b67

Contents?: true

Size: 846 Bytes

Versions: 6

Compression:

Stored size: 846 Bytes

Contents

require 'minitest/autorun'

class TestForms < Minitest::Test
    def setup
        @target = PDF.new
        @target.append_page
    end

    def test_create_acroform
        fields = [
            Annotation::Widget::Text.new.set_name('text'),
            Annotation::Widget::PushButton.new.set_name('button')
        ]

        @target.create_form(*fields)

        assert @target.form?
        assert_kind_of InteractiveForm, @target.Catalog.AcroForm
        assert_equal @target.fields.length, fields.length

        @target.each_field do |field|
            assert_kind_of Field, field
            assert %w{text button}.include?(field.name) 
        end

        assert_nil @target.get_field('not_existent_field')
        assert_kind_of Field, @target.get_field('button')
        assert_kind_of Field, @target.get_field('text')
    end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
origamindee-3.1.0 test/test_forms.rb
origamindee-3.0.0 test/test_forms.rb
origami-2.1.0 test/test_forms.rb
origami-2.0.4 test/test_forms.rb
origami-2.0.3 test/test_forms.rb
origami-2.0.2 test/test_forms.rb