Ensure correct extraction text of rotated text.
()
| 250 | |
| 251 | |
| 252 | def 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 | |
| 280 | def test_3179(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…