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

Function checkAltarSceneGeometry

test/MapSavingLoading.cpp:159–201  ·  view source on GitHub ↗

Checks the main map info (brushes, entities, spawnargs), no layers or grouping

Source from the content-addressed store, hash-verified

157
158// Checks the main map info (brushes, entities, spawnargs), no layers or grouping
159void checkAltarSceneGeometry(const scene::IMapRootNodePtr& root)
160{
161 auto worldspawn = algorithm::findWorldspawn(root);
162
163 // Check a specific spawnarg on worldspawn
164 EXPECT_EQ(Node_getEntity(worldspawn)->getKeyValue("_color"), "0.286 0.408 0.259");
165
166 // Check if all entities are present
167 auto knownEntities = { "func_static_153", "func_static_154", "func_static_156",
168 "func_static_155", "func_static_63", "func_static_66", "func_static_70",
169 "func_static_164", "func_static_165", "light_torchflame_13", "religious_symbol_1" };
170
171 for (auto entity : knownEntities)
172 {
173 EXPECT_TRUE(algorithm::getEntityByName(root, entity));
174 }
175
176 // Check number of patches
177 auto isPatchDef3 = [](const scene::INodePtr& node) { return Node_isPatch(node) && Node_getIPatch(node)->subdivisionsFixed(); };
178 auto isPatchDef2 = [](const scene::INodePtr& node) { return Node_isPatch(node) && !Node_getIPatch(node)->subdivisionsFixed(); };
179
180 EXPECT_EQ(algorithm::getChildCount(worldspawn, isPatchDef3), 110); // 110 patchDef3
181 EXPECT_EQ(algorithm::getChildCount(worldspawn, isPatchDef2), 16); // 16 patchDef2
182
183 // Check number of brushes
184 auto isBrush = [](const scene::INodePtr& node) { return Node_isBrush(node); };
185
186 EXPECT_EQ(algorithm::getChildCount(root, isBrush), 37); // 37 brushes in total
187 EXPECT_EQ(algorithm::getChildCount(worldspawn, isBrush), 21); // 21 worldspawn brushes
188 EXPECT_EQ(algorithm::getChildCount(algorithm::getEntityByName(root, "func_static_66"), isBrush), 4); // 4 child brushes
189 EXPECT_EQ(algorithm::getChildCount(algorithm::getEntityByName(root, "func_static_70"), isBrush), 4); // 4 child brushes
190 EXPECT_EQ(algorithm::getChildCount(algorithm::getEntityByName(root, "func_static_164"), isBrush), 4); // 4 child brushes
191 EXPECT_EQ(algorithm::getChildCount(algorithm::getEntityByName(root, "func_static_165"), isBrush), 4); // 4 child brushes
192
193 // Check the lights
194 auto isLight = [](const scene::INodePtr& node) { return Node_getLightNode(node) != nullptr; };
195 EXPECT_EQ(algorithm::getChildCount(root, isLight), 1); // 1 light
196
197 // Check a specific model
198 auto religiousSymbol = Node_getEntity(algorithm::getEntityByName(root, "religious_symbol_1"));
199 EXPECT_EQ(religiousSymbol->getKeyValue("classname"), "altar_moveable_loot_religious_symbol");
200 EXPECT_EQ(religiousSymbol->getKeyValue("origin"), "-0.0448253 12.0322 -177");
201}
202
203void checkAltarSceneGeometry()
204{

Callers 2

checkAltarSceneFunction · 0.85
TEST_FFunction · 0.85

Calls 11

findWorldspawnFunction · 0.85
Node_getEntityFunction · 0.85
getEntityByNameFunction · 0.85
Node_isPatchFunction · 0.85
Node_getIPatchFunction · 0.85
getChildCountFunction · 0.85
Node_isBrushFunction · 0.85
Node_getLightNodeFunction · 0.85
getKeyValueMethod · 0.45
subdivisionsFixedMethod · 0.45
getRootMethod · 0.45

Tested by

no test coverage detected