diff --git a/pyproject.toml b/pyproject.toml index c252aa4..baf602a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dev = ["pytest>=7.0"] [tool.pytest.ini_options] minversion = "6.0" -addopts = "-ra -q" +addopts = "-ra -vvv --log-cli-level=INFO" testpaths = [ "tests", ] diff --git a/src/videotoolkit/tools.py b/src/videotoolkit/tools.py index f26ea3f..2467ed1 100644 --- a/src/videotoolkit/tools.py +++ b/src/videotoolkit/tools.py @@ -7,8 +7,13 @@ from reportlab.pdfgen import canvas from .utils import add_logo, generate_hex_grid +from pathlib import Path +import logging -def create_start_slide(filename: str, title: str, subtitle: str): +logger = logging.getLogger(__name__) + + +def create_start_slide(filename: str | Path, title: str, subtitle: str): """Creates a PDF start slide with the given title and subtitle.""" # Define the dimensions for a 16:9 aspect ratio width, height = 3840, 2160 @@ -28,6 +33,7 @@ def create_start_slide(filename: str, title: str, subtitle: str): # Save PDF c.showPage() c.save() + logger.info(f'Saved {filename}') def create_end_slide(filename: str, message: str): diff --git a/tests/test_tools.py b/tests/test_tools.py index b5ae052..e335a2c 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -3,10 +3,25 @@ # This source code is licensed under the MIT License found in the # LICENSE file in the root directory of this source tree. +from pathlib import Path +import tempfile + +import videotoolkit + def test_create_start_slide(): - """Placeholder test for create_start_slide""" - assert True # Replace with real test later + with tempfile.TemporaryDirectory() as temp_dir: + # Convert the temporary directory path to a Path object + temp_path = Path(temp_dir) + + pdf_file = temp_path / 'test.pdf' + png_file = temp_path / 'test.png' + + videotoolkit.create_start_slide(str(pdf_file), 'title', 'subtitle') + videotoolkit.pdf_to_png(temp_path / 'test.pdf') + + assert pdf_file.is_file() + assert png_file.is_file() def test_create_end_slide():