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

@@ -64,10 +64,7 @@ TEST_CASE( "The default listing implementation write to provided stream",
{ "fake test name"_catch_sr, "[fakeTestTag]"_catch_sr },
{ "fake-file.cpp", 123456789 } };
std::vector<Catch::TestCaseHandle> tests({ {&fakeInfo, nullptr} });
Catch::ConfigData cd;
cd.useColour = Catch::UseColour::No;
Catch::Config conf(cd);
auto colour = Catch::makeColourImpl( &conf, &sstream);
auto colour = Catch::makeColourImpl( Catch::ColourMode::None, &sstream);
Catch::defaultListTests(sstream.stream(), colour.get(), tests, false, Catch::Verbosity::Normal);
auto listingString = sstream.str();