From: Jihoon Kim Date: Wed, 18 Aug 2021 04:27:00 +0000 (+0900) Subject: Add Unittest for ime_set_native_window_size() X-Git-Tag: submit/tizen/20210818.022703~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd7b2acfc3e29af01fd269f96268f18f0e3b097e;p=platform%2Fcore%2Fapi%2Finputmethod.git Add Unittest for ime_set_native_window_size() lines......: 92.8% (1366 of 1472 lines) functions..: 100.0% (246 of 246 functions) Change-Id: Ibe10630963e9abd6265020050aaeecc1610d7732 Signed-off-by: Jihoon Kim --- diff --git a/inputmethod/src/inputmethod.cpp b/inputmethod/src/inputmethod.cpp index 5decdce..40664a8 100644 --- a/inputmethod/src/inputmethod.cpp +++ b/inputmethod/src/inputmethod.cpp @@ -1571,7 +1571,7 @@ EXPORT_API int ime_set_native_window_size(Ecore_Wl2_Window *window, int portrait { ime_error_e retVal = IME_ERROR_NONE; - if (portrait_width < 1 || portrait_height < 1 || landscape_width < 1 || landscape_height < 1) { + if (!window || portrait_width < 1 || portrait_height < 1 || landscape_width < 1 || landscape_height < 1) { LOGW("IME_ERROR_INVALID_PARAMETER"); return IME_ERROR_INVALID_PARAMETER; } diff --git a/tests/src/inputmethod_unittests.cpp b/tests/src/inputmethod_unittests.cpp index cc6a705..296cf0d 100644 --- a/tests/src/inputmethod_unittests.cpp +++ b/tests/src/inputmethod_unittests.cpp @@ -18,7 +18,9 @@ #include #include "inputmethod_private.h" +#include "inputmethod_internal.h" #include +#include #include "cynara_mock.h" @@ -1473,4 +1475,39 @@ TEST_F(InputMethodTest, utc_ime_input_device_rotary_get_direction_n) EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); } +/** + * @testcase utc_ime_set_native_size_null_window + * @since_tizen 6.5 + * @description Negative UTC of the function that updates the input panel window's size information. + */ +TEST_F(InputMethodTest, utc_ime_set_native_size_null_window) +{ + int ret = ime_set_native_window_size(NULL, 540, 400, 960, 300); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_set_native_window_size_zero_parameter + * @since_tizen 6.5 + * @description Negative UTC of the function that updates the input panel window's size information. + */ +TEST_F(InputMethodTest, utc_ime_set_native_window_size_zero_parameter) +{ + Ecore_Wl2_Window *win = (Ecore_Wl2_Window *)0x1; + int ret = ime_set_native_window_size(win, 0, 0, 0, 0); + EXPECT_EQ(ret, IME_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_ime_set_native_window_size_not_running + * @since_tizen 6.5 + * @description Negative UTC of the function that updates the input panel window's size information. + */ +TEST_F(InputMethodTest, utc_ime_set_native_window_size_not_running) +{ + Ecore_Wl2_Window *win = (Ecore_Wl2_Window *)0x1; + int ret = ime_set_native_window_size(win, 540, 400, 960, 300); + EXPECT_EQ(ret, IME_ERROR_NOT_RUNNING); +} + } // namespace