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

Function exportDefaultBrushUsingFormat

test/MapExport.cpp:81–101  ·  view source on GitHub ↗

Exports a default cuboid brush with its texture fitted 1x1 to a temporary path using the format for the given game type. Returns the exported map text.

Source from the content-addressed store, hash-verified

79// Exports a default cuboid brush with its texture fitted 1x1 to a temporary path
80// using the format for the given game type. Returns the exported map text.
81std::string exportDefaultBrushUsingFormat(const std::string& gameType, const std::string& exportPath)
82{
83 auto brush = algorithm::createCuboidBrush(GlobalMapModule().findOrInsertWorldspawn(),
84 AABB(Vector3(0, 0, 0), Vector3(64, 128, 256)), "textures/darkmod/numbers/1");
85
86 for (auto i = 0; i < Node_getIBrush(brush)->getNumFaces(); ++i)
87 {
88 Node_getIBrush(brush)->getFace(i).fitTexture(1, 1);;
89 }
90
91 auto format = GlobalMapFormatManager().getMapFormatForGameType(gameType, os::getExtension(exportPath));
92
93 EXPECT_FALSE(fs::exists(exportPath)) << "File already exists";
94
95 FileSelectionHelper helper(exportPath, format);
96 GlobalCommandSystem().executeCommand("ExportMap");
97
98 EXPECT_TRUE(fs::exists(exportPath)) << "File still doesn't exist";
99
100 return algorithm::loadFileToString(exportPath);
101}
102
103TEST_F(MapExportTest, exportDoom3Brush)
104{

Callers 1

TEST_FFunction · 0.85

Calls 10

createCuboidBrushFunction · 0.85
Node_getIBrushFunction · 0.85
getExtensionFunction · 0.85
loadFileToStringFunction · 0.85
AABBClass · 0.50
getNumFacesMethod · 0.45
fitTextureMethod · 0.45
getFaceMethod · 0.45
executeCommandMethod · 0.45

Tested by

no test coverage detected