Enhance CMake configuration for UI tests and SDL2 linking

- Added support for UI tests in the CMake configuration by introducing the YAZE_ENABLE_UI_TESTS option, ensuring proper linking with the ImGuiTestEngine if available.
- Updated SDL2 linking in test CMakeLists to use variable targets for improved flexibility and compatibility across platforms.
- Modified sprite_position_test to check for ROM file existence using std::ifstream for better error handling.
This commit is contained in:
scawful
2025-09-26 12:06:39 -04:00
parent 6bfecb475e
commit 9b43c2b4e4
4 changed files with 16 additions and 9 deletions

View File

@@ -72,7 +72,7 @@ target_include_directories(
target_link_libraries(
extract_vanilla_values
SDL2::SDL2
${SDL_TARGETS}
asar-static
${ABSL_TARGETS}
${PNG_LIBRARIES}
@@ -97,7 +97,7 @@ target_include_directories(
target_link_libraries(
yaze_test
SDL2::SDL2
${SDL_TARGETS}
asar-static
${ABSL_TARGETS}
${PNG_LIBRARIES}

View File

@@ -2,6 +2,7 @@
#include <memory>
#include <iostream>
#include <iomanip>
#include <fstream>
#include "app/rom.h"
#include "app/zelda3/overworld/overworld.h"
@@ -18,7 +19,8 @@ protected:
std::string rom_path = "bin/zelda3.sfc";
// Check if ROM exists in build directory
if (std::filesystem::exists(rom_path)) {
std::ifstream rom_file(rom_path);
if (rom_file.good()) {
ASSERT_TRUE(rom_->LoadFromFile(rom_path).ok()) << "Failed to load ROM from " << rom_path;
} else {
// Skip test if ROM not found