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

Function runExportWithEmptyFileExtension

test/MapExport.cpp:291–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289{
290
291void runExportWithEmptyFileExtension(const std::string& temporaryDataPath,const std::string& command)
292{
293 auto brush = algorithm::createCuboidBrush(GlobalMapModule().findOrInsertWorldspawn(),
294 AABB(Vector3(0, 0, 0), Vector3(64, 128, 256)), "textures/darkmod/numbers/1");
295
296 Node_setSelected(brush, true);
297
298 fs::path tempPath = temporaryDataPath;
299 tempPath /= "export_empty_file_extension";
300 EXPECT_FALSE(fs::exists(tempPath)) << "File already exists";
301
302 // Subscribe to the event asking for the target path
303 auto msgSubscription = GlobalRadiantCore().getMessageBus().addListener(
304 radiant::IMessage::Type::FileSelectionRequest,
305 radiant::TypeListener<radiant::FileSelectionRequest>(
306 [&](radiant::FileSelectionRequest& msg)
307 {
308 msg.setHandled(true);
309 msg.setResult(radiant::FileSelectionRequest::Result
310 {
311 tempPath.string(),
312 "" // this can happen if e.g. the *.* filter is active
313 });
314 }));
315 GlobalCommandSystem().executeCommand(command);
316
317 EXPECT_TRUE(fs::exists(tempPath)) << "File still doesn't exist";
318
319 auto content = algorithm::loadFileToString(tempPath);
320
321 EXPECT_NE(content.find("brushDef3"), std::string::npos) << "Couldn't find the brush keyword in the export";
322}
323
324}
325

Callers 1

TEST_FFunction · 0.85

Calls 10

createCuboidBrushFunction · 0.85
Node_setSelectedFunction · 0.85
loadFileToStringFunction · 0.85
addListenerMethod · 0.80
setResultMethod · 0.80
stringMethod · 0.80
AABBClass · 0.50
setHandledMethod · 0.45
executeCommandMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected