1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 00:33:13 +02:00

tests: add tests on gui key functions (issue #1875)

This commit is contained in:
Sébastien Helleu
2023-01-28 18:32:46 +01:00
parent 81f4b16180
commit 48c1aebb83
9 changed files with 601 additions and 0 deletions
+4
View File
@@ -30,6 +30,10 @@ Bug fixes::
* irc: fix join of channels in "autojoin" server option on first connection to server if auto reconnection is performed (issue #1873)
* typing: fix crash when pointer buffer is not received in callback for signal "input_text_changed" (issue #1869)
Tests::
* gui: add tests on key functions
Build::
* core: remove build with autotools (issue #1860)
+1
View File
@@ -429,6 +429,7 @@ WeeChat "core" is located in following directories:
|          test-gui-color.cpp | Tests: colors.
|          test-gui-filter.cpp | Tests: filters.
|          test-gui-input.cpp | Tests: input functions.
|          test-gui-key.cpp | Tests: keys.
|          test-gui-line.cpp | Tests: lines.
|          test-gui-nick.cpp | Tests: nicks.
|       plugins/ | Root of unit tests for plugins.
+1
View File
@@ -431,6 +431,7 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|          test-gui-color.cpp | Tests : couleurs.
|          test-gui-filter.cpp | Tests : filtres.
|          test-gui-input.cpp | Tests : fonctions d'entrée.
|          test-gui-key.cpp | Tests : touches.
|          test-gui-line.cpp | Tests : lignes.
|          test-gui-nick.cpp | Tests : pseudos.
|       plugins/ | Racine des tests unitaires pour les extensions.
+2
View File
@@ -464,6 +464,8 @@ WeeChat "core" は以下のディレクトリに配置されています:
|          test-gui-filter.cpp | Tests: filters.
// TRANSLATION MISSING
|          test-gui-input.cpp | Tests: input functions.
// TRANSLATION MISSING
|          test-gui-key.cpp | Tests: keys.
|          test-gui-line.cpp | テスト: 行
// TRANSLATION MISSING
|          test-gui-nick.cpp | テスト: nicks
+2
View File
@@ -431,6 +431,8 @@ WeeChat „језгро” се налази у следећим директо
|          test-gui-color.cpp | Тестови: боје.
|          test-gui-filter.cpp | Тестови: филтери.
|          test-gui-input.cpp | Тестови: улазне функкције.
// TRANSLATION MISSING
|          test-gui-key.cpp | Тестови: keys.
|          test-gui-line.cpp | Тестови: линије.
|          test-gui-nick.cpp | Тестови: надимци.
|       plugins/ | Корен unit тестова додатака.
+3
View File
@@ -278,6 +278,9 @@ gui_key_get_internal_code (const char *key)
{
char *result, *result2;
if (!key)
return NULL;
if ((key[0] == '@') && strchr (key, ':'))
return strdup (key);
+1
View File
@@ -51,6 +51,7 @@ set(LIB_WEECHAT_UNIT_TESTS_CORE_SRC
unit/gui/test-gui-color.cpp
unit/gui/test-gui-filter.cpp
unit/gui/test-gui-input.cpp
unit/gui/test-gui-key.cpp
unit/gui/test-gui-line.cpp
unit/gui/test-gui-nick.cpp
scripts/test-scripts.cpp
+1
View File
@@ -84,6 +84,7 @@ IMPORT_TEST_GROUP(GuiChat);
IMPORT_TEST_GROUP(GuiColor);
IMPORT_TEST_GROUP(GuiFilter);
IMPORT_TEST_GROUP(GuiInput);
IMPORT_TEST_GROUP(GuiKey);
IMPORT_TEST_GROUP(GuiLine);
IMPORT_TEST_GROUP(GuiNick);
/* scripts */
+586
View File
@@ -0,0 +1,586 @@
/*
* test-gui-key.cpp - test key functions
*
* Copyright (C) 2023 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
*/
#include "CppUTest/TestHarness.h"
#include "tests/tests.h"
extern "C"
{
#include "src/gui/gui-key.h"
}
TEST_GROUP(GuiKey)
{
};
/*
* Tests functions:
* gui_key_init
*/
TEST(GuiKey, Init)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_search_context
*/
TEST(GuiKey, SearchContext)
{
LONGS_EQUAL(-1, gui_key_search_context (NULL));
LONGS_EQUAL(-1, gui_key_search_context (""));
LONGS_EQUAL(-1, gui_key_search_context ("invalid"));
LONGS_EQUAL(0, gui_key_search_context ("default"));
LONGS_EQUAL(1, gui_key_search_context ("search"));
LONGS_EQUAL(2, gui_key_search_context ("cursor"));
LONGS_EQUAL(3, gui_key_search_context ("mouse"));
}
/*
* Tests functions:
* gui_key_get_current_context
*/
TEST(GuiKey, GetCurrentContext)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_grab_init
*/
TEST(GuiKey, GrabInit)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_grab_end_timer_cb
*/
TEST(GuiKey, GrabEndTimerCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_get_internal_code
*/
TEST(GuiKey, GetInternalCode)
{
char *str;
WEE_TEST_STR(NULL, gui_key_get_internal_code (NULL));
WEE_TEST_STR("", gui_key_get_internal_code (""));
WEE_TEST_STR("A", gui_key_get_internal_code ("A"));
WEE_TEST_STR("a", gui_key_get_internal_code ("a"));
WEE_TEST_STR("@chat:t", gui_key_get_internal_code ("@chat:t"));
WEE_TEST_STR("\x01[A", gui_key_get_internal_code ("meta-A"));
WEE_TEST_STR("\x01[a", gui_key_get_internal_code ("meta-a"));
WEE_TEST_STR("\x01[[A", gui_key_get_internal_code ("meta2-A"));
WEE_TEST_STR("\x01[[a", gui_key_get_internal_code ("meta2-a"));
WEE_TEST_STR("\x01" "A", gui_key_get_internal_code ("ctrl-A"));
WEE_TEST_STR("\x01" "a", gui_key_get_internal_code ("ctrl-a"));
WEE_TEST_STR(" ", gui_key_get_internal_code ("space"));
}
/*
* Tests functions:
* gui_key_get_expanded_name
*/
TEST(GuiKey, GetExpandedName)
{
char *str;
WEE_TEST_STR(NULL, gui_key_get_expanded_name (NULL));
WEE_TEST_STR("", gui_key_get_expanded_name (""));
WEE_TEST_STR("A", gui_key_get_expanded_name ("A"));
WEE_TEST_STR("a", gui_key_get_expanded_name ("a"));
WEE_TEST_STR("@chat:t", gui_key_get_expanded_name ("@chat:t"));
WEE_TEST_STR("meta-A", gui_key_get_expanded_name ("\x01[A"));
WEE_TEST_STR("meta-a", gui_key_get_expanded_name ("\x01[a"));
WEE_TEST_STR("meta2-A", gui_key_get_expanded_name ("\x01[[A"));
WEE_TEST_STR("meta2-a", gui_key_get_expanded_name ("\x01[[a"));
WEE_TEST_STR("ctrl-A", gui_key_get_expanded_name ("\x01" "A"));
WEE_TEST_STR("ctrl-a", gui_key_get_expanded_name ("\x01" "a"));
WEE_TEST_STR("space", gui_key_get_expanded_name (" "));
}
/*
* Tests functions:
* gui_key_find_pos
*/
TEST(GuiKey, FindPos)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_insert_sorted
*/
TEST(GuiKey, InsertSorted)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_set_area_type_name
*/
TEST(GuiKey, SetAreaTypeName)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_set_areas
*/
TEST(GuiKey, SetAreas)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_set_score
*/
TEST(GuiKey, SetScore)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_is_safe
*/
TEST(GuiKey, IsSafe)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_new
*/
TEST(GuiKey, New)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_search
*/
TEST(GuiKey, Search)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_cmp
*/
TEST(GuiKey, Cmp)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_search_part
*/
TEST(GuiKey, SearchPart)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_bind
*/
TEST(GuiKey, Bind)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_bind_plugin_hashtable_map_cb
*/
TEST(GuiKey, BindPluginHashtableMapCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_bind_plugin
*/
TEST(GuiKey, BindPlugin)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_unbind
*/
TEST(GuiKey, Unbind)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_unbind_plugin
*/
TEST(GuiKey, UnbindPlugin)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_focus_matching
*/
TEST(GuiKey, FocusMatching)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_focus_command
*/
TEST(GuiKey, FocusCommand)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_focus
*/
TEST(GuiKey, Focus)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_is_complete
*/
TEST(GuiKey, IsComplete)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_pressed
*/
TEST(GuiKey, Pressed)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_free
*/
TEST(GuiKey, Free)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_free_all
*/
TEST(GuiKey, FreeAll)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_buffer_optimize
*/
TEST(GuiKey, BufferOptimize)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_buffer_reset
*/
TEST(GuiKey, BufferReset)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_buffer_add
*/
TEST(GuiKey, BufferAdd)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_buffer_search
*/
TEST(GuiKey, BufferSearch)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_buffer_remove
*/
TEST(GuiKey, BufferRemove)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_remove_newline
*/
TEST(GuiKey, PasteRemoveNewline)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_replace_tabs
*/
TEST(GuiKey, PasteReplaceTabs)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_start
*/
TEST(GuiKey, PasteStart)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_get_paste_lines
*/
TEST(GuiKey, GetPasteLines)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_check
*/
TEST(GuiKey, PasteCheck)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_bracketed_timer_cb
*/
TEST(GuiKey, PasteBracketedTimerCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_bracketed_timer_remove
*/
TEST(GuiKey, PasteBracketedTimerRemove)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_bracketed_timer_add
*/
TEST(GuiKey, PasteBracketedTimerAdd)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_bracketed_start
*/
TEST(GuiKey, PasteBracketedStart)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_bracketed_stop
*/
TEST(GuiKey, PasteBracketedStop)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_accept
*/
TEST(GuiKey, PasteAccept)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_paste_cancel
*/
TEST(GuiKey, PasteCancel)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_end
*/
TEST(GuiKey, End)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_hdata_key_cb
*/
TEST(GuiKey, HdataKeyCb)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_add_to_infolist
*/
TEST(GuiKey, AddToInfolist)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_print_log_key
*/
TEST(GuiKey, PrintLogKey)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_key_print_log
*/
TEST(GuiKey, PrintLog)
{
/* TODO: write tests */
}