summaryrefslogtreecommitdiff
path: root/tests/unit/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-29 19:31:02 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-29 21:07:04 +0200
commit9cd7fd38a91dc2980e82be49185c1eb20d70c0f9 (patch)
treeaf8a880ae9cf2d4575dbf01ec013505a2c328af9 /tests/unit/gui
parentded599b272e94763a3f5477e43ec32bec7080f0d (diff)
downloadweechat-9cd7fd38a91dc2980e82be49185c1eb20d70c0f9.zip
api: allow to set nicklist group/nick id in functions nicklist_group_set and nicklist_nick_set (issue #2081)
Diffstat (limited to 'tests/unit/gui')
-rw-r--r--tests/unit/gui/test-gui-nicklist.cpp86
1 files changed, 52 insertions, 34 deletions
diff --git a/tests/unit/gui/test-gui-nicklist.cpp b/tests/unit/gui/test-gui-nicklist.cpp
index 8da7d0a01..59869bce6 100644
--- a/tests/unit/gui/test-gui-nicklist.cpp
+++ b/tests/unit/gui/test-gui-nicklist.cpp
@@ -704,28 +704,37 @@ TEST(GuiNicklist, GroupGetPointer)
TEST(GuiNicklist, GroupSet)
{
struct t_gui_buffer *buffer;
- struct t_gui_nick_group *group;
+ struct t_gui_nick_group *group1, *group2;
buffer = gui_buffer_new (NULL, TEST_BUFFER_NAME,
NULL, NULL, NULL,
NULL, NULL, NULL);
CHECK(buffer);
- group = gui_nicklist_add_group (buffer, NULL, "group", "blue", 1);
- CHECK(group);
+ group1 = gui_nicklist_add_group (buffer, NULL, "group1", "blue", 1);
+ CHECK(group1);
+
+ group2 = gui_nicklist_add_group (buffer, NULL, "group2", "magenta", 1);
+ CHECK(group2);
gui_nicklist_group_set (NULL, NULL, NULL, NULL);
gui_nicklist_group_set (buffer, NULL, NULL, NULL);
- gui_nicklist_group_set (buffer, group, NULL, NULL);
- gui_nicklist_group_set (buffer, group, "color", NULL);
- gui_nicklist_group_set (buffer, group, "zzz", "test");
-
- gui_nicklist_group_set (buffer, group, "color", "green");
- STRCMP_EQUAL("green", group->color);
- gui_nicklist_group_set (buffer, group, "color", "");
- STRCMP_EQUAL(NULL, group->color);
- gui_nicklist_group_set (buffer, group, "visible", "0");
- LONGS_EQUAL(0, group->visible);
+ gui_nicklist_group_set (buffer, group1, NULL, NULL);
+ gui_nicklist_group_set (buffer, group1, "color", NULL);
+ gui_nicklist_group_set (buffer, group1, "zzz", "test");
+
+ gui_nicklist_group_set (buffer, group1, "id", "123");
+ CHECK(group1->id == 123);
+ gui_nicklist_group_set (buffer, group2, "id", "123");
+ CHECK(group2->id != 123);
+ gui_nicklist_group_set (buffer, group2, "id", "456");
+ CHECK(group2->id == 456);
+ gui_nicklist_group_set (buffer, group1, "color", "green");
+ STRCMP_EQUAL("green", group1->color);
+ gui_nicklist_group_set (buffer, group1, "color", "");
+ STRCMP_EQUAL(NULL, group1->color);
+ gui_nicklist_group_set (buffer, group1, "visible", "0");
+ LONGS_EQUAL(0, group1->visible);
gui_buffer_close (buffer);
}
@@ -825,36 +834,45 @@ TEST(GuiNicklist, NickGetPointer)
TEST(GuiNicklist, NickSet)
{
struct t_gui_buffer *buffer;
- struct t_gui_nick *nick;
+ struct t_gui_nick *nick1, *nick2;
buffer = gui_buffer_new (NULL, TEST_BUFFER_NAME,
NULL, NULL, NULL,
NULL, NULL, NULL);
CHECK(buffer);
- nick = gui_nicklist_add_nick (buffer, NULL, "nick", "green", "@", "lightgreen", 1);
- CHECK(nick);
+ nick1 = gui_nicklist_add_nick (buffer, NULL, "nick1", "green", "@", "lightgreen", 1);
+ CHECK(nick1);
+
+ nick2 = gui_nicklist_add_nick (buffer, NULL, "nick2", "cyan", "+", "lightcyan", 1);
+ CHECK(nick2);
gui_nicklist_nick_set (NULL, NULL, NULL, NULL);
gui_nicklist_nick_set (buffer, NULL, NULL, NULL);
- gui_nicklist_nick_set (buffer, nick, NULL, NULL);
- gui_nicklist_nick_set (buffer, nick, "color", NULL);
- gui_nicklist_nick_set (buffer, nick, "zzz", "test");
-
- gui_nicklist_nick_set (buffer, nick, "color", "red");
- STRCMP_EQUAL("red", nick->color);
- gui_nicklist_nick_set (buffer, nick, "color", "");
- STRCMP_EQUAL(NULL, nick->color);
- gui_nicklist_nick_set (buffer, nick, "prefix", "+");
- STRCMP_EQUAL("+", nick->prefix);
- gui_nicklist_nick_set (buffer, nick, "prefix", "");
- STRCMP_EQUAL(NULL, nick->prefix);
- gui_nicklist_nick_set (buffer, nick, "prefix_color", "lightred");
- STRCMP_EQUAL("lightred", nick->prefix_color);
- gui_nicklist_nick_set (buffer, nick, "prefix_color", "");
- STRCMP_EQUAL(NULL, nick->prefix_color);
- gui_nicklist_nick_set (buffer, nick, "visible", "0");
- LONGS_EQUAL(0, nick->visible);
+ gui_nicklist_nick_set (buffer, nick1, NULL, NULL);
+ gui_nicklist_nick_set (buffer, nick1, "color", NULL);
+ gui_nicklist_nick_set (buffer, nick1, "zzz", "test");
+
+ gui_nicklist_nick_set (buffer, nick1, "id", "123");
+ CHECK(nick1->id == 123);
+ gui_nicklist_nick_set (buffer, nick2, "id", "123");
+ CHECK(nick2->id != 123);
+ gui_nicklist_nick_set (buffer, nick2, "id", "456");
+ CHECK(nick2->id == 456);
+ gui_nicklist_nick_set (buffer, nick1, "color", "red");
+ STRCMP_EQUAL("red", nick1->color);
+ gui_nicklist_nick_set (buffer, nick1, "color", "");
+ STRCMP_EQUAL(NULL, nick1->color);
+ gui_nicklist_nick_set (buffer, nick1, "prefix", "+");
+ STRCMP_EQUAL("+", nick1->prefix);
+ gui_nicklist_nick_set (buffer, nick1, "prefix", "");
+ STRCMP_EQUAL(NULL, nick1->prefix);
+ gui_nicklist_nick_set (buffer, nick1, "prefix_color", "lightred");
+ STRCMP_EQUAL("lightred", nick1->prefix_color);
+ gui_nicklist_nick_set (buffer, nick1, "prefix_color", "");
+ STRCMP_EQUAL(NULL, nick1->prefix_color);
+ gui_nicklist_nick_set (buffer, nick1, "visible", "0");
+ LONGS_EQUAL(0, nick1->visible);
gui_buffer_close (buffer);
}