forked from enlightenment/efl
ecore_wayland: Added test case to check ecore_wl_init by passing socket name.
Summary: Added a test case for ecore_wayland to test ecore_wl_init by passing the socket name. Wayland display is created and a socket is added to the display, then this socket is passed to ecore_wl_init to connect. It should successfully connect. Then ecore_wl_shutdown is called to verify if it closes. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1560
This commit is contained in:
parent
8549ee799a
commit
46d3d38e3c
|
@ -2858,10 +2858,10 @@ EFL_EVAL_PKGS([ECORE_WAYLAND])
|
|||
### Checks for linker characteristics
|
||||
|
||||
### Checks for library functions
|
||||
|
||||
EFL_LIB_END_OPTIONAL([Ecore_Wayland])
|
||||
#### End of Ecore_Wayland
|
||||
|
||||
|
||||
#### Eldbus
|
||||
EFL_LIB_START([Eldbus])
|
||||
|
||||
|
@ -4372,6 +4372,12 @@ EFL_EVAL_PKGS([ELUA])
|
|||
EFL_LIB_END_OPTIONAL([Elua])
|
||||
#### End of Elua
|
||||
|
||||
### Add Wayland server library if test is enabled
|
||||
if test "x${want_tests}" = "xyes" -a "x${want_wayland}" = "xyes"; then
|
||||
EFL_DEPEND_PKG([ECORE_WAYLAND_SRV], [WAYLAND], [wayland-server >= 1.3.0])
|
||||
EFL_EVAL_PKGS([ECORE_WAYLAND_SRV])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([always-build-examples],
|
||||
[AS_HELP_STRING([--enable-always-build-examples],[always build examples. @<:@default=disabled@:>@])],
|
||||
[
|
||||
|
|
|
@ -190,7 +190,8 @@ tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
@ECORE_X_CFLAGS@ \
|
||||
@ECORE_IMF_CFLAGS@ \
|
||||
@ECORE_EVAS_CFLAGS@ \
|
||||
@ECORE_WAYLAND_CFLAGS@
|
||||
@ECORE_WAYLAND_CFLAGS@ \
|
||||
@ECORE_WAYLAND_SRV_CFLAGS@
|
||||
|
||||
tests_ecore_ecore_suite_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
|
@ -201,7 +202,8 @@ tests_ecore_ecore_suite_LDADD = \
|
|||
@USE_ECORE_X_LIBS@ \
|
||||
@USE_ECORE_IMF_LIBS@ \
|
||||
@USE_ECORE_EVAS_LIBS@ \
|
||||
@USE_ECORE_WAYLAND_LIBS@
|
||||
@USE_ECORE_WAYLAND_LIBS@ \
|
||||
@ECORE_WAYLAND_SRV_LIBS@
|
||||
tests_ecore_ecore_suite_DEPENDENCIES = \
|
||||
@USE_ECORE_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_AUDIO_INTERNAL_LIBS@ \
|
||||
|
|
|
@ -8,9 +8,43 @@
|
|||
#include <Ecore_Wayland.h>
|
||||
|
||||
#include "ecore_suite.h"
|
||||
#include "wayland-server.h"
|
||||
|
||||
#define MAX_ITER 15
|
||||
|
||||
static char test_socket[] = "test1";
|
||||
|
||||
START_TEST(ecore_test_ecore_wl_init_name)
|
||||
{
|
||||
struct wl_display *test_display = NULL;
|
||||
int ret = 0, i, j;
|
||||
|
||||
test_display = wl_display_create();
|
||||
fprintf(stderr, "Creating display\n");
|
||||
fail_if(test_display == NULL);
|
||||
|
||||
ret = wl_display_add_socket(test_display, test_socket);
|
||||
fprintf(stderr, "Connecting socket to display\n");
|
||||
fail_if(ret != 0);
|
||||
|
||||
for (i = 1; i <= MAX_ITER; i++)
|
||||
{
|
||||
ret = ecore_wl_init(test_socket);
|
||||
fprintf(stderr, "Created %d ecore wayland instance.\n", i);
|
||||
fail_if(ret != i);
|
||||
}
|
||||
|
||||
for (j = MAX_ITER - 1; j >= 0; j--)
|
||||
{
|
||||
ret = ecore_wl_shutdown();
|
||||
fprintf(stderr, "Deleted %d ecore wayland instance.\n", MAX_ITER - j);
|
||||
fail_if(ret != j);
|
||||
}
|
||||
|
||||
wl_display_destroy(test_display);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(ecore_test_ecore_wl_init)
|
||||
{
|
||||
int ret, i, j;
|
||||
|
@ -34,4 +68,5 @@ END_TEST
|
|||
void ecore_test_ecore_wayland(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, ecore_test_ecore_wl_init);
|
||||
tcase_add_test(tc, ecore_test_ecore_wl_init_name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue