diff --git a/src/db/db/dbAsIfFlatEdgePairs.cc b/src/db/db/dbAsIfFlatEdgePairs.cc index bac1a9495..4ed4ee3e9 100644 --- a/src/db/db/dbAsIfFlatEdgePairs.cc +++ b/src/db/db/dbAsIfFlatEdgePairs.cc @@ -75,7 +75,7 @@ AsIfFlatEdgePairs::in (const EdgePairs &other, bool invert) const op.insert (*o); } - std::auto_ptr new_edge_pairs (new FlatEdgePairs (false)); + std::auto_ptr new_edge_pairs (new FlatEdgePairs ()); for (EdgePairsIterator o (begin ()); ! o.at_end (); ++o) { if ((op.find (*o) == op.end ()) == invert) { diff --git a/src/db/db/dbAsIfFlatTexts.cc b/src/db/db/dbAsIfFlatTexts.cc index df65c4a25..4bad031a1 100644 --- a/src/db/db/dbAsIfFlatTexts.cc +++ b/src/db/db/dbAsIfFlatTexts.cc @@ -88,7 +88,7 @@ AsIfFlatTexts::in (const Texts &other, bool invert) const op.insert (*o); } - std::auto_ptr new_texts (new FlatTexts (false)); + std::auto_ptr new_texts (new FlatTexts ()); for (TextsIterator o (begin ()); ! o.at_end (); ++o) { if ((op.find (*o) == op.end ()) == invert) { @@ -308,7 +308,7 @@ AsIfFlatTexts::selected_interacting_generic (const Region &other, bool inverse) scanner.insert2 (p.operator-> (), 1); } - std::auto_ptr output (new FlatTexts (true)); + std::auto_ptr output (new FlatTexts ()); if (! inverse) { diff --git a/src/db/unit_tests/dbTextsTests.cc b/src/db/unit_tests/dbTextsTests.cc index 609de5876..e99bb6960 100644 --- a/src/db/unit_tests/dbTextsTests.cc +++ b/src/db/unit_tests/dbTextsTests.cc @@ -173,3 +173,32 @@ TEST(6) db::Texts r (db::RecursiveShapeIterator (ly, ly.cell (top_cell), l1)); EXPECT_EQ (r.to_string (), "('abc',r0 100,-200);('uvw',r0 110,210)"); } + +TEST(7) +{ + db::Texts texts; + texts.insert (db::Text ("abc", db::Trans (db::Vector (100, -200)))); + texts.insert (db::Text ("uvw", db::Trans (db::Vector (110, 210)))); + + db::Region region; + region.insert (db::Polygon (db::Box (50, -300, 150, -100))); + + EXPECT_EQ (texts.selected_interacting (region).to_string (), "('abc',r0 100,-200)"); + EXPECT_EQ (texts.selected_not_interacting (region).to_string (), "('uvw',r0 110,210)"); + + { + db::Texts tcopy = texts; + tcopy.select_interacting (region); + EXPECT_EQ (tcopy.to_string (), "('abc',r0 100,-200)"); + } + + { + db::Texts tcopy = texts; + tcopy.select_not_interacting (region); + EXPECT_EQ (tcopy.to_string (), "('uvw',r0 110,210)"); + } + + db::Region region_out; + texts.pull_interacting (region_out, region); + EXPECT_EQ (region_out.to_string (), "(50,-300;50,-100;150,-100;150,-300)"); +}