-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add test comparing odt to png snapshot
- Loading branch information
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file added
BIN
+12.8 KB
tagstudio/tests/qt/__snapshots__/test_thumb_renderer/test_odt_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (C) 2024 Travis Abendshien (CyanVoxel). | ||
# Licensed under the GPL-3.0 License. | ||
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio | ||
|
||
import io | ||
from pathlib import Path | ||
|
||
from PIL import Image | ||
from src.qt.widgets.thumb_renderer import ThumbRenderer | ||
from syrupy.extensions.image import PNGImageSnapshotExtension | ||
|
||
|
||
def test_odt_preview(cwd, snapshot): | ||
file_path: Path = cwd / "fixtures" / "sample.odt" | ||
renderer = ThumbRenderer() | ||
img: Image.Image = renderer._open_doc_thumb(file_path) | ||
|
||
img_bytes = io.BytesIO() | ||
img.save(img_bytes, format="PNG") | ||
img_bytes.seek(0) | ||
assert img_bytes.read() == snapshot(extension_class=PNGImageSnapshotExtension) |