summaryrefslogtreecommitdiff
path: root/tests/unit/gui/test-gui-color.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-11 11:54:16 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-11 14:05:52 +0200
commit32b01a606c3ecf64b05b139c52fedc52cb00c7ab (patch)
tree4540a5850513983f2532c81c74c7c24a6bf1c9b6 /tests/unit/gui/test-gui-color.cpp
parenta456c3db86141bc107cdf7c050b5c5b5c8c5ef2f (diff)
downloadweechat-32b01a606c3ecf64b05b139c52fedc52cb00c7ab.zip
core: fix conversion of WeeChat "default" color to ANSI color
Diffstat (limited to 'tests/unit/gui/test-gui-color.cpp')
-rw-r--r--tests/unit/gui/test-gui-color.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/gui/test-gui-color.cpp b/tests/unit/gui/test-gui-color.cpp
index 40e98393e..d2f618429 100644
--- a/tests/unit/gui/test-gui-color.cpp
+++ b/tests/unit/gui/test-gui-color.cpp
@@ -791,6 +791,12 @@ TEST(GuiColor, EncodeAnsi)
gui_color_get_custom ("-underline"));
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[4m" "underline" "\x1B[24m" "_end", string);
+ /* text color: WeeChat: "default" -> ANSI: 39 (default fg color) */
+ snprintf (string, sizeof (string),
+ "test_" "%s" "default",
+ gui_color_get_custom ("default"));
+ WEE_CHECK_ENCODE_ANSI("test_" "\x1B[39m" "default", string);
+
/* text color */
snprintf (string, sizeof (string),
"test_" "%s" "blue",
@@ -809,6 +815,12 @@ TEST(GuiColor, EncodeAnsi)
gui_color_get_custom ("214"));
WEE_CHECK_ENCODE_ANSI("test_" "\x1B[38;5;214m" "214", string);
+ /* background color: WeeChat: "default" -> ANSI: 49 (default bg color) */
+ snprintf (string, sizeof (string),
+ "test_" "%s" "bg_default",
+ gui_color_get_custom (",default"));
+ WEE_CHECK_ENCODE_ANSI("test_" "\x1B[49m" "bg_default", string);
+
/* background color */
snprintf (string, sizeof (string),
"test_" "%s" "bg_red",