Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions salaTest/testshaperemove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,25 @@ TEST_CASE("Testing deleting shapes from segment maps") {
segmentMap->removeShape(shapeRef, false);
REQUIRE(segmentMap->getAllShapes().size() == idx - 1);
REQUIRE(segmentMap->getConnections().size() == idx - 1);

for (auto it = segmentMap->getAllShapes().begin(); it != segmentMap->getAllShapes().end(); it++) {
std::vector<int> connForConnections = segmentForConnections[it->first];
std::vector<int> connBackConnections = segmentBackConnections[it->first];
if (std::find(connForConnections.begin(), connForConnections.end(), shapeRef) !=
connForConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
} else if (std::find(connBackConnections.begin(), connBackConnections.end(), shapeRef) !=
connBackConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
}

REQUIRE(segmentTable.getRow(AttributeKey(it->first)).getValue(segmentConnectivityColIdx) ==
connectivitiesAfterRemoval[it->first]);
}
}
}

Expand All @@ -325,6 +344,25 @@ TEST_CASE("Testing deleting shapes from segment maps") {
segmentMap->removeShape(shapeRef, false);
REQUIRE(segmentMap->getAllShapes().size() == idx - 1);
REQUIRE(segmentMap->getConnections().size() == idx - 1);

for (auto it = segmentMap->getAllShapes().begin(); it != segmentMap->getAllShapes().end(); it++) {
std::vector<int> connForConnections = segmentForConnections[it->first];
std::vector<int> connBackConnections = segmentBackConnections[it->first];
if (std::find(connForConnections.begin(), connForConnections.end(), shapeRef) !=
connForConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
} else if (std::find(connBackConnections.begin(), connBackConnections.end(), shapeRef) !=
connBackConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
}

REQUIRE(segmentTable.getRow(AttributeKey(it->first)).getValue(segmentConnectivityColIdx) ==
connectivitiesAfterRemoval[it->first]);
}
}
}

Expand All @@ -344,6 +382,25 @@ TEST_CASE("Testing deleting shapes from segment maps") {
segmentMap->removeShape(shapeRef, false);
REQUIRE(segmentMap->getAllShapes().size() == idx - 1);
REQUIRE(segmentMap->getConnections().size() == idx - 1);

for (auto it = segmentMap->getAllShapes().begin(); it != segmentMap->getAllShapes().end(); it++) {
std::vector<int> connForConnections = segmentForConnections[it->first];
std::vector<int> connBackConnections = segmentBackConnections[it->first];
if (std::find(connForConnections.begin(), connForConnections.end(), shapeRef) !=
connForConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
} else if (std::find(connBackConnections.begin(), connBackConnections.end(), shapeRef) !=
connBackConnections.end()) {
// if the other shape contains this one, then remove from its connectivity
// removal does not currently work for segment maps, so connectivity is not adjusted
connectivitiesAfterRemoval[it->first] = connectivitiesAfterRemoval[it->first] - 1;
}

REQUIRE(segmentTable.getRow(AttributeKey(it->first)).getValue(segmentConnectivityColIdx) ==
connectivitiesAfterRemoval[it->first]);
}
}
}
}