diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /src/3rdparty/adaptagrams/libcola/tests/overlappingClusters04.cpp | |
parent | Initial commit. (diff) | |
download | inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/3rdparty/adaptagrams/libcola/tests/overlappingClusters04.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/3rdparty/adaptagrams/libcola/tests/overlappingClusters04.cpp b/src/3rdparty/adaptagrams/libcola/tests/overlappingClusters04.cpp new file mode 100644 index 0000000..45a06ff --- /dev/null +++ b/src/3rdparty/adaptagrams/libcola/tests/overlappingClusters04.cpp @@ -0,0 +1,61 @@ +// From Aidan Delaney: a_b_ab_abc.json.svg +// Regression test for SEGFAULT caused by specifing an invalid node index 7 +// in cluster description. +#include <vector> +#include <utility> +#include "libcola/cola.h" +using namespace cola; +int main(void) { + CompoundConstraints ccs; + std::vector<Edge> es; + EdgeLengths eLengths; + double defaultEdgeLength=10; + std::vector<vpsc::Rectangle*> rs; + vpsc::Rectangle *rect = nullptr; + + rect = new vpsc::Rectangle(0, 5, 0, 5); + rs.push_back(rect); + + rect = new vpsc::Rectangle(-2, 3, -2, 3); + rs.push_back(rect); + + rect = new vpsc::Rectangle(-1, 4, -1, 4); + rs.push_back(rect); + + rect = new vpsc::Rectangle(1, 6, 1, 6); + rs.push_back(rect); + + rect = new vpsc::Rectangle(1, 6, 1, 6); + rs.push_back(rect); + + + ConstrainedFDLayout alg(rs, es, defaultEdgeLength, eLengths); + alg.setAvoidNodeOverlaps(true); + + RootCluster *cluster33771480 = new RootCluster(); + RectangularCluster *cluster33771952 = new RectangularCluster(); + cluster33771952->setPadding(Box(2)); + cluster33771952->addChildNode(1); + cluster33771952->addChildNode(3); + cluster33771952->addChildNode(7); + cluster33771480->addChildCluster(cluster33771952); + + RectangularCluster *cluster33772496 = new RectangularCluster(); + cluster33772496->setPadding(Box(2)); + cluster33772496->addChildNode(2); + cluster33772496->addChildNode(3); + cluster33772496->addChildNode(7); + cluster33771480->addChildCluster(cluster33772496); + + RectangularCluster *cluster33773040 = new RectangularCluster(); + cluster33773040->setPadding(Box(2)); + cluster33773040->addChildNode(7); + cluster33771480->addChildCluster(cluster33773040); + + alg.setClusterHierarchy(cluster33771480); + + alg.setConstraints(ccs); + alg.makeFeasible(); + //alg.outputInstanceToSVG("overlappingCLusters04"); + alg.freeAssociatedObjects(); +}; |