VulkanSurface
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
/*********************************************************************
|
||||
* \file VulkanSurface.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date September 2026
|
||||
*********************************************************************/
|
||||
#include <GraphicsVulkan/VulkanSurface.hpp>
|
||||
|
||||
#include <GraphicsVulkan/VulkanInstance.hpp>
|
||||
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#ifdef BIGFOOT_WINDOWS
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#elif defined BIGFOOT_LINUX
|
||||
#define GLFW_EXPOSE_NATIVE_X11
|
||||
#endif
|
||||
#include <GLFW/glfw3native.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot::Vulkan
|
||||
{
|
||||
class VulkanSurfaceFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
ASSERT_EQ(glfwInit(), GLFW_TRUE);
|
||||
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
m_window = glfwCreateWindow(64, 64, "VulkanSurfaceTests", nullptr, nullptr);
|
||||
ASSERT_NE(m_window, nullptr);
|
||||
|
||||
#ifdef BIGFOOT_WINDOWS
|
||||
m_surfaceCreateInfo.m_windowHandle = glfwGetWin32Window(m_window);
|
||||
m_surfaceCreateInfo.m_windowInstance = GetModuleHandle(nullptr);
|
||||
#elif defined BIGFOOT_LINUX
|
||||
m_surfaceCreateInfo.m_display = glfwGetX11Display();
|
||||
m_surfaceCreateInfo.m_window = glfwGetX11Window(m_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
glfwDestroyWindow(m_window);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
VulkanInstance m_instance {"VulkanSurfaceTests", Version {1, 0, 0}};
|
||||
GLFWwindow* m_window = nullptr;
|
||||
SurfaceCreateInfo m_surfaceCreateInfo;
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(VulkanSurfaceFixture, Constructor_ShouldCreateAValidSurface)
|
||||
{
|
||||
const VulkanSurface surface {m_instance, m_surfaceCreateInfo};
|
||||
|
||||
EXPECT_TRUE(surface.GetHandle());
|
||||
}
|
||||
} // namespace Bigfoot::Vulkan
|
||||
Reference in New Issue
Block a user