mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 01:14:35 +02:00
Merge branch 'master' into 1598-support-for-soft-connections
This commit is contained in:
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
||||
if $drc_test_deep
|
||||
deep
|
||||
end
|
||||
|
||||
l1 = input(1, 0)
|
||||
l2 = input(2, 0)
|
||||
|
||||
l1.output(1, 0)
|
||||
l2.output(2, 0)
|
||||
|
||||
e1 = l1.edges
|
||||
e2 = l2.edges
|
||||
|
||||
e1.output(10, 0)
|
||||
e2.output(11, 0)
|
||||
|
||||
e1.interacting(l2).output(100, 0)
|
||||
e1.interacting(l2, 2).output(101, 0)
|
||||
e1.interacting(l2, 2, 2).output(102, 0)
|
||||
e1.interacting(l2, 3).output(103, 0)
|
||||
|
||||
e1.split_interacting(l2)[0].output(110, 0)
|
||||
e1.split_interacting(l2, 2)[0].output(111, 0)
|
||||
e1.split_interacting(l2, 2, 2)[0].output(112, 0)
|
||||
e1.split_interacting(l2, 3)[0].output(113, 0)
|
||||
|
||||
e1.interacting(e2).output(200, 0)
|
||||
e1.interacting(e2, 2).output(201, 0)
|
||||
e1.interacting(e2, 2, 2).output(202, 0)
|
||||
e1.interacting(e2, 3).output(203, 0)
|
||||
e1.interacting(e2, 3..4).output(204, 0)
|
||||
|
||||
e1.split_interacting(e2)[0].output(210, 0)
|
||||
e1.split_interacting(e2, 2)[0].output(211, 0)
|
||||
e1.split_interacting(e2, 2, 2)[0].output(212, 0)
|
||||
e1.split_interacting(e2, 3)[0].output(213, 0)
|
||||
e1.split_interacting(e2, 3..4)[0].output(214, 0)
|
||||
|
||||
e1.not_interacting(l2).output(300, 0)
|
||||
e1.not_interacting(l2, 2).output(301, 0)
|
||||
e1.not_interacting(l2, 2, 2).output(302, 0)
|
||||
e1.not_interacting(l2, 3).output(303, 0)
|
||||
|
||||
e1.split_interacting(l2)[1].output(310, 0)
|
||||
e1.split_interacting(l2, 2)[1].output(311, 0)
|
||||
e1.split_interacting(l2, 2, 2)[1].output(312, 0)
|
||||
e1.split_interacting(l2, 3)[1].output(313, 0)
|
||||
|
||||
e1.not_interacting(e2).output(400, 0)
|
||||
e1.not_interacting(e2, 2).output(401, 0)
|
||||
e1.not_interacting(e2, 2, 2).output(402, 0)
|
||||
e1.not_interacting(e2, 3).output(403, 0)
|
||||
e1.not_interacting(e2, 3..4).output(404, 0)
|
||||
|
||||
e1.split_interacting(e2)[1].output(410, 0)
|
||||
e1.split_interacting(e2, 2)[1].output(411, 0)
|
||||
e1.split_interacting(e2, 2, 2)[1].output(412, 0)
|
||||
e1.split_interacting(e2, 3)[1].output(413, 0)
|
||||
e1.split_interacting(e2, 3..4)[1].output(414, 0)
|
||||
|
||||
# convex detection (the initial problem)
|
||||
|
||||
c90 = l2.corners(as_dots, 90)
|
||||
cm90 = l2.corners(as_dots, -90)
|
||||
c90.output(1000, 0)
|
||||
cm90.output(1001, 0)
|
||||
|
||||
e2.interacting(c90, 2, 2).output(1100, 0)
|
||||
e2.interacting(cm90, 2, 2).output(1101, 0)
|
||||
e2.interacting(c90, 1, 1).output(1102, 0)
|
||||
e2.interacting(cm90, 1, 1).output(1103, 0)
|
||||
|
||||
c90.interacting(e1).output(1200, 0)
|
||||
c90.not_interacting(e1).output(1201, 0)
|
||||
c90.interacting(e2).output(1202, 0)
|
||||
c90.not_interacting(e2).output(1203, 0)
|
||||
|
||||
c90.interacting(l1).output(1300, 0)
|
||||
c90.not_interacting(l1).output(1301, 0)
|
||||
c90.interacting(l2).output(1302, 0)
|
||||
c90.not_interacting(l2).output(1303, 0)
|
||||
|
||||
c90.split_interacting(l1)[0].output(1310, 0)
|
||||
c90.split_interacting(l1)[1].output(1311, 0)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
||||
if $drc_test_deep
|
||||
deep
|
||||
end
|
||||
|
||||
l1 = input(1, 0)
|
||||
l2 = input(2, 0)
|
||||
|
||||
l1.output(1, 0)
|
||||
l2.output(2, 0)
|
||||
|
||||
e1 = l1.edges
|
||||
e2 = l2.edges
|
||||
|
||||
e1.output(10, 0)
|
||||
e2.output(11, 0)
|
||||
|
||||
c1 = l1.corners(as_dots)
|
||||
c2 = l2.corners(as_dots)
|
||||
|
||||
c1.output(20, 0)
|
||||
c2.output(21, 0)
|
||||
|
||||
(c2 & l1).output(100, 0)
|
||||
(c2 - l1).output(101, 0)
|
||||
|
||||
c2.andnot(l1)[0].output(110, 0)
|
||||
c2.andnot(l1)[1].output(111, 0)
|
||||
|
||||
c2.inside_part(l1).output(200, 0)
|
||||
c2.outside_part(l1).output(201, 0)
|
||||
|
||||
c2.inside_outside_part(l1)[0].output(210, 0)
|
||||
c2.inside_outside_part(l1)[1].output(211, 0)
|
||||
|
||||
c2.interacting(l1).output(300, 0)
|
||||
c2.not_interacting(l1).output(301, 0)
|
||||
|
||||
c2.split_interacting(l1)[0].output(310, 0)
|
||||
c2.split_interacting(l1)[1].output(311, 0)
|
||||
|
||||
(c2 & e1).output(400, 0)
|
||||
(c2 - e1).output(401, 0)
|
||||
(c2 ^ e1).output(402, 0)
|
||||
(c2 | e1).output(403, 0)
|
||||
|
||||
c2.andnot(e1)[0].output(410, 0)
|
||||
c2.andnot(e1)[1].output(411, 0)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
||||
if $drc_test_deep
|
||||
deep
|
||||
end
|
||||
|
||||
l1 = input(1, 0)
|
||||
l2 = input(2, 0)
|
||||
|
||||
l1.output(1, 0)
|
||||
l2.output(2, 0)
|
||||
|
||||
l2.edges.output(100, 0)
|
||||
l2.edges(convex).output(101, 0)
|
||||
l2.edges(concave).output(102, 0)
|
||||
l2.edges(step).output(103, 0)
|
||||
l2.edges(step_in).output(104, 0)
|
||||
l2.edges(step_out).output(105, 0)
|
||||
|
||||
l2.edges(not_convex).output(111, 0)
|
||||
l2.edges(not_concave).output(112, 0)
|
||||
l2.edges(not_step).output(113, 0)
|
||||
l2.edges(not_step_in).output(114, 0)
|
||||
l2.edges(not_step_out).output(115, 0)
|
||||
|
||||
l2.drc(primary.edges).output(200, 0)
|
||||
l2.drc(primary.edges(convex)).output(201, 0)
|
||||
l2.drc(primary.edges(concave)).output(202, 0)
|
||||
l2.drc(primary.edges(step)).output(203, 0)
|
||||
l2.drc(primary.edges(step_in)).output(204, 0)
|
||||
l2.drc(primary.edges(step_out)).output(205, 0)
|
||||
|
||||
l2.drc(primary.edges(not_convex)).output(211, 0)
|
||||
l2.drc(primary.edges(not_concave)).output(212, 0)
|
||||
l2.drc(primary.edges(not_step)).output(213, 0)
|
||||
l2.drc(primary.edges(not_step_in)).output(214, 0)
|
||||
l2.drc(primary.edges(not_step_out)).output(215, 0)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+10
@@ -746,6 +746,16 @@ class DBPolygonTests(unittest.TestCase):
|
||||
poly = pya.Polygon(hull).insert_hole(hole1).insert_hole(hole2)
|
||||
self.assertEqual(str(poly), "(0,0;0,3000;6000,3000;6000,0/1000,1000;2000,1000;2000,2000;1000,2000/3000,1000;4000,1000;4000,2000;3000,2000)")
|
||||
|
||||
def test_argumentShortcuts(self):
|
||||
|
||||
# implicit conversion to a Point array:
|
||||
poly = pya.Polygon([ (0,0), (0,1000), (1000,1000) ])
|
||||
self.assertEqual(str(poly), "(0,0;0,1000;1000,1000)")
|
||||
|
||||
# issue 1651 - no binding to Box constructor
|
||||
poly = pya.Polygon([ (0,0), (0,1000), (1000,1000), (1000,0) ])
|
||||
self.assertEqual(str(poly), "(0,0;0,1000;1000,1000;1000,0)")
|
||||
|
||||
# run unit tests
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(DBPolygonTests)
|
||||
|
||||
Vendored
+3
@@ -146,6 +146,9 @@ class DBBox_TestClass < TestBase
|
||||
assert_equal( a + b, b )
|
||||
assert_equal( (b + c).to_s, "(1,-10;22,22)" )
|
||||
|
||||
assert_equal( b - a, b )
|
||||
assert_equal( (b - c).to_s, "(1,-1;17,22)" )
|
||||
|
||||
assert_equal( a + RBA::DPoint::new( 1, -5 ), RBA::DBox::new( 1, -5, 1, -5 ) )
|
||||
assert_equal( (b + RBA::DPoint::new( 1, -5 )).to_s, "(1,-5;17,22)" )
|
||||
|
||||
|
||||
Vendored
+72
@@ -190,6 +190,78 @@ def norm_hash(hash)
|
||||
end
|
||||
|
||||
|
||||
class DBPCellAPI_TestClass < TestBase
|
||||
|
||||
def test_1
|
||||
|
||||
# PCellParameterDeclaration
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.default.inspect, "nil")
|
||||
assert_equal(decl.unit, "")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
assert_equal(decl.default.to_s, "17")
|
||||
assert_equal(decl.unit, "")
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17", "unit")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
assert_equal(decl.default.to_s, "17")
|
||||
assert_equal(decl.unit, "unit")
|
||||
|
||||
decl.name = "n"
|
||||
assert_equal(decl.name, "n")
|
||||
decl.description = "d"
|
||||
assert_equal(decl.description, "d")
|
||||
decl.unit = "u"
|
||||
assert_equal(decl.unit, "u")
|
||||
decl.type = RBA::PCellParameterDeclaration::TypeBoolean
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeBoolean)
|
||||
decl.default = true
|
||||
assert_equal(decl.default.to_s, "true")
|
||||
|
||||
decl.type = RBA::PCellParameterDeclaration::TypeInt
|
||||
assert_equal(decl.min_value.inspect, "nil")
|
||||
assert_equal(decl.max_value.inspect, "nil")
|
||||
decl.min_value = "-1"
|
||||
assert_equal(decl.min_value.to_s, "-1")
|
||||
decl.max_value = "42"
|
||||
assert_equal(decl.max_value.to_s, "42")
|
||||
decl.min_value = nil
|
||||
decl.max_value = nil
|
||||
assert_equal(decl.min_value.inspect, "nil")
|
||||
assert_equal(decl.max_value.inspect, "nil")
|
||||
|
||||
assert_equal(decl.hidden?, false)
|
||||
decl.hidden = true
|
||||
assert_equal(decl.hidden?, true)
|
||||
|
||||
assert_equal(decl.readonly?, false)
|
||||
decl.readonly = true
|
||||
assert_equal(decl.readonly?, true)
|
||||
|
||||
decl.add_choice("first", 42)
|
||||
assert_equal(decl.choice_values, [42])
|
||||
assert_equal(decl.choice_descriptions, ["first"])
|
||||
decl.clear_choices
|
||||
assert_equal(decl.choice_values, [])
|
||||
assert_equal(decl.choice_descriptions, [])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class DBPCell_TestClass < TestBase
|
||||
|
||||
def test_1
|
||||
|
||||
Vendored
+60
@@ -821,6 +821,54 @@ class DBPolygon_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_breakPolygon
|
||||
|
||||
pts = []
|
||||
pts << RBA::Point::new(0, 0)
|
||||
pts << RBA::Point::new(0, 1000)
|
||||
pts << RBA::Point::new(100, 1000)
|
||||
pts << RBA::Point::new(100, 100)
|
||||
pts << RBA::Point::new(1000, 100)
|
||||
pts << RBA::Point::new(1000, 0)
|
||||
|
||||
split = RBA::Polygon::new(pts).break(4, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::Polygon::new(pts).break(0, 2.0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::Polygon::new(pts).break(0, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,1000;100,1000;100,100;1000,100;1000,0)")
|
||||
|
||||
split = RBA::SimplePolygon::new(pts).break(4, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::SimplePolygon::new(pts).break(0, 2.0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::SimplePolygon::new(pts).break(0, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,1000;100,1000;100,100;1000,100;1000,0)")
|
||||
|
||||
pts = []
|
||||
pts << RBA::DPoint::new(0, 0)
|
||||
pts << RBA::DPoint::new(0, 1000)
|
||||
pts << RBA::DPoint::new(100, 1000)
|
||||
pts << RBA::DPoint::new(100, 100)
|
||||
pts << RBA::DPoint::new(1000, 100)
|
||||
pts << RBA::DPoint::new(1000, 0)
|
||||
|
||||
split = RBA::DPolygon::new(pts).break(4, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::DPolygon::new(pts).break(0, 2.0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::DPolygon::new(pts).break(0, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,1000;100,1000;100,100;1000,100;1000,0)")
|
||||
|
||||
split = RBA::DSimplePolygon::new(pts).break(4, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::DSimplePolygon::new(pts).break(0, 2.0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,100;1000,100;1000,0);(0,100;0,1000;100,1000;100,100)")
|
||||
split = RBA::DSimplePolygon::new(pts).break(0, 0)
|
||||
assert_equal(split.collect { |p| p.to_s }.join(";"), "(0,0;0,1000;100,1000;100,100;1000,100;1000,0)")
|
||||
|
||||
end
|
||||
|
||||
def test_voidMethodsReturnSelf
|
||||
|
||||
hull = [ RBA::Point::new(0, 0), RBA::Point::new(6000, 0),
|
||||
@@ -834,6 +882,18 @@ class DBPolygon_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_argumentShortcuts
|
||||
|
||||
# implicit conversion to a Point array:
|
||||
poly = RBA::Polygon.new([ [0,0], [0,1000], [1000,1000] ])
|
||||
assert_equal(poly.to_s, "(0,0;0,1000;1000,1000)")
|
||||
|
||||
# issue 1651 - no binding to Box constructor
|
||||
poly = RBA::Polygon.new([ [0,0], [0,1000], [1000,1000], [1000,0] ])
|
||||
assert_equal(poly.to_s, "(0,0;0,1000;1000,1000;1000,0)")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
||||
+32
@@ -322,6 +322,38 @@ END
|
||||
|
||||
end
|
||||
|
||||
def test_3
|
||||
|
||||
l = RBA::Layout.new
|
||||
l.insert_layer_at(0, RBA::LayerInfo.new(1, 0))
|
||||
l.insert_layer_at(1, RBA::LayerInfo.new(2, 0))
|
||||
c0 = l.cell(l.add_cell("c0"))
|
||||
c1 = l.cell(l.add_cell("c1"))
|
||||
c2 = l.cell(l.add_cell("c2"))
|
||||
c3 = l.cell(l.add_cell("c3"))
|
||||
|
||||
b = RBA::Box.new(0, 100, 1000, 1200)
|
||||
c0.shapes(0).insert(RBA::Box.new(0, 0, 3000, 2000))
|
||||
c1.shapes(0).insert(b)
|
||||
c2.shapes(0).insert(b)
|
||||
c3.shapes(0).insert(b)
|
||||
|
||||
tt = RBA::Trans.new
|
||||
c0.insert(RBA::CellInstArray.new(c1.cell_index, tt))
|
||||
c0.insert(RBA::CellInstArray.new(c2.cell_index, RBA::Trans.new(RBA::Vector.new(100, -100))))
|
||||
c0.insert(RBA::CellInstArray.new(c3.cell_index, RBA::Trans.new(1)))
|
||||
c2.insert(RBA::CellInstArray.new(c3.cell_index, RBA::Trans.new(RBA::Vector.new(1100, 0))))
|
||||
|
||||
ii = RBA::RecursiveShapeIterator.new(l, c0, 0)
|
||||
assert_equal(ii.for_merged_input, false)
|
||||
assert_equal(collect(ii, l), "[c0](0,0;3000,2000)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)")
|
||||
|
||||
ii.for_merged_input = true
|
||||
assert_equal(ii.for_merged_input, true)
|
||||
assert_equal(collect(ii, l), "[c0](0,0;3000,2000)/[c3](-1200,0;-100,1000)")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
||||
Vendored
+41
@@ -1066,6 +1066,47 @@ class DBRegion_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
# regions from Shapes
|
||||
def test_regions_from_shapes
|
||||
|
||||
shapes = RBA::Shapes::new;
|
||||
|
||||
shapes.insert(RBA::Box::new(0, 0, 100, 200))
|
||||
shapes.insert(RBA::Box::new(50, 50, 150, 250))
|
||||
|
||||
assert_equal(RBA::Region::new(shapes).area, 32500)
|
||||
region = RBA::Region::new(shapes)
|
||||
region.merged_semantics = false
|
||||
assert_equal(region.area, 40000)
|
||||
|
||||
assert_equal(RBA::Region::new(shapes, RBA::ICplxTrans::new(0.5)).area, 8125)
|
||||
region = RBA::Region::new(shapes, RBA::ICplxTrans::new(0.5))
|
||||
region.merged_semantics = false
|
||||
assert_equal(region.area, 10000)
|
||||
|
||||
# for cross-checking: same for RecursiveShapeIterator
|
||||
|
||||
layout = RBA::Layout::new
|
||||
l1 = layout.insert_layer(RBA::LayerInfo::new(1, 0))
|
||||
top = layout.create_cell("TOP")
|
||||
|
||||
top.shapes(l1).insert (RBA::Box::new(0, 0, 100, 200))
|
||||
top.shapes(l1).insert (RBA::Box::new(50, 50, 150, 250))
|
||||
|
||||
si = RBA::RecursiveShapeIterator::new(layout, top, l1)
|
||||
|
||||
assert_equal(RBA::Region::new(si).area, 32500)
|
||||
region = RBA::Region::new(si)
|
||||
region.merged_semantics = false
|
||||
assert_equal(region.area, 40000)
|
||||
|
||||
assert_equal(RBA::Region::new(si, RBA::ICplxTrans::new(0.5)).area, 8125)
|
||||
region = RBA::Region::new(si, RBA::ICplxTrans::new(0.5))
|
||||
region.merged_semantics = false
|
||||
assert_equal(region.area, 10000)
|
||||
|
||||
end
|
||||
|
||||
# deep region tests
|
||||
def test_deep1
|
||||
|
||||
|
||||
Vendored
+4
@@ -178,6 +178,7 @@ class DBShapes_TestClass < TestBase
|
||||
assert_equal( arr[0].is_polygon?, false )
|
||||
assert_equal( arr[0].is_box?, true )
|
||||
assert_equal( arr[0].box.to_s, "(10,-10;50,40)" )
|
||||
assert_equal( arr[0].rectangle.to_s, "(10,-10;50,40)" )
|
||||
assert_equal( arr[0].bbox.to_s, "(10,-10;50,40)" )
|
||||
|
||||
# edges
|
||||
@@ -198,6 +199,7 @@ class DBShapes_TestClass < TestBase
|
||||
assert_equal( arr[0].edge.to_s, "(-1,2;5,2)" )
|
||||
assert_equal( arr[0].edge_pair.inspect, "nil" )
|
||||
assert_equal( arr[0].box.inspect, "nil" )
|
||||
assert_equal( arr[0].rectangle.inspect, "nil" )
|
||||
assert_equal( arr[0].path.inspect, "nil" )
|
||||
assert_equal( arr[0].text.inspect, "nil" )
|
||||
assert_equal( arr[0].edge == a, true )
|
||||
@@ -533,6 +535,7 @@ class DBShapes_TestClass < TestBase
|
||||
assert_equal( arr[0].dedge.inspect, "nil" )
|
||||
assert_equal( arr[0].dedge_pair.inspect, "nil" )
|
||||
assert_equal( arr[0].dbox.to_s, "(0.01,-0.01;0.05,0.04)" )
|
||||
assert_equal( arr[0].drectangle.to_s, "(0.01,-0.01;0.05,0.04)" )
|
||||
assert_equal( arr[0].dpath.inspect, "nil" )
|
||||
assert_equal( arr[0].dtext.inspect, "nil" )
|
||||
assert_equal( arr[0].is_polygon?, false )
|
||||
@@ -557,6 +560,7 @@ class DBShapes_TestClass < TestBase
|
||||
assert_equal( arr[0].dedge.to_s, "(-0.001,0.002;0.005,0.002)" )
|
||||
assert_equal( arr[0].dedge_pair.inspect, "nil" )
|
||||
assert_equal( arr[0].dbox.inspect, "nil" )
|
||||
assert_equal( arr[0].drectangle.inspect, "nil" )
|
||||
assert_equal( arr[0].dpath.inspect, "nil" )
|
||||
assert_equal( arr[0].dtext.inspect, "nil" )
|
||||
assert_equal( arr[0].dbbox.to_s, "(-0.001,0.002;0.005,0.002)" )
|
||||
|
||||
Vendored
+19
@@ -105,10 +105,29 @@ END
|
||||
|
||||
tech.default_grids = []
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "")
|
||||
assert_equal("%.12g" % tech.default_grid, "0")
|
||||
tech.default_grids = [0.001, 0.01, 0.2]
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.001,0.01,0.2")
|
||||
tech.default_grids = [1]
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "1")
|
||||
assert_equal("%.12g" % tech.default_grid, "0")
|
||||
|
||||
# setting the default grid
|
||||
tech.set_default_grids([0.01,0.02,0.05], 0.02)
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.01,0.02,0.05")
|
||||
assert_equal("%.12g" % tech.default_grid, "0.02")
|
||||
|
||||
# default grid must be a member of the default grid list
|
||||
tech.set_default_grids([0.01,0.02,0.05], 0.2)
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.01,0.02,0.05")
|
||||
assert_equal("%.12g" % tech.default_grid, "0")
|
||||
|
||||
# "default_grids=" resets the default grid
|
||||
tech.set_default_grids([0.01,0.02,0.05], 0.02)
|
||||
assert_equal("%.12g" % tech.default_grid, "0.02")
|
||||
tech.default_grids = [1]
|
||||
assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "1")
|
||||
assert_equal("%.12g" % tech.default_grid, "0")
|
||||
|
||||
tech.default_base_path = "/default/path"
|
||||
assert_equal(tech.default_base_path, "/default/path")
|
||||
|
||||
Vendored
+72
@@ -935,6 +935,78 @@ class RDB_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_13
|
||||
|
||||
# manipulations
|
||||
rdb = RBA::ReportDatabase::new("")
|
||||
|
||||
_cell = rdb.create_cell("CELL")
|
||||
_cat = rdb.create_category("cat")
|
||||
_subcat = rdb.create_category(_cat, "subcat")
|
||||
_subcat.description = "subcat_d"
|
||||
_item1 = rdb.create_item(_cell.rdb_id, _subcat.rdb_id)
|
||||
_item1.add_value(17.5)
|
||||
_item1.add_value("string")
|
||||
_item2 = rdb.create_item(_cell.rdb_id, _subcat.rdb_id)
|
||||
_item2.add_value("b")
|
||||
_subsubcat = rdb.create_category(_subcat, "subsubcat")
|
||||
_cat2 = rdb.create_category("cat2")
|
||||
|
||||
cell = rdb.cell_by_id(_cell.rdb_id)
|
||||
assert_equal(cell._is_const_object?, false)
|
||||
assert_equal(rdb.each_cell.to_a[0]._is_const_object?, false)
|
||||
|
||||
cell = rdb.cell_by_qname("CELL")
|
||||
assert_equal(cell._is_const_object?, false)
|
||||
|
||||
cat = rdb.category_by_id(_cat.rdb_id)
|
||||
assert_equal(cat._is_const_object?, false)
|
||||
|
||||
cat = rdb.category_by_path("cat")
|
||||
assert_equal(cat._is_const_object?, false)
|
||||
subcat = rdb.category_by_path("cat.subcat")
|
||||
|
||||
assert_equal(rdb.each_category.to_a[0]._is_const_object?, false)
|
||||
assert_equal(rdb.each_category.collect { |c| c.name }.join(","), "cat,cat2")
|
||||
assert_equal(subcat._is_const_object?, false)
|
||||
assert_equal(subcat.database._is_const_object?, false)
|
||||
assert_equal(subcat.name, "subcat")
|
||||
assert_equal(subcat.parent.name, "cat")
|
||||
|
||||
assert_equal(subcat.description, "subcat_d")
|
||||
subcat.description = "changed"
|
||||
assert_equal(subcat.description, "changed")
|
||||
|
||||
assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), "float: 17.5/text: string;text: b")
|
||||
|
||||
item1 = rdb.each_item_per_category(subcat.rdb_id).to_a[0]
|
||||
assert_equal(item1._is_const_object?, false)
|
||||
item1.clear_values
|
||||
assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), ";text: b")
|
||||
item1.add_value("x")
|
||||
assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), "text: x;text: b")
|
||||
item1.add_tag(17)
|
||||
assert_equal(item1.has_tag?(17), true)
|
||||
assert_equal(item1.has_tag?(16), false)
|
||||
|
||||
item1 = rdb.each_item.to_a[0]
|
||||
assert_equal(item1._is_const_object?, false)
|
||||
assert_equal(item1.has_tag?(17), true)
|
||||
|
||||
item1 = rdb.each_item_per_cell(cell.rdb_id).to_a[0]
|
||||
assert_equal(item1._is_const_object?, false)
|
||||
assert_equal(item1.has_tag?(17), true)
|
||||
|
||||
item1 = rdb.each_item_per_cell_and_category(cell.rdb_id, subcat.rdb_id).to_a[0]
|
||||
assert_equal(item1._is_const_object?, false)
|
||||
assert_equal(item1.has_tag?(17), true)
|
||||
|
||||
item1 = cell.each_item.to_a[0]
|
||||
assert_equal(item1._is_const_object?, false)
|
||||
assert_equal(item1.has_tag?(17), true)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
||||
Reference in New Issue
Block a user