tests/ecore_wl2: Add start of Ecore_Wl2_Input API tests

ref T8016
This commit is contained in:
Christopher Michael 2019-08-01 08:41:07 -04:00
parent a7971f409d
commit 34514ccf58
5 changed files with 58 additions and 3 deletions

View File

@ -12,6 +12,7 @@ static const Efl_Test_Case etc[] =
{ "Ecore_Wl2", ecore_wl2_test_init },
{ "Display", ecore_wl2_test_display },
{ "Window", ecore_wl2_test_window },
{ "Input", ecore_wl2_test_input },
#endif
{ NULL, NULL }
};

View File

@ -7,5 +7,6 @@
void ecore_wl2_test_init(TCase *tc);
void ecore_wl2_test_display(TCase *tc);
void ecore_wl2_test_window(TCase *tc);
void ecore_wl2_test_input(TCase *tc);
#endif

View File

@ -174,8 +174,7 @@ ecore_wl2_test_display(TCase *tc)
tcase_add_test(tc, wl2_display_get);
tcase_add_test(tc, wl2_display_name_get);
}
if (getenv("WAYLAND_DISPLAY"))
else if (getenv("WAYLAND_DISPLAY"))
{
/* tests here are for client-side functions */
printf("Wayland Compositor detected. Testing client-side functions\n");

View File

@ -0,0 +1,53 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Wl2.h>
#include "ecore_wl2_suite.h"
static Ecore_Wl2_Display *
_display_connect(void)
{
Ecore_Wl2_Display *disp;
disp = ecore_wl2_display_connect(NULL);
return disp;
}
EFL_START_TEST(wl2_input_seat_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Input *input;
Eina_Iterator *itr;
disp = _display_connect();
ck_assert(disp != NULL);
itr = ecore_wl2_display_inputs_get(disp);
ck_assert(itr != NULL);
EINA_ITERATOR_FOREACH(itr, input)
{
struct wl_seat *seat;
seat = ecore_wl2_input_seat_get(input);
ck_assert(seat != NULL);
}
eina_iterator_free(itr);
}
EFL_END_TEST
void
ecore_wl2_test_input(TCase *tc)
{
if (getenv("WAYLAND_DISPLAY"))
{
tcase_add_test(tc, wl2_input_seat_get);
}
}

View File

@ -4,7 +4,8 @@ ecore_wl2_suite_src = [
'ecore_wl2_tests_helpers.h',
'ecore_wl2_test_ecore_wl2.c',
'ecore_wl2_test_display.c',
'ecore_wl2_test_window.c'
'ecore_wl2_test_window.c',
'ecore_wl2_test_input.c'
]
ecore_wl2_suite = executable('ecore_wl2_suite',