Skip to content

Commit

Permalink
Add further numpy rendering test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Aug 28, 2022
1 parent 7c4285c commit 88010bb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/helpers/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@ def test_render_page_bgcolour(colour, sample_page):
image.close()


@pytest.mark.parametrize(
"rev_byteorder", [False, True]
)
def test_render_page_tonumpy(rev_byteorder, sample_page):

array, cl_format = sample_page.render_tonumpy(rev_byteorder=rev_byteorder)
assert isinstance(array, numpy.ndarray)
if rev_byteorder:
assert cl_format == "RGB"
else:
assert cl_format == "BGR"

for (x, y), value in ExpRenderPixels:
if rev_byteorder:
assert tuple(array[y][x]) == value
else:
assert tuple(array[y][x]) == tuple(reversed(value))


@pytest.mark.parametrize(
"rev_byteorder", [False, True]
)
Expand Down

0 comments on commit 88010bb

Please sign in to comment.