Refactor colour handling to prepare for per-reporter colour modes

This includes always compiling the ANSI and None colour
implementations, as they don't need to touch any platform
specific APIs, and removing their respective compile-time
configuration options.

Because the Win32 colour implementation requires Win32-specific
APIs, it is still hidden behind a compile-time toggle,
`CATCH_CONFIG_COLOUR_WIN32` (renamed from `..._COLOUR_WINDOWS`).

The commandline options for colours were also changed. The
option now uses different name, and allows to select between
different implementations, rather than changing whether
the compiled-in colour implementation is used through
"yes/no/default" options.
This commit is contained in:
Martin Hořeňovský
2022-03-27 23:35:41 +02:00
parent a4e4e82474
commit 1a8a793178
27 changed files with 292 additions and 203 deletions

View File

@@ -116,7 +116,6 @@
#ifdef __OS400__
# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
# define CATCH_CONFIG_COLOUR_NONE
#endif
////////////////////////////////////////////////////////////////////////////////
@@ -164,7 +163,7 @@
// Universal Windows platform does not support SEH
// Or console colours (or console at all...)
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
# define CATCH_CONFIG_COLOUR_NONE
# define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32
# else
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
# endif
@@ -206,7 +205,7 @@
#if defined(UNDER_RTSS) || defined(RTX64_BUILD)
#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
#define CATCH_INTERNAL_CONFIG_NO_ASYNC
#define CATCH_CONFIG_COLOUR_NONE
#define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32
#endif
#if !defined(_GLIBCXX_USE_C99_MATH_TR1)
@@ -358,4 +357,12 @@
#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#endif
#if defined( CATCH_PLATFORM_WINDOWS ) && \
!defined( CATCH_CONFIG_COLOUR_WIN32 ) && \
!defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) && \
!defined( CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 )
# define CATCH_CONFIG_COLOUR_WIN32
#endif
#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED