From d99aea47d459d4e42959275757e3bb84f7b805e1 Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 28 Nov 2020 03:45:50 +0100 Subject: [PATCH] #5108: Add test case loading a map without info file --- test/MapSavingLoading.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/MapSavingLoading.cpp b/test/MapSavingLoading.cpp index 373eac228b..2a90da8701 100644 --- a/test/MapSavingLoading.cpp +++ b/test/MapSavingLoading.cpp @@ -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(); @@ -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); @@ -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");