Renamed enum color to colors.

Added enum colors conversion to rgb struct.
Added colors_test.cpp.

Removed print_colored.
Renamed enum colors back to color.

Removed unnecessary inline keyword.
Removed print_rgb.
This commit is contained in:
Remotion
2018-06-09 00:33:39 +02:00
committed by Victor Zverovich
parent 0508bbc7ae
commit ce500635c7
5 changed files with 237 additions and 243 deletions
+8
View File
@@ -5,6 +5,7 @@
//
// For the license information refer to format.h.
#define FMT_EXTENDED_COLORS
#define FMT_NOEXCEPT
#undef FMT_SHARED
#include "test-assert.h"
@@ -116,3 +117,10 @@ TEST(FormatTest, FormatErrorCode) {
EXPECT_EQ(msg, to_string(buffer));
}
}
TEST(ColorsTest, Colors) {
EXPECT_WRITE(stdout, fmt::print(fmt::rgb(255,20,30), "rgb(255,20,30)"),
"\x1b[38;2;255;020;030mrgb(255,20,30)\x1b[0m");
EXPECT_WRITE(stdout, fmt::print(fmt::color::blue,"blue"),
"\x1b[38;2;000;000;255mblue\x1b[0m");
}
-7
View File
@@ -1266,13 +1266,6 @@ TEST(FormatTest, Print) {
#endif
}
#if FMT_USE_FILE_DESCRIPTORS
TEST(FormatTest, PrintColored) {
EXPECT_WRITE(stdout, fmt::print_colored(fmt::red, "Hello, {}!\n", "world"),
"\x1b[31mHello, world!\n\x1b[0m");
}
#endif
TEST(FormatTest, Variadic) {
EXPECT_EQ("abc1", format("{}c{}", "ab", 1));
EXPECT_EQ(L"abc1", format(L"{}c{}", L"ab", 1));