Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/interfaces
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-03-27 23:35:41 +0200
committerMartin Hořeňovský2022-03-28 13:10:13 +0200
commit1a8a793178d50b74b0f9a0adb3eec937b61039a9 (patch)
tree2a8cadf3fa4478f1a11548485a4a0389d4920d2d /src/catch2/interfaces
parenta4e4e82474f894d56cbe86e13a2d23bb1b46744d (diff)
downloadcatch3-1a8a793178d50b74b0f9a0adb3eec937b61039a9.tar.gz
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.
Diffstat (limited to 'src/catch2/interfaces')
-rw-r--r--src/catch2/interfaces/catch_interfaces_config.hpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_config.hpp b/src/catch2/interfaces/catch_interfaces_config.hpp
index d98f7b44..fb3b2977 100644
--- a/src/catch2/interfaces/catch_interfaces_config.hpp
+++ b/src/catch2/interfaces/catch_interfaces_config.hpp
@@ -42,10 +42,15 @@ namespace Catch {
LexicographicallySorted,
Randomized
};
- enum class UseColour {
- Auto,
- Yes,
- No
+ enum class ColourMode : std::uint8_t {
+ //! Let Catch2 pick implementation based on platform detection
+ PlatformDefault,
+ //! Use ANSI colour code escapes
+ ANSI,
+ //! Use Win32 console colour API
+ Win32,
+ //! Don't use any colour
+ None
};
struct WaitForKeypress { enum When {
Never,
@@ -79,7 +84,7 @@ namespace Catch {
virtual uint32_t rngSeed() const = 0;
virtual unsigned int shardCount() const = 0;
virtual unsigned int shardIndex() const = 0;
- virtual UseColour useColour() const = 0;
+ virtual ColourMode colourMode() const = 0;
virtual std::vector<std::string> const& getSectionsToRun() const = 0;
virtual Verbosity verbosity() const = 0;