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

Method test_3

testdata/ruby/layLayers.rb:688–809  ·  view source on GitHub ↗

direct replacement of objects and attributes

Source from the content-addressed store, hash-verified

686
687 # direct replacement of objects and attributes
688 def test_3
689
690 if !RBA.constants.member?(:Application)
691 return
692 end
693
694 app = RBA::Application.instance
695 mw = app.main_window
696 mw.close_all
697
698 mw.load_layout( ENV["TESTSRC"] + "/testdata/gds/t11.gds", RBA::LoadLayoutOptions::new, "", 1 )
699 mw.load_layout( ENV["TESTSRC"] + "/testdata/gds/t10.gds", RBA::LoadLayoutOptions::new, "", 2 )
700
701 cv = mw.current_view
702 assert_equal( 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" )
703
704 cv.clear_layers
705
706 pos = cv.end_layers
707 assert_equal( pos.current.is_valid?, false )
708
709 cv.insert_layer( pos, RBA::LayerProperties::new )
710 assert_equal( pos.current.is_valid?, true )
711 assert_equal( lnodes_str( "", cv.begin_layers ), "*/*@*\n" )
712 assert_equal( lnodes_str2(cv), "*/*@*" )
713
714 assert_equal( cv.begin_layers.current.name, "" )
715 assert_equal( cv.begin_layers.current.visible?, true )
716 assert_equal( cv.begin_layers.current.dither_pattern, -1 )
717 assert_equal( cv.begin_layers.current.line_style, -1 )
718 assert_equal( cv.begin_layers.current.valid?, true )
719 assert_equal( cv.begin_layers.current.transparent?, false )
720
721 # test LayerPropertiesNodeRef
722 pos.current.name = "NAME"
723 pos.current.visible = false
724 pos.current.fill_color = 0xff012345
725 pos.current.frame_color = 0xff123456
726 pos.current.fill_brightness = 42
727 pos.current.frame_brightness = 17
728 pos.current.dither_pattern = 4
729 pos.current.line_style = 3
730 pos.current.valid = false
731 pos.current.transparent = true
732 pos.current.marked = false
733 pos.current.xfill = false
734 pos.current.width = 2
735 pos.current.animation = 2
736
737 assert_equal( cv.begin_layers.current.name, "NAME" )
738 assert_equal( cv.begin_layers.current.visible?, false )
739 assert_equal( cv.begin_layers.current.fill_color, 0xff012345 )
740 assert_equal( cv.begin_layers.current.frame_color, 0xff123456 )
741 assert_equal( cv.begin_layers.current.fill_brightness, 42 )
742 assert_equal( cv.begin_layers.current.frame_brightness, 17 )
743 assert_equal( cv.begin_layers.current.dither_pattern, 4 )
744 assert_equal( cv.begin_layers.current.line_style, 3 )
745 assert_equal( cv.begin_layers.current.valid?, false )

Callers

nothing calls this directly

Calls 15

main_windowMethod · 0.80
begin_layersMethod · 0.80
clear_layersMethod · 0.80
end_layersMethod · 0.80
dither_patternMethod · 0.80
line_styleMethod · 0.80
visibleMethod · 0.80
validMethod · 0.80
transparentMethod · 0.80
layer_indexMethod · 0.80
cellviewMethod · 0.80
list_indexMethod · 0.80

Tested by

no test coverage detected