From: Jihoon Kim Date: Mon, 8 Jun 2020 07:40:27 +0000 (+0900) Subject: Add inputmethod unittests X-Git-Tag: submit/tizen/20200611.025938~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e888edb7ac56569230f15bf0842ffda7780d1643;p=platform%2Fcore%2Fapi%2Finputmethod.git Add inputmethod unittests lines......: 86.0% (1085 of 1261 lines) functions..: 100.0% (184 of 184 functions) Change-Id: Ic8c536acb98ea16eeed345e178251875029b6e51 Signed-off-by: Jihoon Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1994c9a..b98c56a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,3 +179,13 @@ ADD_CUSTOM_COMMAND( ) ENDIF(UNIX) + +## Test +IF(NOT DEFINED MINIMUM_BUILD) +ENABLE_TESTING() +SET(UNITTEST_INPUTMETHOD inputmethod_unittests) +ADD_TEST(NAME ${UNITTEST_INPUTMETHOD} COMMAND ${UNITTEST_INPUTMETHOD} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests) + +ADD_SUBDIRECTORY(tests) +ENDIF(NOT DEFINED MINIMUM_BUILD) diff --git a/packaging/capi-ui-inputmethod.spec b/packaging/capi-ui-inputmethod.spec index b7ab5a0..e107ff1 100644 --- a/packaging/capi-ui-inputmethod.spec +++ b/packaging/capi-ui-inputmethod.spec @@ -15,9 +15,15 @@ BuildRequires: pkgconfig(libscl-core) BuildRequires: pkgconfig(isf) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-session) +BuildRequires: pkgconfig(gmock) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif + %description Input Method Library @@ -53,6 +59,13 @@ Group: Graphics & UI Framework/Input Input Method gcov objects %endif +%package unittests +Summary: inputmethod tests +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description unittests +GTest for inputmethod manager %prep %setup -q @@ -92,6 +105,13 @@ mkdir -p %{buildroot}%{_datadir}/gcov/obj install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %endif +%check +ctest --output-on-failure %{?_smp_mflags} +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +genhtml gcov.info +%endif + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -121,3 +141,6 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %files gcov %{_datadir}/gcov/obj/* %endif + +%files unittests +%{_bindir}/* diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..2359a0e --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,50 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(gtest-inputmethod CXX) + +# Find Packages +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + dlog + capi-base-common + evas + eina + ecore-imf + libscl-core + gmock +) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++11") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") + +SET(SOURCES "") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include) + +AUX_SOURCE_DIRECTORY(src SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../inputmethod/src INPUTMETHOD_SOURCES) + +ADD_DEFINITIONS("-DFULLVER=\"${FULLVER}\"") + +ADD_EXECUTABLE(${UNITTEST_INPUTMETHOD} + ${INPUTMETHOD_SOURCES} + ${SOURCES} + ) +TARGET_LINK_LIBRARIES(${UNITTEST_INPUTMETHOD} ${GTEST_LIBRARIES} ${pkgs_LDFLAGS} ${EXTRA_LDFLAGS}) +SET_TARGET_PROPERTIES(${UNITTEST_INPUTMETHOD} PROPERTIES + COMPILE_FLAGS "-fPIE" + #Never add any space for LINKFLAGS + LINK_FLAGS "-Wl,\ +--wrap=cynara_initialize,\ +--wrap=cynara_finish,\ +--wrap=cynara_session_from_pid,\ +--wrap=cynara_check") +INSTALL(TARGETS ${UNITTEST_INPUTMETHOD} DESTINATION /usr/bin) diff --git a/tests/src/cynara_mock.cpp b/tests/src/cynara_mock.cpp new file mode 100644 index 0000000..d553442 --- /dev/null +++ b/tests/src/cynara_mock.cpp @@ -0,0 +1,34 @@ +#include "cynara_mock.h" +#include +#include + +static int check_result = CYNARA_API_ACCESS_ALLOWED; + +void cynara_check_set_result(int result) +{ + check_result = result; +} + +int __wrap_cynara_initialize(cynara** c, const cynara_configuration* conf) +{ + *c = (void *)0x1; + return 0; +} + +int __wrap_cynara_finish(cynara* c) +{ + return 0; +} + +int __wrap_cynara_check(cynara* c, const char* client, const char* client_session, + const char* user, + const char* privilege) +{ + //return CYNARA_API_ACCESS_ALLOWED; + return check_result; +} + +char *__wrap_cynara_session_from_pid(pid_t pid) +{ + return strdup("session"); +} diff --git a/tests/src/cynara_mock.h b/tests/src/cynara_mock.h new file mode 100644 index 0000000..ca302bc --- /dev/null +++ b/tests/src/cynara_mock.h @@ -0,0 +1,87 @@ +#ifndef MOCK_CYNARA_H_ +#define MOCK_CYNARA_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void cynara; +typedef void* cynara_configuration; + +/*! \brief indicating that API call was interrupted by user*/ +#define CYNARA_API_INTERRUPTED 4 + +/*! \brief indicating access that cannot be resolved without further actions*/ +#define CYNARA_API_ACCESS_NOT_RESOLVED 3 + +/*! \brief indicating access that was checked is allowed */ +#define CYNARA_API_ACCESS_ALLOWED 2 + +/*! \brief indicating that access that was checked is denied */ +#define CYNARA_API_ACCESS_DENIED 1 + +/*! \brief indicating the result of the one specific API is successful */ +#define CYNARA_API_SUCCESS 0 + +/*! \brief indicating that value is not present in cache */ +#define CYNARA_API_CACHE_MISS -1 + +/*! \brief indicating that pending requests reached maximum */ +#define CYNARA_API_MAX_PENDING_REQUESTS -2 + +/*! \brief indicating system is running out of memory state */ +#define CYNARA_API_OUT_OF_MEMORY -3 + +/*! \brief indicating the API's parameter is malformed */ +#define CYNARA_API_INVALID_PARAM -4 + +/*! \brief indicating that service is not available */ +#define CYNARA_API_SERVICE_NOT_AVAILABLE -5 + +/*! \brief indicating that provided method is not supported by library */ +#define CYNARA_API_METHOD_NOT_SUPPORTED -6 + +/*! \brief cynara service does not allow to perform requested operation */ +#define CYNARA_API_OPERATION_NOT_ALLOWED -7 + +/*! \brief cynara service failed to perform requested operation */ +#define CYNARA_API_OPERATION_FAILED -8 + +/*! \brief cynara service hasn't found requested bucket */ +#define CYNARA_API_BUCKET_NOT_FOUND -9 + +/*! \brief indicating an unknown error */ +#define CYNARA_API_UNKNOWN_ERROR -10 + +/*! \brief indicating configuration error */ +#define CYNARA_API_CONFIGURATION_ERROR -11 + +/*! \brief indicating invalid parameter in command-line */ +#define CYNARA_API_INVALID_COMMANDLINE_PARAM -12 + +/*! \brief indicating that provided buffer is too short */ +#define CYNARA_API_BUFFER_TOO_SHORT -13 + +/*! \brief indicating that database is corrupted */ +#define CYNARA_API_DATABASE_CORRUPTED -14 + +/*! \brief indicating that user doesn't have enough permission to perform action */ +#define CYNARA_API_PERMISSION_DENIED -15 + +void cynara_check_set_result(int result); + +int __wrap_cynara_initialize(cynara** c, const cynara_configuration* conf); +int __wrap_cynara_finish(cynara* c); +int __wrap_cynara_check(cynara* c, const char* client, const char* client_session, + const char* user, + const char* privilege); + +char *__wrap_cynara_session_from_pid(pid_t pid); + +#ifdef __cplusplus +} +#endif +#endif /* MOCK_CYNARA_H_ */ diff --git a/tests/src/inputmethod_unittests.cpp b/tests/src/inputmethod_unittests.cpp new file mode 100644 index 0000000..5e665f1 --- /dev/null +++ b/tests/src/inputmethod_unittests.cpp @@ -0,0 +1,1425 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include + +#include "cynara_mock.h" + +namespace { + +static Evas_Object *_opt_win = NULL; + +static ime_context_h _context = NULL; +static ime_device_info_h _dev_info = NULL; + +#ifdef __cplusplus +extern "C" { +#endif +//LCOV_EXCL_START +void ime_app_main(int argc, char **argv) +{ +} +//LCOV_EXCL_STOP +#ifdef __cplusplus +} +#endif + +class InputMethodTest : public testing::Test { + public: + virtual void SetUp() { + cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED); + + _context = (ime_context_h)malloc(sizeof(ime_context_h)); + _dev_info = (ime_device_info_h)malloc(sizeof(ime_device_info_h)); + } + virtual void TearDown() { + if (_context) { + free(_context); + _context = NULL; + } + if (_dev_info) { + free(_dev_info); + _dev_info = NULL; + } + } +}; + +class InputMethodDeniedTest : public testing::Test { + public: + virtual void SetUp() { + cynara_check_set_result(CYNARA_API_ACCESS_DENIED); + + _context = (ime_context_h)malloc(sizeof(ime_context_h)); + _dev_info = (ime_device_info_h)malloc(sizeof(ime_device_info_h)); + } + virtual void TearDown() { + cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED); + + if (_context) { + free(_context); + _context = NULL; + } + if (_dev_info) { + free(_dev_info); + _dev_info = NULL; + } + } +}; + +//LCOV_EXCL_START +static void _focus_in_cb(int context_id, void *user_data) +{ +} + +static void _focus_out_cb(int context_id, void *user_data) +{ +} + +static void _surrounding_text_updated_cb(int context_id, const char *text, int cursor_pos, void *user_data) +{ +} + +static void _input_context_reset_cb(void *user_data) +{ +} + +static void _cursor_position_updated_cb(int cursor_pos, void *user_data) +{ +} + +static void _language_requested_cb(void *user_data, char **lang_code) +{ +} + +static void _language_set_cb(Ecore_IMF_Input_Panel_Lang language, void *user_data) +{ +} + +static void _imdata_set_cb(void *data, unsigned int data_length, void *user_data) +{ +} + +static void _imdata_requested_cb(void *user_data, void **data, unsigned int *data_length) +{ +} + +static void _layout_set_cb(Ecore_IMF_Input_Panel_Layout layout, void *user_data) +{ +} + +static void _return_key_type_set_cb(Ecore_IMF_Input_Panel_Return_Key_Type type, void *user_data) +{ +} + +static void _return_key_state_set_cb(bool disabled, void *user_data) +{ +} + +static void _geometry_requested_cb(void *user_data, int *x, int *y, int *w, int *h) +{ +} + +static bool _process_key_event_cb(ime_key_code_e keycode, ime_key_mask_e keymask, ime_device_info_h dev_info, void *user_data) +{ + return true; +} + +static void _display_language_changed_cb(const char *language, void *user_data) +{ +} + +static void _rotation_degree_changed_cb(int degree, void *user_data) +{ +} + +static void _accessibility_state_changed_cb(bool state, void *user_data) +{ +} + +static void _option_window_created_cb(Evas_Object *window, ime_option_window_type_e type, void *user_data) +{ + _opt_win = window; +} + +static void _option_window_destroyed_cb(Evas_Object *window, void *user_data) +{ + _opt_win = NULL; +} + +static void _prediction_hint_set_cb(const char *prediction_hint, void *user_data) +{ +} + +static void _mime_type_set_request_cb(const char *mime_type, void *user_data) +{ +} + +static bool _process_key_event_with_keycode_cb(unsigned int key_code, ime_key_code_e key_sym, ime_key_mask_e key_mask, ime_device_info_h dev_info, void *user_data) +{ + return true; +} +//LCOV_EXCL_STOP + +/** + * @testcase utc_ime_event_set_focus_in_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c focus_in event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_focus_in_cb_p) +{ + int ret = ime_event_set_focus_in_cb(_focus_in_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_focus_out_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c focus_out event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_focus_out_cb_p) +{ + int ret = ime_event_set_focus_out_cb(_focus_out_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_surrounding_text_updated_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c surrounding_text_updated event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_surrounding_text_updated_cb_p) +{ + int ret = ime_event_set_surrounding_text_updated_cb(_surrounding_text_updated_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_input_context_reset_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets #c input_context_reset event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_input_context_reset_cb_p) +{ + int ret = ime_event_set_input_context_reset_cb(_input_context_reset_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_cursor_position_updated_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c cursor_position_updated event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_cursor_position_updated_cb_p) +{ + int ret = ime_event_set_cursor_position_updated_cb(_cursor_position_updated_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_language_requested_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c language_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_language_requested_cb_p) +{ + int ret = ime_event_set_language_requested_cb(_language_requested_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_language_set_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c language_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_language_set_cb_p) +{ + int ret = ime_event_set_language_set_cb(_language_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_imdata_set_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c imdata_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_imdata_set_cb_p) +{ + int ret = ime_event_set_imdata_set_cb(_imdata_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_imdata_requested_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c imdata_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_imdata_requested_cb_p) +{ + int ret = ime_event_set_imdata_requested_cb(_imdata_requested_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_layout_set_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c layout_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_layout_set_cb_p) +{ + int ret = ime_event_set_layout_set_cb(_layout_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_return_key_type_set_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c return_key_type_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_return_key_type_set_cb_p) +{ + int ret = ime_event_set_return_key_type_set_cb(_return_key_type_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_return_key_state_set_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c return_key_state_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_return_key_state_set_cb_p) +{ + int ret = ime_event_set_return_key_state_set_cb(_return_key_state_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_geometry_requested_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c geometry_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_geometry_requested_cb_p) +{ + int ret = ime_event_set_geometry_requested_cb(_geometry_requested_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_process_key_event_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c process_key_event event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_process_key_event_cb_p) +{ + int ret = ime_event_set_process_key_event_cb(_process_key_event_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_display_language_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c display_language_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_display_language_changed_cb_p) +{ + int ret = ime_event_set_display_language_changed_cb(_display_language_changed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_rotation_degree_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets #c rotation_degree_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_rotation_degree_changed_cb_p) +{ + int ret = ime_event_set_rotation_degree_changed_cb(_rotation_degree_changed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_accessibility_state_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c accessibility_state_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_accessibility_state_changed_cb_p) +{ + int ret = ime_event_set_accessibility_state_changed_cb(_accessibility_state_changed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_option_window_created_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c option_window_created event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_option_window_created_cb_p) +{ + int ret = ime_event_set_option_window_created_cb(_option_window_created_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_option_window_destroyed_cb_p + * @since_tizen 2.4 + * @description Positive UTC of the function that sets @c option_window_destroyed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_option_window_destroyed_cb_p) +{ + int ret = ime_event_set_option_window_destroyed_cb(_option_window_destroyed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_prediction_hint_set_cb_p + * @since_tizen 4.0 + * @description Positive UTC of the function that sets @c prediction_hint event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_prediction_hint_set_cb_p) +{ + int ret = ime_event_set_prediction_hint_set_cb(_prediction_hint_set_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_mime_type_set_request_cb_p + * @since_tizen 4.0 + * @description Positive UTC of the function that sets @c mime_type event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_mime_type_set_request_cb_p) +{ + int ret = ime_event_set_mime_type_set_request_cb(_mime_type_set_request_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +/** + * @testcase utc_ime_event_set_process_key_event_with_keycode_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets @c process_key_event_with_keycode event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_process_key_event_with_keycode_cb_p) +{ + int ret = ime_event_set_process_key_event_with_keycode_cb(_process_key_event_with_keycode_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); +} + +//& purpose: A purpose of a first negative TC. +/** + * @testcase utc_ime_run_n + * @since_tizen 2.4 + * @description Negative UTC of the function that runs the main loop of IME application. + */ +TEST_F(InputMethodTest, utc_ime_run_n) +{ + int ret = ime_run(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_run_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that runs the main loop of IME application. + */ +TEST_F(InputMethodTest, utc_ime_run_n2) +{ + ime_callback_s ime_cb = {NULL, NULL, NULL, NULL}; + int ret = ime_run(&ime_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NO_CALLBACK_FUNCTION); +} + +/** + * @testcase utc_ime_event_set_focus_in_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c focus_in event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_focus_in_cb_n) +{ + int ret = ime_event_set_focus_in_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_focus_out_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c focus_out event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_focus_out_cb_n) +{ + int ret = ime_event_set_focus_out_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_surrounding_text_updated_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests the surrounding text from the position of the cursor, asynchronously. + */ +TEST_F(InputMethodTest, utc_ime_event_set_surrounding_text_updated_cb_n) +{ + int ret = ime_event_set_surrounding_text_updated_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_input_context_reset_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets #c input_context_reset event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_input_context_reset_cb_n) +{ + int ret = ime_event_set_input_context_reset_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_cursor_position_updated_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c cursor_position_updated event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_cursor_position_updated_cb_n) +{ + int ret = ime_event_set_cursor_position_updated_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_language_requested_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c language_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_language_requested_cb_n) +{ + int ret = ime_event_set_language_requested_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_language_set_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c language_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_language_set_cb_n) +{ + int ret = ime_event_set_language_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_imdata_set_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c imdata_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_imdata_set_cb_n) +{ + int ret = ime_event_set_imdata_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_imdata_requested_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c imdata_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_imdata_requested_cb_n) +{ + int ret = ime_event_set_imdata_requested_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_layout_set_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c layout_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_layout_set_cb_n) +{ + int ret = ime_event_set_layout_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_return_key_type_set_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c return_key_type_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_return_key_type_set_cb_n) +{ + int ret = ime_event_set_return_key_type_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_return_key_state_set_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c return_key_state_set event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_return_key_state_set_cb_n) +{ + int ret = ime_event_set_return_key_state_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_geometry_requested_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c geometry_requested event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_geometry_requested_cb_n) +{ + int ret = ime_event_set_geometry_requested_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_process_key_event_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c process_key_event event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_process_key_event_cb_n) +{ + int ret = ime_event_set_process_key_event_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_display_language_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c display_language_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_display_language_changed_cb_n) +{ + int ret = ime_event_set_display_language_changed_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_rotation_degree_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets #c rotation_degree_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_rotation_degree_changed_cb_n) +{ + int ret = ime_event_set_rotation_degree_changed_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_accessibility_state_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sets @c accessibility_state_changed event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_accessibility_state_changed_cb_n) +{ + int ret = ime_event_set_accessibility_state_changed_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_option_window_created_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to create an option window from the input panel. + */ +TEST_F(InputMethodTest, utc_ime_event_set_option_window_created_cb_n) +{ + int ret = ime_event_set_option_window_created_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_event_set_option_window_destroyed_cb_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to destroy an option window. + */ +TEST_F(InputMethodTest, utc_ime_event_set_option_window_destroyed_cb_n) +{ + int ret = ime_event_set_option_window_destroyed_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_send_key_event_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sends a key event to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_send_key_event_n) +{ + int ret = ime_send_key_event(IME_KEY_BackSpace, IME_KEY_MASK_PRESSED, true); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_commit_string_n + * @since_tizen 2.4 + * @description Negative UTC of the function that sends the text to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_commit_string_n) +{ + int ret = ime_commit_string(NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_commit_string_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that sends the text to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_commit_string_n2) +{ + int ret = ime_commit_string("test"); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_show_preedit_string_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to show preedit string. + */ +TEST_F(InputMethodTest, utc_ime_show_preedit_string_n) +{ + int ret = ime_show_preedit_string(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_hide_preedit_string_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to hide preedit string. + */ +TEST_F(InputMethodTest, utc_ime_hide_preedit_string_n) +{ + int ret = ime_hide_preedit_string(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_update_preedit_string_n + * @since_tizen 2.4 + * @description Negative UTC of the function that updates a new preedit string. + */ +TEST_F(InputMethodTest, utc_ime_update_preedit_string_n) +{ + int ret = ime_update_preedit_string(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_update_preedit_string_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that updates a new preedit string. + */ +TEST_F(InputMethodTest, utc_ime_update_preedit_string_n2) +{ + int ret = ime_update_preedit_string("test", NULL); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_request_surrounding_text_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests the surrounding text from the position of the cursor, asynchronously. + */ +TEST_F(InputMethodTest, utc_ime_request_surrounding_text_n) +{ + int ret = ime_request_surrounding_text(-1, -1); + EXPECT_EQ(ret, IME_ERROR_NO_CALLBACK_FUNCTION); +} + +/** + * @testcase utc_ime_request_surrounding_text_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that requests the surrounding text from the position of the cursor, asynchronously. + */ +TEST_F(InputMethodTest, utc_ime_request_surrounding_text_n2) +{ + int ret = ime_event_set_surrounding_text_updated_cb(_surrounding_text_updated_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); + ret = ime_request_surrounding_text(-1, -1); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_delete_surrounding_text_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to delete surrounding text. + */ +TEST_F(InputMethodTest, utc_ime_delete_surrounding_text_n) +{ + int ret = ime_delete_surrounding_text(0, 0); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_delete_surrounding_text_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to delete surrounding text. + */ +TEST_F(InputMethodTest, utc_ime_delete_surrounding_text_n2) +{ + int ret = ime_delete_surrounding_text(0, 1); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_get_surrounding_text_n + * @since_tizen 3.0 + * @description Negative UTC of the function that requests to get surrounding text. + */ +TEST_F(InputMethodTest, utc_ime_get_surrounding_text_n) +{ + int ret = ime_get_surrounding_text(-1, -1, NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_set_selection_n + * @since_tizen 3.0 + * @description Negative UTC of the function that requests to set selection text. + */ +TEST_F(InputMethodTest, utc_ime_set_selection_n) +{ + int ret = ime_set_selection(-1, -1); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_get_main_window_n + * @since_tizen 2.4 + * @description Negative UTC of the function that returns the pointer of input panel main window. + */ +TEST_F(InputMethodTest, utc_ime_get_main_window_n) +{ + Evas_Object *win = ime_get_main_window(); + int ret = get_last_result(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); + EXPECT_EQ(win, NULL); +} + +/** + * @testcase utc_ime_get_main_window_denied + * @since_tizen 2.4 + * @description Negative UTC of the function that returns the pointer of input panel main window. + */ +TEST_F(InputMethodDeniedTest, utc_ime_get_main_window_denied) +{ + Evas_Object *win = ime_get_main_window(); + int ret = get_last_result(); + EXPECT_EQ(ret, IME_ERROR_PERMISSION_DENIED); + EXPECT_EQ(win, NULL); +} + +/** + * @testcase utc_ime_set_size_n + * @since_tizen 2.4 + * @description Negative UTC of the function that updates the input panel window's size information. + */ +TEST_F(InputMethodTest, utc_ime_set_size_n) +{ + int ret = ime_set_size(0, 0, 0, 0); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_set_size_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that updates the input panel window's size information. + */ +TEST_F(InputMethodTest, utc_ime_set_size_n2) +{ + int ret = ime_set_size(540, 400, 960, 300); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_create_option_window_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to create an option window from the input panel. + */ +TEST_F(InputMethodTest, utc_ime_create_option_window_n) +{ + int ret = ime_create_option_window(); + EXPECT_EQ(ret, IME_ERROR_NO_CALLBACK_FUNCTION); +} + +/** + * @testcase utc_ime_create_option_window_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to create an option window from the input panel. + */ +TEST_F(InputMethodTest, utc_ime_create_option_window_n2) +{ + int ret = ime_event_set_option_window_created_cb(_option_window_created_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); + ret = ime_event_set_option_window_destroyed_cb(_option_window_destroyed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); + ret = ime_create_option_window(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_destroy_option_window_n + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to destroy an option window. + */ +TEST_F(InputMethodTest, utc_ime_destroy_option_window_n) +{ + int ret = ime_destroy_option_window(NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_destroy_option_window_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that requests to destroy an option window. + */ +TEST_F(InputMethodTest, utc_ime_destroy_option_window_n2) +{ + int ret = ime_event_set_option_window_created_cb(_option_window_created_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); + ret = ime_event_set_option_window_destroyed_cb(_option_window_destroyed_cb, NULL); + EXPECT_EQ(ret, IME_ERROR_NONE); + ret = ime_destroy_option_window(NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_layout_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the layout information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_layout_n) +{ + int ret = ime_context_get_layout(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_layout_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the layout information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_layout_n2) +{ + Ecore_IMF_Input_Panel_Layout layout; + int ret = ime_context_get_layout(_context, &layout); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_layout_variation_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the layout variation information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_layout_variation_n) +{ + int ret = ime_context_get_layout_variation(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_layout_variation_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the layout variation information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_layout_variation_n2) +{ + ime_layout_variation_e variation; + int ret = ime_context_get_layout_variation(_context, &variation); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_cursor_position_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the cursor position information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_cursor_position_n) +{ + int ret = ime_context_get_cursor_position(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_cursor_position_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the cursor position information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_cursor_position_n2) +{ + int pos; + int ret = ime_context_get_cursor_position(_context, &pos); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_autocapital_type_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the autocapital type information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_autocapital_type_n) +{ + int ret = ime_context_get_autocapital_type(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_autocapital_type_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the autocapital type information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_autocapital_type_n2) +{ + Ecore_IMF_Autocapital_Type type; + int ret = ime_context_get_autocapital_type(_context, &type); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_return_key_type_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the @c Return key label type information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_return_key_type_n) +{ + int ret = ime_context_get_return_key_type(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_return_key_type_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the @c Return key label type information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_return_key_type_n2) +{ + Ecore_IMF_Input_Panel_Return_Key_Type type; + int ret = ime_context_get_return_key_type(_context, &type); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_return_key_state_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the @c Return key state information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_return_key_state_n) +{ + int ret = ime_context_get_return_key_state(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_return_key_state_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the @c Return key state information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_return_key_state_n2) +{ + bool state; + int ret = ime_context_get_return_key_state(_context, &state); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_prediction_mode_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the prediction mode information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_prediction_mode_n) +{ + int ret = ime_context_get_prediction_mode(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_prediction_mode_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the prediction mode information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_prediction_mode_n2) +{ + bool mode; + int ret = ime_context_get_prediction_mode(_context, &mode); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_password_mode_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the password mode information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_password_mode_n) +{ + int ret = ime_context_get_password_mode(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_password_mode_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the password mode information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_password_mode_n2) +{ + bool mode; + int ret = ime_context_get_password_mode(_context, &mode); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_input_hint_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the input hint information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_input_hint_n) +{ + int ret = ime_context_get_input_hint(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_input_hint_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the input hint information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_input_hint_n2) +{ + Ecore_IMF_Input_Hints hint; + int ret = ime_context_get_input_hint(_context, &hint); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_bidi_direction_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the text bidirectional information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_bidi_direction_n) +{ + int ret = ime_context_get_bidi_direction(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_bidi_direction_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the text bidirectional information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_bidi_direction_n2) +{ + Ecore_IMF_BiDi_Direction dir; + int ret = ime_context_get_bidi_direction(_context, &dir); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_context_get_language_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the preferred language information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_language_n) +{ + int ret = ime_context_get_language(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_context_get_language_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the preferred language information from the given input context. + */ +TEST_F(InputMethodTest, utc_ime_context_get_language_n2) +{ + Ecore_IMF_Input_Panel_Lang lang; + int ret = ime_context_get_language(_context, &lang); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_device_info_get_name_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device name of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_name_n) +{ + int ret = ime_device_info_get_name(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_device_info_get_name_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device name of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_name_n2) +{ + char *dev_name = NULL; + int ret = ime_device_info_get_name(_dev_info, &dev_name); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); + + if (dev_name) + free(dev_name); +} + +/** + * @testcase utc_ime_device_info_get_class_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device class of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_class_n) +{ + int ret = ime_device_info_get_class(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_device_info_get_class_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device class of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_class_n2) +{ + Ecore_IMF_Device_Class dev_class; + int ret = ime_device_info_get_class(_dev_info, &dev_class); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_device_info_get_subclass_n + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device subclass of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_subclass_n) +{ + int ret = ime_device_info_get_subclass(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_device_info_get_subclass_n2 + * @since_tizen 2.4 + * @description Negative UTC of the function that gets the device subclass of the key event. + */ +TEST_F(InputMethodTest, utc_ime_device_info_get_subclass_n2) +{ + Ecore_IMF_Device_Subclass dev_subclass; + int ret = ime_device_info_get_subclass(_dev_info, &dev_subclass); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_event_set_prediction_hint_set_cb_n + * @since_tizen 4.0 + * @description Negative UTC of the function that sets @c prediction_hint event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_prediction_hint_set_cb_n) +{ + int ret = ime_event_set_prediction_hint_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_send_private_command_n + * @since_tizen 4.0 + * @description Negative UTC of the function that sends the private_command to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_send_private_command_n) +{ + int ret = ime_send_private_command(NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_send_private_command_n2 + * @since_tizen 4.0 + * @description Negative UTC of the function that sends the private_command to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_send_private_command_n2) +{ + int ret = ime_send_private_command("test"); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_event_set_mime_type_set_request_cb_n + * @since_tizen 4.0 + * @description Negative UTC of the function that sets @c mime_type event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_mime_type_set_request_cb_n) +{ + int ret = ime_event_set_mime_type_set_request_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_commit_content_n + * @since_tizen 4.0 + * @description Negative UTC of the function that sends the content to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_commit_content_n) +{ + int ret = ime_commit_content(NULL, NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_commit_content_n2 + * @since_tizen 4.0 + * @description Negative UTC of the function that sends the content to the associated text input UI control. + */ +TEST_F(InputMethodTest, utc_ime_commit_content_n2) +{ + int ret = ime_commit_content("test1", "test2", "test3"); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_set_floating_mode_n + * @since_tizen 4.0 + * @description Negative UTC of the function that sets the floating mode of input panel window. + */ +TEST_F(InputMethodTest, utc_ime_set_floating_mode_n) +{ + int ret = ime_set_floating_mode(true); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_set_floating_drag_start_n + * @since_tizen 4.0 + * @description Negative UTC of the function that allows the movement of the floating input panel window. + */ +TEST_F(InputMethodTest, utc_ime_set_floating_drag_start_n) +{ + int ret = ime_set_floating_drag_start(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_set_floating_drag_end_n + * @since_tizen 4.0 + * @description Negative UTC of the function that disallows the movement of the floating input panel window. + */ +TEST_F(InputMethodTest, utc_ime_set_floating_drag_end_n) +{ + int ret = ime_set_floating_drag_end(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_get_selected_text_n + * @since_tizen 4.0 + * @description Negative UTC of the function that gets the selected text synchronously. + */ +TEST_F(InputMethodTest, utc_ime_get_selected_text_n) +{ + char *text = NULL; + int ret = ime_get_selected_text(&text); + if (text) + free(text); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_get_selected_text_n2 + * @since_tizen 4.0 + * @description Negative UTC of the function that gets the selected text synchronously. + */ +TEST_F(InputMethodTest, utc_ime_get_selected_text_n2) +{ + int ret = ime_get_selected_text(NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_request_hide_n + * @since_tizen 5.0 + * @description Negative UTC of the function that sends the request to hide IME. + */ +TEST_F(InputMethodTest, utc_ime_request_hide_n) +{ + int ret = ime_request_hide(); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_event_set_prediction_hint_data_set_cb_n + * @since_tizen 5.0 + * @description Negative UTC of the function that sets @c prediction_hint_data event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_prediction_hint_data_set_cb_n) +{ + int ret = ime_event_set_prediction_hint_data_set_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_update_input_panel_event_n + * @since_tizen 5.5 + * @description Negative UTC of the function that updates the state of input panel event. + */ +TEST_F(InputMethodTest, utc_ime_update_input_panel_event_n) +{ + int ret = ime_update_input_panel_event(IME_EVENT_TYPE_SHIFT_MODE, 0); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_event_set_process_key_event_with_keycode_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets @c process_key_event_with_keycode event callback function. + */ +TEST_F(InputMethodTest, utc_ime_event_set_process_key_event_with_keycode_cb_n) +{ + int ret = ime_event_set_process_key_event_with_keycode_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_set_candidate_visibility_state_n + * @since_tizen 5.5 + * @description Negative UTC of the function that sets the candidate visibility state. + */ +TEST_F(InputMethodTest, utc_ime_set_candidate_visibility_state_n) +{ + int ret = ime_set_candidate_visibility_state(true); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + +/** + * @testcase utc_ime_event_set_process_input_device_event_cb_n + * @since_tizen 3.0 + * @description Negative UTC of the function that called when the input event is received from an unconventional input device that does not generate key events. + */ +TEST_F(InputMethodTest, utc_ime_event_set_process_input_device_event_cb_n) +{ + int ret = ime_event_set_process_input_device_event_cb(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_input_device_rotary_get_direction_n + * @since_tizen 3.0 + * @description Negative UTC of the function for Rotary input device event. + */ +TEST_F(InputMethodTest, utc_ime_input_device_rotary_get_direction_n) +{ + int ret = ime_input_device_rotary_get_direction(NULL, NULL); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +} // namespace diff --git a/tests/src/main.cpp b/tests/src/main.cpp new file mode 100644 index 0000000..a37d671 --- /dev/null +++ b/tests/src/main.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}