mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 11:45:43 +02:00
tests: add tests on typing plugin functions
This commit is contained in:
+51
-48
File diff suppressed because it is too large
Load Diff
+51
-48
File diff suppressed because it is too large
Load Diff
+54
-48
File diff suppressed because it is too large
Load Diff
+54
-48
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,9 @@ typing_status_search_state (const char *state)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!state)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < TYPING_STATUS_NUM_STATES; i++)
|
||||
{
|
||||
if (strcmp (typing_status_state_string[i], state) == 0)
|
||||
@@ -297,6 +300,27 @@ typing_status_nick_add (struct t_gui_buffer *buffer, const char *nick,
|
||||
return ptr_typing_status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Searches a nick typing status for a buffer.
|
||||
*
|
||||
* Returns pointer to t_typing_status found, NULL if not found.
|
||||
*/
|
||||
|
||||
struct t_typing_status *
|
||||
typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
|
||||
{
|
||||
struct t_hashtable *ptr_nicks;
|
||||
|
||||
if (!typing_status_nicks || !buffer || !nick)
|
||||
return NULL;
|
||||
|
||||
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
|
||||
if (!ptr_nicks)
|
||||
return NULL;
|
||||
|
||||
return weechat_hashtable_get (ptr_nicks, nick);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes a nick typing status from a buffer.
|
||||
*
|
||||
@@ -320,27 +344,6 @@ typing_status_nick_remove (struct t_gui_buffer *buffer, const char *nick)
|
||||
weechat_hashtable_remove (ptr_nicks, nick);
|
||||
}
|
||||
|
||||
/*
|
||||
* Searches a nick typing status for a buffer.
|
||||
*
|
||||
* Returns pointer to t_typing_status found, NULL if not found.
|
||||
*/
|
||||
|
||||
struct t_typing_status *
|
||||
typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
|
||||
{
|
||||
struct t_hashtable *ptr_nicks;
|
||||
|
||||
if (!typing_status_nicks)
|
||||
return NULL;
|
||||
|
||||
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
|
||||
if (!ptr_nicks)
|
||||
return NULL;
|
||||
|
||||
return weechat_hashtable_get (ptr_nicks, nick);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ends typing status.
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,7 @@ struct t_typing_status
|
||||
time_t last_typed; /* when was last char typed */
|
||||
};
|
||||
|
||||
extern char *typing_status_state_string[];
|
||||
extern struct t_hashtable *typing_status_self;
|
||||
extern struct t_hashtable *typing_status_nicks;
|
||||
|
||||
@@ -52,10 +53,10 @@ extern struct t_typing_status *typing_status_nick_add (struct t_gui_buffer *buff
|
||||
const char *nick,
|
||||
int state,
|
||||
int last_typed);
|
||||
extern void typing_status_nick_remove (struct t_gui_buffer *buffer,
|
||||
const char *nick);
|
||||
extern struct t_typing_status *typing_status_nick_search (struct t_gui_buffer *buffer,
|
||||
const char *nick);
|
||||
extern void typing_status_nick_remove (struct t_gui_buffer *buffer,
|
||||
const char *nick);
|
||||
extern void typing_status_end ();
|
||||
|
||||
#endif /* WEECHAT_PLUGIN_TYPING_STATUS_H */
|
||||
|
||||
@@ -78,6 +78,13 @@ if(ENABLE_TRIGGER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TYPING)
|
||||
list(APPEND LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC
|
||||
unit/plugins/typing/test-typing.cpp
|
||||
unit/plugins/typing/test-typing-status.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(weechat_unit_tests_plugins MODULE ${LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC})
|
||||
|
||||
if(ICONV_LIBRARY)
|
||||
|
||||
+7
-1
@@ -88,10 +88,16 @@ if PLUGIN_TRIGGER
|
||||
tests_trigger = unit/plugins/trigger/test-trigger.cpp
|
||||
endif
|
||||
|
||||
if PLUGIN_TYPING
|
||||
tests_typing = unit/plugins/typing/test-typing.cpp \
|
||||
unit/plugins/typing/test-typing-status.cpp
|
||||
endif
|
||||
|
||||
lib_weechat_unit_tests_plugins_la_SOURCES = unit/plugins/test-plugins.cpp \
|
||||
$(tests_irc) \
|
||||
$(tests_relay) \
|
||||
$(tests_trigger)
|
||||
$(tests_trigger) \
|
||||
$(tests_typing)
|
||||
|
||||
lib_weechat_unit_tests_plugins_la_LDFLAGS = -module -no-undefined
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user