devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=46d3d38e3cc59ee7ed731a26040306a9fb95472b

commit 46d3d38e3cc59ee7ed731a26040306a9fb95472b
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Tue Oct 21 08:34:28 2014 -0400

    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.heb...@samsung.com>
    
    Reviewers: devilhorns
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1560
---
 configure.ac                               |  8 ++++++-
 src/Makefile_Ecore.am                      |  6 +++--
 src/tests/ecore/ecore_test_ecore_wayland.c | 35 ++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 042c88c..d43345d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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@:>@])],
    [
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 3bb894a..43acee3 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -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@ \
diff --git a/src/tests/ecore/ecore_test_ecore_wayland.c 
b/src/tests/ecore/ecore_test_ecore_wayland.c
index 54aca3f..bd441ca 100644
--- a/src/tests/ecore/ecore_test_ecore_wayland.c
+++ b/src/tests/ecore/ecore_test_ecore_wayland.c
@@ -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);
 }

-- 


Reply via email to