Enhance testing framework and UI integration for YAZE
- Added a comprehensive testing framework with support for unit, integration, and UI tests, improving overall test coverage and reliability. - Integrated ImGui Test Engine for UI testing, allowing for real-time feedback and visualization of test results. - Updated CMake configuration to conditionally include testing components based on build options, enhancing flexibility for developers. - Introduced a new command in the CLI for running asset loading tests on ROMs, providing a straightforward way to validate functionality. - Enhanced error handling and resource management during testing, ensuring stability and clarity in test execution. - Improved user interface with a dedicated test dashboard for monitoring test progress and results, enhancing developer experience.
This commit is contained in:
@@ -18,7 +18,21 @@ Arena::Arena() {
|
||||
}
|
||||
|
||||
Arena::~Arena() {
|
||||
// Safely clear all resources with proper error checking
|
||||
for (auto& [key, texture] : textures_) {
|
||||
// Don't rely on unique_ptr deleter during shutdown - manually manage
|
||||
if (texture && key) {
|
||||
[[maybe_unused]] auto* released = texture.release(); // Release ownership to prevent double deletion
|
||||
}
|
||||
}
|
||||
textures_.clear();
|
||||
|
||||
for (auto& [key, surface] : surfaces_) {
|
||||
// Don't rely on unique_ptr deleter during shutdown - manually manage
|
||||
if (surface && key) {
|
||||
[[maybe_unused]] auto* released = surface.release(); // Release ownership to prevent double deletion
|
||||
}
|
||||
}
|
||||
surfaces_.clear();
|
||||
}
|
||||
|
||||
@@ -56,6 +70,16 @@ void Arena::FreeTexture(SDL_Texture* texture) {
|
||||
}
|
||||
}
|
||||
|
||||
void Arena::Shutdown() {
|
||||
// Clear all resources safely - let the unique_ptr deleters handle the cleanup
|
||||
// while SDL context is still available
|
||||
|
||||
// Just clear the containers - the unique_ptr destructors will handle SDL cleanup
|
||||
// This avoids double-free issues from manual destruction
|
||||
textures_.clear();
|
||||
surfaces_.clear();
|
||||
}
|
||||
|
||||
void Arena::UpdateTexture(SDL_Texture* texture, SDL_Surface* surface) {
|
||||
if (!texture || !surface) {
|
||||
SDL_Log("Invalid texture or surface passed to UpdateTexture");
|
||||
@@ -104,6 +128,7 @@ SDL_Surface* Arena::AllocateSurface(int width, int height, int depth,
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
||||
void Arena::FreeSurface(SDL_Surface* surface) {
|
||||
if (!surface) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user