summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-17 15:20:23 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-18 14:13:14 +0100
commitdd9ae79204b815187472f5c5ab03495435affa7c (patch)
treef0232f26e1ad2b0b94c2ed2aabe0de5aa36e0d0b /tests
parentf03384d12426228bf80acb1ce4e05ad2d4ff4865 (diff)
downloadweechat-dd9ae79204b815187472f5c5ab03495435affa7c.zip
core: remove unused argument "pos" from function gui_input_insert_string, add tests on function
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/gui/test-gui-input.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/unit/gui/test-gui-input.cpp b/tests/unit/gui/test-gui-input.cpp
index eb6d6e2d8..8bc444a01 100644
--- a/tests/unit/gui/test-gui-input.cpp
+++ b/tests/unit/gui/test-gui-input.cpp
@@ -116,7 +116,36 @@ TEST(GuiInput, SearchSignal)
TEST(GuiInput, InsertString)
{
- /* TODO: write tests */
+ gui_input_replace_input (gui_buffers, "");
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_insert_string (gui_buffers, NULL);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_insert_string (gui_buffers, "");
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_size);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_length);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+
+ gui_input_insert_string (gui_buffers, "noël");
+ STRCMP_EQUAL("noël", gui_buffers->input_buffer);
+ LONGS_EQUAL(5, gui_buffers->input_buffer_size);
+ LONGS_EQUAL(4, gui_buffers->input_buffer_length);
+ LONGS_EQUAL(4, gui_buffers->input_buffer_pos);
+
+ gui_input_set_pos (gui_buffers, 3);
+ LONGS_EQUAL(5, gui_buffers->input_buffer_size);
+ LONGS_EQUAL(4, gui_buffers->input_buffer_length);
+ LONGS_EQUAL(3, gui_buffers->input_buffer_pos);
+
+ gui_input_insert_string (gui_buffers, "ï");
+ STRCMP_EQUAL("noëïl", gui_buffers->input_buffer);
+ LONGS_EQUAL(7, gui_buffers->input_buffer_size);
+ LONGS_EQUAL(5, gui_buffers->input_buffer_length);
+ LONGS_EQUAL(4, gui_buffers->input_buffer_pos);
}
/*