Skip to content

Commit 0b32822

Browse files
tests/test_general.py: test_4902(): new, reproducer for #4902.
1 parent ca1a0ac commit 0b32822

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/test_general.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,3 +2221,25 @@ def test_4928():
22212221
except Exception as e:
22222222
print(f'Ignoring expected exception: {e}')
22232223

2224+
def test_4902():
2225+
print()
2226+
with pymupdf.open() as doc:
2227+
page = doc.new_page()
2228+
text = 'Hello World'
2229+
bw = 0.4
2230+
fontsize = 20
2231+
page.insert_text(
2232+
(72, 72),
2233+
text,
2234+
fontsize=fontsize,
2235+
render_mode=2,
2236+
color=(1, 0, 0),
2237+
fill=(0, 1, 0),
2238+
border_width=bw,
2239+
)
2240+
data = doc.tobytes()
2241+
with pymupdf.open('pdf', data) as doc:
2242+
page = doc[0]
2243+
spans = page.get_texttrace()
2244+
for span in spans:
2245+
print(f'test_4902(): {span["linewidth"]=}, should be {bw*fontsize=}.')

0 commit comments

Comments
 (0)