armor_renderer_test.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include "render/equipment/armor/armor_heavy_carthage.h"
  2. #include "render/equipment/armor/armor_light_carthage.h"
  3. #include "render/equipment/armor/roman_armor.h"
  4. #include "render/equipment/armor/tunic_renderer.h"
  5. #include "render/equipment/equipment_registry.h"
  6. #include "render/humanoid/rig.h"
  7. #include <gtest/gtest.h>
  8. #include <memory>
  9. using namespace Render::GL;
  10. class ArmorRendererTest : public ::testing::Test {
  11. protected:
  12. void SetUp() override {
  13. register_built_in_equipment();
  14. registry = &EquipmentRegistry::instance();
  15. }
  16. EquipmentRegistry *registry = nullptr;
  17. };
  18. TEST_F(ArmorRendererTest, RomanHeavyArmorRegistered) {
  19. auto armor = registry->get(EquipmentCategory::Armor, "roman_heavy_armor");
  20. ASSERT_NE(armor, nullptr);
  21. }
  22. TEST_F(ArmorRendererTest, RomanLightArmorRegistered) {
  23. auto armor = registry->get(EquipmentCategory::Armor, "roman_light_armor");
  24. ASSERT_NE(armor, nullptr);
  25. }
  26. // Test new separate Carthaginian archer armor files
  27. TEST_F(ArmorRendererTest, ArmorLightCarthageRegistered) {
  28. auto armor = registry->get(EquipmentCategory::Armor, "armor_light_carthage");
  29. ASSERT_NE(armor, nullptr);
  30. }
  31. TEST_F(ArmorRendererTest, ArmorHeavyCarthageRegistered) {
  32. auto armor = registry->get(EquipmentCategory::Armor, "armor_heavy_carthage");
  33. ASSERT_NE(armor, nullptr);
  34. }
  35. // Verify both new armor variants share the same helmet
  36. TEST_F(ArmorRendererTest, CarthageArcherArmorSharesHelmet) {
  37. auto light_armor =
  38. registry->get(EquipmentCategory::Armor, "armor_light_carthage");
  39. auto heavy_armor =
  40. registry->get(EquipmentCategory::Armor, "armor_heavy_carthage");
  41. auto shared_helmet =
  42. registry->get(EquipmentCategory::Helmet, "carthage_light");
  43. ASSERT_NE(light_armor, nullptr);
  44. ASSERT_NE(heavy_armor, nullptr);
  45. ASSERT_NE(shared_helmet, nullptr);
  46. }
  47. TEST_F(ArmorRendererTest, TunicRendererCreation) {
  48. TunicConfig config;
  49. config.torso_scale = 1.1F;
  50. config.include_pauldrons = true;
  51. config.include_gorget = true;
  52. config.include_belt = true;
  53. auto tunic = std::make_shared<TunicRenderer>(config);
  54. ASSERT_NE(tunic, nullptr);
  55. }
  56. TEST_F(ArmorRendererTest, ArmorCategoryIsDistinct) {
  57. auto helmet = registry->get(EquipmentCategory::Helmet, "roman_heavy");
  58. auto armor = registry->get(EquipmentCategory::Armor, "roman_heavy_armor");
  59. auto weapon = registry->get(EquipmentCategory::Weapon, "bow");
  60. ASSERT_NE(helmet, nullptr);
  61. ASSERT_NE(armor, nullptr);
  62. ASSERT_NE(weapon, nullptr);
  63. EXPECT_FALSE(registry->has(EquipmentCategory::Armor, "roman_heavy"));
  64. EXPECT_FALSE(registry->has(EquipmentCategory::Helmet, "roman_heavy_armor"));
  65. }