From e46ae5f98937834cd56eca5489fa2e3b83e66871 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 20 Oct 2016 18:13:40 +0900 Subject: [PATCH] Added autotest feature for isf-demo-efl Change-Id: I6acea1aa39c8fa8175a173158d59d88b8708264f --- ism/demos/Makefile.am | 3 +- ism/demos/autotest/autotest.sh | 55 +++++++ ism/demos/autotest/cmd_check_ime_visibility.sh | 7 + ism/demos/autotest/cmd_dump_ime_surface.sh | 14 ++ ism/demos/autotest/cmd_rotate_screen.sh | 6 + ism/demos/autotest/process_cmds.sh | 50 +++++++ ism/demos/include/isf_demo_autotest.h | 80 ++++++++++ ism/demos/isf_autocapital_efl.cpp | 154 +++++++++++++++++++ ism/demos/isf_demo_autotest.cpp | 170 +++++++++++++++++++++ ism/demos/isf_demo_efl.cpp | 165 +++++++++++++++++++++ ism/demos/isf_layout_efl.cpp | 198 +++++++++++++++++++++++++ ism/demos/isf_return_key_disable_efl.cpp | 172 +++++++++++++++++++++ 12 files changed, 1073 insertions(+), 1 deletion(-) create mode 100755 ism/demos/autotest/autotest.sh create mode 100755 ism/demos/autotest/cmd_check_ime_visibility.sh create mode 100755 ism/demos/autotest/cmd_dump_ime_surface.sh create mode 100755 ism/demos/autotest/cmd_rotate_screen.sh create mode 100755 ism/demos/autotest/process_cmds.sh create mode 100644 ism/demos/include/isf_demo_autotest.h create mode 100644 ism/demos/isf_demo_autotest.cpp diff --git a/ism/demos/Makefile.am b/ism/demos/Makefile.am index e96c8ff..e646b23 100644 --- a/ism/demos/Makefile.am +++ b/ism/demos/Makefile.am @@ -39,7 +39,8 @@ isf_demo_efl_SOURCES = isf_demo_efl.cpp \ isf_language_efl.cpp \ isf_ondemand_efl.cpp \ isf_input_hint_efl.cpp \ - isf_password_mode_efl.cpp + isf_password_mode_efl.cpp \ + isf_demo_autotest.cpp isf_demo_efl_CXXFLAGS = @ECOREX_CFLAGS@ \ @ELEMENTARY_CFLAGS@ \ diff --git a/ism/demos/autotest/autotest.sh b/ism/demos/autotest/autotest.sh new file mode 100755 index 0000000..1594ff5 --- /dev/null +++ b/ism/demos/autotest/autotest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +#set -x + +AUTOTEST_TAG="AUTOTEST" +LOG_TAG="$AUTOTEST_TAG:LOG:" +CMD_TAG="$AUTOTEST_TAG:CMD:" + +export AUTOTEST_PATH=${1:-$(pwd)} +export AUTOTEST_SDB_MODE=${2:-'-d'} +export AUTOTEST_PROFILE=${3:-'mobile'} + +export PROCESS_CMDS_SCRIPT="$AUTOTEST_PATH/process_cmds.sh" +export WORKSPACE_LINK_NAME="workspace" + +export AUTOTEST_RESULT_DIR="$AUTOTEST_PATH/result/$AUTOTEST_PROFILE" +export AUTOTEST_CURRENT_RESULT_DIR="$AUTOTEST_RESULT_DIR/current" +export AUTOTEST_PROPER_RESULT_DIR="$AUTOTEST_RESULT_DIR/proper" + +AUTOTEST_TARGET_PATH="/home/owner/autotest.sh" + +LOG_TAG_LEN=`echo $LOG_TAG | wc -c` +CMD_TAG_LEN=`echo $CMD_TAG | wc -c` + +function prepare() { + rm -rf $AUTOTEST_CURRENT_RESULT_DIR + mkdir -p $AUTOTEST_CURRENT_RESULT_DIR + mkdir -p $AUTOTEST_PROPER_RESULT_DIR + ln -s $AUTOTEST_CURRENT_RESULT_DIR $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + + sdb $AUTOTEST_SDB_MODE root on + sdb $AUTOTEST_SDB_MODE shell "echo 'isf-demo-efl /autotest 2>/dev/null' > $AUTOTEST_TARGET_PATH" +} + +function cleanup() { + rm $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME +} + +prepare + +while read -r line +do + AUTOTEST_LOG=`echo $line | grep $LOG_TAG | tr -d '\r'` + AUTOTEST_CMD=`echo $line | grep $CMD_TAG | tr -d '\r'` + if [[ ! -z $AUTOTEST_LOG ]]; then + LOG_MESSAGE=`echo $AUTOTEST_LOG | cut -c $LOG_TAG_LEN-` + echo "[LOG] : $LOG_MESSAGE" + fi + if [[ ! -z $AUTOTEST_CMD ]]; then + CMD_LINE=`echo $AUTOTEST_CMD | cut -c $CMD_TAG_LEN-` + echo "[CMD] : $CMD_LINE" + $PROCESS_CMDS_SCRIPT $CMD_LINE + fi +done < <(sdb $AUTOTEST_SDB_MODE shell "su - owner $AUTOTEST_TARGET_PATH" 2>&1) + +cleanup diff --git a/ism/demos/autotest/cmd_check_ime_visibility.sh b/ism/demos/autotest/cmd_check_ime_visibility.sh new file mode 100755 index 0000000..f27d2ba --- /dev/null +++ b/ism/demos/autotest/cmd_check_ime_visibility.sh @@ -0,0 +1,7 @@ +#!/bin/bash +#set -x + +NAME=$1 + +ISE_PID=`sdb $AUTOTEST_SDB_MODE shell ps -ef | grep ise | awk '{print $2}'` +sdb $AUTOTEST_SDB_MODE shell 'enlightenment_info -topvwins' | grep $ISE_PID | awk '{print $5 " " $6 " " $7 " " $8 " " $13}' > $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME/$NAME.topvwins diff --git a/ism/demos/autotest/cmd_dump_ime_surface.sh b/ism/demos/autotest/cmd_dump_ime_surface.sh new file mode 100755 index 0000000..be19ce3 --- /dev/null +++ b/ism/demos/autotest/cmd_dump_ime_surface.sh @@ -0,0 +1,14 @@ +#!/bin/bash +#set -x + +ISE_WIN_NAME="NAME" + +NAME=$1 + +ISE_PID=`sdb $AUTOTEST_SDB_MODE shell ps -ef | grep ise | awk '{print $2}'` +ISE_XID=`sdb $AUTOTEST_SDB_MODE shell 'enlightenment_info -topvwins' | grep $ISE_PID | grep $ISE_WIN_NAME | awk '{print $2}' | tr -d '\r'` +sdb $AUTOTEST_SDB_MODE shell 'rm -rf topvwins*' +sdb $AUTOTEST_SDB_MODE shell 'enlightenment_info -dump_topvwins > /dev/null' > /dev/null +DUMP_DIR=`sdb $AUTOTEST_SDB_MODE shell 'find / -maxdepth 1 -type d -name "topvwins*"' | tr -d '\r'` +sdb $AUTOTEST_SDB_MODE pull $DUMP_DIR/$ISE_XID.png $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME/$NAME.dumpwin.png > /dev/null +sdb $AUTOTEST_SDB_MODE shell 'rm -rf topvwins*' diff --git a/ism/demos/autotest/cmd_rotate_screen.sh b/ism/demos/autotest/cmd_rotate_screen.sh new file mode 100755 index 0000000..e822723 --- /dev/null +++ b/ism/demos/autotest/cmd_rotate_screen.sh @@ -0,0 +1,6 @@ +#!/bin/bash +#set -x + +ANGLE=$1 + +sdb $AUTOTEST_SDB_MODE shell "enlightenment_info -rotation set 0 $ANGLE" diff --git a/ism/demos/autotest/process_cmds.sh b/ism/demos/autotest/process_cmds.sh new file mode 100755 index 0000000..8fed25c --- /dev/null +++ b/ism/demos/autotest/process_cmds.sh @@ -0,0 +1,50 @@ +#!/bin/bash +#set -x + +function log() { + local NAME=$1 + local MESSAGE=$2 + echo "$MESSAGE" > $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME/$NAME.log +} + +function dump_ime_surface() { + $AUTOTEST_PATH/cmd_dump_ime_surface.sh $1 & +} + +function check_ime_visibility() { + $AUTOTEST_PATH/cmd_check_ime_visibility.sh $1 & +} + +function rotate_screen() { + $AUTOTEST_PATH/cmd_rotate_screen.sh $1 & +} + +CMD=`echo $1 | awk -F ':' '{print $1}'` +PARAM=`echo $1 | awk -F ':' '{$1="";print $0;}' | sed 's/ //g'` + +case "$CMD" in + LOG) + log $PARAM + ;; + ENTER_SUBITEM) + mkdir $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME/$PARAM + cd $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME/$PARAM + rm $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + ln -s `pwd -P` $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + ;; + LEAVE_SUBITEM) + cd $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + cd -P .. + rm $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + ln -s `pwd -P` $AUTOTEST_CURRENT_RESULT_DIR/$WORKSPACE_LINK_NAME + ;; + DUMP_IME_SURFACE) + dump_ime_surface $PARAM + ;; + CHECK_IME_VISIBILITY) + check_ime_visibility $PARAM + ;; + ROTATE_SCREEN) + rotate_screen $PARAM + ;; +esac diff --git a/ism/demos/include/isf_demo_autotest.h b/ism/demos/include/isf_demo_autotest.h new file mode 100644 index 0000000..a62f7fa --- /dev/null +++ b/ism/demos/include/isf_demo_autotest.h @@ -0,0 +1,80 @@ +/* + * ISF(Input Service Framework) + * + * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. + * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd. + * + * Contact: Shuo Liu , Jihoon Kim + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __ISF_DEMO_AUTOTEST_H +#define __ISF_DEMO_AUTOTEST_H + +#include +#include +#include "isf_demo_efl.h" + +#define AUTOTEST_DEFAULT_PAUSE 1000 // default pause : 1 sec + +enum _autotest_cmd { + _autotest_cmd_log, + _autotest_cmd_enter_subitem, + _autotest_cmd_leave_subitem, + _autotest_cmd_dump_ime_surface, + _autotest_cmd_check_ime_visibility, + _autotest_cmd_rotate_screen, + + _autotest_cmd_num +}; + +typedef int (*autotest_test_fn)(void *data); +typedef int (*autotest_command_fn)(void *data); + +struct _autotest_item { + _autotest_item() : + test_func(NULL), + verify_func(NULL), + param(NULL), + pause_before_test(AUTOTEST_DEFAULT_PAUSE), + pause_before_command(AUTOTEST_DEFAULT_PAUSE) + { + } + + autotest_test_fn test_func; + autotest_command_fn verify_func; + void *param; + unsigned int pause_before_test; + unsigned int pause_before_command; +}; + +typedef std::vector<_autotest_item> _autotest_list; + +void isf_demo_autotest_item_add(_autotest_list& list, _autotest_item& item); +void isf_demo_autotest_list_push(const char *name, _autotest_list& list); +void isf_demo_autotest_list_pop(); + +void isf_demo_autotest_run(); + +void isf_demo_autotest_log(const char *fmt, ...); +void isf_demo_autotest_cmd(_autotest_cmd cmd, const char *fmt, ...); + +#endif /* __ISF_DEMO_AUTOTEST_H */ + +/* +vi:ts=4:ai:nowrap:expandtab +*/ diff --git a/ism/demos/isf_autocapital_efl.cpp b/ism/demos/isf_autocapital_efl.cpp index 7f81e12..e88b33f 100644 --- a/ism/demos/isf_autocapital_efl.cpp +++ b/ism/demos/isf_autocapital_efl.cpp @@ -24,6 +24,15 @@ #include "isf_demo_efl.h" #include "isf_autocapital_efl.h" +#include "isf_demo_autotest.h" + +#include +#include +#include + +static _autotest_list autotest_autocapital_list; +static void autotest_add_demo_autocapital(struct appdata *ad); +static std::vector _autocapital_entries; struct _menu_item { const char *name; @@ -59,6 +68,8 @@ static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, c ecore_imf_context_input_panel_caps_lock_mode_set (ic, caps_lock_mode); } + _autocapital_entries.push_back(en); + return ef; } @@ -88,6 +99,149 @@ void ise_autocapital_bt (void *data, Evas_Object *obj, void *event_info) { Evas_Object *lay_inner = create_inner_layout (data); add_layout_to_naviframe (data, lay_inner, _("Autocapital")); + + autotest_add_demo_autocapital((struct appdata *)data); +} + +enum autotest_autocapital_cmd { + autotest_autocapital_cmd_exit, + autotest_autocapital_cmd_focus_in, + autotest_autocapital_cmd_input_character, + autotest_autocapital_cmd_input_word, + autotest_autocapital_cmd_input_sentence, + autotest_autocapital_cmd_focus_out, +}; + +struct autotest_autocapital_param { + std::string name; + struct appdata *ad; + autotest_autocapital_cmd cmd; + int index; +}; + +int autotest_autocapital_test_func(void *param) +{ + struct autotest_autocapital_param *autocapital_param = (struct autotest_autocapital_param *)param; + if (autocapital_param) { + switch (autocapital_param->cmd) { + case autotest_autocapital_cmd_exit: + isf_demo_autotest_log("Exiting autotest_autocapital"); + elm_naviframe_item_pop(autocapital_param->ad->naviframe); + break; + case autotest_autocapital_cmd_focus_in: + isf_demo_autotest_log("Testing focus in : %s", autocapital_param->name.c_str()); + elm_object_focus_set(_autocapital_entries.at(autocapital_param->index), EINA_TRUE); + break; + case autotest_autocapital_cmd_input_character: + isf_demo_autotest_log("Testing input character : %s", autocapital_param->name.c_str()); + elm_entry_entry_set(_autocapital_entries.at(autocapital_param->index), "I"); + elm_entry_cursor_pos_set(_autocapital_entries.at(autocapital_param->index), + strlen(elm_entry_entry_get(_autocapital_entries.at(autocapital_param->index)))); + break; + case autotest_autocapital_cmd_input_word: + isf_demo_autotest_log("Testing input word : %s", autocapital_param->name.c_str()); + elm_entry_entry_set(_autocapital_entries.at(autocapital_param->index), "Boy "); + elm_entry_cursor_pos_set(_autocapital_entries.at(autocapital_param->index), + strlen(elm_entry_entry_get(_autocapital_entries.at(autocapital_param->index)))); + break; + case autotest_autocapital_cmd_input_sentence: + isf_demo_autotest_log("Testing input sentence : %s", autocapital_param->name.c_str()); + elm_entry_entry_set(_autocapital_entries.at(autocapital_param->index), "I am a boy. "); + elm_entry_cursor_pos_set(_autocapital_entries.at(autocapital_param->index), + strlen(elm_entry_entry_get(_autocapital_entries.at(autocapital_param->index)))); + break; + case autotest_autocapital_cmd_focus_out: + isf_demo_autotest_log("Testing focus out : %s", autocapital_param->name.c_str()); + elm_object_focus_set(_autocapital_entries.at(autocapital_param->index), EINA_FALSE); + break; + } + } + return 0; +} + +int autotest_autocapital_verify_func(void *param) +{ + struct autotest_autocapital_param *autocapital_param = (struct autotest_autocapital_param *)param; + if (autocapital_param) { + switch (autocapital_param->cmd) { + case autotest_autocapital_cmd_input_character: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", autocapital_param->name.c_str()); + break; + case autotest_autocapital_cmd_input_word: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", autocapital_param->name.c_str()); + break; + case autotest_autocapital_cmd_input_sentence: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", autocapital_param->name.c_str()); + break; + } + } +} + +void autotest_add_demo_autocapital(struct appdata *ad) +{ + int loop; + _autotest_item item; + item.test_func = autotest_autocapital_test_func; + item.verify_func = autotest_autocapital_verify_func; + + const int TYPE_NUM = (sizeof(_menu_its) / sizeof(_menu_its[0])) - 1; + + /* Focus IN / OUT test for each autocapitals */ + static autotest_autocapital_param param_focus_in[TYPE_NUM]; + static autotest_autocapital_param param_input_character[TYPE_NUM]; + static autotest_autocapital_param param_input_word[TYPE_NUM]; + static autotest_autocapital_param param_input_sentence[TYPE_NUM]; + static autotest_autocapital_param param_focus_out[TYPE_NUM]; + + for (loop = 0;loop < TYPE_NUM;loop++) { + param_focus_in[loop].ad = ad; + param_focus_in[loop].index = loop; + param_focus_in[loop].cmd = autotest_autocapital_cmd_focus_in; + param_focus_in[loop].name = std::string("Focus in ") + _menu_its[loop].name; + std::replace(param_focus_in[loop].name.begin(), param_focus_in[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_focus_in[loop]); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + + param_input_character[loop].ad = ad; + param_input_character[loop].index = loop; + param_input_character[loop].cmd = autotest_autocapital_cmd_input_character; + param_input_character[loop].name = std::string("Input character ") + _menu_its[loop].name; + std::replace(param_input_character[loop].name.begin(), param_input_character[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_input_character[loop]); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + + param_input_word[loop].ad = ad; + param_input_word[loop].index = loop; + param_input_word[loop].cmd = autotest_autocapital_cmd_input_word; + param_input_word[loop].name = std::string("Input word ") + _menu_its[loop].name; + std::replace(param_input_word[loop].name.begin(), param_input_word[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_input_word[loop]); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + + param_input_sentence[loop].ad = ad; + param_input_sentence[loop].index = loop; + param_input_sentence[loop].cmd = autotest_autocapital_cmd_input_sentence; + param_input_sentence[loop].name = std::string("Input sentence ") + _menu_its[loop].name; + std::replace(param_input_sentence[loop].name.begin(), param_input_sentence[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_input_sentence[loop]); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + + param_focus_out[loop].ad = ad; + param_focus_out[loop].index = loop; + param_focus_out[loop].cmd = autotest_autocapital_cmd_focus_out; + param_focus_out[loop].name = std::string("Focus out ") + _menu_its[loop].name; + std::replace(param_focus_out[loop].name.begin(), param_focus_out[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_focus_out[loop]); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + } + + static autotest_autocapital_param param_exit; + param_exit.ad = ad; + param_exit.cmd = autotest_autocapital_cmd_exit; + item.param = (void*)(¶m_exit); + isf_demo_autotest_item_add(autotest_autocapital_list, item); + + isf_demo_autotest_list_push("AUTOCAPITAL", autotest_autocapital_list); } /* diff --git a/ism/demos/isf_demo_autotest.cpp b/ism/demos/isf_demo_autotest.cpp new file mode 100644 index 0000000..f76fe99 --- /dev/null +++ b/ism/demos/isf_demo_autotest.cpp @@ -0,0 +1,170 @@ +/* + * ISF(Input Service Framework) + * + * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. + * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd. + * + * Contact: Shuo Liu , Jihoon Kim + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "isf_demo_autotest.h" +#include +#include +#include +#include +#include +#include + +using namespace std; + +#define AUTOTEST_TIMER_INTERVAL 0.05f + +enum _autotest_list_running_state { + _autotest_list_running_pause_before_test, + _autotest_list_running_test_func, + _autotest_list_running_pause_before_command, + _autotest_list_running_verify_func, +}; + +struct _autotest_list_running_info { + _autotest_list_running_state state; + _autotest_list list; + int index; + int counter; +}; + +static const char *_autotest_cmd_string[_autotest_cmd_num] = { + "LOG", + "ENTER_SUBITEM", + "LEAVE_SUBITEM", + "DUMP_IME_SURFACE", + "CHECK_IME_VISIBILITY", + "ROTATE_SCREEN", +}; + +static list<_autotest_list_running_info> _autotest_info_stack; + +static Ecore_Timer *_autotest_timer = NULL; + +static Eina_Bool _isf_autotest_timer_cb (void *data) +{ + if (_autotest_info_stack.empty()) { + if (_autotest_timer != NULL) { + ecore_timer_del(_autotest_timer); + _autotest_timer = NULL; + } + return ECORE_CALLBACK_CANCEL; + } else { + _autotest_list_running_info &info = _autotest_info_stack.front(); + if (info.index >= info.list.size()) { + isf_demo_autotest_list_pop(); + } else { + switch(info.state) { + case _autotest_list_running_pause_before_test: + if (AUTOTEST_TIMER_INTERVAL * 1000 * info.counter++ >= info.list.at(info.index).pause_before_test) { + info.state = _autotest_list_running_test_func; + info.counter = 0; + } + break; + case _autotest_list_running_test_func: + info.list.at(info.index).test_func(info.list.at(info.index).param); + info.state = _autotest_list_running_pause_before_command; + info.counter = 0; + break; + case _autotest_list_running_pause_before_command: + if (AUTOTEST_TIMER_INTERVAL * 1000 * info.counter++ >= info.list.at(info.index).pause_before_command) { + info.state = _autotest_list_running_verify_func; + info.counter = 0; + } + break; + case _autotest_list_running_verify_func: + if (info.list.at(info.index).verify_func) { + info.list.at(info.index).verify_func(info.list.at(info.index).param); + } + info.state = _autotest_list_running_pause_before_test; + info.counter = 0; + info.index++; + break; + } + } + } + return ECORE_CALLBACK_RENEW; +} + +void isf_demo_autotest_item_add(_autotest_list& list, _autotest_item& item) +{ + list.push_back(item); +} + +void isf_demo_autotest_list_push(const char *name, _autotest_list& list) +{ + _autotest_list_running_info info; + info.list = list; + info.counter = 0; + info.index = 0; + info.state = _autotest_list_running_pause_before_test; + + _autotest_info_stack.push_front(info); + + isf_demo_autotest_cmd(_autotest_cmd_enter_subitem, "%s", name); +} + +void isf_demo_autotest_list_pop() +{ + isf_demo_autotest_cmd(_autotest_cmd_leave_subitem, ""); + _autotest_info_stack.pop_front(); + if (_autotest_info_stack.size() == 0) { + ecore_timer_del(_autotest_timer); + _autotest_timer = NULL; + } +} + +void isf_demo_autotest_run() +{ + if (_autotest_timer == NULL) { + _autotest_timer = ecore_timer_add(AUTOTEST_TIMER_INTERVAL, _isf_autotest_timer_cb, NULL); + } +} + +void isf_demo_autotest_log(const char *fmt, ...) +{ + printf("AUTOTEST:LOG:"); + va_list args; + va_start(args, fmt); + vprintf(fmt, args); + printf("\n"); + fflush(NULL); + va_end(args); +} + +void isf_demo_autotest_cmd(_autotest_cmd cmd, const char *fmt, ...) +{ + if (cmd >= 0 && cmd < _autotest_cmd_num) { + printf("AUTOTEST:CMD:%s:", _autotest_cmd_string[cmd]); + va_list args; + va_start(args, fmt); + vprintf(fmt, args); + printf("\n"); + fflush(NULL); + va_end(args); + } +} + +/* +vi:ts=4:ai:nowrap:expandtab +*/ diff --git a/ism/demos/isf_demo_efl.cpp b/ism/demos/isf_demo_efl.cpp index 44d0468..fc3cf7e 100644 --- a/ism/demos/isf_demo_efl.cpp +++ b/ism/demos/isf_demo_efl.cpp @@ -45,12 +45,23 @@ #include "isf_ondemand_efl.h" #include "isf_input_hint_efl.h" #include "isf_password_mode_efl.h" +#include "isf_demo_autotest.h" + +#include +#include struct _menu_item { const char *name; void (*func)(void *data, Evas_Object *obj, void *event_info); }; +#define AUTOTEST_RUN_PARAMETER "/autotest" +static bool _autotest_enabled = false; + +static _autotest_list autotest_demo_list; +static void autotest_add_demo(struct appdata *ad); +static Evas_Object *_popup_test_win = NULL; + static void isf_popup_bt (void *data, Evas_Object *obj, void *event_info); static struct _menu_item isf_demo_menu_its[] = { @@ -124,6 +135,7 @@ static void isf_popup_bt (void *data, Evas_Object *obj, void *event_info) elm_object_content_set (conformant, bx); evas_object_show(win); + _popup_test_win = win; } static void _quit_cb (void *data, Evas_Object *obj, void *event_info) @@ -390,6 +402,11 @@ static int app_create (void *data) appcore_measure_time (); + autotest_add_demo(ad); + if (_autotest_enabled) { + isf_demo_autotest_run(); + } + return 0; } @@ -456,6 +473,12 @@ EXAPI int main (int argc, char *argv[]) memset (&ad, 0x0, sizeof (struct appdata)); ops.data = &ad; + for (int loop = 0;loop < argc;loop++) { + if (strcmp(argv[loop], AUTOTEST_RUN_PARAMETER) == 0) { + _autotest_enabled = true; + } + } + try { ret = appcore_efl_main ("isf-demo-efl", &argc, &argv, &ops); } catch (...) { @@ -557,6 +580,148 @@ Elm_Object_Item *add_layout_to_naviframe (void *data, Evas_Object *lay_in, const return naviframe_item_push (ad->naviframe, title, back_btn, scroller); } +enum autotest_demo_cmd { + autotest_demo_cmd_exit, + autotest_demo_cmd_open, + autotest_demo_cmd_click, +}; + +struct autotest_demo_param { + std::string name; + struct appdata *ad; + autotest_demo_cmd cmd; + int index; +}; + +int autotest_demo_verify_func(void *param) +{ + autotest_demo_param *demo_param = (autotest_demo_param*)param; + if (demo_param) { + switch (demo_param->cmd) { + case autotest_demo_cmd_click: + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", demo_param->name.c_str()); + break; + } + } +} + +int autotest_demo_test_func(void *param) +{ + autotest_demo_param *demo_param = (autotest_demo_param*)param; + if (demo_param) { + isf_demo_autotest_log("Executing Demo item : %s\n", demo_param->name.c_str()); + switch (demo_param->cmd) { + case autotest_demo_cmd_open: + isf_demo_menu_its[demo_param->index].func(demo_param->ad, NULL, NULL); + break; + case autotest_demo_cmd_click: + close_btn_cb(_popup_test_win, NULL, NULL); + break; + case autotest_demo_cmd_exit: + elm_exit(); + break; + } + } + return 0; +} + +int find_menu_item_index(const char *name) +{ + for (int loop = 0;loop < (sizeof(isf_demo_menu_its) / sizeof(_menu_item));loop++) { + if (name && isf_demo_menu_its[loop].name) { + if (strcmp(isf_demo_menu_its[loop].name, name) == 0) { + return loop; + } + } + } + return -1; +} + +void autotest_add_demo(struct appdata *ad) +{ + _autotest_item item; + int item_index; + const char *item_name; + + item.test_func = autotest_demo_test_func; + item.verify_func = autotest_demo_verify_func; + + item_name = "ISF Layout"; + item_index = find_menu_item_index(item_name); + if (item_index != -1) { + static autotest_demo_param param_layout; + param_layout.name = item_name; + param_layout.ad = ad; + param_layout.cmd = autotest_demo_cmd_open; + param_layout.index = item_index; + item.param = (void*)(¶m_layout); + isf_demo_autotest_item_add(autotest_demo_list, item); + isf_demo_autotest_log("Added %s %d", item_name, item_index); + } else { + isf_demo_autotest_log("[[ ERROR : Could not find item with name %s]]", item_name); + } + + item_name = "ISF Autocapital"; + item_index = find_menu_item_index(item_name); + if (item_index != -1) { + static autotest_demo_param param_autocapital; + param_autocapital.name = item_name; + param_autocapital.ad = ad; + param_autocapital.cmd = autotest_demo_cmd_open; + param_autocapital.index = item_index; + item.param = (void*)(¶m_autocapital); + isf_demo_autotest_item_add(autotest_demo_list, item); + } else { + isf_demo_autotest_log("[[ ERROR : Could not find item with name %s]]", item_name); + } + + item_name = "ISF Return Key Disable"; + item_index = find_menu_item_index(item_name); + if (item_index != -1) { + static autotest_demo_param param_return_key_disable; + param_return_key_disable.name = item_name; + param_return_key_disable.ad = ad; + param_return_key_disable.cmd = autotest_demo_cmd_open; + param_return_key_disable.index = item_index; + item.param = (void*)(¶m_return_key_disable); + isf_demo_autotest_item_add(autotest_demo_list, item); + } else { + isf_demo_autotest_log("[[ ERROR : Could not find item with name %s]]", item_name); + } + + item_name = "ISF Popup test"; + item_index = find_menu_item_index(item_name); + if (item_index != -1) { + static autotest_demo_param param_popup_test; + param_popup_test.name = item_name; + param_popup_test.ad = ad; + param_popup_test.cmd = autotest_demo_cmd_open; + param_popup_test.index = item_index; + item.param = (void*)(¶m_popup_test); + std::replace(param_popup_test.name.begin(), param_popup_test.name.end(), ' ', '_'); + isf_demo_autotest_item_add(autotest_demo_list, item); + + static autotest_demo_param param_popup_test_close; + param_popup_test_close.name = item_name; + param_popup_test_close.ad = ad; + param_popup_test_close.cmd = autotest_demo_cmd_click; + param_popup_test_close.index = item_index; + item.param = (void*)(¶m_popup_test_close); + std::replace(param_popup_test_close.name.begin(), param_popup_test_close.name.end(), ' ', '_'); + isf_demo_autotest_item_add(autotest_demo_list, item); + } else { + isf_demo_autotest_log("[[ ERROR : Could not find item with name %s]]", item_name); + } + + static autotest_demo_param param_exit; + param_exit.name = "Exit"; + param_exit.cmd = autotest_demo_cmd_exit; + item.param = (void*)(¶m_exit); + isf_demo_autotest_item_add(autotest_demo_list, item); + + isf_demo_autotest_list_push("DEMO", autotest_demo_list); +} + /* vi:ts=4:ai:nowrap:expandtab */ diff --git a/ism/demos/isf_layout_efl.cpp b/ism/demos/isf_layout_efl.cpp index fd51d84..08207b7 100644 --- a/ism/demos/isf_layout_efl.cpp +++ b/ism/demos/isf_layout_efl.cpp @@ -24,10 +24,19 @@ #include "isf_demo_efl.h" #include "isf_layout_efl.h" +#include "isf_demo_autotest.h" #ifndef WAYLAND #include #endif +#include +#include +#include + +static _autotest_list autotest_layout_list; +static void autotest_add_demo_layout(struct appdata *ad); +static std::vector _layout_entries; + struct _menu_item { const char *name; const char *guide_text; @@ -236,6 +245,8 @@ static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, c ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, _candidate_panel_geometry_changed_cb, NULL); } + _layout_entries.push_back(en); + return ef; } @@ -263,6 +274,7 @@ static Evas_Object * create_inner_layout (void *data) evas_object_size_hint_align_set (bx, EVAS_HINT_FILL, 0.0); evas_object_show (bx); + _layout_entries.clear(); while (_menu_its[idx].name != NULL) { ef = _create_ef_layout (parent, _menu_its[idx].name, _menu_its[idx].guide_text, _menu_its[idx].layout, _menu_its[idx].layout_variation); elm_box_pack_end (bx, ef); @@ -294,6 +306,192 @@ void ise_layout_bt (void *data, Evas_Object *obj, void *event_info) { Evas_Object *lay_inner = create_inner_layout (data); add_layout_to_naviframe (data, lay_inner, _("Layout")); + + autotest_add_demo_layout((struct appdata *)data); +} + +enum autotest_layout_cmd { + autotest_layout_cmd_exit, + autotest_layout_cmd_focus_in, + autotest_layout_cmd_rotate_portrait, + autotest_layout_cmd_rotate_landscape, + autotest_layout_cmd_focus_out, + autotest_layout_cmd_focus_repeat, +}; + +struct autotest_layout_param { + std::string name; + struct appdata *ad; + autotest_layout_cmd cmd; + int index; +}; + +int autotest_layout_test_func(void *param) +{ + struct autotest_layout_param *layout_param = (struct autotest_layout_param *)param; + if (layout_param) { + switch (layout_param->cmd) { + case autotest_layout_cmd_exit: + isf_demo_autotest_log("Exiting autotest_layout"); + elm_naviframe_item_pop(layout_param->ad->naviframe); + break; + case autotest_layout_cmd_focus_in: + isf_demo_autotest_log("Testing focus in : %s", layout_param->name.c_str()); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_TRUE); + break; + case autotest_layout_cmd_rotate_portrait: + isf_demo_autotest_log("Testing rotate to portrait : %s", layout_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_rotate_screen, "%d", 0); + break; + case autotest_layout_cmd_rotate_landscape: + isf_demo_autotest_log("Testing rotate to landscape : %s", layout_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_rotate_screen, "%d", 270); + break; + case autotest_layout_cmd_focus_out: + isf_demo_autotest_log("Testing focus out : %s", layout_param->name.c_str()); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_FALSE); + break; + case autotest_layout_cmd_focus_repeat: + isf_demo_autotest_log("Testing focus repeat : %s", layout_param->name.c_str()); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_FALSE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_TRUE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_FALSE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_TRUE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_FALSE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_TRUE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_FALSE); + elm_object_focus_set(_layout_entries.at(layout_param->index), EINA_TRUE); + break; + } + } + return 0; +} + +int autotest_layout_verify_func(void *param) +{ + struct autotest_layout_param *layout_param = (struct autotest_layout_param *)param; + if (layout_param) { + switch (layout_param->cmd) { + case autotest_layout_cmd_focus_in: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", layout_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", layout_param->name.c_str()); + break; + case autotest_layout_cmd_rotate_landscape: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", layout_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", layout_param->name.c_str()); + break; + case autotest_layout_cmd_focus_out: + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", layout_param->name.c_str()); + break; + case autotest_layout_cmd_focus_repeat: + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", layout_param->name.c_str()); + break; + } + } +} + +void autotest_add_demo_layout(struct appdata *ad) +{ + int loop; + _autotest_item item; + item.test_func = autotest_layout_test_func; + item.verify_func = autotest_layout_verify_func; + + const int LAYOUT_NUM = (sizeof(_menu_its) / sizeof(_menu_its[0])) - 1; + + /* Focus IN / OUT test for each layouts */ + static autotest_layout_param param_focus_in[LAYOUT_NUM]; + static autotest_layout_param param_rotate_landscape[LAYOUT_NUM]; + static autotest_layout_param param_rotate_portrait[LAYOUT_NUM]; + static autotest_layout_param param_focus_out[LAYOUT_NUM]; + + for (loop = 0;loop < LAYOUT_NUM;loop++) { + param_focus_in[loop].ad = ad; + param_focus_in[loop].index = loop; + param_focus_in[loop].cmd = autotest_layout_cmd_focus_in; + param_focus_in[loop].name = std::string("Focus in ") + _menu_its[loop].name; + std::replace(param_focus_in[loop].name.begin(), param_focus_in[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_focus_in[loop]); + isf_demo_autotest_item_add(autotest_layout_list, item); + + item.pause_before_command = 3000; // Rotation takes a little time to complete + param_rotate_landscape[loop].ad = ad; + param_rotate_landscape[loop].index = loop; + param_rotate_landscape[loop].cmd = autotest_layout_cmd_rotate_landscape; + param_rotate_landscape[loop].name = std::string("Rotating landscape ") + _menu_its[loop].name; + std::replace(param_rotate_landscape[loop].name.begin(), param_rotate_landscape[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_rotate_landscape[loop]); + isf_demo_autotest_item_add(autotest_layout_list, item); + + item.verify_func = NULL; // No need for verifying command when rotating back to portrait + param_rotate_portrait[loop].ad = ad; + param_rotate_portrait[loop].index = loop; + param_rotate_portrait[loop].cmd = autotest_layout_cmd_rotate_portrait; + param_rotate_portrait[loop].name = std::string("Rotating portrait") + _menu_its[loop].name; + std::replace(param_rotate_portrait[loop].name.begin(), param_rotate_portrait[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_rotate_portrait[loop]); + isf_demo_autotest_item_add(autotest_layout_list, item); + item.verify_func = autotest_layout_verify_func; + item.pause_before_command = AUTOTEST_DEFAULT_PAUSE; // Reset pause interval + + param_focus_out[loop].ad = ad; + param_focus_out[loop].index = loop; + param_focus_out[loop].cmd = autotest_layout_cmd_focus_out; + param_focus_out[loop].name = std::string("Focus out ") + _menu_its[loop].name; + std::replace(param_focus_out[loop].name.begin(), param_focus_out[loop].name.end(), ' ', '_'); + item.param = (void*)(¶m_focus_out[loop]); + isf_demo_autotest_item_add(autotest_layout_list, item); + } + + /* Focus IN / OUT repeat test with short interval for entry 0 */ + static autotest_layout_param param_repeat_focus_in; + static autotest_layout_param param_repeat_focus_out; + + param_repeat_focus_in.ad = ad; + param_repeat_focus_in.index = 0; + param_repeat_focus_in.cmd = autotest_layout_cmd_focus_in; + param_repeat_focus_in.name = "Repeat_focus_in"; + + param_repeat_focus_out.ad = ad; + param_repeat_focus_out.index = 0; + param_repeat_focus_out.cmd = autotest_layout_cmd_focus_out; + param_repeat_focus_out.name = "Repeat_focus_out"; + + item.verify_func = NULL; // No commands needed when repeat focus in / out + item.pause_before_test = 0; + item.pause_before_command = 0; + for (loop = 0;loop < 5;loop++) { + item.param = (void*)(¶m_repeat_focus_in); + isf_demo_autotest_item_add(autotest_layout_list, item); + + item.param = (void*)(¶m_repeat_focus_out); + isf_demo_autotest_item_add(autotest_layout_list, item); + } + + item.verify_func = autotest_layout_verify_func; // Verify when repeat focus in / out finished + + item.param = (void*)(¶m_repeat_focus_in); + isf_demo_autotest_item_add(autotest_layout_list, item); + + item.pause_before_test = AUTOTEST_DEFAULT_PAUSE; + item.pause_before_command = AUTOTEST_DEFAULT_PAUSE; + + /* Focus IN / OUT repeat test with no interval for entry 0 */ + static autotest_layout_param param_focus_repeat; + param_focus_repeat.ad = ad; + param_focus_repeat.index = 1; + param_focus_repeat.cmd = autotest_layout_cmd_focus_repeat; + param_focus_repeat.name = "Repeat_focus"; + item.param = (void*)(¶m_focus_repeat); + isf_demo_autotest_item_add(autotest_layout_list, item); + + static autotest_layout_param param_exit; + param_exit.ad = ad; + param_exit.cmd = autotest_layout_cmd_exit; + item.param = (void*)(¶m_exit); + isf_demo_autotest_item_add(autotest_layout_list, item); + + isf_demo_autotest_list_push("LAYOUT", autotest_layout_list); } /* diff --git a/ism/demos/isf_return_key_disable_efl.cpp b/ism/demos/isf_return_key_disable_efl.cpp index 99d6529..fc54b23 100644 --- a/ism/demos/isf_return_key_disable_efl.cpp +++ b/ism/demos/isf_return_key_disable_efl.cpp @@ -24,6 +24,16 @@ #include "isf_demo_efl.h" #include "isf_return_key_disable_efl.h" +#include "isf_demo_autotest.h" + +#include +#include +#include + +static _autotest_list autotest_return_key_disable_list; +static void autotest_add_demo_return_key_disable(struct appdata *ad); +static std::vector _return_key_disable_entries; +static std::vector _return_key_disable_titles; static void _cursor_changed_cb (void *data, Evas_Object *obj, void *event_info) @@ -52,6 +62,9 @@ static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, c evas_object_smart_callback_add (en, "cursor,changed", _cursor_changed_cb, NULL); evas_object_smart_callback_add (en, "focused", _cursor_changed_cb, NULL); + _return_key_disable_entries.push_back(en); + _return_key_disable_titles.push_back(label); + return ef; } @@ -88,6 +101,165 @@ void ise_return_key_disable_bt (void *data, Evas_Object *obj, void *event_info) { Evas_Object *lay_inner = create_inner_layout (data); add_layout_to_naviframe (data, lay_inner, _("Return Key Disable")); + + autotest_add_demo_return_key_disable((struct appdata *)data); +} + +enum autotest_return_key_disable_cmd { + autotest_return_key_disable_cmd_exit, + autotest_return_key_disable_cmd_focus_in, + autotest_return_key_disable_cmd_rotate_portrait, + autotest_return_key_disable_cmd_input_character, + autotest_return_key_disable_cmd_rotate_landscape, + autotest_return_key_disable_cmd_focus_out, +}; + +struct autotest_return_key_disable_param { + std::string name; + struct appdata *ad; + autotest_return_key_disable_cmd cmd; + int index; +}; + +int autotest_return_key_disable_test_func(void *param) +{ + struct autotest_return_key_disable_param *return_key_disable_param = (struct autotest_return_key_disable_param *)param; + if (return_key_disable_param) { + switch (return_key_disable_param->cmd) { + case autotest_return_key_disable_cmd_exit: + isf_demo_autotest_log("Exiting autotest_return_key_disable"); + elm_naviframe_item_pop(return_key_disable_param->ad->naviframe); + break; + case autotest_return_key_disable_cmd_focus_in: + isf_demo_autotest_log("Testing focus in : %s", return_key_disable_param->name.c_str()); + elm_object_focus_set(_return_key_disable_entries.at(return_key_disable_param->index), EINA_TRUE); + break; + case autotest_return_key_disable_cmd_rotate_portrait: + isf_demo_autotest_log("Testing rotate to portrait : %s", return_key_disable_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_rotate_screen, "%d", 0); + break; + case autotest_return_key_disable_cmd_input_character: + isf_demo_autotest_log("Testing input character : %s", return_key_disable_param->name.c_str()); + elm_entry_entry_set(_return_key_disable_entries.at(return_key_disable_param->index), "A"); + elm_entry_cursor_pos_set(_return_key_disable_entries.at(return_key_disable_param->index), + strlen(elm_entry_entry_get(_return_key_disable_entries.at(return_key_disable_param->index)))); + break; + case autotest_return_key_disable_cmd_rotate_landscape: + isf_demo_autotest_log("Testing rotate to landscape : %s", return_key_disable_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_rotate_screen, "%d", 270); + break; + case autotest_return_key_disable_cmd_focus_out: + isf_demo_autotest_log("Testing focus out : %s", return_key_disable_param->name.c_str()); + elm_object_focus_set(_return_key_disable_entries.at(return_key_disable_param->index), EINA_FALSE); + break; + } + } + return 0; +} + +int autotest_return_key_disable_verify_func(void *param) +{ + struct autotest_return_key_disable_param *return_key_disable_param = (struct autotest_return_key_disable_param *)param; + if (return_key_disable_param) { + switch (return_key_disable_param->cmd) { + case autotest_return_key_disable_cmd_focus_in: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", return_key_disable_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", return_key_disable_param->name.c_str()); + break; + case autotest_return_key_disable_cmd_rotate_landscape: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", return_key_disable_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", return_key_disable_param->name.c_str()); + break; + case autotest_return_key_disable_cmd_input_character: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", return_key_disable_param->name.c_str()); + break; + case autotest_return_key_disable_cmd_rotate_portrait: + isf_demo_autotest_cmd(_autotest_cmd_dump_ime_surface, "%s", return_key_disable_param->name.c_str()); + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", return_key_disable_param->name.c_str()); + break; + case autotest_return_key_disable_cmd_focus_out: + isf_demo_autotest_cmd(_autotest_cmd_check_ime_visibility, "%s", return_key_disable_param->name.c_str()); + break; + } + } +} + +void autotest_add_demo_return_key_disable(struct appdata *ad) +{ + int i,j; + _autotest_item item; + item.test_func = autotest_return_key_disable_test_func; + item.verify_func = autotest_return_key_disable_verify_func; + + const int return_key_disable_param_size = (ELM_INPUT_PANEL_LAYOUT_PASSWORD + 1) * (ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND + 1); + // 5 test items per entry + static autotest_return_key_disable_param return_key_disable_param[return_key_disable_param_size * 5]; + + int entry_index = 0; + int param_index = 0; + for (i = (int)ELM_INPUT_PANEL_LAYOUT_NORMAL; i <= (int)ELM_INPUT_PANEL_LAYOUT_PASSWORD; i++) { + if (i == (int)ELM_INPUT_PANEL_LAYOUT_INVALID) continue; + for (j = (int)ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; j <= (int)ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND; j++) { + return_key_disable_param[param_index].ad = ad; + return_key_disable_param[param_index].index = entry_index; + return_key_disable_param[param_index].cmd = autotest_return_key_disable_cmd_focus_in; + return_key_disable_param[param_index].name = std::string("Focus in ") + _return_key_disable_titles.at(entry_index); + std::replace(return_key_disable_param[param_index].name.begin(), return_key_disable_param[param_index].name.end(), ' ', '_'); + item.param = (void*)(&return_key_disable_param[param_index]); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + param_index++; + + item.pause_before_command = 3000; // Rotation takes a little time to complete + return_key_disable_param[param_index].ad = ad; + return_key_disable_param[param_index].index = entry_index; + return_key_disable_param[param_index].cmd = autotest_return_key_disable_cmd_rotate_landscape; + return_key_disable_param[param_index].name = std::string("Rotating landscape ") + _return_key_disable_titles.at(entry_index); + std::replace(return_key_disable_param[param_index].name.begin(), return_key_disable_param[param_index].name.end(), ' ', '_'); + item.param = (void*)(&return_key_disable_param[param_index]); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + param_index++; + item.pause_before_command = AUTOTEST_DEFAULT_PAUSE; // Reset pause interval + + return_key_disable_param[param_index].ad = ad; + return_key_disable_param[param_index].index = entry_index; + return_key_disable_param[param_index].cmd = autotest_return_key_disable_cmd_input_character; + return_key_disable_param[param_index].name = std::string("Input character ") + _return_key_disable_titles.at(entry_index); + std::replace(return_key_disable_param[param_index].name.begin(), return_key_disable_param[param_index].name.end(), ' ', '_'); + item.param = (void*)(&return_key_disable_param[param_index]); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + param_index++; + + item.pause_before_command = 3000; // Rotation takes a little time to complete + return_key_disable_param[param_index].ad = ad; + return_key_disable_param[param_index].index = entry_index; + return_key_disable_param[param_index].cmd = autotest_return_key_disable_cmd_rotate_portrait; + return_key_disable_param[param_index].name = std::string("Rotating portrait ") + _return_key_disable_titles.at(entry_index); + std::replace(return_key_disable_param[param_index].name.begin(), return_key_disable_param[param_index].name.end(), ' ', '_'); + item.param = (void*)(&return_key_disable_param[param_index]); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + param_index++; + item.pause_before_command = AUTOTEST_DEFAULT_PAUSE; // Reset pause interval + + return_key_disable_param[param_index].ad = ad; + return_key_disable_param[param_index].index = entry_index; + return_key_disable_param[param_index].cmd = autotest_return_key_disable_cmd_focus_out; + return_key_disable_param[param_index].name = std::string("Focus out ") + _return_key_disable_titles.at(entry_index); + std::replace(return_key_disable_param[param_index].name.begin(), return_key_disable_param[param_index].name.end(), ' ', '_'); + item.param = (void*)(&return_key_disable_param[param_index]); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + param_index++; + + entry_index++; + } + } + + static autotest_return_key_disable_param param_exit; + param_exit.ad = ad; + param_exit.cmd = autotest_return_key_disable_cmd_exit; + item.param = (void*)(¶m_exit); + isf_demo_autotest_item_add(autotest_return_key_disable_list, item); + + isf_demo_autotest_list_push("RETURN_KEY_DISABLE", autotest_return_key_disable_list); } /* -- 2.7.4