From 0354e5b6694af0aab8badc96d8767699077d417a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 May 2018 20:15:23 +0530 Subject: [PATCH] Add a PNG load test that does not depend on PIL --- kitty_tests/graphics.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kitty_tests/graphics.py b/kitty_tests/graphics.py index e02ba1056..51e19a2e0 100644 --- a/kitty_tests/graphics.py +++ b/kitty_tests/graphics.py @@ -6,7 +6,7 @@ import os import tempfile import unittest import zlib -from base64 import standard_b64encode +from base64 import standard_b64decode, standard_b64encode from io import BytesIO from kitty.fast_data_types import ( @@ -206,6 +206,12 @@ class TestGraphics(BaseTest): self.ae(l(b'a' * 20, f=100, S=20).partition(':')[0], 'EBADPNG') + def test_load_png_simple(self): + # 1x1 transparent PNG + png_data = standard_b64decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==') + s, g, l, sl = load_helpers(self) + sl(png_data, f=100, expecting_data=b'\x00\xff\xff\x7f') + def test_image_put(self): cw, ch = 10, 20 s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch)