From b1e3bc48a7ce2352771082591b2680c6a3000313 Mon Sep 17 00:00:00 2001 From: hyunho Date: Wed, 10 Jul 2019 14:03:19 +0900 Subject: [PATCH 01/16] Make a gcov package for measuring coverage easier Change-Id: I3358c89372f727a09eb998815fcbf702a7ac3740 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 7be64cd..8d01f77 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -47,19 +47,45 @@ Requires: %{name} = %{version}-%{release} %description -n capi-appfw-widget-application-devel widget application (development files) +%if 0%{?gcov:1} +%package gcov +Summary: Widget application API(gcov) +Group: Application Framework/Libraries + +%description gcov +gcov objects of a widget application library +%endif + %prep %setup -q %build +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" +%endif + export CFLAGS+=" -DEFL_BETA_API_SUPPORT " MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} %__make %{?jobs:-j%jobs} +%if 0%{?gcov:1} +mkdir -p gcov-obj +find . -name '*.gcno' -exec cp '{}' gcov-obj ';' +%endif + %install rm -rf %{buildroot} %make_install +%if 0%{?gcov:1} +mkdir -p %{buildroot}%{_datadir}/gcov/obj +install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +%endif + mkdir -p %{buildroot}%{_libdir}/pkgconfig cp capi-appfw-widget-application.pc %{buildroot}%{_libdir}/pkgconfig @@ -92,3 +118,7 @@ cp capi-appfw-widget-application.pc %{buildroot}%{_libdir}/pkgconfig %{_libdir}/pkgconfig/capi-appfw-widget-application.pc %{_libdir}/libcapi-appfw-widget-application.so +%if 0%{?gcov:1} +%files gcov +%{_datadir}/gcov/obj/* +%endif -- 2.7.4 From 251db92c77c0494774d5de43cb3d983cf2199ef7 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Fri, 18 Oct 2019 13:00:10 +0900 Subject: [PATCH 02/16] Update doxygen Change-Id: I9b1d04a6f4e98005e4954662d797139302b516bd Signed-off-by: mk5004.lee --- include/widget_app.h | 44 ++++++++++++++++++++++++-------------------- include/widget_app_efl.h | 4 ++-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/include/widget_app.h b/include/widget_app.h index 35d864d..8413c33 100755 --- a/include/widget_app.h +++ b/include/widget_app.h @@ -66,7 +66,7 @@ typedef struct _widget_context *widget_context_h; * @param[in] content The data set for the previous status * @param[in] w The pixel value for widget width * @param[in] h The pixel value for widget height - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure @@ -84,12 +84,12 @@ typedef int (*widget_instance_create_cb)(widget_context_h context, bundle *conte * As a input parameter, content contains the saved status of the widget instance. * You can fill the content parameter with the current status in this callback, * then the framework will save the content by receiving it as a output parameter. - * Consequently, you should not use widget_app_context_set_content_info() api in this callback. + * Consequently, you should not use widget_app_context_set_content_info() function in this callback. * The content will be overwritten after this callback returns with the 'content' parameter. * @param[in] context The context of widget instance * @param[in] reason The reason for destruction * @param[in,out] content The data set to save - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure */ @@ -102,7 +102,7 @@ typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_d * The paused instance may be destroyed by framework. * @since_tizen 2.3.1 * @param[in] context The context of widget instance - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure */ @@ -114,7 +114,7 @@ typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_dat * @details The callback function is called when the widget is visible. * @since_tizen 2.3.1 * @param[in] context The context of widget instance - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure */ @@ -128,7 +128,7 @@ typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_da * @param[in] context The context of widget instance * @param[in] w The pixel value for widget width * @param[in] h The pixel value for widget height - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure */ @@ -143,7 +143,7 @@ typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h, * @param[in] content The data set for updating this widget. It will be provided by requester. * Requester can use widget_service_trigger_update() * @param[in] force Although the widget is paused, if it is TRUE, the widget can be updated - * @param[in] user_data The user data passed from widget_app_class_create function + * @param[in] user_data The user data passed from widget_app_class_create() function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @see widget_service_trigger_update() @@ -211,15 +211,15 @@ typedef struct { /** * @brief Called for each widget context. - * @details This function will be called in the function of widget_app_foreach_context repeatedly. + * @details This function will be called in the function of widget_app_foreach_context() repeatedly. * @since_tizen 2.3.1 * @param[in] context The context for widget instance - * @param[in] data The data for caller + * @param[in] user_data The data for caller * @return @c true to continue with the next iteration of the loop, * otherwise @c false to break out of the loop * @see widget_app_foreach_context() */ -typedef bool (*widget_context_cb)(widget_context_h context, void *data); +typedef bool (*widget_context_cb)(widget_context_h context, void *user_data); /** @@ -232,8 +232,8 @@ typedef bool (*widget_context_cb)(widget_context_h context, void *data); * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful - * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error * @see widget_app_exit() */ @@ -262,8 +262,8 @@ int widget_app_exit(void); * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful - * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error */ int widget_app_terminate_context(widget_context_h context); @@ -277,11 +277,11 @@ int widget_app_terminate_context(widget_context_h context); * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful + * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_CANCELED The iteration is canceled - * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_FAULT Unrecoverable error - * @see widget_app_foreach_context() + * @see widget_context_cb() */ int widget_app_foreach_context(widget_context_cb callback, void *data); @@ -296,9 +296,9 @@ int widget_app_foreach_context(widget_context_cb callback, void *data); * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful + * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory - * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_FAULT Unrecoverable error * @see app_event_type_e * @see app_event_cb() @@ -314,8 +314,8 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful - * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error * @see watch_app_add_event_handler() */ @@ -334,7 +334,9 @@ int widget_app_remove_event_handler(app_event_handler_h event_handler); * @param[in] context The context for widget instance * @return widget instance id on success, * otherwise NULL + * @exception #WIDGET_ERROR_NONE Successful * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_FAULT Unrecoverable error * @see get_last_result() * @see widget_service_trigger_update() @@ -353,8 +355,8 @@ const char *widget_app_get_id(widget_context_h context); * @return The new widget class object, * NULL on error * @exception #WIDGET_ERROR_NONE Successfully added - * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @see get_last_result() */ @@ -368,6 +370,7 @@ widget_class_h widget_app_class_create(widget_instance_lifecycle_callback_s call * @param[in] tag The value to save * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error @@ -382,6 +385,7 @@ int widget_app_context_set_tag(widget_context_h context, void *tag); * @param[out] tag The value to get * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error @@ -397,8 +401,8 @@ int widget_app_context_get_tag(widget_context_h context, void **tag); * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successfully sent - * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @retval #WIDGET_ERROR_FAULT Unrecoverable error */ @@ -413,8 +417,8 @@ int widget_app_context_set_content_info(widget_context_h context, bundle *conten * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successfully sent - * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @retval #WIDGET_ERROR_FAULT Unrecoverable error */ @@ -432,8 +436,8 @@ int widget_app_context_set_title(widget_context_h context, const char *title); * @return The new widget class object, * NULL on error * @exception #WIDGET_ERROR_NONE Successfully added - * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported + * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @see get_last_result() */ diff --git a/include/widget_app_efl.h b/include/widget_app_efl.h index 7d65cf3..8817395 100644 --- a/include/widget_app_efl.h +++ b/include/widget_app_efl.h @@ -37,11 +37,11 @@ extern "C" { * @param[in] context The context for widget instance * @param[out] win evas object for window * @return 0 on success, - * otherwise a negative error value + * otherwise a negative error value * @retval #WIDGET_ERROR_NONE Successful + * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Failed to make evas object - * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported */ int widget_app_get_elm_win(widget_context_h context, Evas_Object **win); -- 2.7.4 From 3af2cf5dc781f226121c3c7c62c7f40952deb0b1 Mon Sep 17 00:00:00 2001 From: "SukHyung, Kang" Date: Wed, 13 Nov 2019 17:19:45 +0900 Subject: [PATCH 03/16] Fix api reference for appcore widget Change-Id: I1de112889084b965f6593528525d6f17b2e78206 Signed-off-by: SukHyung, Kang --- doc/appcore-widget_doc.h | 4 ++-- include/widget_app.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/appcore-widget_doc.h b/doc/appcore-widget_doc.h index 0dbc9a9..0e540a4 100755 --- a/doc/appcore-widget_doc.h +++ b/doc/appcore-widget_doc.h @@ -63,9 +63,9 @@ * * @subsection CAPI_WIDGET_APP_MODULE_SYSTEM_EVENT Registering Callbacks for System Events * Tizen widget applications can receive system events with widget_app_add_event_handler() API. - * The type of system events that can be received are same as Tizen UI applications except for APP_EVENT_DEVICE_ORIENTATION_CHANGED. + * The type of system events that can be received are same as Tizen UI applications except for #APP_EVENT_DEVICE_ORIENTATION_CHANGED. * See @ref CAPI_APPLICATION_MODULE. - * The event for APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported in this module. + * The event for #APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported in this module. * @subsection CAPI_WIDGET_APP_INSTNACE_STATE_CHANGE_EVENT Registering callbacks for instance state change events * As for Tizen widget instance states, it is somewhat similar to Tizen application states. diff --git a/include/widget_app.h b/include/widget_app.h index 35d864d..6b4d1d9 100755 --- a/include/widget_app.h +++ b/include/widget_app.h @@ -290,7 +290,7 @@ int widget_app_foreach_context(widget_context_cb callback, void *data); * @brief Adds the system event handler. * @since_tizen 2.3.1 * @param[out] event_handler The event handler - * @param[in] event_type The system event type. APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported + * @param[in] event_type The system event type. #APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported * @param[in] callback The callback function * @param[in] user_data The user data to be passed to the callback function * @return #WIDGET_ERROR_NONE on success, @@ -302,7 +302,7 @@ int widget_app_foreach_context(widget_context_cb callback, void *data); * @retval #WIDGET_ERROR_FAULT Unrecoverable error * @see app_event_type_e * @see app_event_cb() - * @see watch_app_remove_event_handler() + * @see widget_app_remove_event_handler() */ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_e event_type, app_event_cb callback, void *user_data); @@ -317,7 +317,7 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_FAULT Unrecoverable error - * @see watch_app_add_event_handler() + * @see widget_app_add_event_handler() */ int widget_app_remove_event_handler(app_event_handler_h event_handler); -- 2.7.4 From e6677450fdf32eda7326d9a084a6f598238f0f7a Mon Sep 17 00:00:00 2001 From: "SukHyung, Kang" Date: Thu, 14 Nov 2019 17:42:27 +0900 Subject: [PATCH 04/16] Release version 1.3.6 Changes: - Make a gcov package for measuring coverage easier - Update doxygen - Fix api reference for appcore widget Change-Id: Idb424743b2b3a7223bba2487d32ed60e2c8f7bd8 Signed-off-by: SukHyung, Kang --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 8d01f77..6488763 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.5 +Version: 1.3.6 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From d61b07592af387b08dbb84424d43f10f570027de Mon Sep 17 00:00:00 2001 From: hyunho Date: Mon, 17 Feb 2020 18:06:44 +0900 Subject: [PATCH 05/16] Add log for app control event Change-Id: I039e1fa0327b54a99878fdb19cd46352d96f2677 Signed-off-by: hyunho --- src/base/widget_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index c11f0af..17edb5d 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -525,6 +525,8 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b) free(data->id); free(data); __check_empty_instance(); + aul_widget_write_log(LOG_TAG, + "[%s:%d] instance_id(%s)", __FUNCTION__, __LINE__, id); } static void __control_change_period(const char *class_id, const char *id, @@ -639,6 +641,7 @@ static int __multiwindow_control(bundle *b, void *data) return 0; } + LOGI("app control operation(%s)", operation); if (strcmp(operation, "create") == 0) __control_create(class_id, id, b); else if (strcmp(operation, "resize") == 0) -- 2.7.4 From 8bb1fa9c191d15d6cd8a8d8a6ace4d4e04a2145e Mon Sep 17 00:00:00 2001 From: hyunho Date: Mon, 17 Feb 2020 18:30:41 +0900 Subject: [PATCH 06/16] Release version 1.3.7 Changes: - Add log for app control event - Merge "Add log for app control event" into tizen Change-Id: I64facda04efd4ce09e1189c209c22814b610fdb2 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 6488763..86af3a7 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.6 +Version: 1.3.7 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From ac5251199582de1a19f45101a4c97a988266d964 Mon Sep 17 00:00:00 2001 From: hyunho Date: Wed, 22 Jul 2020 17:36:23 +0900 Subject: [PATCH 07/16] Add unittest Change-Id: Ibe2d80778ef7abb774a79d1139f262e9e464249f Signed-off-by: hyunho --- CMakeLists.txt | 115 ++++++++------------- cmake/Modules/ApplyPkgConfig.cmake | 35 +++++++ packaging/appcore-widget.spec | 25 ++++- src/CMakeLists.txt | 2 + src/base/CMakeLists.txt | 23 +++++ src/efl_base/CMakeLists.txt | 26 +++++ test/CMakeLists.txt | 1 + test/unit_tests/CMakeLists.txt | 27 +++++ test/unit_tests/main.cc | 25 +++++ .../mock/appcore_multiwindow_base_mock.cc | 46 +++++++++ .../mock/appcore_multiwindow_base_mock.h | 40 +++++++ test/unit_tests/mock/ecore_wl2_mock.cc | 59 +++++++++++ test/unit_tests/mock/ecore_wl2_mock.h | 49 +++++++++ test/unit_tests/mock/gio_mock.cc | 99 ++++++++++++++++++ test/unit_tests/mock/gio_mock.h | 67 ++++++++++++ test/unit_tests/mock/mock_hook.h | 42 ++++++++ test/unit_tests/mock/module_mock.h | 25 +++++ test/unit_tests/mock/system_info_mock.cc | 27 +++++ test/unit_tests/mock/system_info_mock.h | 32 ++++++ test/unit_tests/mock/test_fixture.cc | 21 ++++ test/unit_tests/mock/test_fixture.h | 53 ++++++++++ test/unit_tests/test_widget_app.cc | 97 +++++++++++++++++ 22 files changed, 861 insertions(+), 75 deletions(-) create mode 100644 cmake/Modules/ApplyPkgConfig.cmake create mode 100644 src/CMakeLists.txt create mode 100644 src/base/CMakeLists.txt create mode 100644 src/efl_base/CMakeLists.txt create mode 100644 test/CMakeLists.txt create mode 100644 test/unit_tests/CMakeLists.txt create mode 100644 test/unit_tests/main.cc create mode 100644 test/unit_tests/mock/appcore_multiwindow_base_mock.cc create mode 100644 test/unit_tests/mock/appcore_multiwindow_base_mock.h create mode 100644 test/unit_tests/mock/ecore_wl2_mock.cc create mode 100644 test/unit_tests/mock/ecore_wl2_mock.h create mode 100644 test/unit_tests/mock/gio_mock.cc create mode 100755 test/unit_tests/mock/gio_mock.h create mode 100644 test/unit_tests/mock/mock_hook.h create mode 100644 test/unit_tests/mock/module_mock.h create mode 100644 test/unit_tests/mock/system_info_mock.cc create mode 100644 test/unit_tests/mock/system_info_mock.h create mode 100644 test/unit_tests/mock/test_fixture.cc create mode 100644 test/unit_tests/mock/test_fixture.h create mode 100644 test/unit_tests/test_widget_app.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ac5b6..7dc63e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,86 +1,53 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(appcore-widget C) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) + +PROJECT(appcore-widget) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") +SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") +SET(LIBDIR ${LIB_INSTALL_DIR}) SET(INCLUDEDIR "\${prefix}/include") -SET(VERSION ${FULLVER}) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +## Compiler flags +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -g -Wall -Werror") -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +## Linker flags +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed,--gc-sections -pie") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") -SET(CMAKE_SKIP_BUILD_RPATH TRUE) +## Targets +SET(TARGET_WIDGET_BASE "appcore-widget-base") +SET(TARGET_WIDGET_APPLICATION "capi-appfw-widget-application") -################################################################# -# Build appcore-widget base Library -# ------------------------------ -SET(APPCORE_WIDGET_BASE "appcore-widget-base") -SET(SOURCES_base src/base/widget_base.c) +ENABLE_TESTING() +SET(TARGET_WIDGET_APPLICATION_UNIT_TEST "appcore-widget-unit-test") INCLUDE(FindPkgConfig) -pkg_check_modules(pkg_widget_base REQUIRED - dlog - appcore-common - capi-appfw-app-common - widget_service - capi-system-info - ecore-wl2 - capi-system-info - screen_connector_provider - appcore-multiwindow - ) - -FOREACH(flag ${pkg_widget_base_CFLAGS}) - SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}") -ENDFOREACH(flag) - -ADD_LIBRARY(${APPCORE_WIDGET_BASE} SHARED ${SOURCES_base}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET_BASE} PROPERTIES SOVERSION ${MAJORVER}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET_BASE} PROPERTIES VERSION ${FULLVER}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET_BASE} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_widget}) -TARGET_LINK_LIBRARIES(${APPCORE_WIDGET_BASE} ${pkg_widget_base_LDFLAGS} "-ldl -Wl,--no-undefined") - -CONFIGURE_FILE(${APPCORE_WIDGET_BASE}.pc.in ${APPCORE_WIDGET_BASE}.pc @ONLY) -INSTALL(TARGETS ${APPCORE_WIDGET_BASE} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_WIDGET_BASE}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - - -################################################################# -# Build appcore-widget Library -# ------------------------------ -SET(APPCORE_WIDGET "capi-appfw-widget-application") -SET(SOURCES_efl src/efl_base/widget_app.c src/efl_base/widget_app_internal.c src/efl_base/widget_error.c) +INCLUDE(ApplyPkgConfig) + +ADD_DEFINITIONS("-DPROJECT_TAG=\"TIZEN_APPCORE_WIDGET\"") + +## Find all needed packages once +PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle) +PKG_CHECK_MODULES(DLOG_DEPS REQUIRED dlog) +PKG_CHECK_MODULES(APPCORE_COMMON_DEPS REQUIRED appcore-common) +PKG_CHECK_MODULES(WIDGET_SERVICE_DEPS REQUIRED widget_service) +PKG_CHECK_MODULES(SYSTEM_INFO_DEPS REQUIRED capi-system-info) +PKG_CHECK_MODULES(ECORE_WL2_DEPS REQUIRED ecore-wl2) +PKG_CHECK_MODULES(SCREEN_CONNECTOR_PROVIDER_DEPS REQUIRED screen_connector_provider) +PKG_CHECK_MODULES(APPCORE_MULTIWINDOW_DEPS REQUIRED appcore-multiwindow) +PKG_CHECK_MODULES(AUL_DEP REQUIRED aul) +PKG_CHECK_MODULES(ELEMENTARY_DEP REQUIRED elementary) +PKG_CHECK_MODULES(CAPI_APP_COMMON_DEP REQUIRED capi-appfw-app-common) +PKG_CHECK_MODULES(GLIB_DEPS REQUIRED glib-2.0) +PKG_CHECK_MODULES(GOBJECT_DEPS REQUIRED gobject-2.0) +PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(test) + + + + -INCLUDE(FindPkgConfig) -pkg_check_modules(pkg_widget REQUIRED - aul - dlog - appcore-common - capi-appfw-app-common - elementary - ) -FOREACH(flag ${pkg_widget_CFLAGS}) - SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}") -ENDFOREACH(flag) - -ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SOURCES_efl}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES SOVERSION ${MAJORVER}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES VERSION ${FULLVER}) -SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_widget}) -TARGET_LINK_LIBRARIES(${APPCORE_WIDGET} ${pkg_widget_LDFLAGS} ${APPCORE_WIDGET_BASE} "-ldl -Wl,--no-undefined") - -CONFIGURE_FILE(${APPCORE_WIDGET}.pc.in ${APPCORE_WIDGET}.pc @ONLY) -INSTALL(TARGETS ${APPCORE_WIDGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_WIDGET}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - -INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/appfw/ - FILES_MATCHING - PATTERN "*.h" - ) diff --git a/cmake/Modules/ApplyPkgConfig.cmake b/cmake/Modules/ApplyPkgConfig.cmake new file mode 100644 index 0000000..97679d7 --- /dev/null +++ b/cmake/Modules/ApplyPkgConfig.cmake @@ -0,0 +1,35 @@ +# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# This function applies external (out of source tree) dependencies +# to given target. Arguments are: +# TARGET - valid cmake target +# PRIVACY - dependency can be inherited by dependent targets or not: +# PUBLIC - this should be used by default, cause compile/link flags passing +# PRIVATE - do not passes any settings to dependent targets, +# may be usefull for static libraries from the inside of the project +# Argument ARGV2 and following are supposed to be names of checked pkg config +# packages. This function will use variables created by check_pkg_modules(). +# - ${DEP_NAME}_LIBRARIES +# - ${DEP_NAME}_INCLUDE_DIRS +# - ${DEP_NAME}_CFLAGS +# +FUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY) + MATH(EXPR DEST_INDEX "${ARGC}-1") + FOREACH(I RANGE 2 ${DEST_INDEX}) + IF(NOT ${ARGV${I}}_FOUND) + MESSAGE(FATAL_ERROR "Not found dependency - ${ARGV${I}}_FOUND") + ENDIF(NOT ${ARGV${I}}_FOUND) + TARGET_LINK_LIBRARIES(${TARGET} ${PRIVACY} "${${ARGV${I}}_LIBRARIES}") + TARGET_INCLUDE_DIRECTORIES(${TARGET} ${PRIVACY} SYSTEM "${${ARGV${I}}_INCLUDE_DIRS}") + STRING(REPLACE ";" " " CFLAGS_STR "${${ARGV${I}}_CFLAGS}") + SET(CFLAGS_LIST ${CFLAGS_STR}) + SEPARATE_ARGUMENTS(CFLAGS_LIST) + FOREACH(OPTION ${CFLAGS_LIST}) + TARGET_COMPILE_OPTIONS(${TARGET} ${PRIVACY} ${OPTION}) + ENDFOREACH(OPTION) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SKIP_BUILD_RPATH true) + ENDFOREACH(I RANGE 2 ${DEST_INDEX}) +ENDFUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 86af3a7..be7e811 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -15,8 +15,14 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(ecore-wl2) BuildRequires: pkgconfig(appcore-multiwindow) BuildRequires: pkgconfig(screen_connector_provider) +BuildRequires: pkgconfig(gmock) BuildRequires: cmake +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif + %description Widget base @@ -47,6 +53,13 @@ Requires: %{name} = %{version}-%{release} %description -n capi-appfw-widget-application-devel widget application (development files) +%package -n appcore_widget_unittests +Summary: GTest for appcore-widget +Group: Development/Libraries +%description -n appcore_widget_unittests +GTest for appcore-widget + + %if 0%{?gcov:1} %package gcov Summary: Widget application API(gcov) @@ -89,6 +102,16 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj mkdir -p %{buildroot}%{_libdir}/pkgconfig cp capi-appfw-widget-application.pc %{buildroot}%{_libdir}/pkgconfig +%check +export LD_LIBRARY_PATH=../../src/base:../../src/efl_base +ctest -V +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o appcore-widget.info +genhtml appcore-widget.info -o appcore-widget.out +zip -r appcore-widget.zip appcore-widget.out +install -m 0644 appcore-widget.zip %{buildroot}%{_datadir}/gcov/ +%endif + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -120,5 +143,5 @@ cp capi-appfw-widget-application.pc %{buildroot}%{_libdir}/pkgconfig %if 0%{?gcov:1} %files gcov -%{_datadir}/gcov/obj/* +%{_datadir}/gcov/* %endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e6f55ae --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,2 @@ +ADD_SUBDIRECTORY(base) +ADD_SUBDIRECTORY(efl_base) \ No newline at end of file diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt new file mode 100644 index 0000000..13314c5 --- /dev/null +++ b/src/base/CMakeLists.txt @@ -0,0 +1,23 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} WIDGET_BASE_SRCS) + +ADD_LIBRARY(${TARGET_WIDGET_BASE} SHARED ${WIDGET_BASE_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_WIDGET_BASE} PROPERTIES SOVERSION ${MAJORVER}) +SET_TARGET_PROPERTIES(${TARGET_WIDGET_BASE} PROPERTIES VERSION ${FULLVER}) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_BASE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) +TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_BASE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include/) + +APPLY_PKG_CONFIG(${TARGET_WIDGET_BASE} PUBLIC + DLOG_DEPS + APPCORE_COMMON_DEPS + WIDGET_SERVICE_DEPS + SYSTEM_INFO_DEPS + ECORE_WL2_DEPS + SCREEN_CONNECTOR_PROVIDER_DEPS + APPCORE_MULTIWINDOW_DEPS + CAPI_APP_COMMON_DEP +) + +CONFIGURE_FILE(../../appcore-widget-base.pc.in ../../appcore-widget-base.pc @ONLY) +INSTALL(TARGETS ${TARGET_WIDGET_BASE} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../appcore-widget-base.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/efl_base/CMakeLists.txt b/src/efl_base/CMakeLists.txt new file mode 100644 index 0000000..e9e7311 --- /dev/null +++ b/src/efl_base/CMakeLists.txt @@ -0,0 +1,26 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} WIDGET_APPLICATION_SRCS) + +ADD_LIBRARY(${TARGET_WIDGET_APPLICATION} SHARED ${WIDGET_APPLICATION_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_WIDGET_APPLICATION} PROPERTIES SOVERSION ${MAJORVER}) +SET_TARGET_PROPERTIES(${TARGET_WIDGET_APPLICATION} PROPERTIES VERSION ${FULLVER}) +TARGET_LINK_LIBRARIES(${TARGET_WIDGET_APPLICATION} PRIVATE ${TARGET_WIDGET_BASE}) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_APPLICATION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) +TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_APPLICATION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include/) + +APPLY_PKG_CONFIG(${TARGET_WIDGET_APPLICATION} PUBLIC + AUL_DEP + DLOG_DEPS + APPCORE_COMMON_DEPS + ELEMENTARY_DEP + WIDGET_SERVICE_DEPS + CAPI_APP_COMMON_DEP +) + +CONFIGURE_FILE(../../capi-appfw-widget-application.pc.in ../../capi-appfw-widget-application.pc @ONLY) +INSTALL(TARGETS ${TARGET_WIDGET_APPLICATION} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../capi-appfw-widget-application.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/appfw/ + FILES_MATCHING + PATTERN "*.h" + ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..c90fac8 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(unit_tests) diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt new file mode 100644 index 0000000..5bdc45d --- /dev/null +++ b/test/unit_tests/CMakeLists.txt @@ -0,0 +1,27 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ UNIT_TESTS_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/mock/ UNIT_TESTS_SRCS) +ADD_EXECUTABLE(${TARGET_WIDGET_APPLICATION_UNIT_TEST} + ${UNIT_TESTS_SRCS} +) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/../" + "${CMAKE_CURRENT_SOURCE_DIR}/../../include" + "${CMAKE_CURRENT_SOURCE_DIR}/../../src" +) + +APPLY_PKG_CONFIG(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PUBLIC + GLIB_DEPS + GMOCK_DEPS + BUNDLE_DEPS + GOBJECT_DEPS +) + +TARGET_LINK_LIBRARIES(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PUBLIC ${TARGET_WIDGET_BASE} ${TARGET_WIDGET_APPLICATION}) +SET_TARGET_PROPERTIES(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PROPERTIES COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PROPERTIES LINK_FLAGS "-pie") + +ADD_TEST( + NAME ${TARGET_WIDGET_APPLICATION_UNIT_TEST} + COMMAND ${TARGET_WIDGET_APPLICATION_UNIT_TEST} +) diff --git a/test/unit_tests/main.cc b/test/unit_tests/main.cc new file mode 100644 index 0000000..5f340cd --- /dev/null +++ b/test/unit_tests/main.cc @@ -0,0 +1,25 @@ +// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. + +#include +#include + +int main(int argc, char** argv) { + int ret = -1; + try { + testing::InitGoogleTest(&argc, argv); + } catch(...) { + std::cout << "Exception occurred" << std::endl; + } + + try { + ret = RUN_ALL_TESTS(); + } catch (const ::testing::internal::GoogleTestFailureException& e) { + ret = -1; + std::cout << "GoogleTestFailureException was thrown:" << e.what() + << std::endl; + } + + return ret; +} diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.cc b/test/unit_tests/mock/appcore_multiwindow_base_mock.cc new file mode 100644 index 0000000..f140a0d --- /dev/null +++ b/test/unit_tests/mock/appcore_multiwindow_base_mock.cc @@ -0,0 +1,46 @@ +/* + * 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 "unit_tests/mock/appcore_multiwindow_base_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" int appcore_multiwindow_base_init( + appcore_multiwindow_base_ops ops, int argc, char **argv, void *data) { + return MOCK_HOOK_P4(MultiWindowBaseMock, appcore_multiwindow_base_init, + ops, argc, argv, data); +} + +extern "C" const char *appcore_multiwindow_base_instance_get_id( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_get_id, context); +} + +extern "C" void *appcore_multiwindow_base_instance_get_extra( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_get_extra, context); +} + +extern "C" const char* appcore_multiwindow_base_instance_get_class_id( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_get_class_id, context); +} diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.h b/test/unit_tests/mock/appcore_multiwindow_base_mock.h new file mode 100644 index 0000000..6aa400e --- /dev/null +++ b/test/unit_tests/mock/appcore_multiwindow_base_mock.h @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_ +#define UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_ + +#include +#include + +#include "mock/module_mock.h" + +class MultiWindowBaseMock : public virtual ModuleMock { + public: + virtual ~MultiWindowBaseMock() {} + + MOCK_METHOD4(appcore_multiwindow_base_init, + int(appcore_multiwindow_base_ops, int, char **, void *)); + MOCK_METHOD1(appcore_multiwindow_base_instance_get_id, + const char *(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_instance_get_extra, + void *(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_instance_get_class_id, + const char *(appcore_multiwindow_base_instance_h)); +}; + +#endif // UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_ + diff --git a/test/unit_tests/mock/ecore_wl2_mock.cc b/test/unit_tests/mock/ecore_wl2_mock.cc new file mode 100644 index 0000000..11df066 --- /dev/null +++ b/test/unit_tests/mock/ecore_wl2_mock.cc @@ -0,0 +1,59 @@ +/* + * 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 "unit_tests/mock/ecore_wl2_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" int ecore_wl2_init() { + return MOCK_HOOK_P0(EcoreWl2Mock, ecore_wl2_init); +} + +extern "C" Ecore_Wl2_Display* ecore_wl2_connected_display_get( + const char *display) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_connected_display_get, display); +} + +extern "C" void ecore_wl2_window_iconified_set( + Ecore_Wl2_Window *win, Eina_Bool flag) { + return MOCK_HOOK_P2(EcoreWl2Mock, ecore_wl2_window_iconified_set, win, flag); +} + +extern "C" void ecore_wl2_window_class_set( + Ecore_Wl2_Window *win, const char *name) { + return MOCK_HOOK_P2(EcoreWl2Mock, ecore_wl2_window_class_set, win, name); +} + +extern "C" int ecore_wl2_window_id_get( + Ecore_Wl2_Window *win) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_window_id_get, win); +} + +extern "C" void ecore_wl2_display_disconnect( + Ecore_Wl2_Display *display) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_display_disconnect, display); +} + +extern "C" int ecore_wl2_shutdown() { + return MOCK_HOOK_P0(EcoreWl2Mock, ecore_wl2_shutdown); +} + +extern "C" Ecore_Wl2_Display *ecore_wl2_display_connect(const char *conn) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_display_connect, conn); +} diff --git a/test/unit_tests/mock/ecore_wl2_mock.h b/test/unit_tests/mock/ecore_wl2_mock.h new file mode 100644 index 0000000..78e7704 --- /dev/null +++ b/test/unit_tests/mock/ecore_wl2_mock.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_ECORE_WL2_MOCK_H_ +#define UNIT_TESTS_MOCK_ECORE_WL2_MOCK_H_ + +#include +#include +#include + +#include "mock/module_mock.h" + +class EcoreWl2Mock : public virtual ModuleMock { + public: + virtual ~EcoreWl2Mock() {} + + MOCK_METHOD0(ecore_wl2_init, + int()); + MOCK_METHOD1(ecore_wl2_connected_display_get, + Ecore_Wl2_Display*(const char *)); + MOCK_METHOD2(ecore_wl2_window_iconified_set, + void(Ecore_Wl2_Window *, Eina_Bool)); + MOCK_METHOD2(ecore_wl2_window_class_set, + void(Ecore_Wl2_Window *, const char *)); + MOCK_METHOD1(ecore_wl2_window_id_get, + int(Ecore_Wl2_Window *)); + MOCK_METHOD1(ecore_wl2_display_disconnect, + void(Ecore_Wl2_Display *)); + MOCK_METHOD0(ecore_wl2_shutdown, + int()); + MOCK_METHOD1(ecore_wl2_display_connect, + Ecore_Wl2_Display *(const char *conn)); + +}; + +#endif // UNIT_TESTS_MOCK_ECORE_WL2_MOCK_H_ diff --git a/test/unit_tests/mock/gio_mock.cc b/test/unit_tests/mock/gio_mock.cc new file mode 100644 index 0000000..4e048fc --- /dev/null +++ b/test/unit_tests/mock/gio_mock.cc @@ -0,0 +1,99 @@ +/* + * 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 "unit_tests/mock/gio_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" GDBusConnection* g_bus_get_sync(GBusType type, + GCancellable* cancellable, GError** error) { + return MOCK_HOOK_P3(GioMock, g_bus_get_sync, type, cancellable, error); +} + +extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_sync( + GDBusConnection* conn, GDBusMessage* msg, GDBusSendMessageFlags flags, + gint timeout, volatile guint32* out_serial, GCancellable* cancellable, + GError** error) { + return MOCK_HOOK_P7(GioMock, g_dbus_connection_send_message_with_reply_sync, + conn, msg, flags, timeout, out_serial, cancellable, error); +} + +extern "C" GDBusMessage* g_dbus_message_new_method_call(const gchar* arg0, + const gchar* arg1, const gchar* arg2, const gchar* arg3) { + return MOCK_HOOK_P4(GioMock, g_dbus_message_new_method_call, arg0, arg1, arg2, + arg3); +} + +extern "C" void g_dbus_message_set_body(GDBusMessage* arg0, GVariant* arg1) { + return MOCK_HOOK_P2(GioMock, g_dbus_message_set_body, arg0, arg1); +} + +extern "C" GVariant* g_dbus_message_get_body(GDBusMessage* arg0) { + return MOCK_HOOK_P1(GioMock, g_dbus_message_get_body, arg0); +} + +extern "C" gboolean g_dbus_connection_emit_signal(GDBusConnection* arg0, + const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4, + GVariant* arg5, GError** arg6) { + return MOCK_HOOK_P7(GioMock, g_dbus_connection_emit_signal, + arg0, arg1, arg2, arg3, arg4, arg5, arg6); +} + +extern "C" GDBusNodeInfo* g_dbus_node_info_new_for_xml( + const gchar* arg0, GError** arg1) { + return MOCK_HOOK_P2(GioMock, g_dbus_node_info_new_for_xml, arg0, arg1); +} + +extern "C" guint g_dbus_connection_register_object(GDBusConnection* arg0, + const gchar* arg1, GDBusInterfaceInfo* arg2, + const GDBusInterfaceVTable* arg3, gpointer arg4, + GDestroyNotify arg5, GError** arg6) { + return MOCK_HOOK_P7(GioMock, g_dbus_connection_register_object, + arg0, arg1, arg2, arg3, arg4, arg5, arg6); +} + +extern "C" guint g_bus_own_name_on_connection(GDBusConnection* arg0, + const gchar* arg1, GBusNameOwnerFlags arg2, + GBusNameAcquiredCallback arg3, GBusNameLostCallback arg4, + gpointer arg5, GDestroyNotify arg6) { + return MOCK_HOOK_P7(GioMock, g_bus_own_name_on_connection, + arg0, arg1, arg2, arg3, arg4, arg5, arg6); +} + +extern "C" guint g_dbus_connection_signal_subscribe(GDBusConnection* arg0, + const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4, + const gchar* arg5, GDBusSignalFlags arg6, GDBusSignalCallback arg7, + gpointer arg8, GDestroyNotify arg9) { + return MOCK_HOOK_P10(GioMock, g_dbus_connection_signal_subscribe, + arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); +} + +extern "C" void g_dbus_connection_send_message_with_reply(GDBusConnection* arg0, + GDBusMessage* arg1, GDBusSendMessageFlags arg2, gint arg3, + volatile guint32* arg4, GCancellable* arg5, GAsyncReadyCallback arg6, + gpointer arg7) { + return MOCK_HOOK_P8(GioMock, g_dbus_connection_send_message_with_reply, + arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +} + +extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_finish( + GDBusConnection* arg0, GAsyncResult* arg1, GError** arg2) { + return MOCK_HOOK_P3(GioMock, g_dbus_connection_send_message_with_reply_finish, + arg0, arg1, arg2); +} diff --git a/test/unit_tests/mock/gio_mock.h b/test/unit_tests/mock/gio_mock.h new file mode 100755 index 0000000..a85f992 --- /dev/null +++ b/test/unit_tests/mock/gio_mock.h @@ -0,0 +1,67 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_GIO_MOCK_H_ +#define UNIT_TESTS_MOCK_GIO_MOCK_H_ + +#include +#include + +#include "mock/module_mock.h" + +class GioMock : public virtual ModuleMock { + public: + virtual ~GioMock() {} + + MOCK_METHOD3(g_bus_get_sync, + GDBusConnection*(GBusType, GCancellable*, GError**)); + MOCK_METHOD7(g_bus_own_name_on_connection, + guint(GDBusConnection*, const gchar*, GBusNameOwnerFlags, + GBusNameAcquiredCallback, GBusNameLostCallback, + gpointer, GDestroyNotify)); + + MOCK_METHOD4(g_dbus_message_new_method_call, + GDBusMessage*(const gchar*, const gchar*, const gchar*, const gchar*)); + MOCK_METHOD2(g_dbus_message_set_body, void(GDBusMessage*, GVariant*)); + MOCK_METHOD1(g_dbus_message_get_body, GVariant*(GDBusMessage*)); + + MOCK_METHOD7(g_dbus_connection_send_message_with_reply_sync, + GDBusMessage*(GDBusConnection*, GDBusMessage*, GDBusSendMessageFlags, + gint, volatile guint32*, GCancellable*, GError**)); + MOCK_METHOD7(g_dbus_connection_emit_signal, + gboolean(GDBusConnection*, const gchar*, const gchar*, const gchar*, + const gchar*, GVariant*, GError**)); + MOCK_METHOD7(g_dbus_connection_register_object, + guint(GDBusConnection*, const gchar*, GDBusInterfaceInfo*, + const GDBusInterfaceVTable*, gpointer, GDestroyNotify, GError**)); + MOCK_METHOD10(g_dbus_connection_signal_subscribe, + guint(GDBusConnection*, const gchar*, const gchar*, const gchar*, + const gchar*, const gchar*, GDBusSignalFlags, GDBusSignalCallback, + gpointer, GDestroyNotify)); + MOCK_METHOD8(g_dbus_connection_send_message_with_reply, + void(GDBusConnection*, GDBusMessage*, GDBusSendMessageFlags, gint, + volatile guint32*, GCancellable*, GAsyncReadyCallback, gpointer)); + MOCK_METHOD3(g_dbus_connection_send_message_with_reply_finish, + GDBusMessage*(GDBusConnection*, GAsyncResult*, GError**)); + + MOCK_METHOD2(g_dbus_node_info_new_for_xml, + GDBusNodeInfo*(const gchar*, GError**)); + + MOCK_METHOD2(g_dbus_method_invocation_return_value, + GDBusNodeInfo*(GDBusMethodInvocation*, GVariant*)); +}; + +#endif // UNIT_TESTS_MOCK_GIO_MOCK_H_ diff --git a/test/unit_tests/mock/mock_hook.h b/test/unit_tests/mock/mock_hook.h new file mode 100644 index 0000000..af27bba --- /dev/null +++ b/test/unit_tests/mock/mock_hook.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_MOCK_HOOK_H_ +#define UNIT_TESTS_MOCK_MOCK_HOOK_H_ + +#define MOCK_HOOK_P0(MOCK_CLASS, f) \ + TestFixture::GetMock().f() +#define MOCK_HOOK_P1(MOCK_CLASS, f, p1) \ + TestFixture::GetMock().f(p1) +#define MOCK_HOOK_P2(MOCK_CLASS, f, p1, p2) \ + TestFixture::GetMock().f(p1, p2) +#define MOCK_HOOK_P3(MOCK_CLASS, f, p1, p2, p3) \ + TestFixture::GetMock().f(p1, p2, p3) +#define MOCK_HOOK_P4(MOCK_CLASS, f, p1, p2, p3, p4) \ + TestFixture::GetMock().f(p1, p2, p3, p4) +#define MOCK_HOOK_P5(MOCK_CLASS, f, p1, p2, p3, p4, p5) \ + TestFixture::GetMock().f(p1, p2, p3, p4, p5) +#define MOCK_HOOK_P6(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6) \ + TestFixture::GetMock().f(p1, p2, p3, p4, p5, p6) +#define MOCK_HOOK_P7(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7) \ + TestFixture::GetMock().f(p1, p2, p3, p4, p5, p6, p7) +#define MOCK_HOOK_P8(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8) \ + TestFixture::GetMock().f(p1, p2, p3, p4, p5, p6, p7, p8) +#define MOCK_HOOK_P10(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) \ + TestFixture::GetMock().f( \ + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) + +#endif // UNIT_TESTS_MOCK_MOCK_HOOK_H_ diff --git a/test/unit_tests/mock/module_mock.h b/test/unit_tests/mock/module_mock.h new file mode 100644 index 0000000..9b19d89 --- /dev/null +++ b/test/unit_tests/mock/module_mock.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_MODULE_MOCK_H_ +#define UNIT_TESTS_MOCK_MODULE_MOCK_H_ + +class ModuleMock { + public: + virtual ~ModuleMock() {} +}; + +#endif // UNIT_TESTS_MOCK_MODULE_MOCK_H_ diff --git a/test/unit_tests/mock/system_info_mock.cc b/test/unit_tests/mock/system_info_mock.cc new file mode 100644 index 0000000..ae07f8d --- /dev/null +++ b/test/unit_tests/mock/system_info_mock.cc @@ -0,0 +1,27 @@ +/* + * 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 "unit_tests/mock/system_info_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" int system_info_get_platform_bool(const char *key, bool *value) { + return MOCK_HOOK_P2(SystemInfoMock, + system_info_get_platform_bool, key, value); +} diff --git a/test/unit_tests/mock/system_info_mock.h b/test/unit_tests/mock/system_info_mock.h new file mode 100644 index 0000000..83593ab --- /dev/null +++ b/test/unit_tests/mock/system_info_mock.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_SYSTEM_INFO_MOCK_H_ +#define UNIT_TESTS_MOCK_SYSTEM_INFO_MOCK_H_ + +#include + +#include "mock/module_mock.h" + +class SystemInfoMock : public virtual ModuleMock { + public: + virtual ~SystemInfoMock() {} + MOCK_METHOD2(system_info_get_platform_bool, + int (const char *, bool *)); +}; + +#endif // UNIT_TESTS_MOCK_SYSTEM_INFO_MOCK_H_ + diff --git a/test/unit_tests/mock/test_fixture.cc b/test/unit_tests/mock/test_fixture.cc new file mode 100644 index 0000000..cc5dd19 --- /dev/null +++ b/test/unit_tests/mock/test_fixture.cc @@ -0,0 +1,21 @@ +/* + * 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 "unit_tests/mock/test_fixture.h" + +#include + +std::unique_ptr TestFixture::mock_; diff --git a/test/unit_tests/mock/test_fixture.h b/test/unit_tests/mock/test_fixture.h new file mode 100644 index 0000000..3858e35 --- /dev/null +++ b/test/unit_tests/mock/test_fixture.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_TEST_FIXTURE_H_ +#define UNIT_TESTS_MOCK_TEST_FIXTURE_H_ + +#include + +#include +#include +#include +#include + +#include "unit_tests/mock/module_mock.h" + +class TestFixture : public ::testing::Test { + public: + explicit TestFixture(std::unique_ptr&& mock) { + mock_ = std::move(mock); + } + virtual ~TestFixture() { + mock_.reset(); + } + + virtual void SetUp() {} + virtual void TearDown() {} + + template + static T& GetMock() { + auto ptr = dynamic_cast(mock_.get()); + if (!ptr) + throw std::invalid_argument("The test does not provide mock of \"" + + std::string(typeid(T).name()) + "\""); + return *ptr; + } + + static std::unique_ptr mock_; +}; + +#endif // UNIT_TESTS_MOCK_TEST_FIXTURE_H_ diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc new file mode 100644 index 0000000..0460d13 --- /dev/null +++ b/test/unit_tests/test_widget_app.cc @@ -0,0 +1,97 @@ +/* + * 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 +#include + +#include +#include + +#include "widget_app.h" +#include "unit_tests/mock/gio_mock.h" +#include "unit_tests/mock/ecore_wl2_mock.h" +#include "unit_tests/mock/system_info_mock.h" +#include "unit_tests/mock/appcore_multiwindow_base_mock.h" +#include "unit_tests/mock/test_fixture.h" + +using ::testing::_; +using ::testing::DoAll; +using ::testing::Return; +using ::testing::SetArgPointee; +using ::testing::StrEq; + +class Mocks : public ::testing::NiceMock, + public ::testing::NiceMock, + public ::testing::NiceMock, + public ::testing::NiceMock {}; + +class WidgetAppTest : public TestFixture { + public: + WidgetAppTest() : TestFixture(std::make_unique()) {} + virtual ~WidgetAppTest() {} + + virtual void SetUp() { + } + + virtual void TearDown() { + } +}; + +widget_class_h __app_create_cb(void *user_data) { + return nullptr; +} + +void __app_terminate_cb(void *user_data) { +} + +TEST_F(WidgetAppTest, widget_app_main) { + tizen_base::Bundle b; + b.Add("__AUL_WIDGET_VIEWER__", "test"); + int ret = bundle_add_str(b.GetHandle(), "KEY", "VALUE"); + ASSERT_EQ(ret, BUNDLE_ERROR_NONE); + + char** argv = nullptr; + int argc = bundle_export_to_argv(b.GetHandle(), &argv); + ASSERT_EQ(get_last_result(), BUNDLE_ERROR_NONE); + ASSERT_NE(argv, nullptr); + ASSERT_NE(argc, 0); + + widget_app_lifecycle_callback_s callback; + callback.create = __app_create_cb; + callback.terminate = __app_terminate_cb; + + EXPECT_CALL(GetMock(), ecore_wl2_display_disconnect(_)). + Times(1); + + EXPECT_CALL(GetMock(), ecore_wl2_shutdown()). + Times(1); + + EXPECT_CALL(GetMock(), + system_info_get_platform_bool(_, _)). + WillOnce(DoAll( + SetArgPointee<1>(true), + Return(0))); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_init(_, _, _, _)). + WillOnce(Return(0)); + + ret = widget_app_main(argc, argv, &callback, nullptr); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} -- 2.7.4 From af733e56e8da1a54266739adfbe1be7f2bba4239 Mon Sep 17 00:00:00 2001 From: hyunho Date: Thu, 6 Aug 2020 13:00:51 +0900 Subject: [PATCH 08/16] Add widget efl unittests Change-Id: Ic9237c8f2c345e28f18603174d7557eded299c89 Signed-off-by: hyunho --- test/unit_tests/CMakeLists.txt | 2 +- test/unit_tests/mock/app_common_mock.cc | 26 ++ test/unit_tests/mock/app_common_mock.h | 33 ++ .../mock/appcore_multiwindow_base_mock.cc | 37 ++ .../mock/appcore_multiwindow_base_mock.h | 12 + test/unit_tests/mock/aul_mock.cc | 24 ++ test/unit_tests/mock/aul_mock.h | 33 ++ test/unit_tests/mock/ecore_wl2_mock.cc | 31 ++ test/unit_tests/mock/ecore_wl2_mock.h | 18 +- test/unit_tests/mock/elm_mock.cc | 46 +++ test/unit_tests/mock/elm_mock.h | 38 ++ test/unit_tests/test_widget_app.cc | 402 ++++++++++++++++++++- 12 files changed, 695 insertions(+), 7 deletions(-) create mode 100644 test/unit_tests/mock/app_common_mock.cc create mode 100644 test/unit_tests/mock/app_common_mock.h create mode 100644 test/unit_tests/mock/aul_mock.cc create mode 100644 test/unit_tests/mock/aul_mock.h create mode 100644 test/unit_tests/mock/elm_mock.cc create mode 100644 test/unit_tests/mock/elm_mock.h diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 5bdc45d..64fd8a4 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -7,7 +7,7 @@ ADD_EXECUTABLE(${TARGET_WIDGET_APPLICATION_UNIT_TEST} TARGET_INCLUDE_DIRECTORIES(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../" "${CMAKE_CURRENT_SOURCE_DIR}/../../include" - "${CMAKE_CURRENT_SOURCE_DIR}/../../src" + "${CMAKE_CURRENT_SOURCE_DIR}/../../src/efl_base" ) APPLY_PKG_CONFIG(${TARGET_WIDGET_APPLICATION_UNIT_TEST} PUBLIC diff --git a/test/unit_tests/mock/app_common_mock.cc b/test/unit_tests/mock/app_common_mock.cc new file mode 100644 index 0000000..c495c41 --- /dev/null +++ b/test/unit_tests/mock/app_common_mock.cc @@ -0,0 +1,26 @@ +/* + * 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 "unit_tests/mock/app_common_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" int app_get_id(char **id) { + return MOCK_HOOK_P1(AppCommonMock, app_get_id, id); +} diff --git a/test/unit_tests/mock/app_common_mock.h b/test/unit_tests/mock/app_common_mock.h new file mode 100644 index 0000000..5fa214e --- /dev/null +++ b/test/unit_tests/mock/app_common_mock.h @@ -0,0 +1,33 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_ +#define UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_ + +#include +#include + +#include "mock/module_mock.h" + +class AppCommonMock : public virtual ModuleMock { + public: + virtual ~AppCommonMock() {} + + MOCK_METHOD1(app_get_id, int (char **id)); +}; + +#endif // UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_ + diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.cc b/test/unit_tests/mock/appcore_multiwindow_base_mock.cc index f140a0d..0f88b17 100644 --- a/test/unit_tests/mock/appcore_multiwindow_base_mock.cc +++ b/test/unit_tests/mock/appcore_multiwindow_base_mock.cc @@ -44,3 +44,40 @@ extern "C" const char* appcore_multiwindow_base_instance_get_class_id( return MOCK_HOOK_P1(MultiWindowBaseMock, appcore_multiwindow_base_instance_get_class_id, context); } + +extern "C" void appcore_multiwindow_base_class_add( + appcore_multiwindow_base_class cls) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_class_add, cls); +} + +extern "C" void appcore_multiwindow_base_instance_drop( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_drop, context); +} + +extern "C" appcore_multiwindow_base_instance_h + appcore_multiwindow_base_instance_find(const char *id) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_find, id); +} + +extern "C" const appcore_multiwindow_base_class * + appcore_multiwindow_base_instance_get_class( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_get_class, context); +} + +extern "C" void appcore_multiwindow_base_instance_exit( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_exit, context); +} + +extern "C" void appcore_multiwindow_base_instance_pause( + appcore_multiwindow_base_instance_h context) { + return MOCK_HOOK_P1(MultiWindowBaseMock, + appcore_multiwindow_base_instance_pause, context); +} diff --git a/test/unit_tests/mock/appcore_multiwindow_base_mock.h b/test/unit_tests/mock/appcore_multiwindow_base_mock.h index 6aa400e..e15dc4e 100644 --- a/test/unit_tests/mock/appcore_multiwindow_base_mock.h +++ b/test/unit_tests/mock/appcore_multiwindow_base_mock.h @@ -34,6 +34,18 @@ class MultiWindowBaseMock : public virtual ModuleMock { void *(appcore_multiwindow_base_instance_h)); MOCK_METHOD1(appcore_multiwindow_base_instance_get_class_id, const char *(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_class_add, + void(appcore_multiwindow_base_class)); + MOCK_METHOD1(appcore_multiwindow_base_instance_drop, + void(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_instance_find, + appcore_multiwindow_base_instance_h(const char *)); + MOCK_METHOD1(appcore_multiwindow_base_instance_get_class, + const appcore_multiwindow_base_class *(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_instance_exit, + void(appcore_multiwindow_base_instance_h)); + MOCK_METHOD1(appcore_multiwindow_base_instance_pause, + void(appcore_multiwindow_base_instance_h)); }; #endif // UNIT_TESTS_MOCK_APPCORE_MULTIWINDOW_BASE_MOCK_H_ diff --git a/test/unit_tests/mock/aul_mock.cc b/test/unit_tests/mock/aul_mock.cc new file mode 100644 index 0000000..76ed247 --- /dev/null +++ b/test/unit_tests/mock/aul_mock.cc @@ -0,0 +1,24 @@ +/* + * 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 "unit_tests/mock/aul_mock.h" + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + +extern "C" int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len) { + return MOCK_HOOK_P3(AulMock, aul_app_get_pkgid_bypid, pid, pkgid, len); +} diff --git a/test/unit_tests/mock/aul_mock.h b/test/unit_tests/mock/aul_mock.h new file mode 100644 index 0000000..359db71 --- /dev/null +++ b/test/unit_tests/mock/aul_mock.h @@ -0,0 +1,33 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_AUL_MOCK_H_ +#define UNIT_TESTS_MOCK_AUL_MOCK_H_ + +#include +#include + +#include "mock/module_mock.h" + +class AulMock : public virtual ModuleMock { + public: + virtual ~AulMock() {} + + MOCK_METHOD3(aul_app_get_pkgid_bypid, int (int , char *, int)); +}; + +#endif // UNIT_TESTS_MOCK_AUL_MOCK_H_ + diff --git a/test/unit_tests/mock/ecore_wl2_mock.cc b/test/unit_tests/mock/ecore_wl2_mock.cc index 11df066..1cf68e6 100644 --- a/test/unit_tests/mock/ecore_wl2_mock.cc +++ b/test/unit_tests/mock/ecore_wl2_mock.cc @@ -57,3 +57,34 @@ extern "C" int ecore_wl2_shutdown() { extern "C" Ecore_Wl2_Display *ecore_wl2_display_connect(const char *conn) { return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_display_connect, conn); } + +extern "C" Ecore_Wl2_Window *ecore_evas_wayland2_window_get(const Ecore_Evas *ee) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_evas_wayland2_window_get, ee); +} + +extern "C" Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_evas_ecore_evas_get, e); +} + +extern "C" Evas *evas_object_evas_get(const Eo *eo_obj) { + return MOCK_HOOK_P1(EcoreWl2Mock, evas_object_evas_get, eo_obj); +} + +extern "C" void evas_object_del(Evas_Object *obj) { + return MOCK_HOOK_P1(EcoreWl2Mock, evas_object_del, obj); +} + +extern "C" struct wl_surface *ecore_wl2_window_surface_get(Ecore_Wl2_Window *window) { + return MOCK_HOOK_P1(EcoreWl2Mock, ecore_wl2_window_surface_get, window); +} + +extern "C" void evas_object_data_set(Evas_Object *eo_obj, const char *key, + const void *data) { + return MOCK_HOOK_P3(EcoreWl2Mock, evas_object_data_set, eo_obj, key, data); +} + +extern "C" void evas_object_event_callback_add(Evas_Object *eo_obj, + Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data) { + return MOCK_HOOK_P4(EcoreWl2Mock, evas_object_event_callback_add, + eo_obj, type, func, data); +} diff --git a/test/unit_tests/mock/ecore_wl2_mock.h b/test/unit_tests/mock/ecore_wl2_mock.h index 78e7704..bf7f84f 100644 --- a/test/unit_tests/mock/ecore_wl2_mock.h +++ b/test/unit_tests/mock/ecore_wl2_mock.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "mock/module_mock.h" @@ -42,8 +43,21 @@ class EcoreWl2Mock : public virtual ModuleMock { MOCK_METHOD0(ecore_wl2_shutdown, int()); MOCK_METHOD1(ecore_wl2_display_connect, - Ecore_Wl2_Display *(const char *conn)); - + Ecore_Wl2_Display *(const char *)); + MOCK_METHOD1(ecore_evas_wayland2_window_get, + Ecore_Wl2_Window *(const Ecore_Evas *)); + MOCK_METHOD1(ecore_evas_ecore_evas_get, + Ecore_Evas *(const Evas *)); + MOCK_METHOD1(evas_object_evas_get, + Evas *(const Eo *)); + MOCK_METHOD1(evas_object_del, + void (Evas_Object *)); + MOCK_METHOD1(ecore_wl2_window_surface_get, + struct wl_surface *(Ecore_Wl2_Window *)); + MOCK_METHOD3(evas_object_data_set, + void (Evas_Object *, const char *, const void *)); + MOCK_METHOD4(evas_object_event_callback_add, void (Evas_Object *, + Evas_Callback_Type, Evas_Object_Event_Cb, const void *)); }; #endif // UNIT_TESTS_MOCK_ECORE_WL2_MOCK_H_ diff --git a/test/unit_tests/mock/elm_mock.cc b/test/unit_tests/mock/elm_mock.cc new file mode 100644 index 0000000..05bf369 --- /dev/null +++ b/test/unit_tests/mock/elm_mock.cc @@ -0,0 +1,46 @@ +/* + * 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 "unit_tests/mock/elm_mock.h" + +#include + +#include "unit_tests/mock/mock_hook.h" +#include "unit_tests/mock/test_fixture.h" + + +extern "C" Evas_Object * elm_win_add(Evas_Object *parent, + const char *name, Elm_Win_Type type) { + return MOCK_HOOK_P3(ElmMock, elm_win_add, parent, name, type); +} + +extern "C" void elm_win_wm_rotation_preferred_rotation_set( + Evas_Object *obj, int rotation) { + return MOCK_HOOK_P2( + ElmMock, elm_win_wm_rotation_preferred_rotation_set, obj, rotation); +} + +extern "C" void elm_win_wm_rotation_available_rotations_set(Elm_Win *obj, + const int *rotations, unsigned int count) { + return MOCK_HOOK_P3( + ElmMock, elm_win_wm_rotation_available_rotations_set, + obj, rotations, count); +} + +extern "C" int elm_win_aux_hint_add(Evas_Object *obj, + const char *hint, const char *val) { + return MOCK_HOOK_P3(ElmMock, elm_win_aux_hint_add, obj, hint, val); +} diff --git a/test/unit_tests/mock/elm_mock.h b/test/unit_tests/mock/elm_mock.h new file mode 100644 index 0000000..efd2ef7 --- /dev/null +++ b/test/unit_tests/mock/elm_mock.h @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#ifndef UNIT_TESTS_MOCK_ELM_MOCK_H_ +#define UNIT_TESTS_MOCK_ELM_MOCK_H_ + +#include +#include + +#include "mock/module_mock.h" + +class ElmMock : public virtual ModuleMock { + public: + virtual ~ElmMock() {} + MOCK_METHOD3(elm_win_add, + Evas_Object *(Evas_Object *, const char *, Elm_Win_Type)); + MOCK_METHOD2(elm_win_wm_rotation_preferred_rotation_set, + void (Evas_Object *, int)); + MOCK_METHOD3(elm_win_wm_rotation_available_rotations_set, + void (Elm_Win *, const int *, unsigned int)); + MOCK_METHOD3(elm_win_aux_hint_add, + int (Evas_Object *, const char *, const char *)); +}; + +#endif // UNIT_TESTS_MOCK_ELM_MOCK_H_ diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc index 0460d13..f6c73f5 100644 --- a/test/unit_tests/test_widget_app.cc +++ b/test/unit_tests/test_widget_app.cc @@ -24,20 +24,39 @@ #include #include "widget_app.h" +#include "widget_app_efl.h" #include "unit_tests/mock/gio_mock.h" #include "unit_tests/mock/ecore_wl2_mock.h" #include "unit_tests/mock/system_info_mock.h" #include "unit_tests/mock/appcore_multiwindow_base_mock.h" +#include "unit_tests/mock/app_common_mock.h" +#include "unit_tests/mock/elm_mock.h" +#include "unit_tests/mock/aul_mock.h" #include "unit_tests/mock/test_fixture.h" using ::testing::_; using ::testing::DoAll; using ::testing::Return; using ::testing::SetArgPointee; -using ::testing::StrEq; +using ::testing::Invoke; + +typedef struct _widget_base_instance_data { + bundle* args; + char* id; + char* content; + void* tag; + double period; + guint periodic_timer; + bool pending_update; + char* pending_content; + void* user_data; +} widget_base_instance_data; class Mocks : public ::testing::NiceMock, public ::testing::NiceMock, + public ::testing::NiceMock, + public ::testing::NiceMock, + public ::testing::NiceMock, public ::testing::NiceMock, public ::testing::NiceMock {}; @@ -53,11 +72,139 @@ class WidgetAppTest : public TestFixture { } }; -widget_class_h __app_create_cb(void *user_data) { +int __instance_create_cb(widget_context_h context, bundle* content, + int w, int h, void* user_data) { + return 0; +} + +int __instance_destroy_cb(widget_context_h context, + widget_app_destroy_type_e reason, bundle* content, void* user_data) { + return 0; +} + +int __instance_pause_cb(widget_context_h context, void* user_data) { + return 0; +} + +int __instance_resume_cb(widget_context_h context, void* user_data) { + return 0; +} + +int __instance_resize_cb(widget_context_h context, + int w, int h, void* user_data) { + return 0; +} + +int __instance_update_cb(widget_context_h context, + bundle* content, int force, void* user_data) { + return 0; +} + +widget_class_h __app_create_cb(void* user_data) { return nullptr; } -void __app_terminate_cb(void *user_data) { +void __app_terminate_cb(void* user_data) { +} + +int __app_get_id_fake(char** id) { + *id = strdup("test"); + return 0; +} + +int __aul_app_get_pkgid_bypid_fake(int pid, char* pkgid, int len) { + snprintf(pkgid, 10, "%s", "test"); + return 0; +} + +struct instance_data { + Evas_Object* win; + guint iconify_timer; + bool is_iconified; +}; + +void* __appcore_multiwindow_base_instance_get_extra_fake( + appcore_multiwindow_base_instance_h handle) { + widget_base_instance_data* data = (widget_base_instance_data*) + calloc(1, sizeof(widget_base_instance_data)); + data->args = bundle_create(); + bundle_add_str(data->args, "__AUL_WIDGET_ID__", "test"); + bundle_add_str(data->args, "__WIDGET_OP__", "optest"); + bundle_add_str(data->args, "__WIDGET_WIDTH__", "320"); + bundle_add_str(data->args, "__WIDGET_HEIGHT__", "320"); + data->pending_content = strdup("test"); + data->content = strdup("test"); + data->id = strdup("id"); + data->user_data = calloc(1, sizeof (struct instance_data)); + + return data; +} + +const char* __appcore_multiwindow_base_instance_get_id_fake( + appcore_multiwindow_base_instance_h handle) { + return strdup("test"); +} + +const char* __appcore_multiwindow_base_instance_get_class_id_fake( + appcore_multiwindow_base_instance_h context) { + return strdup("test"); +} + +appcore_multiwindow_base_class __cls; +void __appcore_multiwindow_base_class_add_fake( + appcore_multiwindow_base_class cls) { + __cls = cls; + cls.create(nullptr, nullptr); + cls.terminate(nullptr, nullptr); + cls.pause((appcore_multiwindow_base_instance_h) + calloc(1, sizeof(char)), nullptr); + cls.resume((appcore_multiwindow_base_instance_h) + calloc(1, sizeof(char)), nullptr); +} + +int __appcore_multiwindow_base_init_fake(appcore_multiwindow_base_ops ops, + int argc, char** argv, void* data) { + tizen_base::Bundle b; + + b.Add("__WIDGET_WIDTH__", "320"); + b.Add("__WIDGET_HEIGHT__", "320"); + b.Add("__AUL_WIDGET_INSTANCE_ID__", "instance_id"); + b.Add("__AUL_WIDGET_ID__", "test"); + b.Add("__WIDGET_OP__", "create"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "resize"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "update"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "destroy"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "resume"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "pause"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "terminate"); + ops.base.control(b.GetHandle(), nullptr); + + b.Delete("__WIDGET_OP__"); + b.Add("__WIDGET_OP__", "period"); + ops.base.control(b.GetHandle(), nullptr); + + ops.base.create(nullptr); + ops.base.terminate(nullptr); + + return 0; } TEST_F(WidgetAppTest, widget_app_main) { @@ -90,8 +237,255 @@ TEST_F(WidgetAppTest, widget_app_main) { EXPECT_CALL(GetMock(), appcore_multiwindow_base_init(_, _, _, _)). - WillOnce(Return(0)); + WillOnce(Invoke(__appcore_multiwindow_base_init_fake)); + + EXPECT_CALL(GetMock(), + aul_app_get_pkgid_bypid(_, _, _)). + WillOnce(Invoke(__aul_app_get_pkgid_bypid_fake)); + + EXPECT_CALL(GetMock(), app_get_id(_)). + WillOnce(Invoke(__app_get_id_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_find(_)). + WillRepeatedly( + Return( + (appcore_multiwindow_base_instance_h)calloc(1, sizeof(char)))); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_class(_)). + WillRepeatedly( + Return(&__cls)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillRepeatedly( + Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_exit(_)).Times(2); ret = widget_app_main(argc, argv, &callback, nullptr); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } + +TEST_F(WidgetAppTest, widget_app_exit) { + int ret = widget_app_exit(); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_terminate_context) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + int ret = widget_app_terminate_context(context); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +bool __widget_context_cb(widget_context_h context, void *user_data) { + return true; +} + +TEST_F(WidgetAppTest, widget_app_foreach_context) { + int ret = widget_app_foreach_context(__widget_context_cb, nullptr); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +void __app_event_cb(app_event_info_h event_info, void *user_data) { +} + +TEST_F(WidgetAppTest, widget_app_add_event_handler) { + app_event_handler_h handle; + int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY, + __app_event_cb, nullptr); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_remove_event_handler) { + app_event_handler_h handle; + int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY, + __app_event_cb, nullptr); + ret = widget_app_remove_event_handler(handle); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_get_id) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_id(_)). + WillOnce(Return("test")); + + const char *id = widget_app_get_id(context); + EXPECT_STREQ(id, "test"); +} + +TEST_F(WidgetAppTest, widget_app_class_create) { + widget_instance_lifecycle_callback_s lifecycle; + + lifecycle.create = __instance_create_cb; + lifecycle.destroy = __instance_destroy_cb; + lifecycle.pause = __instance_pause_cb; + lifecycle.resume = __instance_resume_cb; + lifecycle.resize = __instance_resize_cb; + lifecycle.update = __instance_update_cb; + + EXPECT_CALL(GetMock(), app_get_id(_)). + WillOnce(Invoke(__app_get_id_fake)); + + widget_class_h cls = widget_app_class_create(lifecycle, nullptr); + EXPECT_NE(nullptr, cls); +} + +TEST_F(WidgetAppTest, widget_app_context_set_tag) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + int ret = widget_app_context_set_tag(context, (void*)"test"); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_context_get_tag) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + void* tag; + int ret = widget_app_context_get_tag(context, &tag); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_context_set_content_info) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_id(_)). + WillOnce(Invoke(__appcore_multiwindow_base_instance_get_id_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_class_id(_)). + WillOnce(Invoke(__appcore_multiwindow_base_instance_get_class_id_fake)); + + bundle* content_info = bundle_create(); + int ret = widget_app_context_set_content_info(context, content_info); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_context_set_title) { + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + int ret = widget_app_context_set_title(context, "title"); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_class_add) { + widget_instance_lifecycle_callback_s lifecycle; + widget_class_h cls = widget_app_class_add( + nullptr, "test", lifecycle, nullptr); + + lifecycle.create = __instance_create_cb; + lifecycle.destroy = __instance_destroy_cb; + lifecycle.pause = __instance_pause_cb; + lifecycle.resume = __instance_resume_cb; + lifecycle.resize = __instance_resize_cb; + lifecycle.update = __instance_update_cb; + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_class_add(_)). + WillOnce(Invoke(__appcore_multiwindow_base_class_add_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_class_id(_)). + WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_class_id_fake)); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_drop(_)). + Times(1); + + cls = widget_app_class_add( + nullptr, "test", lifecycle, nullptr); + EXPECT_NE(nullptr, cls); + + tizen_base::Bundle b; + b.Add("__AUL_WIDGET_VIEWER__", "test"); + int ret = bundle_add_str(b.GetHandle(), "KEY", "VALUE"); + ASSERT_EQ(ret, BUNDLE_ERROR_NONE); + + char** argv = nullptr; + int argc = bundle_export_to_argv(b.GetHandle(), &argv); + ASSERT_EQ(get_last_result(), BUNDLE_ERROR_NONE); + ASSERT_NE(argv, nullptr); + ASSERT_NE(argc, 0); + + widget_app_lifecycle_callback_s callback; + callback.create = __app_create_cb; + callback.terminate = __app_terminate_cb; + + ret = widget_app_main(argc, argv, &callback, nullptr); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} + +TEST_F(WidgetAppTest, widget_app_get_elm_win_negative) { + Evas_Object* win; + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + int ret = widget_app_get_elm_win(context, &win); + EXPECT_EQ(WIDGET_ERROR_FAULT, ret); +} + +TEST_F(WidgetAppTest, widget_app_get_elm_win) { + EXPECT_CALL(GetMock(), + elm_win_add(_, _, _)). + WillOnce(Return((Evas_Object*)calloc(1, sizeof(char)))); + + EXPECT_CALL(GetMock(), + ecore_evas_wayland2_window_get(_)). + WillOnce(Return((Ecore_Wl2_Window*)calloc(1, sizeof(char)))); + + EXPECT_CALL(GetMock(), + elm_win_aux_hint_add(_, _, _)). + WillOnce(Return(0)); + + EXPECT_CALL(GetMock(), + ecore_wl2_window_surface_get(_)). + WillOnce(Return(nullptr)); + + EXPECT_CALL(GetMock(), + evas_object_event_callback_add(_, _, _, _)). + Times(1); + + EXPECT_CALL(GetMock(), + evas_object_data_set(_, _, _)). + Times(1); + + EXPECT_CALL(GetMock(), + appcore_multiwindow_base_instance_get_extra(_)). + WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); + + Evas_Object* win; + widget_context_h context = + (widget_context_h)calloc(1, sizeof(widget_context_h)); + int ret = widget_app_get_elm_win(context, &win); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); +} -- 2.7.4 From a46c0f04adc114293ab95385b3e17dd3ee7dfed7 Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 18 Aug 2020 16:30:46 +0900 Subject: [PATCH 09/16] Fix notify event sequence widget created event should be notified after widget instance is added to the AMD Change-Id: I0b6469c2bc396fedbbdf378c68dca561a16a66f5 Signed-off-by: hyunho --- src/base/widget_base.c | 3 +-- test/unit_tests/test_widget_app.cc | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 17edb5d..16928b9 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -1392,13 +1392,12 @@ static void __multiwindow_instance_create( __instance_drop(instance_h); } else { LOGD("%s is created", id); + aul_widget_instance_add(class_id, id); ret = __send_update_status(class_id, id, WIDGET_INSTANCE_EVENT_CREATE, 0, NULL); if (ret < 0) LOGE("Fail to send create status (%d) ", ret); - aul_widget_instance_add(class_id, id); - ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, &size); if (ret == BUNDLE_ERROR_NONE && *period > 0) { diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc index f6c73f5..e6a2264 100644 --- a/test/unit_tests/test_widget_app.cc +++ b/test/unit_tests/test_widget_app.cc @@ -295,6 +295,11 @@ void __app_event_cb(app_event_info_h event_info, void *user_data) { TEST_F(WidgetAppTest, widget_app_add_event_handler) { app_event_handler_h handle; + EXPECT_CALL(GetMock(), + system_info_get_platform_bool(_, _)). + WillOnce(DoAll( + SetArgPointee<1>(true), + Return(0))); int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY, __app_event_cb, nullptr); EXPECT_EQ(WIDGET_ERROR_NONE, ret); @@ -302,6 +307,11 @@ TEST_F(WidgetAppTest, widget_app_add_event_handler) { TEST_F(WidgetAppTest, widget_app_remove_event_handler) { app_event_handler_h handle; + EXPECT_CALL(GetMock(), + system_info_get_platform_bool(_, _)). + WillRepeatedly(DoAll( + SetArgPointee<1>(true), + Return(0))); int ret = widget_app_add_event_handler(&handle, APP_EVENT_LOW_MEMORY, __app_event_cb, nullptr); ret = widget_app_remove_event_handler(handle); -- 2.7.4 From 0e3f38f74a16ee5e24b2e81743eeb49a3ef861db Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 18 Aug 2020 17:57:45 +0900 Subject: [PATCH 10/16] Release version 1.3.8 Changes: - Add unittest - Add widget efl unittests - Fix notify event sequence Change-Id: I48f3c2e1612e80a3dd097fd1ff6f299c13a48fa4 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index be7e811..c6262db 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.7 +Version: 1.3.8 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 491c27c6e7d776a7fa0cabeb15db458f51ffa994 Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 25 Aug 2020 15:18:41 +0900 Subject: [PATCH 11/16] Fix wrong size issue Change-Id: Ic145586c908a4fb7cdb508e18f545dda0a5852d2 Signed-off-by: hyunho --- test/unit_tests/test_widget_app.cc | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc index e6a2264..3966a4f 100644 --- a/test/unit_tests/test_widget_app.cc +++ b/test/unit_tests/test_widget_app.cc @@ -52,6 +52,10 @@ typedef struct _widget_base_instance_data { void* user_data; } widget_base_instance_data; +struct _widget_context { + int context; +}; + class Mocks : public ::testing::NiceMock, public ::testing::NiceMock, public ::testing::NiceMock, @@ -276,8 +280,9 @@ TEST_F(WidgetAppTest, widget_app_exit) { TEST_F(WidgetAppTest, widget_app_terminate_context) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); int ret = widget_app_terminate_context(context); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } @@ -320,13 +325,14 @@ TEST_F(WidgetAppTest, widget_app_remove_event_handler) { TEST_F(WidgetAppTest, widget_app_get_id) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); EXPECT_CALL(GetMock(), appcore_multiwindow_base_instance_get_id(_)). WillOnce(Return("test")); const char *id = widget_app_get_id(context); + free(context); EXPECT_STREQ(id, "test"); } @@ -349,19 +355,20 @@ TEST_F(WidgetAppTest, widget_app_class_create) { TEST_F(WidgetAppTest, widget_app_context_set_tag) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); EXPECT_CALL(GetMock(), appcore_multiwindow_base_instance_get_extra(_)). WillOnce(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); int ret = widget_app_context_set_tag(context, (void*)"test"); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_context_get_tag) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); EXPECT_CALL(GetMock(), appcore_multiwindow_base_instance_get_extra(_)). @@ -369,12 +376,13 @@ TEST_F(WidgetAppTest, widget_app_context_get_tag) { void* tag; int ret = widget_app_context_get_tag(context, &tag); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_context_set_content_info) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); EXPECT_CALL(GetMock(), appcore_multiwindow_base_instance_get_extra(_)). @@ -390,26 +398,25 @@ TEST_F(WidgetAppTest, widget_app_context_set_content_info) { bundle* content_info = bundle_create(); int ret = widget_app_context_set_content_info(context, content_info); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_context_set_title) { widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); EXPECT_CALL(GetMock(), appcore_multiwindow_base_instance_get_extra(_)). WillRepeatedly(Invoke(__appcore_multiwindow_base_instance_get_extra_fake)); int ret = widget_app_context_set_title(context, "title"); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_class_add) { widget_instance_lifecycle_callback_s lifecycle; - widget_class_h cls = widget_app_class_add( - nullptr, "test", lifecycle, nullptr); - lifecycle.create = __instance_create_cb; lifecycle.destroy = __instance_destroy_cb; lifecycle.pause = __instance_pause_cb; @@ -417,6 +424,9 @@ TEST_F(WidgetAppTest, widget_app_class_add) { lifecycle.resize = __instance_resize_cb; lifecycle.update = __instance_update_cb; + widget_class_h cls = widget_app_class_add( + nullptr, "test", lifecycle, nullptr); + EXPECT_CALL(GetMock(), appcore_multiwindow_base_class_add(_)). WillOnce(Invoke(__appcore_multiwindow_base_class_add_fake)); @@ -459,8 +469,9 @@ TEST_F(WidgetAppTest, widget_app_class_add) { TEST_F(WidgetAppTest, widget_app_get_elm_win_negative) { Evas_Object* win; widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); int ret = widget_app_get_elm_win(context, &win); + free(context); EXPECT_EQ(WIDGET_ERROR_FAULT, ret); } @@ -495,7 +506,8 @@ TEST_F(WidgetAppTest, widget_app_get_elm_win) { Evas_Object* win; widget_context_h context = - (widget_context_h)calloc(1, sizeof(widget_context_h)); + (widget_context_h)calloc(1, sizeof(struct _widget_context)); int ret = widget_app_get_elm_win(context, &win); + free(context); EXPECT_EQ(WIDGET_ERROR_NONE, ret); } -- 2.7.4 From d26ca04060f99f9e70b1f424bcc195d98d439c77 Mon Sep 17 00:00:00 2001 From: hyunho Date: Wed, 26 Aug 2020 10:38:11 +0900 Subject: [PATCH 12/16] Release version 1.3.9 Changes: - Fix wrong size issue Change-Id: I298accaeaee5234bafe118471a13d32156bc0a79 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index c6262db..396393a 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.8 +Version: 1.3.9 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 328856f4abc070f1cddb623bcb9b71ad1ef195dd Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 28 Aug 2020 14:44:30 +0900 Subject: [PATCH 13/16] Fix unittest memory leak Change-Id: Icc093e198269eb9f39850c2da347c76516ae1115 Signed-off-by: hyunho --- test/unit_tests/test_widget_app.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc index 3966a4f..3591adf 100644 --- a/test/unit_tests/test_widget_app.cc +++ b/test/unit_tests/test_widget_app.cc @@ -271,6 +271,7 @@ TEST_F(WidgetAppTest, widget_app_main) { ret = widget_app_main(argc, argv, &callback, nullptr); EXPECT_EQ(WIDGET_ERROR_NONE, ret); + bundle_free_exported_argv(argc, &argv); } TEST_F(WidgetAppTest, widget_app_exit) { @@ -464,6 +465,7 @@ TEST_F(WidgetAppTest, widget_app_class_add) { ret = widget_app_main(argc, argv, &callback, nullptr); EXPECT_EQ(WIDGET_ERROR_NONE, ret); + bundle_free_exported_argv(argc, &argv); } TEST_F(WidgetAppTest, widget_app_get_elm_win_negative) { -- 2.7.4 From ab1e35a0e04e11fb6cf865a3816b0833b5c97ad7 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 28 Aug 2020 15:09:45 +0900 Subject: [PATCH 14/16] Release version 1.3.10 Changes: - Fix unittest memory leak Change-Id: If5387163281ff5dd36f502cd64157b577611df20 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 396393a..5b3323c 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.9 +Version: 1.3.10 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 91853df91bcbe21e3cb71e31e1280566e7c8eadc Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 8 Sep 2020 09:24:08 +0900 Subject: [PATCH 15/16] Fix argv free position Free before check return value so that it can be freed if its return value is error value. Change-Id: I49dd1aa6052c22a70c573d2e95312474f66d8aa5 Signed-off-by: hyunho --- test/unit_tests/test_widget_app.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit_tests/test_widget_app.cc b/test/unit_tests/test_widget_app.cc index 3591adf..3b3d2dc 100644 --- a/test/unit_tests/test_widget_app.cc +++ b/test/unit_tests/test_widget_app.cc @@ -270,8 +270,8 @@ TEST_F(WidgetAppTest, widget_app_main) { appcore_multiwindow_base_instance_exit(_)).Times(2); ret = widget_app_main(argc, argv, &callback, nullptr); - EXPECT_EQ(WIDGET_ERROR_NONE, ret); bundle_free_exported_argv(argc, &argv); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_exit) { @@ -464,8 +464,8 @@ TEST_F(WidgetAppTest, widget_app_class_add) { callback.terminate = __app_terminate_cb; ret = widget_app_main(argc, argv, &callback, nullptr); - EXPECT_EQ(WIDGET_ERROR_NONE, ret); bundle_free_exported_argv(argc, &argv); + EXPECT_EQ(WIDGET_ERROR_NONE, ret); } TEST_F(WidgetAppTest, widget_app_get_elm_win_negative) { -- 2.7.4 From 29b5e9d9c8453465ab38614cde903e258d11498e Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 8 Sep 2020 09:41:11 +0900 Subject: [PATCH 16/16] Release version 1.3.11 Changes: - Fix argv free position Change-Id: I80ac477042db5755a8a09668a3b2d1151f3c7c12 Signed-off-by: hyunho --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 5b3323c..aa0095e 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.3.10 +Version: 1.3.11 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4