Skip to content

Commit

Permalink
Add test to ensure that moving nodes out of linked groups works
Browse files Browse the repository at this point in the history
  • Loading branch information
kduske committed Feb 15, 2024
1 parent c6ec43c commit 4b33e69
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions common/test/src/View/tst_GroupNodes.cpp
Expand Up @@ -587,6 +587,32 @@ TEST_CASE_METHOD(MapDocumentTest, "GroupNodesTest.ungroupLinkedGroups")
CHECK(linkedBrushNode2->linkId() == originalBrushLinkId);
}

TEST_CASE_METHOD(MapDocumentTest, "GroupNodesTest.reparentLinkedNode")
{
auto* brushNode = createBrushNode();
auto* entityNode = new Model::EntityNode{Model::Entity{}};

document->addNodes({{document->parentForNodes(), {brushNode, entityNode}}});
document->selectNodes({brushNode, entityNode});

auto* groupNode = document->groupSelection("test");
REQUIRE(groupNode != nullptr);

document->deselectAll();
document->selectNodes({groupNode});

auto* linkedGroupNode = document->createLinkedDuplicate();
REQUIRE_THAT(*linkedGroupNode, Model::MatchesNode(*groupNode));

document->deselectAll();
document->openGroup(groupNode);

document->reparentNodes({{document->world()->defaultLayer(), {brushNode}}});
REQUIRE(groupNode->children() == std::vector<Model::Node*>{entityNode});
REQUIRE(brushNode->parent() == document->world()->defaultLayer());
REQUIRE_THAT(*linkedGroupNode, Model::MatchesNode(*groupNode));
}

TEST_CASE_METHOD(MapDocumentTest, "GroupNodesTest.createLinkedDuplicate")
{
auto* brushNode = createBrushNode();
Expand Down

0 comments on commit 4b33e69

Please sign in to comment.