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

Method test_3

testdata/python/layLayers.py:666–785  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

664
665 # direct replacement of objects and attributes
666 def test_3(self):
667
668 if not can_create_layoutview():
669 print("Skipped test as LayoutView cannot be created.")
670 return
671
672 cv = pya.LayoutView()
673 cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t11.gds", pya.LoadLayoutOptions(), "", True)
674 cv.load_layout(os.getenv("TESTSRC") + "/testdata/gds/t10.gds", pya.LoadLayoutOptions(), "", True)
675
676 self.assertEqual(self.lnodes_str("", cv.begin_layers()), "1/0@1\n2/0@1\n1/0@2\n2/0@2\n3/0@2\n3/1@2\n4/0@2\n5/0@2\n6/0@2\n6/1@2\n7/0@2\n8/0@2\n8/1@2\n")
677
678 cv.clear_layers()
679
680 pos = cv.end_layers()
681 self.assertEqual(pos.current().is_valid(), False)
682
683 cv.insert_layer(pos, pya.LayerProperties())
684 self.assertEqual(pos.current().is_valid(), True)
685 self.assertEqual(self.lnodes_str("", cv.begin_layers()), "*/*@*\n")
686 self.assertEqual(self.lnodes_str2(cv), "*/*@*")
687
688 self.assertEqual(cv.begin_layers().current().name, "")
689 self.assertEqual(cv.begin_layers().current().visible, True)
690 self.assertEqual(cv.begin_layers().current().dither_pattern, -1)
691 self.assertEqual(cv.begin_layers().current().line_style, -1)
692 self.assertEqual(cv.begin_layers().current().valid, True)
693 self.assertEqual(cv.begin_layers().current().transparent, False)
694
695 # test LayerPropertiesNodeRef
696 pos.current().name = "NAME"
697 pos.current().visible = False
698 pos.current().fill_color = 0xff012345
699 pos.current().frame_color = 0xff123456
700 pos.current().fill_brightness = 42
701 pos.current().frame_brightness = 17
702 pos.current().dither_pattern = 4
703 pos.current().line_style = 3
704 pos.current().valid = False
705 pos.current().transparent = True
706 pos.current().marked = False
707 pos.current().xfill = False
708 pos.current().width = 2
709 pos.current().animation = 2
710
711 self.assertEqual(cv.begin_layers().current().name, "NAME")
712 self.assertEqual(cv.begin_layers().current().visible, False)
713 self.assertEqual(cv.begin_layers().current().fill_color, 0xff012345)
714 self.assertEqual(cv.begin_layers().current().frame_color, 0xff123456)
715 self.assertEqual(cv.begin_layers().current().fill_brightness, 42)
716 self.assertEqual(cv.begin_layers().current().frame_brightness, 17)
717 self.assertEqual(cv.begin_layers().current().dither_pattern, 4)
718 self.assertEqual(cv.begin_layers().current().line_style, 3)
719 self.assertEqual(cv.begin_layers().current().valid, False)
720 self.assertEqual(cv.begin_layers().current().transparent, True)
721 self.assertEqual(cv.begin_layers().current().marked, False)
722 self.assertEqual(cv.begin_layers().current().xfill, False)
723 self.assertEqual(cv.begin_layers().current().width, 2)

Callers

nothing calls this directly

Calls 15

lnodes_strMethod · 0.95
lnodes_str2Method · 0.95
flatMethod · 0.95
lnodes_str3Method · 0.95
add_childMethod · 0.95
strFunction · 0.85
LoadLayoutOptionsMethod · 0.80
begin_layersMethod · 0.80
clear_layersMethod · 0.80
end_layersMethod · 0.80
layer_indexMethod · 0.80
cellviewMethod · 0.80

Tested by

no test coverage detected