mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 13:30:27 +01:00
test: add helpers for private data handling in tests
Our litest context needs the libinput user_data but it does provide a `private` pointer for our test data - let's reduce the boilerplate to access that. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1211>
This commit is contained in:
parent
ec9c39da18
commit
669bc620aa
2 changed files with 21 additions and 0 deletions
|
|
@ -2115,6 +2115,22 @@ litest_destroy_context(struct libinput *li)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
litest_context_set_user_data(struct libinput *li, void *data)
|
||||
{
|
||||
struct litest_user_data *litest_data = libinput_get_user_data(li);
|
||||
litest_assert_ptr_notnull(litest_data);
|
||||
litest_data->private = data;
|
||||
}
|
||||
|
||||
void *
|
||||
litest_context_get_user_data(struct libinput *li)
|
||||
{
|
||||
struct litest_user_data *litest_data = libinput_get_user_data(li);
|
||||
litest_assert_ptr_notnull(litest_data);
|
||||
return litest_data->private;
|
||||
}
|
||||
|
||||
void
|
||||
litest_disable_log_handler(struct libinput *libinput)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -627,6 +627,11 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(struct libinput *, litest_destroy_context);
|
|||
|
||||
#define _litest_context_destroy_ _cleanup_(litest_destroy_contextp)
|
||||
|
||||
void
|
||||
litest_context_set_user_data(struct libinput *li, void *data);
|
||||
void *
|
||||
litest_context_get_user_data(struct libinput *li);
|
||||
|
||||
void litest_disable_log_handler(struct libinput *libinput);
|
||||
void litest_restore_log_handler(struct libinput *libinput);
|
||||
void litest_set_log_handler_bug(struct libinput *libinput);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue