test: encode eeschema kicad-cli ground truth (currently RED)
Update existing rotation/mirror assertions and add a kicad-cli-grounded
regression suite. eeschema's pin transform is verified against:
- rotation: TRANSFORM(0,1,-1,0) for rot=90 — CCW in screen Y-down
- mirror x: SYM_MIRROR_X = TRANSFORM(1,0,0,-1) — negates internal Y
- mirror y: SYM_MIRROR_Y = TRANSFORM(-1,0,0,1) — negates internal X
Updated assertions:
- test_pin_locator_y_flip: rotated cap pin 1 X 153.81 → 146.19
- test_move_with_wire_preservation::test_resistor_rotated_90:
pin 1 X 103.81 → 96.19
- test_hierarchical_pad_net_map::test_90_degree_rotation:
swapped UP_NET / DN_NET label coords
New file tests/test_pin_world_xy_eeschema_truth.py:
- 4 parametrized diode tests via kicad-cli netlist (oracle = eeschema)
- 2 parametrized resistor mirror tests via kicad-cli netlist
- 3 pure-math pin_world_xy assertions for rot=90, mirror_x, mirror_y
Currently RED on rotation 90/270 (rotation direction) and mirror_x/y
(axis semantics swapped). Production fix in WireDragger.pin_world_xy
to follow.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -105,8 +105,9 @@ def test_rotated_capacitor_pin_x_matches_render_convention():
|
||||
p1 = locator.get_pin_location(sch_path, "C1", "1")
|
||||
assert p1 is not None
|
||||
|
||||
# Device:C pin 1 is at symbol (0, +3.81). After y-negate → (0, -3.81).
|
||||
# Rotated 90° CCW in screen coords: (0, -3.81) → (3.81, 0).
|
||||
# Absolute: (150+3.81, 100+0) = (153.81, 100).
|
||||
assert p1[0] == pytest.approx(153.81), f"rotated pin 1 X wrong: {p1[0]}"
|
||||
# Device:C pin 1 lib (0, +3.81). parseXY(invertY=true) → internal (0, -3.81).
|
||||
# Rotation 90 in eeschema is CCW in screen Y-down: TRANSFORM(0,1,-1,0).
|
||||
# Apply: (0*0 + 1*(-3.81), -1*0 + 0*(-3.81)) = (-3.81, 0).
|
||||
# World: (150-3.81, 100) = (146.19, 100). Verified vs kicad-cli netlist.
|
||||
assert p1[0] == pytest.approx(146.19), f"rotated pin 1 X wrong: {p1[0]}"
|
||||
assert p1[1] == pytest.approx(100.0), f"rotated pin 1 Y wrong: {p1[1]}"
|
||||
|
||||
Reference in New Issue
Block a user