diff --git a/test/fixtures/page_generation/page.py b/test/fixtures/page_generation/page.py index b70f6a6..02f1996 100644 --- a/test/fixtures/page_generation/page.py +++ b/test/fixtures/page_generation/page.py @@ -1323,37 +1323,38 @@ def boxes(page_partitioner, blank_page): return boxes +@pytest.fixture +def prepared_texture(texture, texture_fn): + texture = random_flip(texture) + texture = texture_fn(texture) + return texture + + @pytest.fixture def page_with_opaque_content( - blank_page, tinted_blank_page, texture, texture_fn, boxes + blank_page, tinted_blank_page, prepared_texture, boxes ) -> Tuple[np.ndarray, Iterable[Rectangle]]: """Creates a page with content""" content_generator = ContentGenerator() boxes = content_generator(boxes) - texture = random_flip(texture) - texture = texture_fn(texture) - - page = paste_contents(texture, boxes) + page = paste_contents(prepared_texture, boxes) return page, boxes @pytest.fixture def page_with_translucent_content( - blank_page, tinted_blank_page, texture, texture_fn, boxes + blank_page, tinted_blank_page, prepared_texture, boxes ) -> Tuple[np.ndarray, List[Rectangle]]: """Creates a page with content""" content_generator = ContentGenerator() boxes = content_generator(boxes) - texture = random_flip(texture) - texture = texture_fn(texture) - page_content = paste_contents(blank_page, boxes) - page = blend_by_multiply(page_content, texture) + page = blend_by_multiply(page_content, prepared_texture) return page, boxes