[test] data_to_ports should accurately preserve ports from a scaled ref
This commit is contained in:
parent
c32168dc64
commit
c2ef3e4217
1 changed files with 19 additions and 0 deletions
|
|
@ -55,3 +55,22 @@ def test_data_to_ports_hierarchical() -> None:
|
||||||
assert_allclose(parent.ports["A"].offset, [100, 105], atol=1e-10)
|
assert_allclose(parent.ports["A"].offset, [100, 105], atol=1e-10)
|
||||||
assert parent.ports["A"].rotation is not None
|
assert parent.ports["A"].rotation is not None
|
||||||
assert_allclose(parent.ports["A"].rotation, numpy.pi / 2, atol=1e-10)
|
assert_allclose(parent.ports["A"].rotation, numpy.pi / 2, atol=1e-10)
|
||||||
|
|
||||||
|
|
||||||
|
def test_data_to_ports_hierarchical_scaled_ref() -> None:
|
||||||
|
lib = Library()
|
||||||
|
|
||||||
|
child = Pattern()
|
||||||
|
layer = (10, 0)
|
||||||
|
child.label(layer=layer, string="A:type1 0", offset=(5, 0))
|
||||||
|
lib["child"] = child
|
||||||
|
|
||||||
|
parent = Pattern()
|
||||||
|
parent.ref("child", offset=(100, 100), rotation=numpy.pi / 2, scale=2)
|
||||||
|
|
||||||
|
data_to_ports([layer], lib, parent, max_depth=1)
|
||||||
|
|
||||||
|
assert "A" in parent.ports
|
||||||
|
assert_allclose(parent.ports["A"].offset, [100, 110], atol=1e-10)
|
||||||
|
assert parent.ports["A"].rotation is not None
|
||||||
|
assert_allclose(parent.ports["A"].rotation, numpy.pi / 2, atol=1e-10)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue