Navigation Menu

Skip to content

Commit

Permalink
#5108: Add test case loading a map without info file
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 28, 2020
1 parent c3a01d0 commit d99aea4
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/MapSavingLoading.cpp
Expand Up @@ -141,7 +141,8 @@ TEST_F(MapLoadingTest, openMapWithEmptyStringAsksForPath)
GlobalRadiantCore().getMessageBus().removeListener(msgSubscription);
}

void checkAltarScene()
// Checks the main map info (brushes, entities, spawnargs), no layers or grouping
void checkAltarSceneGeometry()
{
auto root = GlobalMapModule().getRoot();
auto worldspawn = GlobalMapModule().findOrInsertWorldspawn();
Expand Down Expand Up @@ -184,6 +185,14 @@ void checkAltarScene()
auto religiousSymbol = Node_getEntity(algorithm::getEntityByName(root, "religious_symbol_1"));
EXPECT_EQ(religiousSymbol->getKeyValue("classname"), "altar_moveable_loot_religious_symbol");
EXPECT_EQ(religiousSymbol->getKeyValue("origin"), "-0.0448253 12.0322 -177");
}

// Check entire map including geometry, entities, layers, groups
void checkAltarScene()
{
checkAltarSceneGeometry();

auto root = GlobalMapModule().getRoot();

// Check layers
EXPECT_TRUE(root->getLayerManager().getLayerID("Default") != -1);
Expand Down Expand Up @@ -293,6 +302,19 @@ TEST_F(MapLoadingTest, openWithInvalidPathInsideMod)
EXPECT_FALSE(algorithm::getEntityByName(GlobalMapModule().getRoot(), "world"));
}

TEST_F(MapLoadingTest, openMapWithoutInfoFile)
{
auto tempPath = createMapCopyInTempDataPath("altar.map", "altar_openMapWithoutInfoFile.map");

fs::remove(fs::path(tempPath).replace_extension("darkradiant"));

EXPECT_FALSE(os::fileOrDirExists(fs::path(tempPath).replace_extension("darkradiant")));

GlobalCommandSystem().executeCommand("OpenMap", tempPath.string());

checkAltarSceneGeometry();
}

TEST_F(MapSavingTest, saveMapWithoutModification)
{
auto tempPath = createMapCopyInTempDataPath("altar.map", "altar_saveMapWithoutModification.map");
Expand Down

0 comments on commit d99aea4

Please sign in to comment.