diff --git a/test/fixtures/page_generation/page.py b/test/fixtures/page_generation/page.py index b2595ec..98ccb15 100644 --- a/test/fixtures/page_generation/page.py +++ b/test/fixtures/page_generation/page.py @@ -6,10 +6,17 @@ import numpy as np import pytest from PIL import Image, ImageEnhance from PIL.Image import Transpose +from funcy import ( + juxt, + compose, + identity, +) from loguru import logger +from cv_analysis.locations import TEST_PAGE_TEXTURES_DIR from cv_analysis.utils.conversion import normalize_image_format_to_array, normalize_image_format_to_pil from cv_analysis.utils.image_operations import blur, sharpen, overlay, superimpose +from cv_analysis.utils.rectangle import Rectangle from synthesis.content_generator import ContentGenerator from synthesis.partitioner.two_column import TwoColumnPagePartitioner from synthesis.random import rnd @@ -19,18 +26,6 @@ logger.remove() logger.add(sys.stderr, level="INFO") -from funcy import ( - juxt, - compose, - identity, -) - -from cv_analysis.locations import TEST_PAGE_TEXTURES_DIR - -from cv_analysis.utils.display import show_image -from cv_analysis.utils.rectangle import Rectangle - - @pytest.fixture( params=[ # "rough_grain", @@ -258,13 +253,4 @@ def page_with_content( page, boxes = page_with_translucent_content # page, boxes = page_with_opaque_content - draw_boxes(page, boxes) - - return page - - -def draw_boxes(page: Image, boxes: Iterable[Rectangle]): - from cv_analysis.utils.drawing import draw_rectangles - - page = draw_rectangles(page, boxes, filled=False, annotate=True) - show_image(page, backend="pil") + return page, boxes diff --git a/test/page_generation_test.py b/test/page_generation_test.py index d7a3ca1..9d56011 100644 --- a/test/page_generation_test.py +++ b/test/page_generation_test.py @@ -1,6 +1,19 @@ +from typing import Iterable + +from PIL.Image import Image + from cv_analysis.utils.display import show_image +from cv_analysis.utils.rectangle import Rectangle def test_blank_page(page_with_content): - pass - # show_image(blank_page) + page, boxes = page_with_content + + draw_boxes(page, boxes) + + +def draw_boxes(page: Image, boxes: Iterable[Rectangle]): + from cv_analysis.utils.drawing import draw_rectangles + + page = draw_rectangles(page, boxes, filled=False, annotate=True) + show_image(page, backend="pil")