Skip to content

Commit 3160185

Browse files
committed
Fix mask rectangle tests
1 parent b132c45 commit 3160185

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tests/test_custom_workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_prepare_mask():
357357
jobs = JobQueue()
358358
workspace = CustomWorkspace(workflows, dummy_generate, jobs)
359359

360-
mask = Mask.rectangle(Bounds(10, 10, 40, 40), 0)
360+
mask = Mask.rectangle(Bounds(10, 10, 40, 40), Bounds(10, 10, 40, 40))
361361
canvas_bounds = Bounds(0, 0, 100, 100)
362362
selection_bounds = Bounds(12, 12, 34, 34)
363363
selection_node = ComfyNode(0, "ETN_Selection", {"context": "automatic", "padding": 3})
@@ -575,8 +575,8 @@ def test_expand_animation():
575575
Image.create(Extent(4, 4), Qt.GlobalColor.white),
576576
])
577577
in_masks = ImageCollection([
578-
Mask.rectangle(Bounds(0, 0, 4, 4), 1).to_image(),
579-
Mask.rectangle(Bounds(1, 1, 3, 3), 1).to_image(),
578+
Mask.rectangle(Bounds(0, 0, 4, 4), Bounds(0, 0, 4, 4)).to_image(),
579+
Mask.rectangle(Bounds(1, 1, 3, 3), Bounds(1, 1, 3, 3)).to_image(),
580580
])
581581
params = {
582582
"image": in_images,

tests/test_image.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,16 @@ def test_mask_to_image_no_extent():
332332

333333

334334
def test_mask_rectangle():
335-
mask = Mask.rectangle(Bounds(1, 2, 6, 5), feather=2)
335+
mask = Mask.rectangle(Bounds(1, 2, 6, 5), Bounds(4, 5, 8, 7))
336336
# fmt: off
337337
assert mask.to_array() == [
338-
127, 159, 191, 191, 159, 127,
339-
159, 191, 223, 223, 191, 159,
340-
191, 223, 255, 255, 223, 191,
341-
159, 191, 223, 223, 191, 159,
342-
127, 159, 191, 191, 159, 127]
338+
0, 0 , 0 , 0 , 0 , 0 , 0 , 0,
339+
0, 0 , 0 , 0 , 0 , 0 , 0 , 0,
340+
0, 255, 255, 255, 255, 255, 255, 0,
341+
0, 255, 255, 255, 255, 255, 255, 0,
342+
0, 255, 255, 255, 255, 255, 255, 0,
343+
0, 255, 255, 255, 255, 255, 255, 0,
344+
0, 255, 255, 255, 255, 255, 255, 0]
343345
# fmt: on
344346

345347

0 commit comments

Comments
 (0)