Refactor test structure and enhance object encoding tests

- Updated CMakeLists.txt to correct file paths for unit tests.
- Modified DungeonObjectRenderingE2ETests to inherit from BoundRomTest for better ROM management.
- Enhanced DungeonEditorIntegrationTest with improved mock ROM handling and added graphics data setup.
- Introduced a new MockRom class with methods for setting mock data and initializing memory layout.
- Added comprehensive unit tests for RoomObject encoding and decoding, covering all object types and edge cases.
- Refactored DungeonObjectRenderingTests to utilize BoundRomTest, ensuring consistent ROM loading and setup.
- Improved assertions in rendering tests for better clarity and reliability.
This commit is contained in:
scawful
2025-10-04 13:37:52 -04:00
parent 6990e565b8
commit 20a406892c
12 changed files with 1261 additions and 469 deletions

View File

@@ -29,6 +29,7 @@
#include "app/rom.h"
#include "app/zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h"
#include "test_utils.h"
namespace yaze {
namespace test {
@@ -37,12 +38,13 @@ namespace test {
* @class DungeonObjectRenderingE2ETests
* @brief Comprehensive E2E test fixture for dungeon object rendering system
*/
class DungeonObjectRenderingE2ETests : public ::testing::Test {
class DungeonObjectRenderingE2ETests : public TestRomManager::BoundRomTest {
protected:
void SetUp() override {
BoundRomTest::SetUp();
// Initialize test environment
rom_ = std::make_shared<Rom>();
ASSERT_TRUE(rom_->LoadFromFile("zelda3.sfc").ok());
rom_ = std::shared_ptr<Rom>(rom(), [](Rom*) {});
dungeon_editor_ = std::make_unique<editor::DungeonEditor>();
dungeon_editor_->SetRom(rom_);
@@ -69,6 +71,7 @@ class DungeonObjectRenderingE2ETests : public ::testing::Test {
}
dungeon_editor_.reset();
rom_.reset();
BoundRomTest::TearDown();
}
void RegisterAllTests();