From f5e777908c76151009f3016918584e8be2b51255 Mon Sep 17 00:00:00 2001 From: Rajeev Ranjan Date: Wed, 8 Sep 2010 20:53:34 +0900 Subject: [PATCH] [TC/elm_ts/button/Makefile, TC/elm_ts/button/tc_gen.sh, TC/elm_ts/button/tslist, TC/elm_ts/button/utc_MODULE_API_func.c.in, TC/elm_ts/button/utc_UIFW_elm_button_add_func.c (new files). TC/tet_scen_arm (modified files)] Added a sample test case for elm_button_add(). --- TC/elm_ts/button/Makefile | 24 ++++++ TC/elm_ts/button/tc_gen.sh | 32 ++++++++ TC/elm_ts/button/tslist | 2 + TC/elm_ts/button/utc_MODULE_API_func.c.in | 103 +++++++++++++++++++++++ TC/elm_ts/button/utc_UIFW_elm_button_add_func.c | 105 ++++++++++++++++++++++++ TC/tet_scen_arm | 1 + 6 files changed, 267 insertions(+) create mode 100755 TC/elm_ts/button/Makefile create mode 100755 TC/elm_ts/button/tc_gen.sh create mode 100644 TC/elm_ts/button/tslist create mode 100755 TC/elm_ts/button/utc_MODULE_API_func.c.in create mode 100644 TC/elm_ts/button/utc_UIFW_elm_button_add_func.c diff --git a/TC/elm_ts/button/Makefile b/TC/elm_ts/button/Makefile new file mode 100755 index 0000000..b98f48d --- /dev/null +++ b/TC/elm_ts/button/Makefile @@ -0,0 +1,24 @@ +CC ?= gcc + +TARGETS = uts_elm_button_add_func + +PKGS = elementary + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGET): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) + rm -f tet_captured + rm -f *~ diff --git a/TC/elm_ts/button/tc_gen.sh b/TC/elm_ts/button/tc_gen.sh new file mode 100755 index 0000000..a55200a --- /dev/null +++ b/TC/elm_ts/button/tc_gen.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 3 ]; then + echo "Usage) $SCRIPT module_name winset_name api_name" + exit 1 +fi + +MODULE=$1 +WINSET=$2 +API=$3 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi + +echo "/elm_ts/$WINSET/$TESTCASE" >> tslist + +echo "Testcase file is $TESTCASE.c" +echo "$TESTCASE is added to tslist" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" diff --git a/TC/elm_ts/button/tslist b/TC/elm_ts/button/tslist new file mode 100644 index 0000000..1b7bd27 --- /dev/null +++ b/TC/elm_ts/button/tslist @@ -0,0 +1,2 @@ +/elm_ts/imageslider/utc_UIFW_elm_imageslider_add_func +/elm_ts/button/utc_UIFW_elm_button_add_func diff --git a/TC/elm_ts/button/utc_MODULE_API_func.c.in b/TC/elm_ts/button/utc_MODULE_API_func.c.in new file mode 100755 index 0000000..710e5a1 --- /dev/null +++ b/TC/elm_ts/button/utc_MODULE_API_func.c.in @@ -0,0 +1,103 @@ +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (!r) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/elm_ts/button/utc_UIFW_elm_button_add_func.c b/TC/elm_ts/button/utc_UIFW_elm_button_add_func.c new file mode 100644 index 0000000..407f835 --- /dev/null +++ b/TC/elm_ts/button/utc_UIFW_elm_button_add_func.c @@ -0,0 +1,105 @@ +#include +#include + +// Definitions +// For checking the result of the positive test case. +#define TET_CHECK_PASS(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err == (x1)) \ + { \ + tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + +// For checking the result of the negative test case. +#define TET_CHECK_FAIL(x1, y...) \ +{ \ + Evas_Object *err = y; \ + if (err != (x1)) \ + { \ + tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \ + tet_result(TET_FAIL); \ + return; \ + } \ +} + + +Evas_Object *main_win; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_UIFW_elm_button_add_func_01(void); +static void utc_UIFW_elm_button_add_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_UIFW_elm_button_add_func_01, POSITIVE_TC_IDX }, + { utc_UIFW_elm_button_add_func_02, NEGATIVE_TC_IDX }, +}; + +static void startup(void) +{ + tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); + elm_init(0, NULL); + main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + evas_object_show(main_win); +} + +static void cleanup(void) +{ + if ( NULL != main_win ) { + evas_object_del(main_win); + main_win = NULL; + } + elm_shutdown(); + tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ "); +} + +/** + * @brief Positive test case of elm_button_add() + */ +static void utc_UIFW_elm_button_add_func_01(void) +{ + Evas_Object *button = NULL; + + button = elm_button_add(main_win); + if (!button) { + tet_infoline("elm_button_add() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + evas_object_del(button); + button = NULL; + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init elm_button_add() + */ +static void utc_UIFW_elm_button_add_func_02(void) +{ + Evas_Object *button = NULL; + + + button = elm_button_add(NULL); + + if (button) { + tet_infoline("elm_button_add() failed in negative test case"); + tet_result(TET_FAIL); + evas_object_del(button); + button = NULL; + return; + } + tet_result(TET_PASS); +} diff --git a/TC/tet_scen_arm b/TC/tet_scen_arm index 49057a8..fa79bf2 100755 --- a/TC/tet_scen_arm +++ b/TC/tet_scen_arm @@ -13,6 +13,7 @@ elm :include:/elm_ts/gengrid/tslist :include:/elm_ts/pagecontrol/tslist :include:/elm_ts/selectioninfo/tslist + :include:/elm_ts/button/tslist #yhkim -- 2.7.4