Add extensive tests for animation, input handling, and map rendering

- Enhanced animation archive tests to validate frame metadata and start frame selection logic.
- Introduced new tests for entity dispatch entry handling, including key event queuing and processing.
- Added tests for fixed map item interactions, including glob egg hatching and item movement.
- Expanded flex archive tests to cover teleport egg spawning and usecode event selection.
- Implemented isometric controls tests to verify directional key handling and animation state changes.
- Improved map renderer tests to ensure correct rendering of map previews and collision detection.
This commit is contained in:
Maddo 2026-09-27 11:48:14 +02:00
commit e757bb33d0
20 changed files with 1247 additions and 142 deletions

View file

@ -100,6 +100,29 @@ int main()
assert(stand.has_value() && stand->frameCount > 0);
assert(walk.has_value() && walk->frameCount == 17);
assert(run.has_value() && run->frameCount == 12);
for (const remorse::AnimationClip* clip : {&*walk, &*run}) {
assert(clip->header[1] == 5);
for (remorse::u8 direction = 0; direction < 16; ++direction) {
for (remorse::u8 frame = 1; frame < clip->frameCount; ++frame) {
const auto metadata = remorse::getAnimationFrame(*clip, direction, frame);
assert(metadata && (metadata->bytes[5] & 2) != 0);
}
}
}
auto startClip = *walk;
startClip.header[1] = 1;
assert(remorse::selectAnimationStartFrame(startClip, false, false, true, true, 0) == 8);
assert(remorse::selectAnimationStartFrame(startClip, true, false, true, true, 0) == 0);
startClip.header[1] = 5;
assert(remorse::selectAnimationStartFrame(startClip, true, false, true, true, 0) == 16);
startClip.header[1] = 4;
assert(remorse::selectAnimationStartFrame(startClip, false, false, true, true, 0) == 0);
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 0) == 1);
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 3) == 2);
assert(remorse::selectAnimationStartFrame(startClip, false, true, false, false, 0) == 2);
assert(remorse::selectAnimationStartFrame(startClip, false, true, false, true, 2) == 2);
startClip.header[1] = 0;
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 0) == 0);
assert(remorse::getAnimationFrame(*walk, 0, 0).has_value());
assert(remorse::getAnimationFrame(*run, 15, 11).has_value());
for (remorse::u8 direction : {remorse::u8{6}, remorse::u8{7}, remorse::u8{10}, remorse::u8{11}}) {