[Pather] fix trace_into() for straight connections
This commit is contained in:
parent
e071bd89b0
commit
bbe3586ba9
2 changed files with 11 additions and 1 deletions
|
|
@ -535,7 +535,7 @@ class Pather(PortList):
|
||||||
if isinstance(portspec, str):
|
if isinstance(portspec, str):
|
||||||
portspec = [portspec]
|
portspec = [portspec]
|
||||||
pos_keys = {'p', 'x', 'y', 'pos', 'position'}
|
pos_keys = {'p', 'x', 'y', 'pos', 'position'}
|
||||||
pb = {k: bounds[k] for k in bounds if k in pos_keys}
|
pb = {k: bounds[k] for k in bounds if k in pos_keys and bounds[k] is not None}
|
||||||
if pb:
|
if pb:
|
||||||
if len(portspec) > 1:
|
if len(portspec) > 1:
|
||||||
raise BuildError('Position bounds only allowed with a single port')
|
raise BuildError('Position bounds only allowed with a single port')
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,16 @@ def test_pather_trace_into() -> None:
|
||||||
assert p.pattern.ports['G'].rotation is not None
|
assert p.pattern.ports['G'].rotation is not None
|
||||||
assert numpy.isclose(p.pattern.ports['G'].rotation, pi)
|
assert numpy.isclose(p.pattern.ports['G'].rotation, pi)
|
||||||
|
|
||||||
|
# 5. Vertical straight connector
|
||||||
|
p.pattern.ports['I'] = Port((0, 0), rotation=pi / 2)
|
||||||
|
p.pattern.ports['J'] = Port((0, -10000), rotation=3 * pi / 2)
|
||||||
|
p.at('I').trace_into('J', plug_destination=False)
|
||||||
|
assert 'J' in p.pattern.ports
|
||||||
|
assert 'I' in p.pattern.ports
|
||||||
|
assert numpy.allclose(p.pattern.ports['I'].offset, (0, -10000))
|
||||||
|
assert p.pattern.ports['I'].rotation is not None
|
||||||
|
assert numpy.isclose(p.pattern.ports['I'].rotation, pi / 2)
|
||||||
|
|
||||||
|
|
||||||
def test_pather_jog_failed_fallback_is_atomic() -> None:
|
def test_pather_jog_failed_fallback_is_atomic() -> None:
|
||||||
lib = Library()
|
lib = Library()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue