Skip to content

Commit

Permalink
Added tests for screenshot suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Apr 24, 2024
1 parent f3266ef commit 08864a4
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/test_scene.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import shutil
from pathlib import Path

import pytest

Expand Down Expand Up @@ -101,12 +102,24 @@ def test_scene_slice():


@pytest.mark.parametrize(
"name, scale", [("test", 2), (None, None), (None, 1), ("test2", None)]
"name, scale, expected_suffix", [
("test", 2, ".png"),
(None, None, ".png"),
(None, 1, ".png"),
("test2", None, ".png"),
("test.jpg", 1, ".jpg"),
("test.eps", 1, ".eps"),
("test.svg", 1, ".svg"),
("test.pdf", 1, ".pdf"),
("test.tiff", 1, ".png"),
]
)
def test_scene_screenshot(name, scale):
s = Scene(screenshots_folder="tests/screenshots")
s.screenshot(name=name, scale=scale)
shutil.rmtree("tests/screenshots")
def test_scene_screenshot(name, scale, expected_suffix):
screenshot_folder = Path.home() / "test_screenshots"
s = Scene(screenshots_folder=screenshot_folder)
out_path = s.screenshot(name=name, scale=scale)
assert Path(out_path).suffix == expected_suffix
shutil.rmtree(screenshot_folder)
del s


Expand Down

0 comments on commit 08864a4

Please sign in to comment.