mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-19 19:25:38 +02:00
@@ -31,7 +31,7 @@ namespace Catch { namespace Detail {
|
||||
|
||||
namespace Catch {
|
||||
namespace {
|
||||
|
||||
|
||||
class Win32ColourImpl : public Detail::IColourImpl {
|
||||
public:
|
||||
Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )
|
||||
@@ -61,7 +61,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void setTextAttribute( WORD _textAttribute ) {
|
||||
SetConsoleTextAttribute( stdoutHandle, _textAttribute );
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace {
|
||||
inline bool shouldUseColourForPlatform() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Win32ColourImpl platformColourImpl;
|
||||
|
||||
} // end anon namespace
|
||||
@@ -106,11 +106,11 @@ namespace {
|
||||
case Colour::BrightRed: return setColour( "[1;31m" );
|
||||
case Colour::BrightGreen: return setColour( "[1;32m" );
|
||||
case Colour::BrightWhite: return setColour( "[1;37m" );
|
||||
|
||||
|
||||
case Colour::Bright: throw std::logic_error( "not a colour" );
|
||||
}
|
||||
}
|
||||
private:
|
||||
private:
|
||||
void setColour( const char* _escapeCode ) {
|
||||
std::cout << '\033' << _escapeCode;
|
||||
}
|
||||
@@ -119,9 +119,9 @@ namespace {
|
||||
inline bool shouldUseColourForPlatform() {
|
||||
return isatty( fileno(stdout) );
|
||||
}
|
||||
|
||||
|
||||
PosixColourImpl platformColourImpl;
|
||||
|
||||
|
||||
} // end anon namespace
|
||||
} // end namespace Catch
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Catch {
|
||||
struct NoColourImpl : Detail::IColourImpl {
|
||||
void use( Colour::Code ) {}
|
||||
};
|
||||
NoColourImpl noColourImpl;
|
||||
NoColourImpl noColourImpl;
|
||||
static const bool shouldUseColour = shouldUseColourForPlatform() &&
|
||||
!isDebuggerActive();
|
||||
}
|
||||
|
Reference in New Issue
Block a user