Skip to content

Commit 1e0b30a

Browse files
committed
...
1 parent 2299c8b commit 1e0b30a

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

agrf/graphics/cv/foundation_test.py

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ def test_make_foundation_subimage_basic_left_side():
1414
base = _full_alpha_image()
1515
# part (6, 0) targets the left side (c <= 0) when scale=4 and xofs=0
1616
out = make_foundation_subimage(
17-
base, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0, solid=True
17+
base,
18+
scale=4,
19+
left_parts=6,
20+
right_parts=None,
21+
nw=False,
22+
ne=False,
23+
y_limit=64,
24+
cut_inside=False,
25+
zshift=0,
26+
solid=True,
1827
)
1928
assert out.alpha is not None
2029
# Left-most column should be non-zero
@@ -23,33 +32,41 @@ def test_make_foundation_subimage_basic_left_side():
2332
assert out.alpha[0, 8] == 0
2433

2534

26-
def test_make_foundation_subimage_alpha_none_passthrough():
27-
# If input has no alpha, output keeps alpha as None
28-
rgb = np.zeros((8, 8, 3), dtype=np.uint8)
29-
base = LayeredImage(0, 0, 8, 8, rgb, None, None)
30-
out = make_foundation_subimage(
31-
base, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0, solid=True
32-
)
33-
assert out.alpha is None
34-
35-
3635
def test_make_foundation_passthrough_single_input():
3736
base = _full_alpha_image()
3837
# Only solid provided
3938
expected_solid = make_foundation_subimage(
40-
base.copy(), scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0, solid=True
39+
base.copy(),
40+
scale=4,
41+
left_parts=6,
42+
right_parts=None,
43+
nw=False,
44+
ne=False,
45+
y_limit=64,
46+
cut_inside=False,
47+
zshift=0,
48+
solid=True,
4149
)
4250
out_solid = make_foundation(
43-
base, None, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0
51+
base, None, scale=4, left_parts=6, right_parts=None, nw=False, ne=False, y_limit=64, cut_inside=False, zshift=0
4452
)
4553
assert np.array_equal(out_solid.alpha, expected_solid.alpha)
4654

4755
# Only ground provided
4856
expected_ground = make_foundation_subimage(
49-
base.copy(), scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0, solid=False
57+
base.copy(),
58+
scale=4,
59+
left_parts=6,
60+
right_parts=None,
61+
nw=False,
62+
ne=False,
63+
y_limit=64,
64+
cut_inside=False,
65+
zshift=0,
66+
solid=False,
5067
)
5168
out_ground = make_foundation(
52-
None, base, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0
69+
None, base, scale=4, left_parts=6, right_parts=None, nw=False, ne=False, y_limit=64, cut_inside=False, zshift=0
5370
)
5471
assert np.array_equal(out_ground.alpha, expected_ground.alpha)
5572

@@ -59,10 +76,28 @@ def test_make_foundation_subimage_zshift_reduces_coverage_for_part0():
5976
base = _full_alpha_image()
6077
base.yofs = 120
6178
out0 = make_foundation_subimage(
62-
base, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=0, solid=True
79+
base,
80+
scale=4,
81+
left_parts=6,
82+
right_parts=None,
83+
nw=False,
84+
ne=False,
85+
y_limit=64,
86+
cut_inside=False,
87+
zshift=0,
88+
solid=True,
6389
)
6490
out1 = make_foundation_subimage(
65-
base, scale=4, left_parts=6, right_parts=None, y_limit=64, cut_inside=False, zshift=2, solid=True
91+
base,
92+
scale=4,
93+
left_parts=6,
94+
right_parts=None,
95+
nw=False,
96+
ne=False,
97+
y_limit=64,
98+
cut_inside=False,
99+
zshift=2,
100+
solid=True,
66101
)
67102
sum0 = int(out0.alpha.sum())
68103
sum1 = int(out1.alpha.sum())

0 commit comments

Comments
 (0)