spec/integration/icon_spec.rb in prawn-icon-3.1.0 vs spec/integration/icon_spec.rb in prawn-icon-4.0.0
- old
+ new
@@ -66,11 +66,11 @@
)
pdf.text('Hello')
inspector = PDF::Inspector::Text.analyze(pdf.render)
y = inspector.positions[1].last.round
- expect(y).to eq(723)
+ expect(y).to eq(722)
end
end
end
context 'without options' do
@@ -152,11 +152,11 @@
pdf.formatted_icon_box(icon_text, inline_format: true, x: 200, y: 100).render
inspector = PDF::Inspector::Text.analyze(pdf.render)
x, y = inspector.positions[0]
expect(x).to eq(200)
- expect(y.round).to eq(90)
+ expect(y.round).to eq(89)
end
it 'handles final_gap: false correctly' do
icon_text = <<~CONTENT
Hello, <icon size="60">fas-globe</icon>
@@ -265,9 +265,15 @@
context 'Material Design Icons' do
it 'renders Material Design Icon glyphs' do
pdf.icon 'mdi-beer'
text = PDF::Inspector::Text.analyze(pdf.render)
- expect(text.strings.first).to eq('')
+ # NOTE: Prawn <= 2.4.0 incorrectly handled unicode codepoints
+ # see: https://github.com/prawnpdf/prawn/pull/1327#issuecomment-1905817491
+ if Gem::Version.new(Prawn::VERSION) <= Gem::Version.new('2.4.0')
+ expect(text.strings.first).to eq("\u{F009}")
+ else
+ expect(text.strings.first).to eq("\u{F0098}")
+ end
end
end
end