Add comprehensive tests for collision detection, entity dispatch, file system, isometric controls, map rendering, and sorting
- Implemented collision tests to verify overlap and movement logic for collision bodies. - Enhanced entity dispatch entry tests to cover initialization, group ID management, and process handling. - Expanded file system tests to include crash diagnostics and ensure proper game data root detection. - Created isometric controls tests to validate movement requests and screen projection calculations. - Added map renderer tests to check fixed map loading and rendering functionality. - Introduced map sorter tests to confirm correct rendering order for various items.
This commit is contained in:
parent
8907604b84
commit
202679f857
27 changed files with 3530 additions and 81 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "remorse/file_system.h"
|
||||
#include "remorse/fixed_map.h"
|
||||
#include "remorse/map_renderer.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <filesystem>
|
||||
|
||||
|
|
@ -21,5 +23,33 @@ int main()
|
|||
assert(!image->pixels.empty());
|
||||
assert(image->decodedItemCount > 0);
|
||||
assert(image->paintedItemCount > 0);
|
||||
|
||||
const auto fixedPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "FIXED.DAT");
|
||||
assert(fixedPath.has_value());
|
||||
const auto archive = remorse::loadFixedMapArchive(*fixedPath);
|
||||
assert(archive.has_value());
|
||||
const auto fixedMap = remorse::loadFixedMap(*archive, options.mapIndex);
|
||||
assert(fixedMap.has_value());
|
||||
remorse::s32 minX = fixedMap->entries.front().x;
|
||||
remorse::s32 minY = fixedMap->entries.front().y;
|
||||
remorse::s32 maxX = minX;
|
||||
remorse::s32 maxY = minY;
|
||||
for (const remorse::FixedMapEntry& entry : fixedMap->entries) {
|
||||
minX = std::min(minX, static_cast<remorse::s32>(entry.x));
|
||||
minY = std::min(minY, static_cast<remorse::s32>(entry.y));
|
||||
maxX = std::max(maxX, static_cast<remorse::s32>(entry.x));
|
||||
maxY = std::max(maxY, static_cast<remorse::s32>(entry.y));
|
||||
}
|
||||
options.maxWidth = 1280;
|
||||
options.maxHeight = 760;
|
||||
options.viewCenter = remorse::WorldPoint{(minX + maxX) / 2, (minY + maxY) / 2, 0};
|
||||
const auto centeredImage = remorse::renderMapPreview(*root, options);
|
||||
assert(centeredImage.has_value());
|
||||
assert(centeredImage->paintedItemCount > 0);
|
||||
assert(centeredImage->width == options.maxWidth);
|
||||
assert(centeredImage->height == options.maxHeight);
|
||||
const remorse::ScreenPoint center = remorse::projectToScreen(*options.viewCenter);
|
||||
assert(centeredImage->sourceLeft == center.x - static_cast<remorse::s32>(options.maxWidth / 2));
|
||||
assert(centeredImage->sourceTop == center.y - static_cast<remorse::s32>(options.maxHeight / 2));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue