From 1e04ff1a9e7f62c4ff4fdb9bd4b045f6b8c3d2d0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:12:21 +0000 Subject: [PATCH] Add enhanced tests for InventoryComponent skill slot assignment Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com> --- .../dComponentsTests/InventoryComponentTests.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp index e34d0f07..88fb084b 100644 --- a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp @@ -3,6 +3,8 @@ #include "InventoryComponent.h" #include "BehaviorSlot.h" +#include "Entity.h" +#include "eItemType.h" class InventoryComponentTest : public GameDependenciesTest { protected: @@ -30,4 +32,16 @@ TEST_F(InventoryComponentTest, FindBehaviorSlotByEquipLocationTest) { EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation(""), BehaviorSlot::Invalid); EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("root"), BehaviorSlot::Invalid); EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("leftHand"), BehaviorSlot::Invalid); +} + +/** + * Test that the original FindBehaviorSlot by itemType still works correctly + */ +TEST_F(InventoryComponentTest, FindBehaviorSlotByItemTypeTest) { + // Test that the original method still works for backward compatibility scenarios + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(eItemType::HAT), BehaviorSlot::Head); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(eItemType::NECK), BehaviorSlot::Neck); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(eItemType::LEFT_HAND), BehaviorSlot::Offhand); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(eItemType::RIGHT_HAND), BehaviorSlot::Primary); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(eItemType::CONSUMABLE), BehaviorSlot::Consumable); } \ No newline at end of file