test/hexapdf/layout/test_style.rb in hexapdf-0.33.0 vs test/hexapdf/layout/test_style.rb in hexapdf-0.34.0
- old
+ new
@@ -578,11 +578,14 @@
describe HexaPDF::Layout::Style::LinkLayer do
describe "initialize" do
it "fails if more than one possible target is chosen" do
assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(dest: true, uri: true) }
assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(dest: true, file: true) }
+ assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(dest: true, action: true) }
assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(uri: true, file: true) }
+ assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(uri: true, action: true) }
+ assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(file: true, action: true) }
end
it "fails if an invalid border is provided" do
assert_raises(ArgumentError) { HexaPDF::Layout::Style::LinkLayer.new(border: 5) }
end
@@ -654,10 +657,16 @@
annot = call_link(file: "local-file.pdf")
assert_equal({S: :Launch, F: "local-file.pdf", NewWindow: true}, annot[:A].value)
assert_nil(annot[:Dest])
end
+ it "works for actions" do
+ annot = call_link(action: {Type: :Action, S: :SetOCGState})
+ assert_equal({Type: :Action, S: :SetOCGState}, annot[:A].value)
+ assert_nil(annot[:Dest])
+ end
+
it "works for destinations set via the 'link' custom box property" do
@box.properties['link'] = [@canvas.context, :FitH]
annot = call_link({})
assert_equal([@canvas.context, :FitH], annot[:Dest].value)
assert_nil(annot[:A])
@@ -771,9 +780,10 @@
assert_equal([[], 0], @style.stroke_dash_pattern.to_operands)
assert_equal([:proportional, 1], [@style.line_spacing.type, @style.line_spacing.value])
refute(@style.subscript)
refute(@style.superscript)
refute(@style.last_line_gap)
+ refute(@style.fill_horizontal)
assert_kind_of(HexaPDF::Layout::Style::Layers, @style.underlays)
assert_kind_of(HexaPDF::Layout::Style::Layers, @style.overlays)
end
it "allows using a non-standard setter for generated properties" do