| 1377 | } |
| 1378 | |
| 1379 | void checkBehaviourCancellingMapChange(const std::string& fullMapPath, std::function<void()> action) |
| 1380 | { |
| 1381 | GlobalCommandSystem().executeCommand("OpenMap", fullMapPath); |
| 1382 | |
| 1383 | auto sizeBefore = fs::file_size(fullMapPath); |
| 1384 | |
| 1385 | // Create a brush to mark the map as modified |
| 1386 | algorithm::createCubicBrush(GlobalMapModule().findOrInsertWorldspawn()); |
| 1387 | EXPECT_TRUE(GlobalMapModule().isModified()) << "Map was not marked as modified after brush creation"; |
| 1388 | |
| 1389 | // Discard the changes |
| 1390 | FileSaveConfirmationHelper helper(radiant::FileSaveConfirmation::Action::Cancel); |
| 1391 | |
| 1392 | // Creating a new map must ask for save, since the file has been changed |
| 1393 | GlobalCommandSystem().executeCommand("NewMap"); |
| 1394 | |
| 1395 | // We should still have the map loaded |
| 1396 | EXPECT_TRUE(GlobalMapModule().isModified()) << "Map was not marked as modified after brush creation"; |
| 1397 | |
| 1398 | EXPECT_TRUE(helper.messageReceived()) << "Map must ask for save"; |
| 1399 | EXPECT_EQ(fs::file_size(fullMapPath), sizeBefore) << "File size has changed after discarding"; |
| 1400 | } |
| 1401 | |
| 1402 | void openMapFromArchive(const radiant::TestContext& context) |
| 1403 | { |
no test coverage detected