mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
relay/api: add buffer keys in GET /api/buffers (issue #2066)
This commit is contained in:
@@ -118,7 +118,7 @@ TEST(RelayApiMsg, SendEvent)
|
||||
|
||||
TEST(RelayApiMsg, BufferToJson)
|
||||
{
|
||||
cJSON *json, *json_obj, *json_local_vars, *json_lines;
|
||||
cJSON *json, *json_obj, *json_local_vars, *json_keys, *json_key, *json_lines;
|
||||
cJSON *json_nicklist_root, *json_nicks, *json_groups, *json_group;
|
||||
cJSON *json_group_nicks, *json_nick;
|
||||
struct t_gui_buffer *buffer;
|
||||
@@ -132,6 +132,9 @@ TEST(RelayApiMsg, BufferToJson)
|
||||
POINTERS_EQUAL(NULL, cJSON_GetObjectItem (json, "name"));
|
||||
cJSON_Delete (json);
|
||||
|
||||
gui_buffer_set (gui_buffers, "key_bind_meta-y,1", "/test1");
|
||||
gui_buffer_set (gui_buffers, "key_bind_meta-y,2", "/test2 arg");
|
||||
|
||||
/* buffer without lines and nicks */
|
||||
json = relay_api_msg_buffer_to_json (gui_buffers, 0, 0, RELAY_API_COLORS_ANSI);
|
||||
CHECK(json);
|
||||
@@ -148,6 +151,17 @@ TEST(RelayApiMsg, BufferToJson)
|
||||
json_local_vars = cJSON_GetObjectItem (json, "local_variables");
|
||||
CHECK(json_local_vars);
|
||||
CHECK(cJSON_IsObject (json_local_vars));
|
||||
json_keys = cJSON_GetObjectItem (json, "keys");
|
||||
CHECK(json_keys);
|
||||
LONGS_EQUAL(2, cJSON_GetArraySize (json_keys));
|
||||
json_key = cJSON_GetArrayItem (json_keys, 0);
|
||||
CHECK(json_key);
|
||||
WEE_CHECK_OBJ_STR("meta-y,1", json_key, "key");
|
||||
WEE_CHECK_OBJ_STR("/test1", json_key, "command");
|
||||
json_key = cJSON_GetArrayItem (json_keys, 1);
|
||||
CHECK(json_key);
|
||||
WEE_CHECK_OBJ_STR("meta-y,2", json_key, "key");
|
||||
WEE_CHECK_OBJ_STR("/test2 arg", json_key, "command");
|
||||
WEE_CHECK_OBJ_STR("core", json_local_vars, "plugin");
|
||||
WEE_CHECK_OBJ_STR("weechat", json_local_vars, "name");
|
||||
POINTERS_EQUAL(NULL, cJSON_GetObjectItem (json, "lines"));
|
||||
@@ -298,6 +312,8 @@ TEST(RelayApiMsg, BufferToJson)
|
||||
WEE_CHECK_OBJ_BOOL(0, json_nick, "visible");
|
||||
cJSON_Delete (json);
|
||||
|
||||
gui_buffer_set (gui_buffers, "key_unbind_meta-y", "");
|
||||
|
||||
gui_buffer_close (buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user