Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
test(video): a first frame moved into the slide is refused on the step it moves inside, and the walk going away rises by sub-pixels
Soohong Kim371139572910
diff --git a/tests/video/test_body_anchor_gate.py b/tests/video/test_body_anchor_gate.pyindex 8bdcdd1..bbfec83 100644--- a/tests/video/test_body_anchor_gate.py+++ b/tests/video/test_body_anchor_gate.py@@ -163,21 +163,28 @@ def test_a_wrap_the_ramp_does_not_close_is_refused_as_the_source_frames_refuse_idef test_a_cut_the_source_frames_pass_is_not_read_again(tmp_path: Path):"""The walk with no slide (the anchor moves nothing), the sliding walk under a limit its source frames pass, and awalk whose first frame moved 3 px, which the source frames pass: the gate's reading is the source frames', the- ratio of the same cut without the anchor."""+ ratio of the same cut without the anchor. The 3 px take up the slide's 2.3 px at the wrap and put the jump on the+ step into frame 1, which the step gate refuses after the seam gate passed the wrap."""still = _keyed(tmp_path, "still", _walk(drift=0.0))sliding = _keyed(tmp_path, "sliding", _walk())nudged = _keyed(tmp_path, "nudged", _spoiled((0,), lambda im: _moved(im, 3)))reports = {}- for keyed, kw in ((still, {}), (sliding, {"seam_max": 1000.0}), (nudged, {})):+ for keyed, kw in ((still, {}), (sliding, {"seam_max": 1000.0})):report = reports[keyed] = _cut(tmp_path, keyed, f"{keyed.name}-body", **kw)plain = _cut(tmp_path, keyed, f"{keyed.name}-none", anchor="none", **kw)assert report["status"] == "passed" and report["seam_measurement"] == "source-frames"assert "seam_after_anchor" not in reportassert report["resampled_seam_ratio"] == plain["resampled_seam_ratio"]- assert reports[still]["strip"]["wrap_dx_px"] == 0- assert reports[sliding]["strip"]["wrap_dx_px"] != 0 and reports[nudged]["strip"]["wrap_dx_px"] != 0+ assert reports[still]["strip"]["wrap_dx_px"] == 0 and reports[sliding]["strip"]["wrap_dx_px"] != 0# the sliding walk's source frames read over the default limit: the forced limit passes them as they readassert reports[sliding]["resampled_seam_ratio"] > loop_mod.SEAM_RATIO_MAX+ message, report = _refused(tmp_path, nudged, "nudged-body")+ plain = _refused(tmp_path, nudged, "nudged-none", anchor="none")[1]+ assert report["seam_measurement"] == "source-frames" and "seam_after_anchor" not in report+ assert report["source_projection"]["wrap_dx_px"] != 0+ assert report["resampled_seam_ratio"] == plain["resampled_seam_ratio"] <= loop_mod.SEAM_RATIO_MAX+ assert message.startswith("video-loop: loop step ratio") and "into frame 1," in message+ assert report["seam_refusal"]["reading"] == plain["seam_refusal"]["reading"] == "steps"def test_a_pinned_walk_is_gated_by_its_pin_and_read_on_its_source_frames(tmp_path: Path):diff --git a/tests/video/test_gait_fallback.py b/tests/video/test_gait_fallback.pyindex 777c83c..393e395 100644--- a/tests/video/test_gait_fallback.py+++ b/tests/video/test_gait_fallback.py@@ -239,10 +239,14 @@ def test_a_settle_does_not_hide_a_walk_that_grows(tmp_path):assert np.ptp(heights[:, 3]-heights[:, 1]) <= 6-def walking_away(k, frames=73):+def walking_away(k, frames=73, sub_pixel=False):"""A walker going away from the camera: 15 % smaller by the end and its feet 20 px higher in the- frame (the ground recedes toward the horizon), its crown 10 px under the top at the start."""+ frame (the ground recedes toward the horizon), its crown 10 px under the top at the start. By+ whole crop rows the feet rise a pixel every three or four frames; `sub_pixel` raises them evenly."""image = walker(k, grow=-0.15, frames=frames)+ if sub_pixel:+ return image.convert('RGBa').transform(image.size, Image.Transform.AFFINE, (1, 0, 0, 0, 1, 40 + 20*k/(frames-1)),+ resample=Image.Resampling.BICUBIC).convert('RGBA')rows = 40 + round(20*k/(frames-1))out = Image.new('RGBA', image.size)out.alpha_composite(image.crop((0, rows, image.width, image.height)), (0, 0))@@ -280,7 +284,9 @@ def test_no_room_is_added_when_nothing_reaches_out():def test_the_held_loop_of_a_shrinking_walk_keeps_its_crown(tmp_path):- frames = [walking_away(k) for k in range(73)]+ # The feet rise evenly: by whole rows they jump a pixel every few frames, which on a walk this+ # slow is a step the step gate reads 2.7 times the loop's mean and refuses.+ frames = [walking_away(k, sub_pixel=True) for k in range(73)]code, report, output = run(tmp_path, frames)assert code == 0assert report['size_hold']['applied'] is True and report['size_hold']['padding_ltrb'][1] > 0