From 6a078eb2dc55c73d119a2477eb713df0755757a5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 24 Mar 2021 11:24:28 +0900 Subject: [PATCH 01/16] Update version in receiver manifest Change-Id: I33d4b6b1d0420d01a7deefe8a7a435d1e153c7c8 Signed-off-by: Jihoon Kim --- receiver/tizen-manifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index aed506c..cdfdfb9 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From ae4015a8b7c16d936727f60ce852fc3448603116 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 25 Mar 2021 10:44:45 +0900 Subject: [PATCH 02/16] Change API description by API review Change-Id: I60ef9bf6887c3fb17e10ed43622ba3f765295bbc --- include/sticker_provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sticker_provider.h b/include/sticker_provider.h index 945338d..9690781 100644 --- a/include/sticker_provider.h +++ b/include/sticker_provider.h @@ -202,7 +202,7 @@ int sticker_provider_delete_data(sticker_provider_h provider_handle, sticker_dat /** * @brief Deletes a sticker with the given @a uri from the sticker database. - * @details If the database does not have a sticker that matches the given @a uri, the STICKER_ERROR_NO_SUCH_FILE error is returned. + * @details If the database does not have a sticker that matches the given @a uri, the #STICKER_ERROR_NO_SUCH_FILE error is returned. * @since_tizen 5.5 * @param[in] provider_handle The sticker provider handle * @param[in] uri The URI of the sticker data to be deleted -- 2.7.4 From 91969957ec33581bc7801e0da766f9accfd60892 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 25 Mar 2021 11:23:25 +0900 Subject: [PATCH 03/16] Enhance unittest coverage lines: 54.8 (1035 of 1888 lines) -> 66.1% (1308 of 1980 lines) functions..: 73.4% (168 of 229 functions) -> 81.5% (202 of 248 functions) Change-Id: I71f38f23ee8cb02edd3494ffde705bf419c15b55 Signed-off-by: Jihoon Kim --- tests/src/sticker_consumer_unittests.cc | 153 ++++++++++++++++++++++++++++++++ tests/src/sticker_data_unittests.cc | 59 ++++++++++++ tests/src/sticker_provider_unittests.cc | 11 +++ 3 files changed, 223 insertions(+) diff --git a/tests/src/sticker_consumer_unittests.cc b/tests/src/sticker_consumer_unittests.cc index e1b59b4..398ed42 100644 --- a/tests/src/sticker_consumer_unittests.cc +++ b/tests/src/sticker_consumer_unittests.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ static bool callback_result = false; static sticker_data_h g_dh = NULL; +static sticker_provider_h g_ph = NULL; static sticker_consumer_h g_ch = NULL; namespace { @@ -138,6 +140,10 @@ void __fake_g_dbus_connection_signal_unsubscribe(GDBusConnection* c, void __fake_g_bus_unwatch_name(guint a) { } +static void event_cb(sticker_consumer_event_type_e event_type, sticker_data_h data_handle, void *user_data) +{ +} + class StickerConsumerTest : public testing::Test { public: virtual void SetUp() { @@ -172,6 +178,9 @@ class StickerConsumerTest : public testing::Test { sticker_data_set_group_name(g_dh, "tizen"); sticker_data_set_thumbnail(g_dh, "/res/test.png"); sticker_data_set_description(g_dh, "TCT Test"); + sticker_data_set_display_type(g_dh, STICKER_DATA_DISP_WALLPAPER); + sticker_provider_insert_data(g_ph, g_dh); + sticker_provider_set_group_image(g_ph, "tizen", STICKER_DATA_URI_WEB_RESOURCE, "www.valid.com/test/test.png"); } virtual void TearDown() { sticker_data_destroy(g_dh); @@ -258,6 +267,19 @@ TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_all_n) } /** + * @testcase utc_sticker_consumer_data_foreach_by_keyword_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using keyword. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_keyword_p) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_keyword(g_ch, 0, 1000, &result, "cute", sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** * @testcase utc_sticker_consumer_data_foreach_by_keyword_n * @since_tizen 5.5 * @description Negative UTC of the function that retrieves all sticker data using keyword. @@ -270,6 +292,19 @@ TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_keyword_n) } /** + * @testcase utc_sticker_consumer_data_foreach_by_group_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using group. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_group_p) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_group(g_ch, 0, 1000, &result, "tizen", sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** * @testcase utc_sticker_consumer_data_foreach_by_group_n * @since_tizen 5.5 * @description Negative UTC of the function that retrieves all sticker data using group. @@ -282,6 +317,19 @@ TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_group_n) } /** + * @testcase utc_sticker_consumer_data_foreach_by_type_p + * @since_tizen 5.5 + * @description Positive UTC of the function that retrieves all sticker data using type. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_type_p) +{ + int result = 0; + callback_result = false; + int ret = sticker_consumer_data_foreach_by_type(g_ch, 0, 1000, &result, STICKER_DATA_URI_WEB_RESOURCE, sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** * @testcase utc_sticker_consumer_data_foreach_by_type_n * @since_tizen 5.5 * @description Negative UTC of the function that retrieves all sticker data using type. @@ -315,4 +363,109 @@ TEST_F(StickerConsumerTest, utc_sticker_consumer_keyword_list_foreach_all_n) EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); } +/** + * @testcase utc_sticker_consumer_data_foreach_by_display_type_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all sticker data using display type. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_data_foreach_by_display_type_n) +{ + int result = 0; + int ret = sticker_consumer_data_foreach_by_display_type(g_ch, -1, 0, &result, STICKER_DATA_DISP_WALLPAPER, sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_group_list_foreach_by_display_type_n + * @since_tizen 5.5 + * @description Negative UTC of the function that retrieves all group name using display type. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_group_list_foreach_by_display_type_n) +{ + int ret = sticker_consumer_group_list_foreach_by_display_type(g_ch, STICKER_DATA_DISP_WALLPAPER, NULL, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_add_recent_data_n + * @since_tizen 5.5 + * @description Negative UTC of the function that adds entry to recently used stickers list. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_add_recent_data_n) +{ + int ret = sticker_consumer_add_recent_data(g_ch, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_get_recent_data_list_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets recently used stickers list. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_get_recent_data_list_p) +{ + int result = 0; + callback_result = false; + sticker_consumer_add_recent_data(g_ch, g_dh); + int ret = sticker_consumer_get_recent_data_list(g_ch, 1, &result, sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** + * @testcase utc_sticker_consumer_get_recent_data_list_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets recently used stickers list. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_get_recent_data_list_n) +{ + int result = 0; + int ret = sticker_consumer_get_recent_data_list(g_ch, 0, &result, sticker_data_foreach_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_set_event_cb_p + * @since_tizen 5.5 + * @description Positive UTC of the function that registers a event callback function. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_set_event_cb_p) +{ + callback_result = false; + int ret = sticker_consumer_set_event_cb(g_ch, event_cb, NULL); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** + * @testcase utc_sticker_consumer_set_event_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that registers a event callback function. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_set_event_cb_n) +{ + int ret = sticker_consumer_set_event_cb(g_ch, NULL, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_unset_event_cb_n + * @since_tizen 5.5 + * @description Negative UTC of the function that unregisters a event callback function. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_unset_event_cb_n) +{ + int ret = sticker_consumer_unset_event_cb(NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_consumer_group_image_list_foreach_all_n + * @since_tizen 6.5 + * @description Negative UTC of the function that retrieves images of all sticker groups. + */ +TEST_F(StickerConsumerTest, utc_sticker_consumer_group_image_list_foreach_all_n) +{ + int ret = sticker_consumer_group_image_list_foreach_all(g_ch, NULL, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + } // namespace diff --git a/tests/src/sticker_data_unittests.cc b/tests/src/sticker_data_unittests.cc index 57002ce..31b4468 100644 --- a/tests/src/sticker_data_unittests.cc +++ b/tests/src/sticker_data_unittests.cc @@ -18,6 +18,7 @@ #include #include +#include #include "app_common_mock.h" @@ -500,4 +501,62 @@ TEST_F(StickerDataTest, utc_sticker_data_get_date_n) EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); } +/** + * @testcase utc_sticker_data_set_display_type_p + * @since_tizen 5.5 + * @description Positive UTC of the function that sets display type of sticker data. + */ +TEST_F(StickerDataTest, utc_sticker_data_set_display_type_p) +{ + int ret = sticker_data_set_display_type(g_dh, STICKER_DATA_DISP_EMOJI); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** + * @testcase utc_sticker_data_get_display_type_p + * @since_tizen 5.5 + * @description Positive UTC of the function that gets display type of sticker data. + */ +TEST_F(StickerDataTest, utc_sticker_data_get_display_type_p) +{ + sticker_data_display_type_e disp_type; + int ret = sticker_data_get_display_type(g_dh, &disp_type); + EXPECT_EQ(ret, STICKER_ERROR_NONE); +} + +/** + * @testcase utc_sticker_data_get_display_type_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets display type of sticker data. + */ +TEST_F(StickerDataTest, utc_sticker_data_get_display_type_n) +{ + int ret = sticker_data_get_display_type(g_dh, NULL); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_data_get_handle_n + * @since_tizen 5.5 + * @description Negative UTC of the function that gets the sticker data handle using URI. + */ +TEST_F(StickerDataTest, tc_sticker_data_get_handle_n) +{ + sticker_data_h tmp_handle = NULL; + int ret = sticker_data_get_handle("", &tmp_handle); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_sticker_data_get_handle_n2 + * @since_tizen 5.5 + * @description Negative UTC of the function that gets the sticker data handle using URI. + */ +TEST_F(StickerDataTest, utc_sticker_data_get_handle_n2) +{ + sticker_data_h tmp_handle = NULL; + int ret = sticker_data_get_handle("www.invalid.com", &tmp_handle); + EXPECT_EQ(ret, STICKER_ERROR_NO_SUCH_FILE); +} + } // namespace diff --git a/tests/src/sticker_provider_unittests.cc b/tests/src/sticker_provider_unittests.cc index 590c48a..98eb73e 100644 --- a/tests/src/sticker_provider_unittests.cc +++ b/tests/src/sticker_provider_unittests.cc @@ -355,4 +355,15 @@ TEST_F(StickerProviderTest, utc_sticker_provider_delete_data_by_uri_n) EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); } +/** + * @testcase utc_sticker_provider_set_group_image_n + * @since_tizen 6.5 + * @description Negative UTC of the function that sets group image. + */ +TEST_F(StickerProviderTest, utc_sticker_provider_set_group_image_n) +{ + int ret = sticker_provider_set_group_image(g_ph, "invalid", STICKER_DATA_URI_WEB_RESOURCE, "www.valid.com/test/image.png"); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); +} + } // namespace -- 2.7.4 From e887881151765cc5d2ae9161156fa14e44ffe8a3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 25 Mar 2021 13:56:08 +0900 Subject: [PATCH 04/16] Fix possible memory leak in unittest Change-Id: I0fee6f5bd53ee58f9f5b4785d958bffedfec86bc Signed-off-by: Jihoon Kim --- tests/src/sticker_data_unittests.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/src/sticker_data_unittests.cc b/tests/src/sticker_data_unittests.cc index 31b4468..5557f29 100644 --- a/tests/src/sticker_data_unittests.cc +++ b/tests/src/sticker_data_unittests.cc @@ -544,6 +544,9 @@ TEST_F(StickerDataTest, tc_sticker_data_get_handle_n) { sticker_data_h tmp_handle = NULL; int ret = sticker_data_get_handle("", &tmp_handle); + if (tmp_handle) + sticker_data_destroy(tmp_handle); + EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER); } @@ -556,6 +559,9 @@ TEST_F(StickerDataTest, utc_sticker_data_get_handle_n2) { sticker_data_h tmp_handle = NULL; int ret = sticker_data_get_handle("www.invalid.com", &tmp_handle); + if (tmp_handle) + sticker_data_destroy(tmp_handle); + EXPECT_EQ(ret, STICKER_ERROR_NO_SUCH_FILE); } -- 2.7.4 From 21414bdf1da3ec0062c39c450a75e46832b8391d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 25 Mar 2021 13:47:21 +0900 Subject: [PATCH 05/16] Fix issue no executable is included in unittest package Change-Id: I165bccf668b16f8e644f0f2892ef72413fd121e5 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 2 +- packaging/capi-ui-sticker.spec | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 916ce15..7da1298 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,11 +55,11 @@ ENDIF() ## Test IF("${TEST_ENABLE}" STREQUAL "true") ENABLE_TESTING() +ENDIF() SET(UTC_STICKER sticker_unittests) ADD_TEST(NAME ${UTC_STICKER} COMMAND ${UTC_STICKER} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests) ADD_SUBDIRECTORY(tests) -ENDIF() ## config ## INSTALL(FILES ${CMAKE_SOURCE_DIR}/capi-ui-sticker.info DESTINATION ${TZ_SYS_RO_SHARE}/parser-plugins) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 2210fec..6855dba 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -213,7 +213,8 @@ chsmack -a "User::App::Shared" /opt/usr/share/sticker-data %endif %files unittests -%{_bindir}/* +%license LICENSE +%{_bindir}/sticker_unittests %if 0%{?gcov:1} %files gcov -- 2.7.4 From 2464ae0869f0d937fd59cb6a9ebd51aa19edde5d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 25 Mar 2021 19:36:50 +0900 Subject: [PATCH 06/16] Update package version to 0.1.74 Change-Id: I20efdef65dde92d84af76f45d7556cd2f1a89f14 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 6855dba..feac92e 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.73 +Version: 0.1.74 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index cdfdfb9..1c2cbb6 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From bdb6702818823a30845b6e13e7af15bae43f6d5f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 26 Mar 2021 11:01:19 +0900 Subject: [PATCH 07/16] Remove unused code Unittest Coverage result: lines......: 66.3% (1307 of 1970 lines) functions..: 85.2% (202 of 237 functions) Change-Id: Iec165cf2ea7953e6ae8ef98c9df948c2fad9269e Signed-off-by: Jihoon Kim --- tests/mock/mock.cc | 11 ----------- tests/src/sticker_provider_unittests.cc | 21 --------------------- 2 files changed, 32 deletions(-) diff --git a/tests/mock/mock.cc b/tests/mock/mock.cc index 75be995..de7faf4 100644 --- a/tests/mock/mock.cc +++ b/tests/mock/mock.cc @@ -17,21 +17,10 @@ DEFINE_FAKE_VALUE_FUNC(int, cynara_initialize, cynara**, DEFINE_FAKE_VALUE_FUNC(int, cynara_finish, cynara*); DEFINE_FAKE_VALUE_FUNC(int, cynara_check, cynara*, const char*, const char*, const char*, const char*); -DEFINE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_client, GDBusConnection*, - const gchar*, enum cynara_client_creds, gchar**); -DEFINE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_user, GDBusConnection*, - const gchar*, enum cynara_user_creds, gchar**); /* gio */ DEFINE_FAKE_VALUE_FUNC(GDBusConnection*, g_bus_get_sync, GBusType, GCancellable*, GError**); -DEFINE_FAKE_VALUE_FUNC(guint, g_bus_own_name_on_connection, - GDBusConnection*, const gchar*, GBusNameOwnerFlags, - GBusNameAcquiredCallback, GBusNameLostCallback, gpointer, - GDestroyNotify); -DEFINE_FAKE_VALUE_FUNC(gboolean, g_dbus_connection_emit_signal, - GDBusConnection*, const gchar*, const gchar*, - const gchar*, const gchar*, GVariant*, GError**); DEFINE_FAKE_VALUE_FUNC(guint, g_bus_watch_name_on_connection, GDBusConnection*, const gchar*, GBusNameWatcherFlags, GBusNameAppearedCallback, GBusNameVanishedCallback, gpointer, diff --git a/tests/src/sticker_provider_unittests.cc b/tests/src/sticker_provider_unittests.cc index 98eb73e..2818166 100644 --- a/tests/src/sticker_provider_unittests.cc +++ b/tests/src/sticker_provider_unittests.cc @@ -33,22 +33,6 @@ static bool callback_result = false; static sticker_data_h g_dh = NULL; static sticker_provider_h g_ph = NULL; -// cynara -int __cynara_initialize(cynara** c, const cynara_configuration* conf) { - *c = (void *)0x1; - return 0; -} - -int __cynara_finish(cynara* c) { - return 0; -} - -int __cynara_check(cynara* c, const char* client, const char* client_session, - const char* user, - const char* privilege) { - return CYNARA_API_ACCESS_ALLOWED; -} - // app common int __fake_app_get_id(char** app_id) { if (app_id) @@ -151,11 +135,6 @@ static void foreach_to_check_del(sticker_data_h data_handle, void *user_data) class StickerProviderTest : public testing::Test { public: virtual void SetUp() { - // cynara - cynara_initialize_fake.custom_fake = __cynara_initialize; - cynara_finish_fake.custom_fake = __cynara_finish; - cynara_check_fake.custom_fake = __cynara_check; - // app-common app_get_id_fake.custom_fake = __fake_app_get_id; -- 2.7.4 From 1d20805ce05aa04f26e1016529084d1078513323 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 31 Mar 2021 17:38:25 +0900 Subject: [PATCH 08/16] Update package version to 0.1.75 Change-Id: I23de32154aa0fea3554db000841edc4e62b2f118 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index feac92e..5bfc02c 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.74 +Version: 0.1.75 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 1c2cbb6..cecaf3e 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From db574706917ed3ffe1ab975d347d73151f5e935e Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 23 Apr 2021 10:59:00 +0900 Subject: [PATCH 09/16] Fix build error on gcov option Change-Id: I5ec5db55b92a2e6c3fb8e699f0bd7108a4c44066 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 2 -- packaging/capi-ui-sticker.spec | 18 ++++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7da1298..4279bb2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,7 @@ ADD_SUBDIRECTORY(receiver) ENDIF() ## Test -IF("${TEST_ENABLE}" STREQUAL "true") ENABLE_TESTING() -ENDIF() SET(UTC_STICKER sticker_unittests) ADD_TEST(NAME ${UTC_STICKER} COMMAND ${UTC_STICKER} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 5bfc02c..125e876 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -115,12 +115,7 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" %endif -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_USER_SHARE=%TZ_USER_SHARE \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \ -%if %{defined _ctest_enable} - -DTEST_ENABLE="%{_ctest_enable}" \ -%else - -DTEST_ENABLE="false" \ -%endif + -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES make %{?jobs:-j%jobs} @@ -158,13 +153,12 @@ tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj %endif %check -%if "%{_ctest_enable}" == "true" -ctest --output-on-failure %{?_smp_mflags} -%endif - %if 0%{?gcov:1} -lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info -genhtml gcov.info +ctest --output-on-failure %{?_smp_mflags} +lcov -c --ignore-errors graph --no-external -q -d . -o capi-ui-sticker.info +genhtml capi-ui-sticker.info -o capi-ui-sticker.out +zip -r capi-ui-sticker.zip capi-ui-sticker.out capi-ui-sticker.info +install -m 0644 capi-ui-sticker.zip %{buildroot}%{_datadir}/gcov %endif %post -- 2.7.4 From 9aabbc8ac53ef75bf4212a5cfc4b7b0aeb0476ff Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 23 Apr 2021 11:00:46 +0900 Subject: [PATCH 10/16] Update package version to 0.1.76 Change-Id: Ib232040e342a826e255a362cb46c319edb48fc17 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 125e876..564e95b 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.75 +Version: 0.1.76 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index cecaf3e..e3ec8e9 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 1b0b0d5a38fb1ef17688d6545c1970e40b9dd6fd Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 21 May 2021 17:20:41 +0900 Subject: [PATCH 11/16] Fix issue detected by static analysis tool double_free: Calling g_variant_iter_free frees pointer info_iter which has already been freed. pass_freed_arg: Passing freed pointer keyword_iter as an argument to g_variant_iter_free. Change-Id: I9517519228317fbf921f5bef60641146c20ff72d --- client/src/sticker_dbus.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/client/src/sticker_dbus.c b/client/src/sticker_dbus.c index 75c1a89..a36cfaa 100644 --- a/client/src/sticker_dbus.c +++ b/client/src/sticker_dbus.c @@ -179,13 +179,6 @@ static void _handle_sticker_consumer_cb(GDBusConnection *connection, g_variant_get(parameters, "(ia{iv}a(s))", &event_type, &info_iter, &keyword_iter); _get_sticker_info_from_gvariant(info_iter, keyword_iter, sticker_data); consumer_handle->event_cb((sticker_consumer_event_type_e)event_type, sticker_data, consumer_handle->event_cb_user_data); - - if (info_iter) - g_variant_iter_free(info_iter); - - if (keyword_iter) - g_variant_iter_free(keyword_iter); - sticker_data_destroy(sticker_data); } } @@ -619,12 +612,6 @@ int sticker_dbus_update_sticker_info(GDBusConnection *gdbus_connection, sticker_ g_variant_get(reply_body, "(a{iv}a(s))", &info_iter, &keyword_iter); _get_sticker_info_from_gvariant(info_iter, keyword_iter, origin_data); - - if (info_iter) - g_variant_iter_free(info_iter); - - if (keyword_iter) - g_variant_iter_free(keyword_iter); } else { LOGW("failed to get sticker info"); free(origin_data); @@ -781,12 +768,6 @@ int sticker_dbus_get_sticker_info_by_record_id(GDBusConnection *gdbus_connection if (reply_body) g_variant_unref(reply_body); - - if (info_iter) - g_variant_iter_free(info_iter); - - if (keyword_iter) - g_variant_iter_free(keyword_iter); } if (reply) @@ -1132,12 +1113,6 @@ int sticker_dbus_get_sticker_info_by_uri(GDBusConnection *gdbus_connection, stic if (reply_body) g_variant_unref(reply_body); - - if (info_iter) - g_variant_iter_free(info_iter); - - if (keyword_iter) - g_variant_iter_free(keyword_iter); } if (reply) -- 2.7.4 From 5c47ae67baccdadbe490d894079e2a014dd37e5a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 21 May 2021 17:22:56 +0900 Subject: [PATCH 12/16] Update package version to 0.1.77 Change-Id: I58d8623a5fd6bf4a28e093ce513f23094e0ce800 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 564e95b..842f64e 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.76 +Version: 0.1.77 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index e3ec8e9..32057c9 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From a53c9df27d5b04334b4b2e6dac044403bdfee40b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 6 Sep 2021 09:52:26 +0900 Subject: [PATCH 13/16] Fix issue detected by static analysis tool Change-Id: I44ca1ca13b33e9f6dc014a7700fca22f4f7322b1 Signed-off-by: Jihoon Kim --- server/stickerd_data_manager.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index 3210959..ac976f2 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -862,6 +862,7 @@ int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_ JsonArray *keyword_arr = NULL; int arr_len = 0; int keyword_arr_len = 0; + const char *keyword = NULL; JsonNode *root = NULL; JsonObject *root_obj = NULL; @@ -967,7 +968,9 @@ int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_ goto free_memory; for (int j = 0; j < keyword_arr_len; j++) { - sticker_info->keyword = g_list_append(sticker_info->keyword, strdup((const char *)json_array_get_string_element(keyword_arr, j))); + keyword = json_array_get_string_element(keyword_arr, j); + if (keyword) + sticker_info->keyword = g_list_append(sticker_info->keyword, strdup(keyword)); } ret = stickerd_db_insert_sticker_info(&record_id, sticker_info); @@ -1898,4 +1901,4 @@ int stickerd_get_group_image_list(GVariant *parameters, GVariant **reply_body) } return ret; -} \ No newline at end of file +} -- 2.7.4 From 0b7854c07e132af8df0b8b864fa3e63aa4dd5ead Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 6 Sep 2021 09:55:20 +0900 Subject: [PATCH 14/16] Update package version to 0.1.78 Change-Id: I098e1947801f6bcb6d7c15c2b0527de3409fff33 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 842f64e..8d2b693 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.77 +Version: 0.1.78 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 32057c9..da652b6 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 2a43d2e836b607c44fb0db38e01133c131f9d9f2 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 12 Oct 2021 13:57:35 +0900 Subject: [PATCH 15/16] Fix build error in sticker-receiver Change-Id: I8131bc527af046aaff894ea8884a8e38167106e2 Signed-off-by: Jihoon Kim --- receiver/inc/ft.h | 4 ++++ receiver/src/main.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/receiver/inc/ft.h b/receiver/inc/ft.h index f3a735c..7421840 100644 --- a/receiver/inc/ft.h +++ b/receiver/inc/ft.h @@ -16,6 +16,8 @@ #include +#include "sticker_request.h" + #ifndef __FT_H__ #define __FT_H__ @@ -39,4 +41,6 @@ bool request_show_sync_notification(); bool get_job_progress(); +void push_sticker_request(request_type req_type, const char *mode, const char *category, const char *type); + #endif /* __FT_H__ */ diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 968b4f4..12cf6a2 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "receiver_preference.h" #include "sticker_info.h" +#include "sticker_request.h" using namespace std; -- 2.7.4 From 987e86f3b8cf1a540b5c032a15bcf83eb1bd5c53 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 12 Oct 2021 19:03:40 +0900 Subject: [PATCH 16/16] Fix typo in receiver Change-Id: I1e55f56ec55429a3075985fe1bb1370cc87c59e2 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 12cf6a2..1363791 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -183,7 +183,7 @@ static void process_request(app_control_h app_control, char *request) if (!is_init_sap()) initialize_sap(); request_all_sticker_data(mode, type); - } else { // Under the sync interval time. Need to check whether last sync was succeded or not. + } else { // Under the sync interval time. Need to check whether last sync was succeeded or not. int last_sync_status = 0; if (preference_get_int(LAST_SYNC_STATUS, &last_sync_status) != PREFERENCE_ERROR_NONE) { -- 2.7.4