From 92a6ff19a1437af8b59969abe33facfce8eb9f34 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 17 May 2016 14:08:46 +0100 Subject: [PATCH] add some more webp tests --- test/test_foreign.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_foreign.py b/test/test_foreign.py index 0eb44ff0..726a790e 100755 --- a/test/test_foreign.py +++ b/test/test_foreign.py @@ -9,6 +9,8 @@ import shutil #import logging #logging.basicConfig(level = logging.DEBUG) +import gi +gi.require_version('Vips', '8.0') from gi.repository import Vips Vips.leak_set(True) @@ -266,6 +268,17 @@ class TestForeign(unittest.TestCase): 50) self.save_load("%s.webp", self.colour) + # test lossless mode + im = Vips.Image.new_from_file(self.webp_file) + buf = im.webpsave_buffer(lossless = True) + im2 = Vips.Image.new_from_buffer(buf, "") + self.assertEqual(im.avg(), im2.avg()) + + # higher Q should mean a bigger buffer + b1 = im.webpsave_buffer(Q = 10) + b2 = im.webpsave_buffer(Q = 90) + self.assertGreater(len(b2), len(b1)) + def test_analyzeload(self): x = Vips.type_find("VipsForeign", "analyzeload") if not x.is_instantiatable():