Added initial testcase module for enlightenment 92/35392/1
authorMinJeong Kim <minjjj.kim@samsung.com>
Fri, 13 Feb 2015 04:11:42 +0000 (13:11 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Fri, 13 Feb 2015 04:13:45 +0000 (13:13 +0900)
Change-Id: I1ec7b1a5daf76f76ca2a12c34c1f488627b3d329
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
12 files changed:
COPYING [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
packaging/e-tizen-testcase.spec [new file with mode: 0644]
src/0000_easy.c [new file with mode: 0644]
src/0001_basic.c [new file with mode: 0644]
src/0001_basic.h [new file with mode: 0644]
src/0002_basic_stack.c [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/e_test_case_main.c [new file with mode: 0644]
src/e_test_case_main.h [new file with mode: 0644]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..f3bbff3
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,25 @@
+Copyright notice for Enlightenment:
+
+Copyright (C) 2000-2012 Carsten Haitzler and various contributors (see AUTHORS)
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..fb2d034
--- /dev/null
@@ -0,0 +1,6 @@
+SUBDIRS = src
+
+MAINTAINERCLEANFILES = \
+                      Makefile.in
+
+EXTRA_DIST = COPYING autogen.sh
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..1ac867a
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+#rm -rf autom4te.cache
+#rm -f aclocal.m4 ltmain.sh
+
+#echo "Running autoreconf..." ; autoreconf -v --install || exit 1
+#echo "Running configure..." ; ./configure --enable-maintainer-mode
+
+set  -x
+aclocal
+autoconf
+libtoolize --copy --force
+autoheader
+automake --foreign --add-missing --copy
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..97d45f2
--- /dev/null
@@ -0,0 +1,36 @@
+# Process this file with autoconf to produce a configure script.
+dnl Process this file with autoconf to produce a configure script.
+
+# get rid of that stupid cache mechanism
+rm -f config.cache
+
+AC_INIT([e_test_case], [0.1.0], [enlightenment-devel@lists.sourceforge.net])
+AC_PREREQ([2.52])
+AC_CONFIG_SRCDIR([configure.ac])
+
+AM_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE([1.11])
+
+GETTEXT_PACKAGE="e_test_case"
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Gettext package])
+
+AC_USE_SYSTEM_EXTENSIONS
+AM_PROG_CC_STDC
+AM_PROG_CC_C_O
+
+requirements="\
+   elementary \
+   eldbus \
+   enlightenment \
+   "
+
+PKG_CHECK_MODULES(E_TEST_CASE, [${requirements}])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+])
+
+AC_OUTPUT
diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec
new file mode 100644 (file)
index 0000000..746d58c
--- /dev/null
@@ -0,0 +1,42 @@
+Name: e-tizen-testcase
+Version: 0.0.1
+Release: 1
+Summary: The test case module for enlightenment
+URL: http://www.enlightenment.org
+Group: Graphics & UI Framework/Other
+Source0: %{name}-%{version}.tar.gz
+License: BSD-2-Clause
+BuildRequires: pkgconfig(enlightenment)
+BuildRequires: pkgconfig(eldbus)
+BuildRequires:  gettext
+
+%description
+This package is a test case module for enlightenment.
+
+%prep
+%setup -q
+
+%build
+
+export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections"
+export CFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}"
+export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib"
+
+%autogen
+%configure --prefix=/usr
+make
+
+%install
+rm -rf %{buildroot}
+
+# for license notification
+mkdir -p %{buildroot}/usr/share/license
+cp -a %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name}
+
+# install
+make install DESTDIR=%{buildroot}
+
+%files
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+%{_bindir}/e_test_case
diff --git a/src/0000_easy.c b/src/0000_easy.c
new file mode 100644 (file)
index 0000000..773b1b5
--- /dev/null
@@ -0,0 +1,14 @@
+#include "e.h"
+#include "e_test_case_main.h"
+
+Eina_Bool
+test_case_0000_easy_fail(E_Test_Case *tc EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+Eina_Bool
+test_case_0000_easy_pass(E_Test_Case *tc EINA_UNUSED)
+{
+   return EINA_TRUE;
+}
diff --git a/src/0001_basic.c b/src/0001_basic.c
new file mode 100644 (file)
index 0000000..d4dfde5
--- /dev/null
@@ -0,0 +1,254 @@
+#include "e.h"
+#include "e_test_case_main.h"
+#include "0001_basic.h"
+
+/* Info of this basic test window */
+E_TC_Basic_Info *_basic_info = NULL;
+
+static E_Test_Case *_test_case = NULL;
+
+static void test(void);
+
+/* Method callbacks */
+static void
+_method_cb_register_window(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+   Eina_Bool accepted = EINA_FALSE;
+   const char *errname, *errmsg;
+
+   EINA_SAFETY_ON_NULL_RETURN(_basic_info);
+
+   if (eldbus_message_error_get(msg, &errname, &errmsg))
+     {
+        ERR("%s %s\n", errname, errmsg);
+        elm_exit();
+        return;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "b", &accepted))
+     {
+        ERR("Error on eldbus_message_arguments_get()\n");
+        elm_exit();
+        return;
+     }
+
+   if (!accepted)
+     {
+        if ((_basic_info) && (_basic_info->client))
+          ERR("WM rejected the request for register!!(0x%08x)\n", _basic_info->client->win);
+        elm_exit();
+     }
+   else if ((_basic_info->elm_win) &&
+            (_basic_info->client))
+     {
+        evas_object_move(_basic_info->elm_win,
+                         _basic_info->client->x, _basic_info->client->y);
+        evas_object_resize(_basic_info->elm_win,
+                           _basic_info->client->w, _basic_info->client->h);
+        evas_object_show(_basic_info->elm_win);
+     }
+}
+
+static void
+_method_cb_deregister_window(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+   const char *errname, *errmsg;
+   Eina_Bool allowed = EINA_TRUE;
+
+   EINA_SAFETY_ON_NULL_RETURN(_basic_info);
+
+   if (eldbus_message_error_get(msg, &errname, &errmsg))
+     {
+        ERR("%s %s\n", errname, errmsg);
+        return;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "b", &allowed))
+     {
+        ERR("Error on eldbus_message_arguments_get()\n");
+        return;
+     }
+
+   if (!allowed)
+     {
+        _basic_info->wait_close = EINA_TRUE;
+        return;
+     }
+
+   elm_exit();
+}
+
+static void
+_method_cb_get_clients(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+   const char *errname, *errmsg;
+   Eldbus_Message_Iter *array_of_ec, *struct_of_ec;
+   Ecore_Window target_win = 0;
+
+   EINA_SAFETY_ON_NULL_RETURN(_basic_info);
+
+   if (eldbus_message_error_get(msg, &errname, &errmsg))
+     {
+        ERR("%s %s", errname, errmsg);
+        return;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "ua(usiiiiibb)", &target_win, &array_of_ec))
+     {
+        ERR("Error on eldbus_message_arguments_get()\n");
+        return;
+     }
+
+   if (_basic_info->clients) eina_list_free(_basic_info->clients);
+
+   while (eldbus_message_iter_get_and_next(array_of_ec, 'r', &struct_of_ec))
+     {
+        const char  *name;
+        int x, y, w, h, layer;
+        Eina_Bool visible, argb;
+        Ecore_Window win;
+        E_TC_Client *client = NULL;
+
+        if (!eldbus_message_iter_arguments_get(struct_of_ec, "usiiiiibb", &win, &name, &x, &y, &w, &h, &layer, &visible, &argb))
+          {
+             WRN("Error on eldbus_message_arguments_get()\n");
+             continue;
+          }
+
+        client = E_NEW(E_TC_Client, 1);
+        client->x = x;
+        client->y = y;
+        client->w = w;
+        client->h = h;
+        client->layer = layer;
+        client->win = win;
+        client->name = eina_stringshare_add(name);
+        _basic_info->clients = eina_list_append(_basic_info->clients, client);
+     }
+
+   test();
+}
+
+/* Signal Callbacks */
+static void
+_signal_cb_change_visibility(void *data EINA_UNUSED, const Eldbus_Message *msg)
+{
+   const char *errname, *errmsg;
+   Eina_Bool vis;
+   Ecore_Window id;
+
+   EINA_SAFETY_ON_NULL_RETURN(_basic_info);
+   EINA_SAFETY_ON_NULL_RETURN(_basic_info->client);
+
+   if (eldbus_message_error_get(msg, &errname, &errmsg))
+     {
+        ERR("%s %s", errname, errmsg);
+        return;
+     }
+
+   if (!eldbus_message_arguments_get(msg, "ub", &id, &vis))
+     {
+        ERR("Error on eldbus_message_arguments_get()\n");
+        return;
+     }
+
+   if (_basic_info->client->win != id) return;
+
+   if (vis)
+     {
+        eldbus_proxy_call(dbus_proxy,
+                          "GetClients", _method_cb_get_clients,
+                          NULL, -1, "");
+     }
+
+   if ((_basic_info->wait_close) && (!vis))
+     {
+        elm_exit();
+     }
+
+   _basic_info->client->visible = vis;
+}
+
+/* Main test */
+static void
+test(void)
+{
+   _test_case->passed = e_test_case_inner_do(_test_case);
+
+   //request for quitting this test
+   eldbus_proxy_call(dbus_proxy, "DeregisterWindow", _method_cb_deregister_window, NULL, -1, "u", _basic_info->client->win);
+}
+
+/* Window setup and request for register of the window */
+Eina_Bool
+test_case_0001_basic(E_Test_Case *tc)
+{
+   Evas_Object *bg, *win;
+   E_TC_Client client = { "0001_basic", // name
+                           0, 0, 320, 320, // geometry(x,y,w,h)
+                           200, -1, -1, 0 // layer, visible, arg, win 
+   };
+
+   if (!tc) goto test_shutdown;
+
+   _test_case = tc;
+   _basic_info = E_NEW(E_TC_Basic_Info, 1);
+
+   win = elm_win_add(NULL, client.name, ELM_WIN_BASIC);
+   client.win = elm_win_xwindow_get(win);
+
+   if (!eldbus_proxy_call(dbus_proxy,
+                          "RegisterWindow", _method_cb_register_window,
+                          NULL, -1, "u", client.win))
+     goto test_shutdown;
+
+
+   _basic_info->sig_hdlrs =
+      eina_list_append(_basic_info->sig_hdlrs,
+                       eldbus_proxy_signal_handler_add(dbus_proxy,
+                                                       "ChangeVisibility",
+                                                       _signal_cb_change_visibility,
+                                                       NULL));
+
+   elm_win_title_set(win, client.name);
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   bg = elm_bg_add(win);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, bg);
+   elm_bg_color_set(bg, 0, 0, 255);
+   evas_object_show(bg);
+
+   _basic_info->elm_win = win;
+   _basic_info->client = E_NEW(E_TC_Client, 1);
+   memcpy(_basic_info->client, &client, sizeof(E_TC_Client));
+
+   elm_run();
+
+test_shutdown:
+   if (_basic_info)
+     {
+        Eldbus_Signal_Handler *_sh;
+        E_TC_Client *_client;
+
+        evas_object_hide(_basic_info->elm_win);
+        evas_object_del(_basic_info->elm_win);
+        _basic_info->elm_win = NULL;
+
+        EINA_LIST_FREE(_basic_info->clients, _client)
+          {
+             eina_stringshare_del(_client->name);
+             E_FREE(_client);
+             _client = NULL;
+          }
+
+        EINA_LIST_FREE(_basic_info->sig_hdlrs, _sh)
+           eldbus_signal_handler_del(_sh);
+
+        if (_basic_info->client) E_FREE(_basic_info->client);
+
+        E_FREE(_basic_info);
+     }
+
+   return _test_case->passed;
+}
diff --git a/src/0001_basic.h b/src/0001_basic.h
new file mode 100644 (file)
index 0000000..cbc5a78
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef E_MOD_TEST_CASE_BASIC_H
+#define E_MOD_TEST_CASE_BASIC_H
+
+typedef struct _E_TC_Basic_Info E_TC_Basic_Info;
+
+extern E_TC_Basic_Info *_basic_info;
+
+struct _E_TC_Basic_Info
+{
+   E_TC_Client *client;
+   Evas_Object *elm_win;
+   Eina_List *clients;
+
+   Eina_List *sig_hdlrs;
+
+   Eina_Bool wait_close;
+};
+
+#endif
diff --git a/src/0002_basic_stack.c b/src/0002_basic_stack.c
new file mode 100644 (file)
index 0000000..c3c6441
--- /dev/null
@@ -0,0 +1,29 @@
+#include "e.h"
+#include "e_test_case_main.h"
+#include "0001_basic.h"
+
+Eina_Bool
+test_case_0002_basic_stack(E_Test_Case *tc EINA_UNUSED)
+{
+   E_TC_Client *client;
+   Eina_Bool passed = EINA_FALSE;
+   Eina_List *l;
+
+   if (!_basic_info) return EINA_FALSE;
+   if (!_basic_info->clients) return EINA_FALSE;
+
+   EINA_LIST_FOREACH(_basic_info->clients, l, client)
+     {
+        if (client->layer > _basic_info->client->layer)
+          continue;
+        if (client->layer < _basic_info->client->layer)
+          break;
+
+        if (!strncmp(client->name, _basic_info->client->name, strlen(client->name)))
+          passed = EINA_TRUE;
+
+        break;
+     }
+
+   return passed;
+}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..9de8215
--- /dev/null
@@ -0,0 +1,19 @@
+bin_PROGRAMS = e_test_case
+
+e_test_case_CPPFLAGS = \
+-I. \
+@E_TEST_CASE_CFLAGS@
+
+e_test_case_LDADD = \
+@E_TEST_CASE_LIBS@
+
+e_test_case_SOURCES = \
+e_test_case_main.c \
+e_test_case_main.h \
+0000_easy.c \
+0001_basic.h \
+0001_basic.c \
+0002_basic_stack.c
+
+MAINTAINERCLEANFILES = \
+Makefile.in
diff --git a/src/e_test_case_main.c b/src/e_test_case_main.c
new file mode 100644 (file)
index 0000000..28764f0
--- /dev/null
@@ -0,0 +1,200 @@
+#include "e.h"
+#include "e_test_case_main.h"
+
+#define ADD_TEST_CASE(test_, name_, desc_, expect_, is_stopper_) \
+   tc = _e_test_case_add(name_, desc_, test_case_##test_, expect_, is_stopper_)
+#define ADD_INNER_TCS(test_, name_, desc_, expect_, is_stopper_) \
+   _e_test_case_inner_add(tc, name_, desc_, test_case_##test_, expect_, is_stopper_)
+
+Eldbus_Connection *dbus_conn;
+Eldbus_Proxy *dbus_proxy;
+Eldbus_Object *dbus_obj;
+
+static Eina_List *signal_hdlrs;
+static Eina_List *tcs = NULL;
+
+static void
+_e_test_case_inner_add(E_Test_Case* gtc,
+                       const char *name, const char* desc,
+                       Eina_Bool (*test)(E_Test_Case*),
+                       Eina_Bool expect, Eina_Bool is_stopper)
+{
+   E_Test_Case *tc;
+
+   tc = E_NEW(E_Test_Case, 1);
+   tc->name = name;
+   tc->desc = desc;
+   tc->test = test;
+   tc->expect = expect;
+   tc->is_stopper = is_stopper;
+
+   gtc->inner_tcs = eina_list_append(gtc->inner_tcs, tc);
+}
+
+static E_Test_Case *
+_e_test_case_add(const char *name, const char* desc,
+                 Eina_Bool (*test)(E_Test_Case*),
+                 Eina_Bool expect, Eina_Bool is_stopper)
+{
+   E_Test_Case *tc;
+
+   tc = E_NEW(E_Test_Case, 1);
+   tc->name = name;
+   tc->desc = desc;
+   tc->test = test;
+   tc->expect = expect;
+   tc->is_stopper = is_stopper;
+
+   tcs = eina_list_append(tcs, tc);
+
+   return tc;
+}
+
+static void
+_e_test_case_result_print(void)
+{
+   Eina_Strbuf *buf;
+   Eina_List *l, *ll;
+   E_Test_Case *tc, *in_tc;
+   int pass_case = 0;
+   int fail_case = 0;
+   int total = 0;
+
+   if (!(buf = eina_strbuf_new())) return;
+
+   eina_strbuf_append(buf, "\n\n====================================\n");
+   eina_strbuf_append(buf, "TEST CASE RESULT\n");
+   eina_strbuf_append(buf, "====================================\n");
+
+   EINA_LIST_FOREACH(tcs, l, tc)
+     {
+        eina_strbuf_append_printf(buf,
+                                  "[%04d] TEST \"%15s\" : %s\n",
+                                  total++,
+                                  tc->name, tc->passed? "PASS":"FAIL");
+        tc->passed? pass_case++ : fail_case++;
+        EINA_LIST_FOREACH(tc->inner_tcs, ll, in_tc)
+          {
+             eina_strbuf_append_printf(buf,
+                                       "[%04d] TEST \"%15s\" : %s\n",
+                                       total++,
+                                       in_tc->name, in_tc->passed? "PASS":"FAIL");
+             in_tc->passed? pass_case++ : fail_case++;
+             if ((in_tc->is_stopper) && (!tc->passed))
+               break;
+          }
+
+        if ((tc->is_stopper) && (!tc->passed))
+          {
+             eina_strbuf_append_printf(buf, "\n!!Test Case failed at \"%s\"\n", tc->name);
+             break;
+          }
+     }
+
+   eina_strbuf_append(buf, "====================================\n");
+   eina_strbuf_append_printf(buf, "TOTAL: %4d Case\n", total);
+   eina_strbuf_append_printf(buf, "PASS : %4d Case\n", pass_case);
+   eina_strbuf_append_printf(buf, "FAIL : %4d Case\n", fail_case);
+   eina_strbuf_append(buf, "====================================\n");
+
+   printf("%s", eina_strbuf_string_get(buf));
+}
+
+
+EAPI Eina_Bool
+e_test_case_inner_do(E_Test_Case *tc)
+{
+   E_Test_Case *_tc;
+   Eina_List *l;
+   Eina_Bool pass;
+
+   pass == !!tc->inner_tcs;
+
+   EINA_LIST_FOREACH(tc->inner_tcs, l, _tc)
+     {
+        _tc->passed = (_tc->test(_tc) == _tc->expect);
+        printf("TEST \"%s\" : %s\n", _tc->name, _tc->passed?"PASS":"FAIL");
+        pass = pass && _tc->passed;
+
+        if ((!_tc->passed) && (_tc->is_stopper))
+          {
+             tc->is_stopper = EINA_TRUE;
+             break;
+          }
+     }
+
+   return pass;
+}
+
+EAPI Eina_Bool
+e_test_case_do(E_Test_Case *tc)
+{
+   Eina_Bool pass = EINA_FALSE;
+
+   pass = tc->test(tc);
+   tc->passed = (pass == tc->expect);
+
+   printf("TEST \"%s\" : %s\n", tc->name, tc->passed?"PASS":"FAIL");
+
+   if ((!tc->passed) && (tc->is_stopper))
+     return EINA_FALSE;
+
+   return EINA_TRUE;
+}
+
+EAPI_MAIN int
+elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
+{
+   E_Test_Case *tc, *in_tc;
+   Eina_List *l, *ll;
+   Eldbus_Signal_Handler *_sh;
+
+   if (!eldbus_init()) return -1;
+
+   /* connect to dbus */
+   dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
+   dbus_obj = eldbus_object_get(dbus_conn, BUS, PATH);
+   dbus_proxy = eldbus_proxy_get(dbus_obj, INTERFACE);
+
+   /* add basic signal handler */
+
+   /* make test case list */
+   ADD_TEST_CASE(0000_easy_pass, "Easy Pass", "Always passed", 1, 1);
+   ADD_TEST_CASE(0000_easy_fail, "Easy Fail", "Always failed", 0, 1);
+
+   ADD_TEST_CASE(0001_basic, "Basic", "Create basic window and do inner tcs after it shows completely", 1, 0);
+   ADD_INNER_TCS(0002_basic_stack, "Basic Stack", "Check stack of the window", 1, 0);
+
+   /* do test */
+   EINA_LIST_FOREACH(tcs, l, tc)
+     {
+        if (!e_test_case_do(tc))
+          break;
+     }
+
+   /* print test result */
+   _e_test_case_result_print();
+
+   /* shutdown */
+   EINA_LIST_FREE(tcs, tc)
+     {
+        EINA_LIST_FREE(tc->inner_tcs, in_tc)
+           E_FREE(in_tc);
+
+        E_FREE(tc);
+     }
+
+   EINA_LIST_FREE(signal_hdlrs, _sh)
+     {
+        eldbus_signal_handler_del(_sh);
+     }
+
+   eldbus_proxy_unref(dbus_proxy);
+   eldbus_object_unref(dbus_obj);
+   eldbus_connection_unref(dbus_conn);
+
+   eldbus_shutdown();
+
+   return 0;
+}
+ELM_MAIN()
diff --git a/src/e_test_case_main.h b/src/e_test_case_main.h
new file mode 100644 (file)
index 0000000..b870e3a
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef E_MOD_TEST_CASE_H
+#define E_MOD_TEST_CASE_H
+
+typedef struct _E_TC_Client E_TC_Client;
+typedef struct _E_Test_Case E_Test_Case;
+
+extern Eldbus_Connection *dbus_conn;
+extern Eldbus_Proxy *dbus_proxy;
+extern Eldbus_Object *dbus_obj;
+
+#define BUS "org.enlightenment.wm"
+#define PATH "/org/enlightenment/wm"
+#define INTERFACE "org.enlightenment.wm.Test"
+
+struct _E_Test_Case
+{
+   const char *name;
+   const char *desc;
+
+   Eina_Bool (*test) (E_Test_Case *tc);
+
+   Eina_Bool passed;
+   Eina_Bool expect;
+   Eina_Bool is_stopper;
+
+   Eina_List *inner_tcs;
+};
+
+struct _E_TC_Client
+{
+   const char *name;
+   int x, y, w, h;
+   int layer;
+   int visible;
+   int argb;
+   Ecore_Window win;
+};
+
+EAPI Eina_Bool e_test_case_inner_do(E_Test_Case *tc);
+EAPI Eina_Bool e_test_case_do(E_Test_Case *tc);
+
+/* test cases  */
+/* 0000 - 0099 */
+Eina_Bool test_case_0000_easy_pass(E_Test_Case *tc);
+Eina_Bool test_case_0000_easy_fail(E_Test_Case *tc);
+
+Eina_Bool test_case_0001_basic(E_Test_Case *tc);
+Eina_Bool test_case_0002_basic_stack(E_Test_Case *tc);
+
+/* 0100 - 0199 */
+/* 0200 - 0299 */
+/* 0300 - 9999 */
+
+/* end of test cases */
+
+#endif