Sha256: 45b342904d16c1d2f82f5cdd41ff22c5f5212591696d01fb0342461988895126

Contents?: true

Size: 1.03 KB

Versions: 77

Compression:

Stored size: 1.03 KB

Contents

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

require 'test_helper'
require 'hexapdf/document'
require 'hexapdf/type/annotations/text'

describe HexaPDF::Type::Annotations::Text do
  before do
    @doc = HexaPDF::Document.new
    @doc.version = '1.5'
    @annot = HexaPDF::Type::Annotations::Text.new({Rect: [0, 0, 1, 1]}, document: @doc, oid: 1)
  end

  describe "validation" do
    it "checks for correct /StateModel values" do
      @annot[:StateModel] = 'Invalid'
      refute(@annot.validate {|msg| assert_match(/does not contain an allowed value/, msg) })
    end

    it "automatically sets /StateModel based on the /State entry" do
      @annot[:State] = 'Marked'
      assert(@annot.validate)
      assert_equal('Marked', @annot[:StateModel])
    end

    it "checks whether /State and /StateModel match" do
      @annot[:State] = 'Marked'
      @annot[:StateModel] = 'Marked'
      assert(@annot.validate)
      @annot[:StateModel] = 'Review'
      refute(@annot.validate {|msg| assert_match(/\/State and \/StateModel don't agree/, msg) })
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
hexapdf-1.2.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.1.1 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.1.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.0.3 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.0.2 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.0.1 test/hexapdf/type/annotations/test_text.rb
hexapdf-1.0.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.47.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.46.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.45.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.44.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.41.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.40.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.39.1 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.39.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.38.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.37.2 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.37.1 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.37.0 test/hexapdf/type/annotations/test_text.rb
hexapdf-0.36.0 test/hexapdf/type/annotations/test_text.rb