MCPcopy Create free account
hub / github.com/KLayout/klayout / test_7_Layout

Method test_7_Layout

testdata/ruby/dbShapesTest.rb:34–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33 # Shapes
34 def test_7_Layout
35
36 shapes = RBA::Shapes::new
37
38 assert_equal(shapes.cell == nil, true)
39 assert_equal(shapes.layout == nil, true)
40
41 ly = RBA::Layout::new
42
43 ci1 = ly.add_cell( "c1" )
44 ci2 = ly.add_cell( "c2" )
45
46 linfo = RBA::LayerInfo::new
47 linfo.layer = 16
48 linfo.datatype = 1
49 lindex = ly.insert_layer( linfo )
50
51 linfo = RBA::LayerInfo::new
52 linfo.layer = 16
53 linfo.datatype = 2
54 ldummy = ly.insert_layer( linfo )
55
56 c1 = ly.cell( ci1 )
57 c2 = ly.cell( ci2 )
58
59 c1.shapes( lindex ).insert( RBA::Box::new( 10, -10, 50, 40 ) )
60 c1.shapes( lindex ).insert( RBA::Box::new( 100, -10, 150, 40 ) )
61 c1.shapes( lindex ).insert( RBA::Box::new( 200, -10, 250, 40 ) )
62
63 shapes = c1.shapes( lindex )
64
65 assert_equal(shapes.cell == c1, true)
66 assert_equal(shapes.layout == ly, true)
67
68 arr = []
69 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.box.to_s ) }
70 assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
71
72 arr = []
73 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.bbox.to_s ) }
74 assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
75
76 arr = []
77 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.area ) }
78 assert_equal( arr, [2000, 2500, 2500] )
79
80 arr = []
81 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.perimeter ) }
82 assert_equal( arr, [180, 200, 200] )
83
84 arr = []
85 shapes.each { |s| arr.push( s.box.to_s ) }
86 assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
87
88 arr = []
89 shapes.each( RBA::Shapes::SBoxes ) { |s| arr.push( s.box.to_s ) }
90 assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
91

Callers

nothing calls this directly

Calls 15

eachMethod · 0.80
simple_polygonMethod · 0.80
is_box?Method · 0.80
rectangleMethod · 0.80
path_widthMethod · 0.80
path_lengthMethod · 0.80
text_stringMethod · 0.80
cellMethod · 0.45
layoutMethod · 0.45
add_cellMethod · 0.45
layerMethod · 0.45
insert_layerMethod · 0.45

Tested by

no test coverage detected