mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 23:06:38 +02:00
tests: split strings with colors for readability
This commit is contained in:
+118
-118
@@ -394,7 +394,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* reset */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreset",
|
||||
"test_" "%s" "reset",
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_DECODE("test_reset", string, NULL);
|
||||
WEE_CHECK_DECODE("test_reset", string, "");
|
||||
@@ -402,7 +402,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* resetcolor */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sresetcolor",
|
||||
"test_" "%s" "resetcolor",
|
||||
gui_color_get_custom ("resetcolor"));
|
||||
WEE_CHECK_DECODE("test_resetcolor", string, NULL);
|
||||
WEE_CHECK_DECODE("test_resetcolor", string, "");
|
||||
@@ -410,7 +410,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* emphasis */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%semphasis",
|
||||
"test_" "%s" "emphasis",
|
||||
gui_color_get_custom ("emphasis"));
|
||||
WEE_CHECK_DECODE("test_emphasis", string, NULL);
|
||||
WEE_CHECK_DECODE("test_emphasis", string, "");
|
||||
@@ -418,7 +418,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* blink */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblink%s_end",
|
||||
"test_" "%s" "blink%s_end",
|
||||
gui_color_get_custom ("blink"),
|
||||
gui_color_get_custom ("-blink"));
|
||||
WEE_CHECK_DECODE("test_blink_end", string, NULL);
|
||||
@@ -427,7 +427,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* dim */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sdim%s_end",
|
||||
"test_" "%s" "dim" "%s" "_end",
|
||||
gui_color_get_custom ("dim"),
|
||||
gui_color_get_custom ("-dim"));
|
||||
WEE_CHECK_DECODE("test_dim_end", string, NULL);
|
||||
@@ -436,7 +436,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bold */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbold%s_end",
|
||||
"test_" "%s" "bold" "%s" "_end",
|
||||
gui_color_get_custom ("bold"),
|
||||
gui_color_get_custom ("-bold"));
|
||||
WEE_CHECK_DECODE("test_bold_end", string, NULL);
|
||||
@@ -445,7 +445,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* reverse */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreverse%s_end",
|
||||
"test_" "%s" "reverse" "%s" "_end",
|
||||
gui_color_get_custom ("reverse"),
|
||||
gui_color_get_custom ("-reverse"));
|
||||
WEE_CHECK_DECODE("test_reverse_end", string, NULL);
|
||||
@@ -454,7 +454,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* italic */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sitalic%s_end",
|
||||
"test_" "%s" "italic" "%s" "_end",
|
||||
gui_color_get_custom ("italic"),
|
||||
gui_color_get_custom ("-italic"));
|
||||
WEE_CHECK_DECODE("test_italic_end", string, NULL);
|
||||
@@ -463,7 +463,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* underline */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sunderline%s_end",
|
||||
"test_" "%s" "underline" "%s" "_end",
|
||||
gui_color_get_custom ("underline"),
|
||||
gui_color_get_custom ("-underline"));
|
||||
WEE_CHECK_DECODE("test_underline_end", string, NULL);
|
||||
@@ -472,7 +472,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bar_fg */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbar_fg",
|
||||
"test_" "%s" "bar_fg",
|
||||
gui_color_get_custom ("bar_fg"));
|
||||
WEE_CHECK_DECODE("test_bar_fg", string, NULL);
|
||||
WEE_CHECK_DECODE("test_bar_fg", string, "");
|
||||
@@ -480,7 +480,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bar_delim */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbar_delim",
|
||||
"test_" "%s" "bar_delim",
|
||||
gui_color_get_custom ("bar_delim"));
|
||||
WEE_CHECK_DECODE("test_bar_delim", string, NULL);
|
||||
WEE_CHECK_DECODE("test_bar_delim", string, "");
|
||||
@@ -488,7 +488,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bar_bg */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbar_bg",
|
||||
"test_" "%s" "bar_bg",
|
||||
gui_color_get_custom ("bar_bg"));
|
||||
WEE_CHECK_DECODE("test_bar_bg", string, NULL);
|
||||
WEE_CHECK_DECODE("test_bar_bg", string, "");
|
||||
@@ -496,7 +496,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* fg color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblue",
|
||||
"test_" "%s" "blue",
|
||||
gui_color_get_custom ("blue"));
|
||||
WEE_CHECK_DECODE("test_blue", string, NULL);
|
||||
WEE_CHECK_DECODE("test_blue", string, "");
|
||||
@@ -504,7 +504,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bg color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblue",
|
||||
"test_" "%s" "blue",
|
||||
gui_color_get_custom (",blue"));
|
||||
WEE_CHECK_DECODE("test_blue", string, NULL);
|
||||
WEE_CHECK_DECODE("test_blue", string, "");
|
||||
@@ -512,7 +512,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* fg+bg color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%syellow_blue",
|
||||
"test_" "%s" "yellow_blue",
|
||||
gui_color_get_custom ("yellow,blue"));
|
||||
WEE_CHECK_DECODE("test_yellow_blue", string, NULL);
|
||||
WEE_CHECK_DECODE("test_yellow_blue", string, "");
|
||||
@@ -520,7 +520,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* fg terminal color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s214",
|
||||
"test_" "%s" "214",
|
||||
gui_color_get_custom ("214"));
|
||||
WEE_CHECK_DECODE("test_214", string, NULL);
|
||||
WEE_CHECK_DECODE("test_214", string, "");
|
||||
@@ -528,7 +528,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* bg terminal color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s,214",
|
||||
"test_" "%s" ",214",
|
||||
gui_color_get_custom (",214"));
|
||||
WEE_CHECK_DECODE("test_,214", string, NULL);
|
||||
WEE_CHECK_DECODE("test_,214", string, "");
|
||||
@@ -536,7 +536,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* fg+bg terminal color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s227,240",
|
||||
"test_" "%s" "227,240",
|
||||
gui_color_get_custom ("227,240"));
|
||||
WEE_CHECK_DECODE("test_227,240", string, NULL);
|
||||
WEE_CHECK_DECODE("test_227,240", string, "");
|
||||
@@ -544,7 +544,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* fg terminal color + bg color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s227,blue",
|
||||
"test_" "%s" "227,blue",
|
||||
gui_color_get_custom ("227,blue"));
|
||||
WEE_CHECK_DECODE("test_227,blue", string, NULL);
|
||||
WEE_CHECK_DECODE("test_227,blue", string, "");
|
||||
@@ -552,7 +552,7 @@ TEST(GuiColor, Decode)
|
||||
|
||||
/* WeeChat color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%soption_weechat.color.chat_host",
|
||||
"test_" "%s" "option_weechat.color.chat_host",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_HOST));
|
||||
WEE_CHECK_DECODE("test_option_weechat.color.chat_host", string, NULL);
|
||||
WEE_CHECK_DECODE("test_option_weechat.color.chat_host", string, "");
|
||||
@@ -579,155 +579,155 @@ TEST(GuiColor, DecodeAnsi)
|
||||
WEE_CHECK_DECODE_ANSI("test string", "test string", 1);
|
||||
|
||||
/* invalid ANSI color */
|
||||
WEE_CHECK_DECODE_ANSI("test_invalid", "test_\x1B[12zinvalid", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_invalid", "test_\x1B[12zinvalid", 1);
|
||||
WEE_CHECK_DECODE_ANSI("test_invalid", "test_" "\x1B[12z" "invalid", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_invalid", "test_\x1B[12z" "invalid", 1);
|
||||
|
||||
/* reset */
|
||||
WEE_CHECK_DECODE_ANSI("test_reset", "test_\x1B[mreset", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_reset", "test_" "\x1B[m" "reset", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[mreset", 1);
|
||||
"test_" "%s" "reset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[m" "reset", 1);
|
||||
|
||||
/* reset with 0 */
|
||||
WEE_CHECK_DECODE_ANSI("test_reset", "test_\x1B[0mreset", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_reset", "test_" "\x1B[0m" "reset", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[0mreset", 1);
|
||||
"test_" "%s" "reset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[0m" "reset", 1);
|
||||
|
||||
/* blink */
|
||||
WEE_CHECK_DECODE_ANSI("test_blink_end", "test_\x1B[5mblink\x1B[25m_end", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_blink_end", "test_" "\x1B[5m" "blink" "\x1B[25m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblink%s_end",
|
||||
"test_" "%s" "blink" "%s" "_end",
|
||||
gui_color_get_custom ("blink"),
|
||||
gui_color_get_custom ("-blink"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[5mblink\x1B[25m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[5m" "blink" "\x1B[25m" "_end", 1);
|
||||
|
||||
/* dim */
|
||||
WEE_CHECK_DECODE_ANSI("test_dim_end", "test_\x1B[2mdim\x1B[22m_end", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_dim_end", "test_" "\x1B[2m" "dim" "\x1B[22m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sdim%s_end",
|
||||
"test_" "%s" "dim" "%s" "_end",
|
||||
gui_color_get_custom ("dim"),
|
||||
gui_color_get_custom ("-dim"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[2mdim\x1B[22m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[2m" "dim" "\x1B[22m" "_end", 1);
|
||||
|
||||
/* bold */
|
||||
WEE_CHECK_DECODE_ANSI("test_bold_end", "test_\x1B[1mbold\x1B[21m_end", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_bold_end", "test_" "\x1B[1m" "bold" "\x1B[21m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbold%s_end",
|
||||
"test_" "%s" "bold" "%s" "_end",
|
||||
gui_color_get_custom ("bold"),
|
||||
gui_color_get_custom ("-bold"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[1mbold\x1B[21m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[1m" "bold" "\x1B[21m" "_end", 1);
|
||||
|
||||
/* reverse */
|
||||
WEE_CHECK_DECODE_ANSI("test_reverse_end",
|
||||
"test_\x1B[7mreverse\x1B[27m_end", 0);
|
||||
"test_" "\x1B[7m" "reverse" "\x1B[27m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreverse%s_end",
|
||||
"test_" "%s" "reverse" "%s" "_end",
|
||||
gui_color_get_custom ("reverse"),
|
||||
gui_color_get_custom ("-reverse"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[7mreverse\x1B[27m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[7m" "reverse" "\x1B[27m" "_end", 1);
|
||||
|
||||
/* italic */
|
||||
WEE_CHECK_DECODE_ANSI("test_italic_end",
|
||||
"test_\x1B[3mitalic\x1B[23m_end", 0);
|
||||
"test_" "\x1B[3m" "italic" "\x1B[23m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sitalic%s_end",
|
||||
"test_" "%s" "italic" "%s" "_end",
|
||||
gui_color_get_custom ("italic"),
|
||||
gui_color_get_custom ("-italic"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[3mitalic\x1B[23m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[3m" "italic" "\x1B[23m" "_end", 1);
|
||||
|
||||
/* underline */
|
||||
WEE_CHECK_DECODE_ANSI("test_underline_end",
|
||||
"test_\x1B[4munderline\x1B[24m_end", 0);
|
||||
"test_" "\x1B[4m" "underline" "\x1B[24m" "_end", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sunderline%s_end",
|
||||
"test_" "%s" "underline" "%s" "_end",
|
||||
gui_color_get_custom ("underline"),
|
||||
gui_color_get_custom ("-underline"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[4munderline\x1B[24m_end", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[4m" "underline" "\x1B[24m" "_end", 1);
|
||||
|
||||
/* default text color */
|
||||
WEE_CHECK_DECODE_ANSI("test_default", "test_\x1B[39mdefault", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_default", "test_" "\x1B[39m" "default", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sdefault",
|
||||
"test_" "%s" "default",
|
||||
gui_color_get_custom ("default"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[39mdefault", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[39m" "default", 1);
|
||||
|
||||
/* default text color */
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_default", "test_\x1B[49mbg_default", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_default", "test_" "\x1B[49m" "bg_default", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_default",
|
||||
"test_" "%s" "bg_default",
|
||||
gui_color_get_custom (",default"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[49mbg_default", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[49m" "bg_default", 1);
|
||||
|
||||
/* text color */
|
||||
WEE_CHECK_DECODE_ANSI("test_blue", "test_\x1B[34mblue", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_blue", "test_" "\x1B[34m" "blue", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblue",
|
||||
"test_" "%s" "blue",
|
||||
gui_color_get_custom ("|blue"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[34mblue", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[34m" "blue", 1);
|
||||
|
||||
/* bright text color */
|
||||
WEE_CHECK_DECODE_ANSI("test_lightgreen", "test_\x1B[92mlightgreen", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_lightgreen", "test_" "\x1B[92m" "lightgreen", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%slightgreen",
|
||||
"test_" "%s" "lightgreen",
|
||||
gui_color_get_custom ("|lightgreen"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[92mlightgreen", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[92m" "lightgreen", 1);
|
||||
|
||||
/* text terminal color */
|
||||
WEE_CHECK_DECODE_ANSI("test_214", "test_\x1B[38;5;214m214", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_214", "test_" "\x1B[38;5;214m" "214", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s214",
|
||||
"test_" "%s" "214",
|
||||
gui_color_get_custom ("|214"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[38;5;214m214", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[38;5;214m" "214", 1);
|
||||
|
||||
/* text RGB color */
|
||||
WEE_CHECK_DECODE_ANSI("test_13", "test_\x1B[38;2;255;0;255m13", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_13", "test_" "\x1B[38;2;255;0;255m" "13", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s13",
|
||||
"test_" "%s" "13",
|
||||
gui_color_get_custom ("|13"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[38;2;255;0;255m13", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[38;2;255;0;255m" "13", 1);
|
||||
|
||||
/* background color */
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_red", "test_\x1B[41mbg_red", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_red", "test_" "\x1B[41m" "bg_red", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_red",
|
||||
"test_" "%s" "bg_red",
|
||||
gui_color_get_custom ("|,red"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[41mbg_red", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[41m" "bg_red", 1);
|
||||
|
||||
/* bright background color */
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_lightgreen",
|
||||
"test_\x1B[102mbg_lightgreen", 0);
|
||||
"test_" "\x1B[102m" "bg_lightgreen", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_lightgreen",
|
||||
"test_" "%s" "bg_lightgreen",
|
||||
gui_color_get_custom ("|,lightgreen"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[102mbg_lightgreen", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[102m" "bg_lightgreen", 1);
|
||||
|
||||
/* background terminal color */
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_240", "test_\x1B[48;5;214mbg_240", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_240", "test_" "\x1B[48;5;214m" "bg_240", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_240",
|
||||
"test_" "%s" "bg_240",
|
||||
gui_color_get_custom ("|,240"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[48;5;240mbg_240", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[48;5;240m" "bg_240", 1);
|
||||
|
||||
/* background RGB color */
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_13", "test_\x1B[48;2;255;0;255mbg_13", 0);
|
||||
WEE_CHECK_DECODE_ANSI("test_bg_13", "test_" "\x1B[48;2;255;0;255m" "bg_13", 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_13",
|
||||
"test_" "%s" "bg_13",
|
||||
gui_color_get_custom ("|,13"));
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[48;2;255;0;255mbg_13", 1);
|
||||
WEE_CHECK_DECODE_ANSI(string, "test_" "\x1B[48;2;255;0;255m" "bg_13", 1);
|
||||
|
||||
/* text RGB + background RGB color */
|
||||
WEE_CHECK_DECODE_ANSI(
|
||||
"test_fg_13_bg_04",
|
||||
"test_\x1B[38;2;255;0;255m\x1B[48;2;0;0;128mfg_13_bg_04",
|
||||
"test_" "\x1B[38;2;255;0;255m" "\x1B[48;2;0;0;128m" "fg_13_bg_04",
|
||||
0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s%sfg_13_bg_04",
|
||||
"test_" "%s" "%s" "fg_13_bg_04",
|
||||
gui_color_get_custom ("|13"),
|
||||
gui_color_get_custom ("|,04"));
|
||||
WEE_CHECK_DECODE_ANSI(
|
||||
string,
|
||||
"test_\x1B[38;2;255;0;255m\x1B[48;2;0;0;128mfg_13_bg_04",
|
||||
"test_\x1B[38;2;255;0;255m" "\x1B[48;2;0;0;128m" "fg_13_bg_04",
|
||||
1);
|
||||
}
|
||||
|
||||
@@ -746,120 +746,120 @@ TEST(GuiColor, EncodeAnsi)
|
||||
|
||||
/* reset */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[0mreset", string);
|
||||
"test_" "%s" "reset", gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[0m" "reset", string);
|
||||
|
||||
/* blink */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblink%s_end",
|
||||
"test_" "%s" "blink" "%s" "_end",
|
||||
gui_color_get_custom ("blink"),
|
||||
gui_color_get_custom ("-blink"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[5mblink\x1B[25m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[5m" "blink" "\x1B[25m" "_end", string);
|
||||
|
||||
/* dim */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sdim%s_end",
|
||||
"test_" "%s" "dim" "%s" "_end",
|
||||
gui_color_get_custom ("dim"),
|
||||
gui_color_get_custom ("-dim"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[2mdim\x1B[22m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[2m" "dim" "\x1B[22m" "_end", string);
|
||||
|
||||
/* bold */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbold%s_end",
|
||||
"test_" "%s" "bold" "%s" "_end",
|
||||
gui_color_get_custom ("bold"),
|
||||
gui_color_get_custom ("-bold"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[1mbold\x1B[21m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[1m" "bold" "\x1B[21m" "_end", string);
|
||||
|
||||
/* reverse */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sreverse%s_end",
|
||||
"test_" "%s" "reverse" "%s" "_end",
|
||||
gui_color_get_custom ("reverse"),
|
||||
gui_color_get_custom ("-reverse"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[7mreverse\x1B[27m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[7m" "reverse" "\x1B[27m" "_end", string);
|
||||
|
||||
/* italic */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sitalic%s_end",
|
||||
"test_" "%s" "italic" "%s" "_end",
|
||||
gui_color_get_custom ("italic"),
|
||||
gui_color_get_custom ("-italic"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[3mitalic\x1B[23m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[3m" "italic" "\x1B[23m" "_end", string);
|
||||
|
||||
/* underline */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sunderline%s_end",
|
||||
"test_" "%s" "underline" "%s" "_end",
|
||||
gui_color_get_custom ("underline"),
|
||||
gui_color_get_custom ("-underline"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[4munderline\x1B[24m_end", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[4m" "underline" "\x1B[24m" "_end", string);
|
||||
|
||||
/* text color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sblue",
|
||||
"test_" "%s" "blue",
|
||||
gui_color_get_custom ("blue"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[34mblue", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[34m" "blue", string);
|
||||
|
||||
/* bright text color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%slightgreen",
|
||||
"test_" "%s" "lightgreen",
|
||||
gui_color_get_custom ("lightgreen"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[92mlightgreen", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[92m" "lightgreen", string);
|
||||
|
||||
/* text terminal color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%s214",
|
||||
"test_" "%s" "214",
|
||||
gui_color_get_custom ("214"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[38;5;214m214", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[38;5;214m" "214", string);
|
||||
|
||||
/* background color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_red",
|
||||
"test_" "%s" "bg_red",
|
||||
gui_color_get_custom (",red"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[41mbg_red", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[41m" "bg_red", string);
|
||||
|
||||
/* bright background color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_lightgreen",
|
||||
"test_" "%s" "bg_lightgreen",
|
||||
gui_color_get_custom (",lightgreen"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[102mbg_lightgreen", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[102m" "bg_lightgreen", string);
|
||||
|
||||
/* background terminal color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sbg_240",
|
||||
"test_" "%s" "bg_240",
|
||||
gui_color_get_custom (",240"));
|
||||
WEE_CHECK_ENCODE_ANSI("test_\x1B[48;5;240mbg_240", string);
|
||||
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[48;5;240m" "bg_240", string);
|
||||
|
||||
/* WeeChat color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%soption_weechat.color.chat_host",
|
||||
"test_" "%s" "option_weechat.color.chat_host",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_HOST));
|
||||
WEE_CHECK_ENCODE_ANSI(
|
||||
"test_\x1B[0m\x1B[38;5;6m\x1B[49m"
|
||||
"test_\x1B[0m" "\x1B[38;5;6m" "\x1B[49m"
|
||||
"option_weechat.color.chat_host",
|
||||
string);
|
||||
|
||||
/* WeeChat bright color */
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%soption_weechat.color.chat_nick",
|
||||
"test_" "%s" "option_weechat.color.chat_nick",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_NICK));
|
||||
WEE_CHECK_ENCODE_ANSI(
|
||||
"test_\x1B[0m\x1B[38;5;14m\x1B[49m"
|
||||
"test_\x1B[0m" "\x1B[38;5;14m" "\x1B[49m"
|
||||
"option_weechat.color.chat_nick",
|
||||
string);
|
||||
|
||||
/* WeeChat color with attributes */
|
||||
config_file_option_set (config_color_chat_host, "_green", 1);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%soption_weechat.color.chat_host",
|
||||
"test_" "%s" "option_weechat.color.chat_host",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_HOST));
|
||||
WEE_CHECK_ENCODE_ANSI(
|
||||
"test_\x1B[0m\x1B[4m\x1B[38;5;2m\x1B[49m"
|
||||
"test_\x1B[0m" "\x1B[4m" "\x1B[38;5;2m" "\x1B[49m"
|
||||
"option_weechat.color.chat_host",
|
||||
string);
|
||||
config_file_option_reset (config_color_chat_host, 1);
|
||||
|
||||
/* multiple colors/attributes */
|
||||
snprintf (string, sizeof (string),
|
||||
"%shello, %sthis is%s %sblink%s %sdim%s a test %sblue %sreset "
|
||||
"%syellow,red here!",
|
||||
"%s" "hello, " "%s" "this is" "%s %s" "blink" "%s %s" "dim"
|
||||
"%s a test %s" "blue %s" "reset %s" "yellow,red here!",
|
||||
gui_color_get_custom (",blue"),
|
||||
gui_color_get_custom ("bold"),
|
||||
gui_color_get_custom ("-bold"),
|
||||
@@ -871,9 +871,9 @@ TEST(GuiColor, EncodeAnsi)
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("yellow,red"));
|
||||
WEE_CHECK_ENCODE_ANSI(
|
||||
"\x1B[44mhello, \x1B[1mthis is\x1B[21m \x1B[5mblink\x1B[25m "
|
||||
"\x1B[2mdim\x1B[22m a test \x1B[34mblue \x1B[0mreset "
|
||||
"\x1B[93m\x1B[41myellow,red here!",
|
||||
"\x1B[44m" "hello, \x1B[1m" "this is" "\x1B[21m \x1B[5m" "blink"
|
||||
"\x1B[25m \x1B[2m" "dim" "\x1B[22m a test \x1B[34m" "blue \x1B[0m"
|
||||
"reset \x1B[93m" "\x1B[41m" "yellow,red here!",
|
||||
string);
|
||||
}
|
||||
|
||||
@@ -894,12 +894,12 @@ TEST(GuiColor, Emphasize)
|
||||
|
||||
/* build strings for tests */
|
||||
snprintf (string1, sizeof (string1),
|
||||
"%shello, %sthis is%s a test here!",
|
||||
"%s" "hello, %s" "this is" "%s a test here!",
|
||||
gui_color_get_custom (",blue"),
|
||||
gui_color_get_custom ("bold"),
|
||||
gui_color_get_custom ("bold"));
|
||||
snprintf (string2, sizeof (string2),
|
||||
"%shello, %s%sthis is%s a test%s here!",
|
||||
"%s" "hello, %s%s" "this is" "%s a test" "%s here!",
|
||||
gui_color_get_custom (",blue"),
|
||||
gui_color_get_custom ("emphasis"),
|
||||
gui_color_get_custom ("bold"),
|
||||
|
||||
Reference in New Issue
Block a user