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

Function setSkinKeyAndCheckModel

test/Skin.cpp:749–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749void setSkinKeyAndCheckModel(const IEntityNodePtr& entity, const std::string& expectedSkin, const std::vector<std::string>& expectedMaterials)
750{
751 // Save the data to do a before/after test
752 auto model = getSkinnedModel(entity);
753 auto modelNode = std::dynamic_pointer_cast<model::ModelNode>(model);
754
755 auto skinBeforeSettingKey = model->getSkin();
756 auto materialsBeforeSettingKey = modelNode->getIModel().getActiveMaterials();
757
758 entity->getEntity().setKeyValue("skin", expectedSkin);
759 expectEntityHasSkinnedModel(entity, expectedSkin, expectedMaterials);
760
761 // Remove the skin key again, it should be as before
762 entity->getEntity().setKeyValue("skin", "");
763 expectEntityHasSkinnedModel(entity, skinBeforeSettingKey, materialsBeforeSettingKey);
764}
765
766// An entity using a certain modelDef as "model" and explicitly setting the "skin" spawnarg
767void expectEntityWithSkinKeyHasSkinnedModel(const std::string& modelKeyValue, const std::string& expectedSkin, const std::vector<std::string>& expectedMaterials)

Calls 6

getSkinnedModelFunction · 0.85
getActiveMaterialsMethod · 0.80
getSkinMethod · 0.45
setKeyValueMethod · 0.45
getEntityMethod · 0.45

Tested by

no test coverage detected