mirror of https://github.com/KLayout/klayout.git
[consider merging] LayoutView#clear_layer_list preserves layer list name now
This commit is contained in:
parent
820ab77903
commit
879df5a85b
|
|
@ -1961,6 +1961,22 @@ LayoutViewBase::set_properties (unsigned int index, const LayerPropertiesList &p
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::clear_layers (unsigned int index)
|
||||
{
|
||||
LayerPropertiesList ll;
|
||||
ll.set_name (get_properties (index).name ());
|
||||
set_properties (index, ll);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::clear_layers ()
|
||||
{
|
||||
LayerPropertiesList ll;
|
||||
ll.set_name (get_properties ().name ());
|
||||
set_properties (ll);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::expand_properties ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -515,18 +515,12 @@ public:
|
|||
/**
|
||||
* @brief Clear the given layer view list
|
||||
*/
|
||||
void clear_layers (unsigned int index)
|
||||
{
|
||||
set_properties (index, LayerPropertiesList ());
|
||||
}
|
||||
void clear_layers (unsigned int index);
|
||||
|
||||
/**
|
||||
* @brief Clear the current layer view list
|
||||
*/
|
||||
void clear_layers ()
|
||||
{
|
||||
set_properties (LayerPropertiesList ());
|
||||
}
|
||||
void clear_layers ();
|
||||
|
||||
/**
|
||||
* @brief Access the current layer properties list
|
||||
|
|
|
|||
|
|
@ -1038,6 +1038,45 @@ class LAYLayers_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
# clear_layers with index and layer list with name
|
||||
def test_8
|
||||
|
||||
if !RBA.constants.member?(:Application)
|
||||
return
|
||||
end
|
||||
|
||||
app = RBA::Application.instance
|
||||
mw = app.main_window
|
||||
mw.close_all
|
||||
|
||||
mw.load_layout( ENV["TESTSRC"] + "/testdata/gds/t11.gds", 1 )
|
||||
|
||||
cv = mw.current_view
|
||||
|
||||
cv.clear_layers
|
||||
assert_equal(lnodes_str("", cv.begin_layers(0)), "")
|
||||
|
||||
cv.rename_layer_list(0, "x")
|
||||
assert_equal(cv.layer_list_name(0), "x")
|
||||
|
||||
cv.insert_layer(0, cv.end_layers(0), RBA::LayerProperties::new)
|
||||
assert_equal(lnodes_str("", cv.begin_layers(0)), "*/*@*\n")
|
||||
|
||||
cv.clear_layers(0)
|
||||
assert_equal(lnodes_str("", cv.begin_layers(0)), "")
|
||||
assert_equal(cv.layer_list_name(0), "x")
|
||||
|
||||
cv.rename_layer_list(cv.current_layer_list, "y")
|
||||
assert_equal(cv.layer_list_name(0), "y")
|
||||
cv.insert_layer(cv.end_layers, RBA::LayerProperties::new)
|
||||
assert_equal(lnodes_str("", cv.begin_layers), "*/*@*\n")
|
||||
|
||||
cv.clear_layers
|
||||
assert_equal(lnodes_str("", cv.begin_layers), "")
|
||||
assert_equal(cv.layer_list_name(cv.current_layer_list), "y")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
|
|
|||
Loading…
Reference in New Issue