Skip to content

Commit

Permalink
Add basic screenshot test
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed May 15, 2024
1 parent 42c3621 commit 166d3bf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Binary file added tests/data/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions tests/test_screenshot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pathlib import Path

from myterial import orange, salmon
from rich import print
from PIL import Image
from brainrender import Scene

def test_screenshot(tmp_path):
filename = "screenshot.png"
scene = Scene(
screenshots_folder=tmp_path,
)
scene.add_brain_region("TH")
scene.render(interactive=False, zoom=2)
scene.screenshot(name=filename)
scene.close()

test_filepath = tmp_path / filename
assert test_filepath.exists()

img1 = Image.open(test_filepath)
assert img1.size == (1600, 1200)

0 comments on commit 166d3bf

Please sign in to comment.