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:
@@ -228,8 +228,9 @@ Bitmap::Bitmap(const Bitmap& other)
|
||||
if (active_ && !data_.empty()) {
|
||||
surface_ = Arena::Get().AllocateSurface(width_, height_, depth_,
|
||||
GetSnesPixelFormat(BitmapFormat::kIndexed));
|
||||
if (surface_) {
|
||||
surface_->pixels = pixel_data_;
|
||||
if (surface_ && surface_->pixels) {
|
||||
memcpy(surface_->pixels, pixel_data_,
|
||||
std::min(data_.size(), static_cast<size_t>(surface_->h * surface_->pitch)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,14 +346,24 @@ void Bitmap::Create(int width, int height, int depth, int format,
|
||||
active_ = false;
|
||||
return;
|
||||
}
|
||||
surface_->pixels = pixel_data_;
|
||||
|
||||
// Copy our data into the surface's pixel buffer instead of pointing to external data
|
||||
if (surface_->pixels && data_.size() > 0) {
|
||||
memcpy(surface_->pixels, pixel_data_,
|
||||
std::min(data_.size(), static_cast<size_t>(surface_->h * surface_->pitch)));
|
||||
}
|
||||
active_ = true;
|
||||
}
|
||||
|
||||
void Bitmap::Reformat(int format) {
|
||||
surface_ = Arena::Get().AllocateSurface(width_, height_, depth_,
|
||||
GetSnesPixelFormat(format));
|
||||
surface_->pixels = pixel_data_;
|
||||
|
||||
// Copy our data into the surface's pixel buffer
|
||||
if (surface_ && surface_->pixels && data_.size() > 0) {
|
||||
memcpy(surface_->pixels, pixel_data_,
|
||||
std::min(data_.size(), static_cast<size_t>(surface_->h * surface_->pitch)));
|
||||
}
|
||||
active_ = true;
|
||||
SetPalette(palette_);
|
||||
}
|
||||
@@ -362,7 +373,13 @@ void Bitmap::UpdateTexture(SDL_Renderer *renderer) {
|
||||
CreateTexture(renderer);
|
||||
return;
|
||||
}
|
||||
memcpy(surface_->pixels, data_.data(), data_.size());
|
||||
|
||||
// Ensure surface pixels are synchronized with our data
|
||||
if (surface_ && surface_->pixels && data_.size() > 0) {
|
||||
memcpy(surface_->pixels, data_.data(),
|
||||
std::min(data_.size(), static_cast<size_t>(surface_->h * surface_->pitch)));
|
||||
}
|
||||
|
||||
Arena::Get().UpdateTexture(texture_, surface_);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user