diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9322d61f0..0a88cf991 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -69,6 +69,7 @@ set(WINDOW_SRC Window/Joystick.test.cpp Window/Keyboard.test.cpp Window/VideoMode.test.cpp + Window/Vulkan.test.cpp Window/Window.test.cpp Window/WindowBase.test.cpp ) diff --git a/test/Window/Vulkan.test.cpp b/test/Window/Vulkan.test.cpp new file mode 100644 index 000000000..e6593296b --- /dev/null +++ b/test/Window/Vulkan.test.cpp @@ -0,0 +1,28 @@ +#include + +#include + +TEST_CASE("[Window] sf::Vulkan") +{ + SECTION("getFunction()") + { + CHECK(sf::Vulkan::getFunction("") == nullptr); + CHECK(sf::Vulkan::getFunction(" ") == nullptr); + CHECK(sf::Vulkan::getFunction("a string that will never resolve to a Vulkan function") == nullptr); + + CHECKED_IF(sf::Vulkan::isAvailable()) + { + CHECK(sf::Vulkan::getFunction("vkCreateInstance") != nullptr); + } + } + + SECTION("getGraphicsRequiredInstanceExtensions()") + { + // If Vulkan is not available this function may or may not return a non-empty vector + // If Vulkan is available then it will always return a non-empty vector + CHECKED_IF(sf::Vulkan::isAvailable()) + { + CHECK(!sf::Vulkan::getGraphicsRequiredInstanceExtensions().empty()); + } + } +}