| 502 | end |
| 503 | |
| 504 | def test_1a |
| 505 | |
| 506 | if !RBA.constants.member?(:PCellDeclarationHelper) |
| 507 | return |
| 508 | end |
| 509 | |
| 510 | # instantiate and register the library |
| 511 | tl = PCellTestLib2::new |
| 512 | |
| 513 | ly = RBA::Layout::new(true) |
| 514 | ly.dbu = 0.01 |
| 515 | |
| 516 | ci1 = ly.add_cell("c1") |
| 517 | c1 = ly.cell(ci1) |
| 518 | |
| 519 | lib = RBA::Library.library_by_name("PCellTestLib2") |
| 520 | assert_equal(lib != nil, true) |
| 521 | pcell_decl = lib.layout().pcell_declaration("Box2") |
| 522 | |
| 523 | param = [ RBA::LayerInfo::new(1, 0) ] # rest is filled with defaults |
| 524 | pcell_var_id = ly.add_pcell_variant(lib, pcell_decl.id(), param) |
| 525 | pcell_var = ly.cell(pcell_var_id) |
| 526 | pcell_inst = c1.insert(RBA::CellInstArray::new(pcell_var_id, RBA::Trans::new)) |
| 527 | assert_equal(pcell_var.basic_name, "Box2") |
| 528 | assert_equal(pcell_var.name, "Box2_L1d0_W1p000_H1p000") |
| 529 | assert_equal(pcell_var.qname, "PCellTestLib2.Box2") |
| 530 | assert_equal(pcell_var.pcell_parameters().inspect, "[<1/0>, 1.0, 1.0, 0]") |
| 531 | assert_equal(pcell_var.display_title(), "PCellTestLib2.Box2(L=1/0,W=1.000,H=1.000)") |
| 532 | assert_equal(norm_hash(pcell_var.pcell_parameters_by_name()), "{\"height\"=>1.0, \"layer\"=><1/0>, \"secret\"=>0, \"width\"=>1.0}") |
| 533 | assert_equal(pcell_var.pcell_parameter("height").inspect(), "1.0") |
| 534 | assert_equal(c1.pcell_parameters(pcell_inst).inspect(), "[<1/0>, 1.0, 1.0, 0]") |
| 535 | assert_equal(c1.pcell_parameter(pcell_inst, "secret"), 0) |
| 536 | assert_equal(norm_hash(c1.pcell_parameters_by_name(pcell_inst)), "{\"height\"=>1.0, \"layer\"=><1/0>, \"secret\"=>0, \"width\"=>1.0}") |
| 537 | assert_equal(c1.pcell_parameter(pcell_inst, "height").inspect(), "1.0") |
| 538 | assert_equal(norm_hash(pcell_inst.pcell_parameters_by_name()), "{\"height\"=>1.0, \"layer\"=><1/0>, \"secret\"=>0, \"width\"=>1.0}") |
| 539 | assert_equal(pcell_inst["height"].inspect(), "1.0") |
| 540 | assert_equal(pcell_inst.pcell_parameter("height").inspect(), "1.0") |
| 541 | assert_equal(pcell_var.pcell_declaration().inspect(), pcell_decl.inspect) |
| 542 | assert_equal(c1.pcell_declaration(pcell_inst).inspect(), pcell_decl.inspect) |
| 543 | assert_equal(pcell_inst.pcell_declaration().inspect(), pcell_decl.inspect) |
| 544 | |
| 545 | li1 = ly.layer(1, 0) |
| 546 | assert_equal(li1 == nil, false) |
| 547 | pcell_inst.change_pcell_parameter("height", 2.0) |
| 548 | assert_equal(norm_hash(pcell_inst.pcell_parameters_by_name()), "{\"height\"=>2.0, \"layer\"=><1/0>, \"secret\"=>0, \"width\"=>1.0}") |
| 549 | |
| 550 | assert_equal(first_shape(ly.begin_shapes(c1.cell_index(), li1)).to_s, "box (-50,-100;50,100)") |
| 551 | |
| 552 | param = { "layer" => RBA::LayerInfo::new(2, 0), "width" => 2, "height" => 1 } |
| 553 | li2 = ly.layer(2, 0) |
| 554 | c1.change_pcell_parameters(pcell_inst, param) |
| 555 | assert_equal(first_shape(ly.begin_shapes(c1.cell_index(), li2)).to_s, "box (-100,-50;100,50)") |
| 556 | |
| 557 | l10 = ly.layer(10, 0) |
| 558 | c1.shapes(l10).insert(RBA::Box::new(0, 10, 100, 210)) |
| 559 | l11 = ly.layer(11, 0) |
| 560 | c1.shapes(l11).insert(RBA::Text::new("hello", RBA::Trans::new)) |
| 561 | assert_equal(pcell_decl.can_create_from_shape(ly, first_shape(ly.begin_shapes(c1.cell_index(), l11)), l10), false) |
nothing calls this directly
no test coverage detected