MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_2365

Function test_2365

tests/test_drawings.py:127–147  ·  view source on GitHub ↗

Draw a filled rectangle on a new page. Then extract the page's vector graphics and confirm that only one path was generated which has all the right properties.

()

Source from the content-addressed store, hash-verified

125
126
127def test_2365():
128 """Draw a filled rectangle on a new page.
129
130 Then extract the page's vector graphics and confirm that only one path
131 was generated which has all the right properties."""
132 doc = pymupdf.open()
133 page = doc.new_page()
134 rect = pymupdf.Rect(100, 100, 200, 200)
135 page.draw_rect(
136 rect, color=pymupdf.pdfcolor["black"], fill=pymupdf.pdfcolor["yellow"], width=3
137 )
138 paths = page.get_drawings()
139 assert len(paths) == 1
140 path = paths[0]
141 assert path["type"] == "fs"
142 assert path["fill"] == pymupdf.pdfcolor["yellow"]
143 assert path["fill_opacity"] == 1
144 assert path["color"] == pymupdf.pdfcolor["black"]
145 assert path["stroke_opacity"] == 1
146 assert path["width"] == 3
147 assert path["rect"] == rect
148
149
150def test_2462():

Callers

nothing calls this directly

Calls 3

new_pageMethod · 0.80
get_drawingsMethod · 0.80
draw_rectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…