MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / verifyTargetScene

Function verifyTargetScene

test/MapMerging.cpp:2310–2363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2308// 7-FS7 group added (same as in target)
2309
2310void verifyTargetScene(const scene::IMapRootNodePtr& targetRoot)
2311{
2312 // FS1 and FS2 no longer form a group
2313 auto func_static_1 = algorithm::getEntityByName(targetRoot, "func_static_1");
2314 auto func_static_2 = algorithm::getEntityByName(targetRoot, "func_static_2");
2315
2316 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(func_static_1)->getGroupIds().size(), 0);
2317 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(func_static_2)->getGroupIds().size(), 0);
2318
2319 // [5-6]-15 group added
2320 auto brush15 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/15");
2321 auto brush5 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/5");
2322 auto brush6 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/6");
2323
2324 bool foundGroup = false;
2325
2326 for (auto groupId : std::dynamic_pointer_cast<IGroupSelectable>(brush15)->getGroupIds())
2327 {
2328 auto group = targetRoot->getSelectionGroupManager().getSelectionGroup(groupId);
2329
2330 if (groupContainsNodes(*group, { brush15, brush5, brush6 }))
2331 {
2332 foundGroup = true;
2333 break;
2334 }
2335 }
2336
2337 EXPECT_TRUE(foundGroup) << "Brush 15 does not form a group with brush 5 and 6";
2338
2339 auto brush11 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/11");
2340 auto brush12 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/12");
2341 auto brush13 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/13");
2342
2343 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(brush11)->getGroupIds().size(), 1);
2344 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(brush12)->getGroupIds().size(), 1);
2345 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(brush13)->getGroupIds().size(), 1);
2346
2347 auto brush11Group = targetRoot->getSelectionGroupManager().getSelectionGroup(
2348 std::dynamic_pointer_cast<IGroupSelectable>(brush11)->getGroupIds().front());
2349
2350 EXPECT_TRUE(groupContainsNodes(*brush11Group, { brush11, brush12, brush13 }));
2351
2352 // brush 7 and func_static_7 form a group
2353 auto brush7 = algorithm::findFirstBrushWithMaterial(algorithm::findWorldspawn(targetRoot), "textures/numbers/7");
2354 auto func_static_7 = algorithm::getEntityByName(targetRoot, "func_static_7");
2355
2356 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(brush7)->getGroupIds().size(), 1);
2357 EXPECT_EQ(std::dynamic_pointer_cast<IGroupSelectable>(func_static_7)->getGroupIds().size(), 1);
2358
2359 auto brush7Group = targetRoot->getSelectionGroupManager().getSelectionGroup(
2360 std::dynamic_pointer_cast<IGroupSelectable>(brush7)->getGroupIds().front());
2361
2362 EXPECT_TRUE(groupContainsNodes(*brush7Group, { brush7, func_static_7 }));
2363}
2364
2365TEST_F(ThreeWaySelectionGroupMergeTest, GroupRemoval)
2366{

Callers 1

TEST_FFunction · 0.85

Calls 6

getEntityByNameFunction · 0.85
findWorldspawnFunction · 0.85
groupContainsNodesFunction · 0.85
sizeMethod · 0.45
getSelectionGroupMethod · 0.45

Tested by

no test coverage detected