Do not skip the gltf output test anymore, adds a mission test for image format = auto

This commit is contained in:
Fabien LOISON 2021-04-16 15:34:05 +02:00
parent 160cc4cf56
commit 688e04daa3
No known key found for this signature in database
GPG Key ID: FF90CA148348048E
2 changed files with 26 additions and 5 deletions

View File

@ -155,8 +155,31 @@ class Test_optimize(object):
assert len(output2.read()) < len(output1.read())
@pytest.mark.skip(reason="Requires output_format=auto")
def test_opacity_threshold(self):
raise NotImplementedError() # TODO
@pytest.mark.parametrize(
"image_path,threshold,format_checker",
[
# fmt: off
("test/images/alpha.png", 254, is_png),
("test/images/alpha.png", 0, is_jpeg),
("test/images/threshold.png", 254, is_png),
("test/images/threshold.png", 255, is_png),
("test/images/threshold.png", 0, is_jpeg),
("test/images/threshold.png", 230, is_png),
("test/images/threshold.png", 229, is_jpeg),
# fmt: on
],
)
def test_opacity_threshold(self, image_path, threshold, format_checker):
output = io.BytesIO()
yoga.image.optimize(
image_path,
output,
{
"output_format": "auto",
"opacity_threshold": threshold,
},
)
output.seek(0)
assert format_checker(output.read())
# TODO test wrong image / fuzzy inputs

View File

@ -90,7 +90,6 @@ class Test_optimize(object):
output.seek(0)
assert output.read().startswith(_MAGIC_GLB)
@pytest.mark.skip("Format not supported yet")
def test_gltf_output_format(self):
output = io.BytesIO()
yoga.model.optimize(
@ -100,5 +99,4 @@ class Test_optimize(object):
assert json.load(output)["asset"]["version"] == "2.0"
# TODO Tests for no_graph_optimization and such
# TODO Tests for no_fix_infacing_normals and such