Add comprehensive tests for image processing and mask functionalities

- Introduced tests for color image handling, ensuring source preservation and premultiplied alpha usage.
- Implemented tests for brush stroke operations, validating segment boundaries and brush anti-aliasing.
- Added tests for frame anti-aliasing, confirming correct rendering behavior with various alpha values and depth settings.
- Created tests for frame projection, ensuring accurate overlap calculations and half-plane clipping.
- Developed tests for image premultiplied retention, verifying behavior during loading and packing processes.
- Added undo functionality tests for mask operations, ensuring single transaction behavior during edits.
This commit is contained in:
2026-09-05 21:33:11 +08:00
parent bbaa4bff46
commit 1994d38ccd
111 changed files with 7691 additions and 2341 deletions

View File

@@ -96,12 +96,12 @@ def test_depth_balloon_plane_calibration_matches_cutout_axes():
uv = []
camera_depth = np.empty((3, 3), dtype=np.float32)
for row in range(3):
local_z = 1.0 - row
local_y = 1.0 - row
for column in range(3):
local_y = column - 1.0
vertices.append((0.0, local_y, local_z))
local_x = column - 1.0
vertices.append((local_x, local_y, 0.0))
uv.append((column * 0.5, 1.0 - row * 0.5))
camera_depth[row, column] = 2.0 + 0.2 * local_y + 0.1 * local_z
camera_depth[row, column] = 2.0 + 0.2 * local_x + 0.1 * local_y
reference, direction = cutout_geometry.depth_balloon_projection_parameters(
vertices,
@@ -110,7 +110,7 @@ def test_depth_balloon_plane_calibration_matches_cutout_axes():
np.ones((3, 3), dtype=bool),
0.5,
)
expected_direction = np.asarray((-0.1, 0.05, 1.0), dtype=np.float64)
expected_direction = np.asarray((0.1, 0.05, 1.0), dtype=np.float64)
expected_direction /= np.linalg.norm(expected_direction)
assert np.isclose(
@@ -130,7 +130,7 @@ def test_depth_balloon_reference_uses_the_shared_upper_depth_percentile():
uv = []
for y in range(size):
for x in range(size):
vertices.append((0.0, float(x), float(size - 1 - y)))
vertices.append((float(x), float(size - 1 - y), 0.0))
uv.append((x / (size - 1), 1.0 - y / (size - 1)))
reference, direction = cutout_geometry.depth_balloon_projection_parameters(