Use SecondaryText code in lists

This commit is contained in:
Phil Nash 2013-03-29 21:55:19 +00:00
parent c7e602f3f2
commit 2a17ef9081
3 changed files with 31 additions and 10 deletions

View File

@ -90,6 +90,7 @@ namespace {
const char* Cyan = "[0;36m";
const char* Yellow = "[0;33m";
const char* LightGrey = "[0;37m";
// const char* DarkGrey = "[1;30m";
struct AnsiConsoleColourCodes : IConsoleColourCodes {

View File

@ -10,6 +10,7 @@
#include "catch_commandline.hpp"
#include "catch_line_wrap.h"
#include "catch_console_colour.hpp"
#include <limits>
#include <algorithm>
@ -63,17 +64,31 @@ namespace Catch {
tagsWrapper.setRight( maxTagLen ).wrap( it->getTestCaseInfo().tagsAsString );
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
TextColour::Colours colour = TextColour::None;
if( it->getTestCaseInfo().isHidden )
colour = TextColour::SecondaryText;
std::string nameCol;
if( i < nameWrapper.size() )
if( i < nameWrapper.size() ) {
nameCol = nameWrapper[i];
else
}
else {
nameCol = " ...";
colour = TextColour::SecondaryText;
}
{
TextColour colourGuard( colour );
std::cout << nameCol;
}
if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
if( i == 0 )
std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " " << tagsWrapper[i];
else
std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " " << tagsWrapper[i];
if( i == 0 ) {
TextColour colourGuard( TextColour::SecondaryText );
std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " ";
}
else {
std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " ";
}
std::cout << tagsWrapper[i];
}
std::cout << "\n";
}
@ -124,10 +139,14 @@ namespace Catch {
wrapper.setIndent(2).setRight( maxTagLen ).wrap( countIt->first );
std::cout << wrapper;
std::size_t dots = 2;
if( maxTagLen > wrapper.last().size() )
std::cout << std::string( maxTagLen - wrapper.last().size(), '.' );
std::cout << ".. "
<< countIt->second
dots += maxTagLen - wrapper.last().size();
{
TextColour colourGuard( TextColour::SecondaryText );
std::cout << std::string( dots, '.' );
}
std::cout << countIt->second
<< "\n";
}
std::cout << pluralise( tagCounts.size(), "tag" ) << std::endl;

View File

@ -253,6 +253,7 @@ namespace Catch {
}
void lazyPrintRunInfo() {
stream << "\n" << getTildes() << "\n";
TextColour colour( TextColour::SecondaryText );
stream << testRunInfo->name
<< " is a CATCH v" << libraryVersion.majorVersion << "."
<< libraryVersion.minorVersion << " b"