fix multi-profile
This commit is contained in:
@@ -31,3 +31,41 @@ def test_vertical_direction():
|
||||
field = make_field(shape=(80, 40))
|
||||
(profile,) = node.process(field, field, row=-1, direction="vertical", mode="overlay")
|
||||
assert len(profile.data) == 80, f"Vertical profile length should be field height (80), got {len(profile.data)}"
|
||||
|
||||
|
||||
def test_emits_blended_overlay():
|
||||
from backend.execution_context import active_node, execution_callbacks
|
||||
from backend.nodes.multi_profile import MultipleProfiles
|
||||
|
||||
node = MultipleProfiles()
|
||||
field = make_field(shape=(64, 128))
|
||||
|
||||
overlays = []
|
||||
with execution_callbacks(overlay=lambda nid, d: overlays.append(d)), active_node("test"):
|
||||
node.process(field, field, row=10, direction="horizontal", mode="overlay")
|
||||
|
||||
assert len(overlays) == 1
|
||||
ov = overlays[0]
|
||||
assert ov["kind"] == "multi_profile"
|
||||
assert ov["section_title"] == "Preview"
|
||||
assert ov["image"].startswith("data:image/png;base64,")
|
||||
assert ov["row"] == 10
|
||||
assert ov["direction"] == "horizontal"
|
||||
assert ov["max_index"] == 63 # height - 1
|
||||
|
||||
|
||||
def test_overlay_max_index_for_vertical():
|
||||
from backend.execution_context import active_node, execution_callbacks
|
||||
from backend.nodes.multi_profile import MultipleProfiles
|
||||
|
||||
node = MultipleProfiles()
|
||||
field = make_field(shape=(80, 40))
|
||||
|
||||
overlays = []
|
||||
with execution_callbacks(overlay=lambda nid, d: overlays.append(d)), active_node("test"):
|
||||
node.process(field, field, row=-1, direction="vertical", mode="overlay")
|
||||
|
||||
ov = overlays[0]
|
||||
assert ov["direction"] == "vertical"
|
||||
assert ov["max_index"] == 39 # width - 1
|
||||
assert ov["row"] == 20 # center column for 40 wide
|
||||
|
||||
Reference in New Issue
Block a user