mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 04:07:10 +01:00 
			
		
		
		
	Use SecondaryText code in lists
This commit is contained in:
		| @@ -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 { | ||||
|      | ||||
|   | ||||
| @@ -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 = "    ..."; | ||||
|                     std::cout << 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; | ||||
|   | ||||
| @@ -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" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash