mirror of https://github.com/KLayout/klayout.git
Fixed some Ruby tests - as RecursiveShapeIterator lifelime may be longer than expected, we need to explicitly destroy the iterator now to avoid layout locking.
This commit is contained in:
parent
0c0baed664
commit
57e98d17ac
|
|
@ -232,6 +232,16 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
def first_shape(s)
|
||||
|
||||
sdup = s.dup
|
||||
shape = sdup.shape
|
||||
sdup._destroy
|
||||
|
||||
return shape
|
||||
|
||||
end
|
||||
|
||||
def collect(s, l)
|
||||
|
||||
res = []
|
||||
|
|
@ -1042,18 +1052,18 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
c0c = l.cell(l.add_cell("c0"))
|
||||
c0c.copy_shapes(c0)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
|
||||
c0c.clear
|
||||
lm = RBA::LayerMapping::new
|
||||
lm.map(1, 0)
|
||||
c0c.copy_shapes(c0, lm)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), nil)
|
||||
|
||||
l2 = RBA::Layout::new
|
||||
l2.dbu = 0.0005
|
||||
|
|
@ -1063,9 +1073,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
l2 = RBA::Layout::new
|
||||
l2.dbu = 0.0005
|
||||
|
|
@ -1084,9 +1094,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1127,9 +1137,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
c0.move_shapes(c0c)
|
||||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "[c0](1,101;1001,1201)")
|
||||
|
|
@ -1142,9 +1152,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), nil)
|
||||
|
||||
l = ll.dup
|
||||
c0 = l.cell("c0")
|
||||
|
|
@ -1159,9 +1169,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
l = ll.dup
|
||||
c0 = l.cell("c0")
|
||||
|
|
@ -1185,9 +1195,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1351,7 +1361,7 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(l2.cell("c1").begin_shapes_rec(layer1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(l2.cell("c1").begin_shapes_rec(layer1)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l2), "[c0](0,200;2000,2400)/[c2](200,0;2200,2200)/[c3](2400,0;4400,2200)/[c3](-2400,0;-200,2000)/[c1](0,200;2000,2400)")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l2), "[c0](2,202;2002,2402)")
|
||||
|
||||
|
|
@ -1401,7 +1411,7 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
i0 = nil
|
||||
c0c.each_inst { |i| i.cell_index == l.cell("c1$1").cell_index && i0 = i }
|
||||
assert_equal(i0.property("p"), 18)
|
||||
assert_equal(l.cell("c1$1").begin_shapes_rec(0).shape.property("p"), 17)
|
||||
assert_equal(first_shape(l.cell("c1$1").begin_shapes_rec(0)).property("p"), 17)
|
||||
|
||||
assert_equal(collect(c0.begin_shapes_rec(0), l), "")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
|
|
@ -1429,7 +1439,7 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(l2.cell("c1").begin_shapes_rec(layer1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(l2.cell("c1").begin_shapes_rec(layer1)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l2), "[c0](0,200;2000,2400)/[c2](200,0;2200,2200)/[c3](2400,0;4400,2200)/[c3](-2400,0;-200,2000)/[c1](0,200;2000,2400)")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l2), "[c0](2,202;2002,2402)")
|
||||
|
||||
|
|
@ -1471,16 +1481,16 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
cm.for_single_cell(l, c0c.cell_index, l, c0.cell_index)
|
||||
c0c.copy_tree_shapes(c0, cm)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)/[c0$1](0,100;1000,1200)/[c0$1](100,0;1100,1100)/[c0$1](-1200,0;-100,1000)/[c0$1](1200,0;2200,1100)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
|
||||
c0c.clear
|
||||
lm = RBA::LayerMapping::new
|
||||
lm.map(1, 0)
|
||||
c0c.copy_tree_shapes(c0, cm, lm)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), nil)
|
||||
|
||||
|
|
@ -1488,9 +1498,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
cm.for_single_cell_full(l, c0c.cell_index, l, c0.cell_index)
|
||||
c0c.copy_tree_shapes(c0, cm)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)/[c2$1](100,0;1100,1100)/[c3$1](1200,0;2200,1100)/[c3$1](-1200,0;-100,1000)/[c1$1](0,100;1000,1200)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
|
||||
i0 = nil
|
||||
c0c.each_inst { |i| i.cell_index == l.cell("c1$1").cell_index && i0 = i }
|
||||
|
|
@ -1505,9 +1515,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)/[c2](200,0;2200,2200)/[c3](2400,0;4400,2200)/[c3](-2400,0;-200,2000)/[c1](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
i0 = nil
|
||||
c0c.each_inst { |i| i.cell_index == l2.cell("c1").cell_index && i0 = i }
|
||||
|
|
@ -1559,9 +1569,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)/[c0$1](0,100;1000,1200)/[c0$1](100,0;1100,1100)/[c0$1](-1200,0;-100,1000)/[c0$1](1200,0;2200,1100)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
|
||||
l = ll.dup
|
||||
c0 = l.cell("c0")
|
||||
|
|
@ -1573,9 +1583,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "[c0](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)/[c1](0,100;1000,1200)")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), 17)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), nil)
|
||||
|
||||
l = ll.dup
|
||||
c0 = l.cell("c0")
|
||||
|
|
@ -1586,9 +1596,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(c0.begin_shapes_rec(0), l), "")
|
||||
assert_equal(collect(c0.begin_shapes_rec(1), l), "")
|
||||
assert_equal(collect(c0c.begin_shapes_rec(0), l), "[c0$1](0,100;1000,1200)/[c2$1](100,0;1100,1100)/[c3$1](1200,0;2200,1100)/[c3$1](-1200,0;-100,1000)/[c1$1](0,100;1000,1200)")
|
||||
assert_equal(c0c.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(1), l), "[c0$1](1,101;1001,1201)")
|
||||
assert_equal(c0c.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(1)).property("p"), 17)
|
||||
|
||||
i0 = nil
|
||||
c0c.each_inst { |i| i.cell_index == l.cell("c1$1").cell_index && i0 = i }
|
||||
|
|
@ -1608,9 +1618,9 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
layer1 = l2.find_layer(1, 0)
|
||||
layer2 = l2.find_layer(2, 0)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer1), l), "[c0](0,200;2000,2400)/[c2](200,0;2200,2200)/[c3](2400,0;4400,2200)/[c3](-2400,0;-200,2000)/[c1](0,200;2000,2400)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer1).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer1)).property("p"), nil)
|
||||
assert_equal(collect(c0c.begin_shapes_rec(layer2), l), "[c0](2,202;2002,2402)")
|
||||
assert_equal(c0c.begin_shapes_rec(layer2).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0c.begin_shapes_rec(layer2)).property("p"), 17)
|
||||
|
||||
i0 = nil
|
||||
c0c.each_inst { |i| i.cell_index == l2.cell("c1").cell_index && i0 = i }
|
||||
|
|
@ -1833,10 +1843,10 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
lt.copy_tree_shapes(l, cm)
|
||||
assert_equal(collect(c0t.begin_shapes_rec(0), lt), "[c0](0,100;1000,1200)/[c0](0,100;1000,1200)/[c0](100,0;1100,1100)/[c0](-1200,0;-100,1000)/[c0](1200,0;2200,1100)")
|
||||
assert_equal(c0t.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(0), lt), "[c9](0,100;1000,1200)")
|
||||
assert_equal(collect(c0t.begin_shapes_rec(1), l), "[c0](1,101;1001,1201)")
|
||||
assert_equal(c0t.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(1)).property("p"), 17)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(1), l), "")
|
||||
|
||||
lt = RBA::Layout::new
|
||||
|
|
@ -1850,10 +1860,10 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
lt.copy_tree_shapes(l, cm)
|
||||
assert_equal(collect(c0t.begin_shapes_rec(0), lt), "[c0](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)/[c1](0,100;1000,1200)")
|
||||
assert_equal(c0t.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(0), lt), "[c1](0,100;1000,1200)")
|
||||
assert_equal(collect(c0t.begin_shapes_rec(1), l), "[c0](1,101;1001,1201)")
|
||||
assert_equal(c0t.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(1)).property("p"), 17)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(1), l), "")
|
||||
|
||||
lt = RBA::Layout::new
|
||||
|
|
@ -1873,7 +1883,7 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
|
||||
lt.copy_tree_shapes(l, cm, lm)
|
||||
assert_equal(collect(c0t.begin_shapes_rec(ll), lt), "[c0](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)/[c1](0,100;1000,1200)")
|
||||
assert_equal(c0t.begin_shapes_rec(ll).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(ll)).property("p"), nil)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(ll), lt), "[c1](0,100;1000,1200)")
|
||||
|
||||
lt = RBA::Layout::new
|
||||
|
|
@ -1897,10 +1907,10 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(ls.cell(c9.cell_index).begin_shapes_rec(1), ls), "")
|
||||
|
||||
assert_equal(collect(c0t.begin_shapes_rec(0), lt), "[c0](0,100;1000,1200)/[c0](0,100;1000,1200)/[c0](100,0;1100,1100)/[c0](-1200,0;-100,1000)/[c0](1200,0;2200,1100)")
|
||||
assert_equal(c0t.begin_shapes_rec(0).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(0)).property("p"), nil)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(0), lt), "[c9](0,100;1000,1200)")
|
||||
assert_equal(collect(c0t.begin_shapes_rec(1), l), "[c0](1,101;1001,1201)")
|
||||
assert_equal(c0t.begin_shapes_rec(1).shape.property("p"), 17)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(1)).property("p"), 17)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(1), l), "")
|
||||
|
||||
lt = RBA::Layout::new
|
||||
|
|
@ -1931,7 +1941,7 @@ class DBLayoutTests1_TestClass < TestBase
|
|||
assert_equal(collect(ls.cell(c9.cell_index).begin_shapes_rec(1), ls), "")
|
||||
|
||||
assert_equal(collect(c0t.begin_shapes_rec(ll), lt), "[c0](0,100;1000,1200)/[c0](0,100;1000,1200)/[c0](100,0;1100,1100)/[c0](-1200,0;-100,1000)/[c0](1200,0;2200,1100)")
|
||||
assert_equal(c0t.begin_shapes_rec(ll).shape.property("p"), nil)
|
||||
assert_equal(first_shape(c0t.begin_shapes_rec(ll)).property("p"), nil)
|
||||
assert_equal(collect(c9t.begin_shapes_rec(ll), lt), "[c9](0,100;1000,1200)")
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ end
|
|||
|
||||
load("test_prologue.rb")
|
||||
|
||||
def first_shape(s)
|
||||
|
||||
sdup = s.dup
|
||||
shape = sdup.shape
|
||||
sdup._destroy
|
||||
|
||||
return shape
|
||||
|
||||
end
|
||||
|
||||
class BoxPCell < RBA::PCellDeclaration
|
||||
|
||||
def display_text(parameters)
|
||||
|
|
@ -428,30 +438,30 @@ class DBPCell_TestClass < TestBase
|
|||
li2 = ly.layer_indices.find { |li| ly.get_info(li).to_s == "10/0" }
|
||||
assert_equal(li2 != nil, true)
|
||||
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-250,-500;250,500)")
|
||||
assert_equal(ly.begin_shapes(lib_proxy.cell_index, li2).shape.to_s, "box (0,0;10,20)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-250,-500;250,500)")
|
||||
assert_equal(first_shape(ly.begin_shapes(lib_proxy.cell_index, li2)).to_s, "box (0,0;10,20)")
|
||||
|
||||
param = { "w" => 1, "h" => 2 }
|
||||
c1.change_pcell_parameters(pcell_inst, param)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-50,-100;50,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-50,-100;50,100)")
|
||||
|
||||
param = [ RBA::LayerInfo::new(1, 0), 5.0, 5.0 ]
|
||||
c1.change_pcell_parameters(pcell_inst, param)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-250,-250;250,250)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-250,-250;250,250)")
|
||||
|
||||
pcell_inst.change_pcell_parameters({ "w" => 2.0, "h" => 10.0 })
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-100,-500;100,500)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-100,-500;100,500)")
|
||||
|
||||
pcell_inst.change_pcell_parameters([ RBA::LayerInfo::new(1, 0), 5.0, 5.0 ])
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-250,-250;250,250)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-250,-250;250,250)")
|
||||
|
||||
pcell_inst.change_pcell_parameter("w", 5.0)
|
||||
pcell_inst.change_pcell_parameter("h", 1.0)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-250,-50;250,50)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-250,-50;250,50)")
|
||||
|
||||
c1.change_pcell_parameter(pcell_inst, "w", 10.0)
|
||||
c1.change_pcell_parameter(pcell_inst, "h", 2.0)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-500,-100;500,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-500,-100;500,100)")
|
||||
|
||||
assert_equal(ly.cell(pcell_inst.cell_index).is_pcell_variant?, true)
|
||||
assert_equal(pcell_inst.is_pcell?, true)
|
||||
|
|
@ -460,18 +470,18 @@ class DBPCell_TestClass < TestBase
|
|||
assert_equal(ly.cell(new_id).is_pcell_variant?, false)
|
||||
param = [ RBA::LayerInfo::new(1, 0), 5.0, 5.0 ]
|
||||
c1.change_pcell_parameters(pcell_inst, param)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-250,-250;250,250)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-250,-250;250,250)")
|
||||
pcell_inst.cell_index = new_id
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, li1).shape.to_s, "box (-500,-100;500,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, li1)).to_s, "box (-500,-100;500,100)")
|
||||
|
||||
l10 = ly.layer(10, 0)
|
||||
c1.shapes(l10).insert(RBA::Box::new(0, 10, 100, 210))
|
||||
l11 = ly.layer(11, 0)
|
||||
c1.shapes(l11).insert(RBA::Text::new("hello", RBA::Trans::new))
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, ly.begin_shapes(c1.cell_index(), l11).shape(), l10), false)
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10), true)
|
||||
assert_equal(pcell_decl.parameters_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10).inspect, "[<10/0>, 1.0, 2.0]")
|
||||
assert_equal(pcell_decl.transformation_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10).to_s, "r0 50,110")
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l11)), l10), false)
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10), true)
|
||||
assert_equal(pcell_decl.parameters_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10).inspect, "[<10/0>, 1.0, 2.0]")
|
||||
assert_equal(pcell_decl.transformation_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10).to_s, "r0 50,110")
|
||||
|
||||
ly._destroy
|
||||
tl._destroy
|
||||
|
|
@ -522,21 +532,21 @@ class DBPCell_TestClass < TestBase
|
|||
pcell_inst.change_pcell_parameter("height", 2.0)
|
||||
assert_equal(norm_hash(pcell_inst.pcell_parameters_by_name()), "{\"height\"=>2.0, \"layer\"=><1/0>, \"secret\"=>0, \"width\"=>1.0}")
|
||||
|
||||
assert_equal(ly.begin_shapes(c1.cell_index(), li1).shape().to_s, "box (-50,-100;50,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index(), li1)).to_s, "box (-50,-100;50,100)")
|
||||
|
||||
param = { "layer" => RBA::LayerInfo::new(2, 0), "width" => 2, "height" => 1 }
|
||||
li2 = ly.layer(2, 0)
|
||||
c1.change_pcell_parameters(pcell_inst, param)
|
||||
assert_equal(ly.begin_shapes(c1.cell_index(), li2).shape().to_s, "box (-100,-50;100,50)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index(), li2)).to_s, "box (-100,-50;100,50)")
|
||||
|
||||
l10 = ly.layer(10, 0)
|
||||
c1.shapes(l10).insert(RBA::Box::new(0, 10, 100, 210))
|
||||
l11 = ly.layer(11, 0)
|
||||
c1.shapes(l11).insert(RBA::Text::new("hello", RBA::Trans::new))
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, ly.begin_shapes(c1.cell_index(), l11).shape(), l10), false)
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10), true)
|
||||
assert_equal(pcell_decl.parameters_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10).inspect, "[<10/0>, 1.0, 2.0, 0]")
|
||||
assert_equal(pcell_decl.transformation_from_shape(ly, ly.begin_shapes(c1.cell_index(), l10).shape(), l10).to_s, "r0 50,110")
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l11)), l10), false)
|
||||
assert_equal(pcell_decl.can_create_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10), true)
|
||||
assert_equal(pcell_decl.parameters_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10).inspect, "[<10/0>, 1.0, 2.0, 0]")
|
||||
assert_equal(pcell_decl.transformation_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l10)), l10).to_s, "r0 50,110")
|
||||
|
||||
param2 = c1.pcell_parameters(pcell_inst)
|
||||
param2[3] = -2 # "secret"
|
||||
|
|
@ -594,13 +604,13 @@ class DBPCell_TestClass < TestBase
|
|||
|
||||
assert_equal(pcell_inst.is_pcell?, true)
|
||||
|
||||
assert_equal(ly.begin_shapes(pcell_inst.cell_index, li1).shape.to_s, "box (-500,-100;500,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(pcell_inst.cell_index, li1)).to_s, "box (-500,-100;500,100)")
|
||||
pcell_inst.convert_to_static
|
||||
assert_equal(pcell_inst.is_pcell?, false)
|
||||
assert_equal(ly.begin_shapes(pcell_inst.cell_index, li1).shape.to_s, "box (-500,-100;500,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(pcell_inst.cell_index, li1)).to_s, "box (-500,-100;500,100)")
|
||||
pcell_inst.convert_to_static
|
||||
assert_equal(pcell_inst.is_pcell?, false)
|
||||
assert_equal(ly.begin_shapes(pcell_inst.cell_index, li1).shape.to_s, "box (-500,-100;500,100)")
|
||||
assert_equal(first_shape(ly.begin_shapes(pcell_inst.cell_index, li1)).to_s, "box (-500,-100;500,100)")
|
||||
|
||||
ly._destroy
|
||||
tl._destroy
|
||||
|
|
@ -625,7 +635,7 @@ class DBPCell_TestClass < TestBase
|
|||
pcell_var = ly.cell(pcell_var_id)
|
||||
pcell_inst = c1.insert(RBA::CellInstArray::new(pcell_var_id, RBA::Trans::new))
|
||||
|
||||
assert_equal(ly.begin_shapes(c1.cell_index, ly.layer(1, 0)).shape.to_s, "box (-200,-400;200,400)")
|
||||
assert_equal(first_shape(ly.begin_shapes(c1.cell_index, ly.layer(1, 0))).to_s, "box (-200,-400;200,400)")
|
||||
|
||||
ly._destroy
|
||||
tl._destroy
|
||||
|
|
@ -643,7 +653,7 @@ class DBPCell_TestClass < TestBase
|
|||
param = { "w" => 4.0, "h" => 8.0, "l" => RBA::LayerInfo::new(1, 0) }
|
||||
pcell_var_id = lib.layout.add_pcell_variant(pcell_decl_id, param)
|
||||
|
||||
assert_equal(lib.layout.begin_shapes(pcell_var_id, lib.layout.layer(1, 0)).shape.to_s, "box (-2000,-4000;2000,4000)")
|
||||
assert_equal(first_shape(lib.layout.begin_shapes(pcell_var_id, lib.layout.layer(1, 0))).to_s, "box (-2000,-4000;2000,4000)")
|
||||
|
||||
tl._destroy
|
||||
|
||||
|
|
@ -660,7 +670,7 @@ class DBPCell_TestClass < TestBase
|
|||
param = { "w" => 3.0, "h" => 7.0, "l" => RBA::LayerInfo::new(2, 0) }
|
||||
pcell_var_id = lib.layout.add_pcell_variant(pcell_decl_id, param)
|
||||
|
||||
assert_equal(lib.layout.begin_shapes(pcell_var_id, lib.layout.layer(2, 0)).shape.to_s, "box (-1500,-3500;1500,3500)")
|
||||
assert_equal(first_shape(lib.layout.begin_shapes(pcell_var_id, lib.layout.layer(2, 0))).to_s, "box (-1500,-3500;1500,3500)")
|
||||
|
||||
tl._destroy
|
||||
|
||||
|
|
@ -676,7 +686,7 @@ class DBPCell_TestClass < TestBase
|
|||
param = { "w" => 3.0, "h" => 8.0, "l" => RBA::LayerInfo::new(3, 0) }
|
||||
pcell_var = lib.layout.create_cell("Box", param)
|
||||
|
||||
assert_equal(lib.layout.begin_shapes(pcell_var.cell_index, lib.layout.layer(3, 0)).shape.to_s, "box (-1500,-4000;1500,4000)")
|
||||
assert_equal(first_shape(lib.layout.begin_shapes(pcell_var.cell_index, lib.layout.layer(3, 0))).to_s, "box (-1500,-4000;1500,4000)")
|
||||
|
||||
tl._destroy
|
||||
|
||||
|
|
@ -693,7 +703,7 @@ class DBPCell_TestClass < TestBase
|
|||
param = { "w" => 4.0, "h" => 8.0, "l" => RBA::LayerInfo::new(4, 0) }
|
||||
cell = ly.create_cell("Box", "PCellTestLib", param)
|
||||
|
||||
assert_equal(ly.begin_shapes(cell, ly.layer(4, 0)).shape.to_s, "box (-200,-400;200,400)")
|
||||
assert_equal(first_shape(ly.begin_shapes(cell, ly.layer(4, 0))).to_s, "box (-200,-400;200,400)")
|
||||
|
||||
tl._destroy
|
||||
ly._destroy
|
||||
|
|
@ -715,7 +725,7 @@ class DBPCell_TestClass < TestBase
|
|||
|
||||
cell = ly.create_cell("BOXVAR", "PCellTestLib")
|
||||
|
||||
assert_equal(cell.begin_shapes_rec(ly.layer(5, 0)).shape.to_s, "box (-100,-300;100,300)")
|
||||
assert_equal(first_shape(cell.begin_shapes_rec(ly.layer(5, 0))).to_s, "box (-100,-300;100,300)")
|
||||
|
||||
tl._destroy
|
||||
ly._destroy
|
||||
|
|
|
|||
Loading…
Reference in New Issue