Skip to content

Commit

Permalink
Fixed #592 (layer mapping issue) (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
klayoutmatthias committed Jul 3, 2020
1 parent 5ed1e27 commit c416c7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/db/db/dbStreamLayers.cc
Expand Up @@ -305,7 +305,7 @@ LayerMap::prepare (db::Layout &layout)

// In addition, map other existing layers as well, so merging of layout is somewhat better supported
for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) {
if (mapped_layers.find ((*l).first) == mapped_layers.end ()) {
if (! (*l).second->is_null () && mapped_layers.find ((*l).first) == mapped_layers.end ()) {
map (*(*l).second, (*l).first);
}
}
Expand Down
38 changes: 38 additions & 0 deletions src/db/unit_tests/dbStreamLayerTests.cc
Expand Up @@ -407,3 +407,41 @@ TEST(6)
"layer_map('1/0';'3/10-*';'2/0 : 2/0';'2/42 : 2/42';'2/1-41,43-* : */*')"
);
}

// issue #592
TEST(7)
{
db::Layout ly;

unsigned int l1 = ly.insert_layer (db::LayerProperties (85, 0));
unsigned int l2 = ly.insert_layer (db::LayerProperties (185, 0));
ly.insert_layer ();
ly.insert_layer ();

db::LayerMap lm;
lm.map (db::LayerProperties (10001, 0), l1);
lm.map (db::LayerProperties (10000, 0), l2);

EXPECT_EQ (layers_to_string (ly), "85/0,185/0,,");

lm.prepare (ly);

EXPECT_EQ (layers_to_string (ly), "85/0,185/0,,");

std::pair<bool, unsigned int> p;
p = lm.logical (db::LayerProperties (85, 0));
EXPECT_EQ (p.first, false);
EXPECT_EQ (p.second, (unsigned int) 0);

p = lm.logical (db::LayerProperties (185, 0));
EXPECT_EQ (p.first, false);
EXPECT_EQ (p.second, (unsigned int) 0);

p = lm.logical (db::LayerProperties (10000, 0));
EXPECT_EQ (p.first, true);
EXPECT_EQ (p.second, (unsigned int) 1);

p = lm.logical (db::LayerProperties (10001, 0));
EXPECT_EQ (p.first, true);
EXPECT_EQ (p.second, (unsigned int) 0);
}

0 comments on commit c416c7f

Please sign in to comment.