Add option for skipping tests that require an attached display

This commit is contained in:
Chris Thrasher 2022-12-26 22:30:18 -06:00
parent b128fcd3df
commit 84f56d0936
4 changed files with 20 additions and 3 deletions

View File

@ -48,9 +48,9 @@ jobs:
- platform: { name: Android, os: ubuntu-latest }
config: { name: x86_64, flags: -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
- platform: { name: Linux GCC, os: ubuntu-latest }
config: { name: Static DRM, flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE }
config: { name: Static DRM, flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
- platform: { name: Linux GCC, os: ubuntu-latest }
config: { name: Shared DRM, flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE }
config: { name: Shared DRM, flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
steps:
- name: Checkout Code
uses: actions/checkout@v3

View File

@ -49,6 +49,14 @@ target_compile_definitions(test-sfml-system PRIVATE
EXPECTED_SFML_VERSION_IS_RELEASE=$<IF:$<BOOL:${VERSION_IS_RELEASE}>,true,false>
)
# FIXME Remove this once the Buildbot supports handling display tests on Linux platforms
if(SFML_OS_WINDOWS OR SFML_OS_MACOSX)
set(SFML_RUN_DISPLAY_TESTS_DEFAULT ON)
else()
set(SFML_RUN_DISPLAY_TESTS_DEFAULT OFF)
endif()
sfml_set_option(SFML_RUN_DISPLAY_TESTS ${SFML_RUN_DISPLAY_TESTS_DEFAULT} BOOL "TRUE to run tests that require a display, FALSE to ignore it")
set(WINDOW_SRC
Window/Context.test.cpp
Window/ContextSettings.test.cpp
@ -88,6 +96,9 @@ set(GRAPHICS_SRC
Graphics/View.test.cpp
)
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics)
if(SFML_RUN_DISPLAY_TESTS)
target_compile_definitions(test-sfml-graphics PRIVATE SFML_RUN_DISPLAY_TESTS)
endif()
set(NETWORK_SRC
Network/Ftp.test.cpp

View File

@ -12,7 +12,7 @@ static_assert(!std::is_nothrow_move_constructible_v<sf::Texture>);
static_assert(std::is_move_assignable_v<sf::Texture>);
static_assert(!std::is_nothrow_move_assignable_v<sf::Texture>);
TEST_CASE("[Graphics] sf::Texture")
TEST_CASE("[Graphics] sf::Texture" * doctest::skip(skipDisplayTests))
{
SUBCASE("Construction")
{

View File

@ -11,6 +11,12 @@
#include <iomanip>
#include <limits>
#ifdef SFML_RUN_DISPLAY_TESTS
static constexpr bool skipDisplayTests = false;
#else
static constexpr bool skipDisplayTests = true;
#endif
namespace sf
{
struct BlendMode;