#include "mock_window.h" #include namespace mirage::render::vulkan::test { auto mock_window::create(const create_info& info) -> std::expected { // In headless mode, we don't create a real window if (info.headless) { return mock_window(info.width, info.height, true, nullptr); } // For non-headless mode, we would need platform-specific window creation // For now, we'll just create a mock with nullptr handle // In a real implementation, this would use GLFW or platform APIs return mock_window(info.width, info.height, false, nullptr); } mock_window::mock_window(uint32_t width, uint32_t height, bool headless, void* native_handle) : width_(width), height_(height), headless_(headless), native_handle_(native_handle) { } mock_window::~mock_window() { // Cleanup would happen here // In headless mode, nothing to clean up // In window mode, would destroy platform window } mock_window::mock_window(mock_window&& other) noexcept : width_(other.width_) , height_(other.height_) , headless_(other.headless_) , native_handle_(other.native_handle_) { other.width_ = 0; other.height_ = 0; other.headless_ = false; other.native_handle_ = nullptr; } mock_window& mock_window::operator=(mock_window&& other) noexcept { if (this != &other) { width_ = other.width_; height_ = other.height_; headless_ = other.headless_; native_handle_ = other.native_handle_; other.width_ = 0; other.height_ = 0; other.headless_ = false; other.native_handle_ = nullptr; } return *this; } auto mock_window::create_surface(vk::Instance instance) -> expected { if (headless_) { // In headless mode, we can't create a real surface // Tests should skip surface-dependent operations when headless return std::unexpected(vk::Result::eErrorInitializationFailed); } // For non-headless mode, would create platform-specific surface // This is a simplified implementation for testing // Real implementation would use vkCreateWin32SurfaceKHR, vkCreateXlibSurfaceKHR, etc. // Return an error for now since we don't have real window implementation return std::unexpected(vk::Result::eErrorFeatureNotPresent); } } // namespace mirage::render::vulkan::test