Add tests for sf::Vulkan

This commit is contained in:
Chris Thrasher 2023-09-24 17:34:31 -06:00
parent f40d5ac21d
commit 3750074238
2 changed files with 29 additions and 0 deletions

View File

@ -69,6 +69,7 @@ set(WINDOW_SRC
Window/Joystick.test.cpp Window/Joystick.test.cpp
Window/Keyboard.test.cpp Window/Keyboard.test.cpp
Window/VideoMode.test.cpp Window/VideoMode.test.cpp
Window/Vulkan.test.cpp
Window/Window.test.cpp Window/Window.test.cpp
Window/WindowBase.test.cpp Window/WindowBase.test.cpp
) )

View File

@ -0,0 +1,28 @@
#include <SFML/Window/Vulkan.hpp>
#include <catch2/catch_test_macros.hpp>
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());
}
}
}