Refactoring

This commit is contained in:
Matthias Bisping 2023-02-01 16:36:21 +01:00
parent 740a9cb3c2
commit 56c10490b9

View File

@ -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