diff --git a/test/PatchWelding.cpp b/test/PatchWelding.cpp index 18ea5a994d..189c6b892a 100644 --- a/test/PatchWelding.cpp +++ b/test/PatchWelding.cpp @@ -17,16 +17,16 @@ inline scene::INodePtr findPatchWithNumber(const std::string& number) return algorithm::findFirstPatchWithMaterial(worldspawn, "textures/numbers/" + number); } -// Patch 1 = 3x3, Patch 4 = 3x3 to the right -TEST_F(PatchWeldingTest, WeldPatches1And4) +namespace { - loadMap("weld_patches.mapx"); - auto patch1 = findPatchWithNumber("1"); - auto patch4 = findPatchWithNumber("4"); +void performPatchWeldingTest(const std::string& number1, const std::string& number2, int expectedRows, int expectedCols) +{ + auto firstPatch = findPatchWithNumber(number1); + auto secondPatch = findPatchWithNumber(number2); - Node_setSelected(patch1, true); - Node_setSelected(patch4, true); + Node_setSelected(firstPatch, true); + Node_setSelected(secondPatch, true); GlobalCommandSystem().executeCommand("WeldSelectedPatches"); @@ -34,12 +34,23 @@ TEST_F(PatchWeldingTest, WeldPatches1And4) EXPECT_EQ(GlobalSelectionSystem().countSelected(), 1); // Two patches removed from the scene - EXPECT_FALSE(patch1->getParent()); - EXPECT_FALSE(patch4->getParent()); + EXPECT_FALSE(firstPatch->getParent()); + EXPECT_FALSE(secondPatch->getParent()); auto merged = std::dynamic_pointer_cast(GlobalSelectionSystem().ultimateSelected()); - EXPECT_EQ(merged->getPatch().getWidth(), 3); - EXPECT_EQ(merged->getPatch().getWidth(), 5); + EXPECT_EQ(merged->getPatch().getHeight(), expectedRows); + EXPECT_EQ(merged->getPatch().getWidth(), expectedCols); +} + +} + +// Patch 1 = 3x3, Patch 4 = 3x3 to the right +TEST_F(PatchWeldingTest, WeldPatches1And4) +{ + loadMap("weld_patches.mapx"); + + // Welding patches 1 and 4 should produce a 3 x 5 patch + performPatchWeldingTest("1", "4", 3, 5); } }