Tests: Add test for broken EXR files

To make sure non-trivial cases like #106977 are not re-introduced.

Pull Request: https://projects.blender.org/blender/blender/pulls/107643
This commit is contained in:
Sergey Sharybin 2023-05-05 11:00:54 +02:00 committed by Sergey Sharybin
parent 70cd2a9741
commit ecb8d7f8ab
1 changed files with 26 additions and 0 deletions

View File

@ -155,6 +155,32 @@ class ImBufLoadTest(ImBufTest):
self.check("*.webp")
class ImBufBrokenTest(AbstractImBufTest):
@classmethod
def setUpClass(cls):
AbstractImBufTest.init(args)
def _get_image_files(self, file_pattern):
return [f for f in (self.test_dir / "broken_images").glob(file_pattern)]
def check(self, file_pattern):
image_files = self._get_image_files(file_pattern)
print(image_files)
if len(image_files) == 0:
self.fail(f"No images found for pattern {file_pattern}")
for image_path in image_files:
print_message(image_path.name, 'SUCCESS', 'RUN')
bpy.ops.image.open(filepath=str(image_path))
class ImBufLoadBrokenTest(ImBufBrokenTest):
def test_load_exr(self):
self.skip_if_format_missing("OPENEXR")
self.check("*.exr")
def main():
global args
import argparse