Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#5546: add passing test for entity attribute inheritance
Confirm that an entity class can inherit attributes from its parent class
(there is already a test for inheritance of spawnargs on an actual entity).
  • Loading branch information
Matthew Mott committed Feb 24, 2021
1 parent 39d5000 commit aeffec9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Entity.cpp
Expand Up @@ -82,6 +82,24 @@ TEST_F(EntityTest, LightEntitiesRecognisedAsLights)
EXPECT_FALSE(brazier->isLight());
}

TEST_F(EntityTest, EntityClassInheritsAttributes)
{
auto cls = GlobalEntityClassManager().findClass("light_extinguishable");
ASSERT_TRUE(cls);

// Inherited from 'light'
EXPECT_EQ(cls->getAttribute("editor_color").getValue(), "0 1 0");
EXPECT_EQ(cls->getAttribute("spawnclass").getValue(), "idLight");

// Inherited from 'atdm:light_base'
EXPECT_EQ(cls->getAttribute("AIUse").getValue(), "AIUSE_LIGHTSOURCE");
EXPECT_EQ(cls->getAttribute("shouldBeOn").getValue(), "0");

// Inherited but overridden on 'light_extinguishable' itself
EXPECT_EQ(cls->getAttribute("editor_displayFolder").getValue(),
"Lights/Base Entities, DoNotUse");
}

TEST_F(EntityTest, CannotCreateEntityWithoutClass)
{
// Creating with a null entity class should throw an exception
Expand Down

0 comments on commit aeffec9

Please sign in to comment.