Tests: Add tests for image format saving and loading #104442
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104442
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "deadpin:image-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds saving and loading tests for our supported image formats.
Saving - bf_imbuf_save.py
There are 2 template images which are loaded anew for each file save
attempt. One is an 8-bit RGBA image and the other 32-bit. This is
required as many formats use a variety of factors to determine which of
ibuf->rect
oribuf->rectfloat
to use for processing. The templatesare constructed to have alpha transparency as well as values > 1 (or
clamped to 1 for the case of the 8-bit template).
Test flow:
Notes:
Loading - bf_imbuf_load.py
Test flow:
Notes:
A HTML report is not implemented. The diff output organization is very
similar to the other tests so it should be somewhat easy to do in the
future if we want.
The standard set of environment variables are implemented for both:
BLENDER_TEST_UPDATE, BLENDER_VERBOSE, and BLENDER_TEST_COLOR
Test files
The SVN test files are attached.
There's a variety of images which are probably "incorrect" with current master.
Their reference comparisons will pass, so the tests won't fail, but they look incorrect in Blender or other software.
I believe most/all of these images will be corrected once OIIO is used for saving/loading.
In the provided SVN zip file, check the following for some examples:
reference/png-bw-16-25__from__rgba32.png
--> color shift compared to other BW variantsreference/dpx-rgb-08-false__from__rgba08.dpx
--> too darkreference/dpx-*-true*.dpx
--> broken alpha? (these have use_cineon_log = True)Looks fine overall, only minor nitpicks.
@ -0,0 +7,4 @@
import bpy
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
We're trying to move away from os.path towards pathlib. I think removing the few usages in the new code in this patch is relatively straightforward.
@ -0,0 +34,4 @@
actual_metadata = f"{channels=} {is_float=} {colorspace=} {alpha_mode=}"
# Save actual metadata
with open(out_metadata_path, "w+") as meta:
Can just be
"w"
?Or better
out_metadata_path.write_text(out_metadata_path)
when usingpathlib
.@ -0,0 +57,4 @@
if failed and self.update:
# Update reference metadata if requested.
with open(ref_metadata_path, "w+") as meta:
Same comment.
@ -0,0 +9,4 @@
args = None
class COLORS_ANSI:
Can we deduplicate this colored printing code with other test modules?
Sorry, I rebased this branch before knowing the rule not to. The additional 4 commits that came in are organized
accordingly though.
No problem, it's not a hard rule and I only edited the wiki page to recommend it a few days ago.
@blender-bot build
@blender-bot build
Pull request closed