diff --git a/radiantcore/shaders/Doom3ShaderSystem.cpp b/radiantcore/shaders/Doom3ShaderSystem.cpp index 36771ad72a..28d56fcee5 100644 --- a/radiantcore/shaders/Doom3ShaderSystem.cpp +++ b/radiantcore/shaders/Doom3ShaderSystem.cpp @@ -415,7 +415,6 @@ MaterialPtr Doom3ShaderSystem::copyMaterial(const std::string& nameOfOriginal, c auto material = _library->findShader(candidate); material->setIsModified(); - material->setShaderFileName(""); return material; } diff --git a/test/MaterialExport.cpp b/test/MaterialExport.cpp index cccf4c0705..a2da52f56a 100644 --- a/test/MaterialExport.cpp +++ b/test/MaterialExport.cpp @@ -1215,6 +1215,10 @@ TEST_F(MaterialExportTest, WritingMaterialFiles) // Create a new material, which is definitely not present in the file auto newMaterial = GlobalMaterialManager().copyMaterial("textures/exporttest/renderBumpFlat1", "textures/exporttest/renderBumpX"); + EXPECT_EQ(newMaterial->getShaderFileInfo().name, ""); + EXPECT_EQ(newMaterial->getShaderFileInfo().topDir, ""); + EXPECT_EQ(newMaterial->getShaderFileInfo().visibility, vfs::Visibility::HIDDEN); + newMaterial->setDescription(description); newMaterial->setShaderFileName(exportTestFile.string()); EXPECT_TRUE(newMaterial->isModified()); @@ -1291,7 +1295,7 @@ TEST_F(MaterialExportTest_TdmMissionSetup, ShaderFilePathValidation) EXPECT_THROW(newMaterial->setShaderFileName(tdmPath + "materials/exporttest.mtr2"), std::invalid_argument); // FM setup says this is OK - auto missionPath = tdmPath + MaterialExportTest_TdmMissionSetup::MissionBasePath + "/" + MaterialExportTest_TdmMissionSetup::TestMissionName + "/"; + auto missionPath = getTestMissionPath(); auto wrongMissionPath = tdmPath + MaterialExportTest_TdmMissionSetup::MissionBasePath + "/tork/"; EXPECT_NO_THROW(newMaterial->setShaderFileName(missionPath + "materials/exporttest.mtr")); diff --git a/test/Materials.cpp b/test/Materials.cpp index b233a1e808..e08ef2f9cd 100644 --- a/test/Materials.cpp +++ b/test/Materials.cpp @@ -173,6 +173,8 @@ TEST_F(MaterialsTest, MaterialCopy) EXPECT_EQ(material->getName(), "texures/copytest"); EXPECT_TRUE(materialManager.materialCanBeModified("texures/copytest")); EXPECT_STREQ(material->getShaderFileName(), ""); + EXPECT_EQ(material->getShaderFileInfo().name, ""); + EXPECT_EQ(material->getShaderFileInfo().topDir, ""); // Check signal emission EXPECT_EQ(firedNewName, "texures/copytest"); diff --git a/test/RadiantTest.h b/test/RadiantTest.h index 8604c13c49..8141f8d591 100644 --- a/test/RadiantTest.h +++ b/test/RadiantTest.h @@ -128,7 +128,7 @@ class RadiantTest : /// Override this to perform custom actions after the main module shuts down virtual void postShutdown() {} - ~RadiantTest() + virtual ~RadiantTest() { _coreModule->get()->getLogWriter().detach(_testLogFile.get()); _testLogFile->close(); diff --git a/test/TdmMissionSetup.h b/test/TdmMissionSetup.h index 5372ee3969..15dce108c5 100644 --- a/test/TdmMissionSetup.h +++ b/test/TdmMissionSetup.h @@ -22,7 +22,7 @@ class TdmMissionContext : os::makeDirectory(_projectFolder); } - ~TdmMissionContext() + virtual ~TdmMissionContext() { if (!_projectFolder.empty()) { @@ -68,6 +68,8 @@ class TdmMissionSetup : virtual void TearDown() override { os::removeDirectory(_fmBasePath); + + RadiantTest::TearDown(); } virtual void handleGameConfigMessage(game::ConfigurationNeeded& message) override @@ -76,7 +78,7 @@ class TdmMissionSetup : config.gameType = "The Dark Mod 2.0 (Standalone)"; config.enginePath = _context.getTestProjectPath(); - config.modPath = std::string(MissionBasePath) + "/" + TestMissionName; + config.modPath = getTestMissionPath(); message.setConfig(config); message.setHandled(true); diff --git a/test/TestContext.h b/test/TestContext.h index b8921011bf..4b049f9af5 100644 --- a/test/TestContext.h +++ b/test/TestContext.h @@ -43,7 +43,7 @@ class TestContext : }); } - ~TestContext() + virtual ~TestContext() { if (!_settingsFolder.empty()) { diff --git a/test/WorldspawnColour.cpp b/test/WorldspawnColour.cpp index 10cf5ae5f2..a0227ae289 100644 --- a/test/WorldspawnColour.cpp +++ b/test/WorldspawnColour.cpp @@ -30,7 +30,7 @@ class Quake4TestContext : os::makeDirectory(_projectFolder); } - ~Quake4TestContext() + virtual ~Quake4TestContext() { if (!_projectFolder.empty()) { @@ -57,6 +57,8 @@ class EmptyQuake4Setup : protected: virtual void setupGameFolder() override { + RadiantTest::setupGameFolder(); + // Create the q4base folder os::makeDirectory(_context.getTestProjectPath() + "q4base");