Core (nodes/core/): alpha, masks, batch consolidation, blend, transform matrix, bbox, parameters, validation engines shared across nodes, each with unit tests. Fix an unconditional RGB clamp to [0,1] that silently destroyed HDR/negative values in Merge, Transform, Color Correct, Comp, CornerPin, Distort, Spherize, Crop Stitch, and the shared masked-compositing helpers. Alpha stays clamped everywhere; RGB no longer does. Fix Grain applying `amount` twice in overlay/soft_light modes (quadratic instead of linear falloff). Add STMap mode to Distort (absolute UV remap vs relative displacement). Add bbox output/input wiring between Crop and Crop Stitch. Add edge_grow and edge_color_match to Crop Stitch. Add despill to Keyer. Add shuffle mode to Channel (R/G/B/A routed from any source). Add size/luma_response to Grain. Add grid mode to Constant. Add frame/layer accumulation limits to Preview and Draw, plus a font-path containment fix and supersampling in Text. Make Frame Range and Append recognize a real ComfyUI VIDEO input (not only this pack's internal media wrapper), preserving true fps/audio instead of silently dropping them, and add a native VIDEO output alongside the existing IMAGE output on both. Add node_replacements.py (empty registry, wired into the extension lifecycle) for future schema migrations. Add a CI matrix pinning the verified requires-comfyui floor, and .comfyignore for Registry packaging.
52 lines
973 B
Python
52 lines
973 B
Python
from __future__ import annotations
|
|
|
|
from nodes.core.bbox import BBox
|
|
|
|
|
|
def test_width_and_height():
|
|
box = BBox(10, 20, 40, 50)
|
|
|
|
assert box.width == 30
|
|
assert box.height == 30
|
|
|
|
|
|
def test_negative_extent_reports_zero_size():
|
|
box = BBox(40, 40, 10, 10)
|
|
|
|
assert box.width == 0
|
|
assert box.height == 0
|
|
assert box.is_empty
|
|
|
|
|
|
def test_expand_grows_in_all_directions():
|
|
box = BBox(10, 10, 20, 20).expand(5)
|
|
|
|
assert box == BBox(5, 5, 25, 25)
|
|
|
|
|
|
def test_intersect():
|
|
a = BBox(0, 0, 10, 10)
|
|
b = BBox(5, 5, 15, 15)
|
|
|
|
assert a.intersect(b) == BBox(5, 5, 10, 10)
|
|
|
|
|
|
def test_intersect_disjoint_is_empty():
|
|
a = BBox(0, 0, 5, 5)
|
|
b = BBox(10, 10, 15, 15)
|
|
|
|
assert a.intersect(b).is_empty
|
|
|
|
|
|
def test_union():
|
|
a = BBox(0, 0, 10, 10)
|
|
b = BBox(5, 5, 20, 15)
|
|
|
|
assert a.union(b) == BBox(0, 0, 20, 15)
|
|
|
|
|
|
def test_clamp_to_frame():
|
|
box = BBox(-10, -10, 200, 200)
|
|
|
|
assert box.clamp_to_frame(100, 80) == BBox(0, 0, 100, 80)
|