MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / test_3148

Function test_3148

tests/test_tables.py:252–277  ·  view source on GitHub ↗

Ensure correct extraction text of rotated text.

()

Source from the content-addressed store, hash-verified

250
251
252def test_3148():
253 """Ensure correct extraction text of rotated text."""
254 doc = pymupdf.open()
255 page = doc.new_page()
256 rect = pymupdf.Rect(100, 100, 300, 300)
257 text = (
258 "rotation 0 degrees",
259 "rotation 90 degrees",
260 "rotation 180 degrees",
261 "rotation 270 degrees",
262 )
263 degrees = (0, 90, 180, 270)
264 delta = (2, 2, -2, -2)
265 cells = pymupdf.make_table(rect, cols=3, rows=4)
266 for i in range(3):
267 for j in range(4):
268 page.draw_rect(cells[j][i])
269 k = (i + j) % 4
270 page.insert_textbox(cells[j][i] + delta, text[k], rotate=degrees[k])
271 # doc.save("multi-degree.pdf")
272 tabs = page.find_tables()
273 tab = tabs[0]
274 for extract in tab.extract():
275 for item in extract:
276 item = item.replace("\n", " ")
277 assert item in text
278
279
280def test_3179():

Callers

nothing calls this directly

Calls 4

new_pageMethod · 0.80
extractMethod · 0.80
draw_rectMethod · 0.45
insert_textboxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…