Merge branch 'master' into dev-polygon-graph

This commit is contained in:
Matthias Koefferlein
2025-05-28 19:01:42 +02:00
179 changed files with 6157 additions and 674 deletions
+1 -1
View File
@@ -684,7 +684,7 @@ class DBLayoutTest(unittest.TestCase):
ly = pya.Layout(True)
pv = [ [ 17, "a" ], [ "b", [ 1, 5, 7 ] ] ]
pid = ly.properties_id( pv )
# does not work? @@@
# does not work?
# pv = { 17: "a", "b": [ 1, 5, 7 ] }
# pid2 = ly.properties_id( pv )
# self.assertEqual( pid, pid2 )
+13 -1
View File
@@ -24,7 +24,7 @@ import os
class DBShapesTest(unittest.TestCase):
# Shape objects as hashes
def test_12(self):
def test_1(self):
s = pya.Shapes()
s1 = s.insert(pya.Box(1, 2, 3, 4))
@@ -50,6 +50,18 @@ class DBShapesTest(unittest.TestCase):
self.assertEqual(h[s2], 2)
self.assertEqual(h[s3], 3)
# Issue #2012 (reference count)
def test_2(self):
ly = pya.Layout()
top = ly.create_cell("TOP")
l1 = ly.layer(1, 0)
top.shapes(l1).insert(pya.Box(0, 0, 100, 200))
shapes = top.shapes(l1)
self.assertEqual(sys.getrefcount(shapes), 2)
# run unit tests
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(DBShapesTest)
+72
View File
@@ -972,6 +972,78 @@ class RDB_TestClass(unittest.TestCase):
_cat_same = None
self.assertEqual(_subcat.rdb_id(), _subcat_same.rdb_id())
def test_15(self):
p = pya.DPolygon(pya.DBox(0.5, 1, 2, 3))
pwp = pya.DPolygonWithProperties(p, { 1: "value" })
e = pya.DEdge(pya.DPoint(0, 0), pya.DPoint(1, 2))
ewp = pya.DEdgeWithProperties(e, { 1: "value" })
ep = pya.DEdgePair(e, e.moved(10, 10))
epwp = pya.DEdgePairWithProperties(ep, { 1: "value" })
t = pya.DText("text", pya.DTrans.R0)
twp = pya.DTextWithProperties(t, { 1: "value" })
b = pya.DBox(0, 0, 1, 2)
bwp = pya.DBoxWithProperties(b, { 1: "value" })
ip = pya.Polygon(pya.Box(0, 1, 2, 3))
ipwp = pya.PolygonWithProperties(ip, { 1: "value" })
ie = pya.Edge(pya.Point(0, 0), pya.Point(1, 2))
iewp = pya.EdgeWithProperties(ie, { 1: "value" })
iep = pya.EdgePair(ie, ie.moved(10, 10))
iepwp = pya.EdgePairWithProperties(iep, { 1: "value" })
it = pya.Text("text", pya.Trans.R0)
itwp = pya.TextWithProperties(it, { 1: "value" })
ib = pya.Box(0, 0, 1, 2)
ibwp = pya.BoxWithProperties(ib, { 1: "value" })
rdb = pya.ReportDatabase()
cat = rdb.create_category("name")
cell = rdb.create_cell("TOP")
item = rdb.create_item(cell, cat)
item.add_value(p)
item.add_value(pwp)
item.add_value(b)
item.add_value(bwp)
item.add_value(t)
item.add_value(twp)
item.add_value(e)
item.add_value(ewp)
item.add_value(ep)
item.add_value(epwp)
item.add_value(ip)
item.add_value(ipwp)
item.add_value(ib)
item.add_value(ibwp)
item.add_value(it)
item.add_value(itwp)
item.add_value(ie)
item.add_value(iewp)
item.add_value(iep)
item.add_value(iepwp)
item.add_value("string")
item.add_value(17.5)
values = [ str(v) for v in item.each_value() ]
self.assertEqual(values, [
'polygon: (0.5,1;0.5,3;2,3;2,1)', 'polygon: (0.5,1;0.5,3;2,3;2,1)',
'box: (0,0;1,2)', 'box: (0,0;1,2)',
"label: ('text',r0 0,0)", "label: ('text',r0 0,0)",
'edge: (0,0;1,2)', 'edge: (0,0;1,2)',
'edge-pair: (0,0;1,2)/(10,10;11,12)', 'edge-pair: (0,0;1,2)/(10,10;11,12)',
'polygon: (0,1;0,3;2,3;2,1)', 'polygon: (0,1;0,3;2,3;2,1)',
'box: (0,0;1,2)', 'box: (0,0;1,2)',
"label: ('text',r0 0,0)", "label: ('text',r0 0,0)",
'edge: (0,0;1,2)', 'edge: (0,0;1,2)',
'edge-pair: (0,0;1,2)/(10,10;11,12)', 'edge-pair: (0,0;1,2)/(10,10;11,12)',
'text: string',
'float: 17.5'
])
# run unit tests
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(RDB_TestClass)