25 #ifndef WTERMINALCOLOR_TEST_H
26 #define WTERMINALCOLOR_TEST_H
32 #include <cxxtest/TestSuite.h>
34 #include "../WTerminalColor.h"
48 TS_ASSERT_THROWS_NOTHING(
WTerminalColor( WTerminalColor::Bold, WTerminalColor::FGRed, WTerminalColor::BGNone ) );
57 TS_ASSERT_THROWS_NOTHING( c =
WTerminalColor( WTerminalColor::Bold, WTerminalColor::FGRed, WTerminalColor::BGGreen ) );
60 std::ostringstream ss;
61 #if defined( __linux__ ) || defined( __APPLE__ )
63 ss << cStart <<
"[" << 1 <<
";" << 31 <<
";" << 42 <<
"m";
75 TS_ASSERT_THROWS_NOTHING( c =
WTerminalColor( WTerminalColor::Bold, WTerminalColor::FGRed, WTerminalColor::BGGreen ) );
78 std::ostringstream ss;
79 #if defined( __linux__ ) || defined( __APPLE__ )
81 ss << cStart <<
"[0m";
93 TS_ASSERT_THROWS_NOTHING( c =
WTerminalColor( WTerminalColor::Bold, WTerminalColor::FGRed, WTerminalColor::BGGreen ) );
void testColorControlString(void)
Test control string generated by class.
void testColorDisabled(void)
Test whether the class returns empty control strings when colors are disabled.
void testColorResetControlString(void)
Test control string (reset) generated by class.
void testInstantiation(void)
An instantiation should never throw an exception.
Helper class to provide a convenient way to colorize output on the console.
void setEnabled(bool enabled)
With this you can easily trigger whether the color control string is used or if "" is returned.
std::string m_colorString
The string actually containing the control sequence to enable colors on the console.
std::string m_colorResetString
Control sequence to reset color.