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

Method test_7_LayoutEdit2

testdata/ruby/dbShapesTest.rb:937–1159  ·  view source on GitHub ↗

Shapes (edit, new methods)

Source from the content-addressed store, hash-verified

935
936 # Shapes (edit, new methods)
937 def test_7_LayoutEdit2
938
939 ly = RBA::Layout::new(true)
940
941 pid1 = ly.properties_id( { "id" => 1 } )
942
943 ci1 = ly.add_cell( "c1" )
944 ci2 = ly.add_cell( "c2" )
945
946 linfo = RBA::LayerInfo::new
947 linfo.layer = 16
948 linfo.datatype = 1
949 lindex = ly.insert_layer( linfo )
950
951 linfo = RBA::LayerInfo::new
952 linfo.layer = 16
953 linfo.datatype = 2
954 ldummy = ly.insert_layer( linfo )
955
956 c1 = ly.cell( ci1 )
957 c2 = ly.cell( ci2 )
958
959 s1 = c1.shapes( lindex ).insert( RBA::Box::new( 10, -10, 50, 40 ) )
960 s2 = c1.shapes( lindex ).insert( RBA::Box::new( 100, -10, 150, 40 ) )
961 s3 = c1.shapes( lindex ).insert( RBA::Box::new( 200, -10, 250, 40 ) )
962
963 assert_equal( s1.cell.name, c1.name )
964 assert_equal( s1.layout.inspect, ly.inspect )
965
966 s1.box = RBA::Box::new( 11, -11, 51, 41 )
967
968 shapes = c1.shapes( lindex )
969
970 arr = []
971 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
972 assert_equal( arr, ["box (11,-11;51,41)", "box (100,-10;150,40)", "box (200,-10;250,40)"] )
973
974 s2.text = RBA::Text::new( "text", RBA::Trans::new( RBA::Point::new( 100, 200 ) ) )
975 assert_equal(s2.polygon.inspect, "nil")
976 assert_equal(s2.simple_polygon.inspect, "nil")
977 assert_equal(s2.text.to_s, "('text',r0 100,200)")
978 assert_equal(s2.edge.inspect, "nil")
979 assert_equal(s2.edge_pair.inspect, "nil")
980 assert_equal(s2.path.inspect, "nil")
981 assert_equal(s2.box.inspect, "nil")
982
983 shapes = c1.shapes( lindex )
984
985 arr = []
986 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
987 assert_equal( arr, ["box (11,-11;51,41)", "box (200,-10;250,40)", "text ('text',r0 100,200)"] )
988
989 s3.edge_pair = RBA::EdgePair::new(RBA::Edge::new(RBA::Point::new(1, 2), RBA::Point::new(3, 4)), RBA::Edge::new(RBA::Point::new(1, 12), RBA::Point::new(3, 14)))
990
991 shapes = c1.shapes( lindex )
992
993 arr = []
994 shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }

Callers

nothing calls this directly

Calls 15

eachMethod · 0.80
simple_polygonMethod · 0.80
path_widthMethod · 0.80
round_pathMethod · 0.80
text_stringMethod · 0.80
text_halignMethod · 0.80
text_valignMethod · 0.80
text_transMethod · 0.80
properties_idMethod · 0.45
add_cellMethod · 0.45
layerMethod · 0.45
insert_layerMethod · 0.45

Tested by

no test coverage detected