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

Function checkBehaviourCancellingMapChange

test/MapSavingLoading.cpp:1379–1400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379void 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
1402void openMapFromArchive(const radiant::TestContext& context)
1403{

Callers 1

TEST_FFunction · 0.85

Calls 4

createCubicBrushFunction · 0.85
executeCommandMethod · 0.45
isModifiedMethod · 0.45
messageReceivedMethod · 0.45

Tested by

no test coverage detected