SFML/test/Window/Vulkan.test.cpp

29 lines
903 B
C++
Raw Permalink Normal View History

2023-09-25 07:34:31 +08:00
#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());
}
}
}