| 289 | { |
| 290 | |
| 291 | void 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 |
no test coverage detected