Skip to content

Commit

Permalink
#4900: Add material file with a couple of test materials. The third o…
Browse files Browse the repository at this point in the history
…ne is lacking whitespace between name and opening brace.
  • Loading branch information
codereader committed Jan 23, 2021
1 parent 38294b3 commit 2e114d6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/Materials.cpp
Expand Up @@ -37,4 +37,15 @@ TEST_F(MaterialsTest, MaterialFileInfo)
EXPECT_EQ(hiddenTex2->getShaderFileInfo().visibility, vfs::Visibility::HIDDEN);
}

TEST_F(MaterialsTest, MaterialParser)
{
auto& materialManager = GlobalMaterialManager();

// All of these materials need to be present
// variant3 lacks whitespace between its name and {, which caused trouble in #4900
EXPECT_TRUE(materialManager.materialExists("textures/parsing_test/variant1"));
EXPECT_TRUE(materialManager.materialExists("textures/parsing_test/variant2"));
EXPECT_TRUE(materialManager.materialExists("textures/parsing_test/variant3"));
}

}
13 changes: 13 additions & 0 deletions test/resources/tdm/materials/parsing_test.mtr
@@ -0,0 +1,13 @@
textures/parsing_test/variant1
{
diffusemap _white
}

textures/parsing_test/variant2 {
diffusemap _white
}

// No space between name and curly brace
textures/parsing_test/variant3{
diffusemap _white
}

0 comments on commit 2e114d6

Please sign in to comment.